/* ============================================
   월간 유레카 - 상품 목록 페이지
   Warm Editorial Bookshop
   ============================================ */

/* Pretendard는 common.css에서 로드 */

:root {
    --eureka-deep: #1a5c4e;
    --eureka-teal: #24a7a7;
    --eureka-mint: #34b197;
    --eureka-cream: #faf8f3;
    --eureka-warm: #f5f0e8;
    --eureka-gold: #c8a45c;
    --text-primary: #1a1a1a;
    --text-secondary: #5a5a5a;
    --text-muted: #8a8a8a;
    /* 상품 리스트 전용 컬러 — 따뜻한 네이비 계열 */
    --pl-accent: #2e4a62;
    --pl-accent-hover: #3d6d8f;
    --pl-accent-light: rgba(46, 74, 98, 0.07);
    --pl-bg: #f7f4ee;
    --pl-card-bg: #fff;
    --pl-border: rgba(46, 74, 98, 0.08);
    --pl-border-strong: rgba(46, 74, 98, 0.16);
    --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(46,74,98,0.03);
    --shadow-card-hover: 0 8px 32px rgba(46,74,98,0.13), 0 2px 8px rgba(0,0,0,0.04);
    --shadow-filter: 0 1px 2px rgba(0,0,0,0.03);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── 컨테이너 ── */
.product-list-container {
    max-width: 1260px;
    margin: 0 auto;
    padding: 48px 32px 80px;
    background: var(--pl-bg);
    min-height: 60vh;
    position: relative;
}

/* 미세한 노이즈 텍스처 오버레이 */
.product-list-container::before {
    content: '';
    position: fixed;
    inset: 0;
    opacity: 0.018;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

.product-list-container > * {
    position: relative;
    z-index: 1;
}

/* ── 페이지 헤더 ── */
.page-header {
    padding: 20px 0 28px;
    margin-bottom: 4px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    border-bottom: none;
    position: relative;
}

.page-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--pl-accent) 0%, var(--pl-accent) 60px, var(--pl-border) 60px, var(--pl-border) 100%);
}

.page-title {
    font-family: 'Pretendard', sans-serif;
    font-size: 28px;
    font-weight: 900;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin: 0;
    line-height: 1.2;
}

.page-info {
    font-family: 'Pretendard', sans-serif;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0;
    white-space: nowrap;
    padding-bottom: 2px;
}

/* ── 필터 섹션 ── */
.filter-section {
    background: var(--pl-card-bg);
    border-radius: var(--radius);
    padding: 18px 24px;
    margin: 20px 0 8px;
    box-shadow: var(--shadow-filter);
    border: 1px solid var(--pl-border);
}

.filter-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-row:not(:last-child) {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--pl-border);
}

.filter-label {
    font-family: 'Pretendard', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: var(--pl-accent);
    letter-spacing: 0.5px;
    min-width: 72px;
    opacity: 0.8;
}

.filter-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}

.filter-btn {
    font-family: 'Pretendard', sans-serif;
    padding: 7px 18px;
    border: 1px solid var(--pl-border-strong);
    background: transparent;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s var(--transition);
    color: var(--text-secondary);
    letter-spacing: 0;
}

.filter-btn:hover {
    border-color: var(--pl-accent);
    color: var(--pl-accent);
    background: var(--pl-accent-light);
}

.filter-btn.active {
    background: var(--pl-accent);
    border-color: var(--pl-accent);
    color: #fff;
    font-weight: 600;
}

/* 모바일 필터 select */
.filter-select {
    display: none;
    width: 100%;
    padding: 11px 16px;
    border: 1px solid var(--pl-border-strong);
    border-radius: var(--radius-sm);
    font-family: 'Pretendard', sans-serif;
    font-size: 14px;
    cursor: pointer;
    background: var(--pl-card-bg);
    color: var(--text-primary);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%232e4a62' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    font-weight: 500;
    transition: all 0.3s var(--transition);
}

.filter-select:focus {
    outline: none;
    border-color: var(--pl-accent);
    box-shadow: 0 0 0 3px rgba(46, 74, 98, 0.08);
}

/* ── 정렬 바 ── */
.filter-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px 0;
}

.sort-select {
    font-family: 'Pretendard', sans-serif;
    padding: 8px 36px 8px 14px;
    border: 1px solid var(--pl-border-strong);
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    background: var(--pl-card-bg);
    color: var(--text-primary);
    font-weight: 500;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%232e4a62' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: all 0.3s var(--transition);
}

.sort-select:focus {
    outline: none;
    border-color: var(--pl-accent);
    box-shadow: 0 0 0 3px rgba(46, 74, 98, 0.08);
}

/* ── 상품 그리드 ── */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 56px;
}

/* ── 상품 카드 ── */
.product-card {
    background: var(--pl-card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out);
    cursor: pointer;
    border: 1px solid var(--pl-border);
    position: relative;
    box-shadow: var(--shadow-card);
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-card-hover);
    border-color: rgba(46, 74, 98, 0.12);
}

.product-card:hover .product-img {
    transform: none;
}

.product-card:hover .product-img-wrapper::after {
    opacity: 0;
}

.product-card:hover .btn-cart {
    background: var(--pl-accent-hover);
    transform: translateY(-1px);
}

/* 이미지 래퍼 */
.product-img-wrapper {
    overflow: hidden;
    background: var(--eureka-warm);
    position: relative;
    aspect-ratio: 3 / 4;
}

.product-img-wrapper::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.05), transparent);
    pointer-events: none;
    transition: opacity 0.5s var(--transition);
}

.product-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center center;
    transition: transform 0.7s var(--ease-out);
    background: var(--eureka-warm);
    display: block;
    margin: 0;
}

/* ── 카드 본문 ── */
.product-body {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.product-category {
    font-family: 'Pretendard', sans-serif;
    font-size: 12px;
    color: var(--pl-accent);
    letter-spacing: 0.3px;
    font-weight: 600;
    opacity: 0.8;
    margin-bottom: 2px;
}

.product-title {
    font-family: 'Pretendard', sans-serif;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 44px;
    line-height: 1.5;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.product-author {
    font-family: 'Pretendard', sans-serif;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 400;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 14px;
    border-top: 1px solid var(--pl-border);
    gap: 8px;
}

.product-price {
    font-family: 'Pretendard', sans-serif;
    font-size: 17px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.product-discount-price {
    font-family: 'Pretendard', sans-serif;
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: line-through;
    margin-left: 6px;
    font-weight: 400;
    opacity: 0.7;
}

/* 카드 담기 버튼 */
.btn-cart {
    font-family: 'Pretendard', sans-serif;
    padding: 8px 18px;
    min-width: 44px;
    min-height: 44px;
    background: var(--pl-accent);
    color: #fff;
    border: none;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s var(--ease-out);
    letter-spacing: 0.3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-cart:hover {
    background: var(--pl-accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(46, 74, 98, 0.25);
}

.btn-cart:active {
    transform: scale(0.96);
}

/* ── 빈 상품 목록 ── */
.no-products {
    text-align: center;
    padding: 100px 20px;
    background: var(--pl-card-bg);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 15px;
    border: 1px dashed var(--pl-border-strong);
}

.no-products p {
    font-family: 'Pretendard', sans-serif;
}

/* ── 페이지네이션 ── */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 56px;
    padding-bottom: 20px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--pl-border-strong);
    border-radius: var(--radius-sm);
    font-family: 'Pretendard', sans-serif;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.35s var(--ease-out);
    color: var(--text-secondary);
    background: var(--pl-card-bg);
    font-variant-numeric: tabular-nums;
}

.pagination a:hover {
    background: var(--pl-accent);
    color: #fff;
    border-color: var(--pl-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 74, 98, 0.2);
}

.pagination .active {
    background: var(--pl-accent);
    color: #fff;
    border-color: var(--pl-accent);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(46, 74, 98, 0.15);
}

/* ── 카드 등장 애니메이션 ── */
@keyframes cardReveal {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.product-card {
    animation: cardReveal 0.6s var(--ease-out) both;
}

.product-card:nth-child(1)  { animation-delay: 0.03s; }
.product-card:nth-child(2)  { animation-delay: 0.07s; }
.product-card:nth-child(3)  { animation-delay: 0.11s; }
.product-card:nth-child(4)  { animation-delay: 0.15s; }
.product-card:nth-child(5)  { animation-delay: 0.19s; }
.product-card:nth-child(6)  { animation-delay: 0.23s; }
.product-card:nth-child(7)  { animation-delay: 0.27s; }
.product-card:nth-child(8)  { animation-delay: 0.31s; }
.product-card:nth-child(9)  { animation-delay: 0.35s; }
.product-card:nth-child(10) { animation-delay: 0.39s; }
.product-card:nth-child(11) { animation-delay: 0.43s; }
.product-card:nth-child(12) { animation-delay: 0.47s; }

/* 페이지 헤더 등장 */
@keyframes headerSlide {
    from {
        opacity: 0;
        transform: translateX(-12px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.page-header {
    animation: headerSlide 0.5s var(--ease-out) both;
}

/* 필터 등장 */
@keyframes filterFade {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filter-section {
    animation: filterFade 0.5s var(--ease-out) 0.1s both;
}

.filter-bar {
    animation: filterFade 0.4s var(--ease-out) 0.15s both;
}

/* ── 반응형: 태블릿 ── */
@media (max-width: 1024px) {
    .product-list-container {
        padding: 36px 24px 60px;
    }

    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
    }

    .page-title {
        font-size: 24px;
    }
}

/* ── 반응형: 모바일 ── */
@media (max-width: 768px) {
    .product-list-container {
        padding: 20px 14px 48px;
    }

    .page-header {
        padding: 16px 0 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .page-header::after {
        background: linear-gradient(90deg, var(--pl-accent) 0%, var(--pl-accent) 40px, var(--pl-border) 40px, var(--pl-border) 100%);
    }

    .page-title {
        font-size: 22px;
    }

    .page-info {
        font-size: 13px;
    }

    .filter-section {
        padding: 14px 16px;
        border-radius: var(--radius-sm);
    }

    .filter-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .filter-label {
        margin-bottom: 0;
        font-size: 11px;
    }

    /* 데스크톱 필터 버튼 숨기기 */
    .filter-buttons {
        display: none;
    }

    /* 모바일 select 표시 */
    .filter-select {
        display: block;
        min-height: 44px;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .product-img-wrapper {
        aspect-ratio: 3 / 3.8;
    }

    .product-body {
        padding: 12px 14px 14px;
    }

    .product-category {
        font-size: 11px;
    }

    .product-title {
        font-size: 14px;
        min-height: 40px;
    }

    .product-author {
        font-size: 11px;
        margin-bottom: 10px;
    }

    .product-price {
        font-size: 15px;
    }

    .btn-cart {
        padding: 7px 14px;
        font-size: 11px;
        min-height: 44px;
    }

    .pagination {
        margin-top: 40px;
    }

    .pagination a,
    .pagination span {
        min-width: 36px;
        height: 44px;
        font-size: 13px;
    }
}

/* ── 반응형: 소형 모바일 ── */
@media (max-width: 480px) {
    .product-list-container {
        padding: 16px 10px 40px;
    }

    .page-title {
        font-size: 20px;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .product-img-wrapper {
        aspect-ratio: 3 / 3.5;
    }

    .product-body {
        padding: 10px 10px 12px;
        gap: 2px;
    }

    .product-title {
        font-size: 13px;
        min-height: 40px;
        -webkit-line-clamp: 2;
    }

    .product-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding-top: 10px;
    }

    .btn-cart {
        width: 100%;
        text-align: center;
        padding: 9px 14px;
    }

    .pagination a,
    .pagination span {
        min-width: 44px;
        height: 44px;
        font-size: 12px;
        padding: 0 8px;
    }
}

/* ── 호버 없는 환경 (터치 디바이스) ── */
@media (hover: none) {
    .product-card:hover {
        transform: none;
        box-shadow: var(--shadow-card);
    }

    .product-card:hover .product-img {
        transform: none;
    }

    .product-card:active {
        transform: scale(0.98);
        transition-duration: 0.15s;
    }

    .btn-cart:hover {
        transform: none;
        box-shadow: none;
    }

    .pagination a:hover {
        transform: none;
        box-shadow: none;
    }
}

/* ── 모션 축소 선호 ── */
@media (prefers-reduced-motion: reduce) {
    .product-card,
    .page-header,
    .filter-section,
    .filter-bar {
        animation: none;
    }

    .product-card,
    .product-img,
    .btn-cart,
    .pagination a {
        transition-duration: 0.01s;
    }
}
