/* =========================================================
 * 상품 카드 — 쇼핑몰 전체가 공유하는 단 하나의 카드 디자인.
 *
 * views/common/_product_card.ejs 와 1:1 로 대응한다. 메인(최근 둘러본/베스트셀러/전체 상품/
 * 상품 리스트)과 카테고리 목록이 모두 이 파일만 본다. 섹션별 카드 스타일은 더 이상 없고,
 * index.css / category/index.css 에는 섹션 레이아웃(그리드 열 수, 섹션 헤더, 페이지네이션)만 남는다.
 *
 * 카드를 쓰는 화면은 이 파일을 반드시 link 해야 한다 (views/index.ejs, views/category/index.ejs).
 * ========================================================= */

/* ---------- 카드 ---------- */
.product-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    cursor: pointer;
}

/*
 * 썸네일. 예전에는 260px 고정 / 200px 고정 / padding-bottom 75% / padding-top 100% 로 네 가지였다.
 * aspect-ratio 1:1 하나로 통일한다. 들어오는 이미지는 비율이 제각각이라 object-fit: cover 로 채운다.
 */
.product-card__thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 8px;
    background-color: #f5f5f5;
}

.product-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card:hover .product-card__thumb img {
    transform: scale(1.04);
}

/* 썸네일이 없거나 로딩에 실패한 경우. 배경(#f5f5f5)이 그대로 보인다. */
.product-card__no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #d0d3d9;
}

/* ---------- 원형 썸네일 (cardShape: CIRCLE) ---------- */
.product-card--circle .product-card__thumb {
    border-radius: 50%;
}

.product-card--circle .product-card__info {
    text-align: center;
}

/* ---------- 순위 뱃지 (베스트셀러 전용 옵션) ---------- */
.product-card__rank {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 30px;
    height: 30px;
    background-color: #fff;
    border-radius: 50%;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #000;
    z-index: 1;
}

/* 원형 카드에서는 뱃지가 원 밖으로 튀어나가지 않게 안쪽으로 당긴다. */
.product-card--circle .product-card__rank {
    top: 16px;
    left: 16px;
}

/* ---------- 퀵 액션 (카테고리 목록 전용 옵션) ---------- */
.quick-actions {
    position: absolute;
    bottom: 16px;
    right: 16px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transform: translateY(12px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card:hover .quick-actions {
    opacity: 1;
    transform: translateY(0);
}

.quick-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: #fff;
    border: none;
    border-radius: 50%;
    color: #111827;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
}

.quick-btn:hover {
    background: #111827;
    color: #fff;
    transform: scale(1.05);
}

/* ---------- 카드 본문 ---------- */
.product-card__info {
    display: flex;
    flex-direction: column;
    padding-top: 12px;
}

.product-card__category {
    align-self: flex-start;
    font-size: 11px;
    font-weight: 500;
    color: #6b7280;
    background: #f3f4f6;
    padding: 4px 10px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.product-card--circle .product-card__category {
    align-self: center;
}

.product-card__name {
    font-size: 16px;
    font-weight: 600;
    color: #252525;
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card__desc {
    font-size: 14px;
    font-weight: 400;
    color: #6a7282;
    line-height: 1.6;
    margin: 6px 0 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card__price {
    font-size: 16px;
    font-weight: 700;
    color: #101828;
    margin: 10px 0 0 0;
}

.product-card__price small {
    font-size: 13px;
    font-weight: 500;
    color: #6a7282;
}

.product-card__price--contact {
    font-size: 14px;
    font-weight: 500;
    color: #6a7282;
}

/* ---------- PRODUCT_LIST 섹션 그리드 ---------- */
/*
 * 관리자가 상품을 직접 골라 만드는 섹션. 열 수(2/3/4)는 섹션 설정값이다.
 * .all-products 와 달리 페이지네이션이 없으므로 index.js 의 슬라이더 로직과 엮이지 않게
 * 클래스 이름을 따로 쓴다.
 */
.product-list-section {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 40px 20px;
}

.product-list-section .section-header {
    text-align: center;
}

.product-list-section .section-header .title {
    font-size: 22px;
    font-weight: 600;
    color: #0a0a0a;
}

.product-list-section .section-header .desc {
    font-size: 14px;
    color: #6a7282;
    margin-top: 10px;
}

.product-card-grid {
    display: grid;
    gap: 24px;
    margin-top: 32px;
}

.product-card-grid.cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.product-card-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.product-card-grid.cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* ---------- 반응형 ---------- */
@media screen and (max-width: 1024px) {
    .product-card-grid.cols-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media screen and (max-width: 768px) {
    .product-card-grid.cols-3,
    .product-card-grid.cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .product-list-section {
        padding: 24px 16px;
    }

    .product-card__thumb {
        border-radius: 6px;
    }

    .product-card--circle .product-card__thumb {
        border-radius: 50%;
    }

    .product-card__info {
        padding-top: 8px;
    }

    .product-card__name {
        font-size: 14px;
    }

    .product-card__desc {
        font-size: 12px;
        line-height: 1.4;
        margin-top: 4px;
    }

    .product-card__price {
        font-size: 14px;
        margin-top: 8px;
    }

    .quick-actions {
        display: none;
    }
}

@media screen and (max-width: 480px) {
    .product-card__name {
        font-size: 13px;
    }

    .product-card__desc {
        display: none;
    }

    .product-card__price {
        font-size: 13px;
        margin-top: 6px;
    }

    .product-card__rank {
        width: 24px;
        height: 24px;
        font-size: 12px;
        top: 6px;
        left: 6px;
    }
}
