/* ============================================================
   상품 카드 공통 스타일 (모든 고객 화면)
   - 메인 · 상품 목록 · 검색 · 특가 · 기획전 · 찜 목록이 모두 이 파일 하나를 쓴다
   - 카드 모양을 바꿀 때는 이 파일만 고친다
   - 화면별 배치(가로 슬라이드 폭, 그리드 칸 수)는 각 화면 CSS 에 둔다
   ============================================================ */

.product-card {
    display: flex;
    flex-direction: column;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: box-shadow var(--transition-normal);
}

/* 상품 카드: 마우스를 올려도 그림자는 띄우지 않는다 (사진 확대만) */

.product-card-image {
    position: relative;
    aspect-ratio: 1;
    background: var(--color-bg-gray);
    overflow: hidden;
    /* 사진 네 귀퉁이 모두 둥글게 (위쪽만 둥글던 것을 아래까지) */
    border-radius: var(--radius-md);
}

.product-card-image img {
    width: 100%;
    height: 100%;
    /* cover: 원본 비율과 상관없이 항상 정사각형으로 꽉 채운다 (가장자리가 조금 잘릴 수 있음) */
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.product-card:hover .product-card-image img {
    transform: scale(1.05);
}

.product-card-badges {
    position: absolute;
    top: var(--spacing-sm);
    left: var(--spacing-sm);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.product-badge {
    padding: 2px 8px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    border-radius: var(--radius-sm);
}

.product-badge.best {
    background: var(--color-primary);
    color: var(--color-text-white);
}

.product-badge.new {
    background: var(--color-info);
    color: var(--color-text-white);
}

.product-badge.sale {
    background: var(--color-accent);
    color: var(--color-text-white);
}

.product-card-wishlist {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    z-index: 5;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: var(--color-bg);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.product-card-wishlist:hover {
    transform: scale(1.1);
}

.product-card-wishlist svg {
    width: 18px;
    height: 18px;
    stroke: var(--color-text-muted);
    fill: none;
}

.product-card-wishlist.active svg {
    stroke: var(--color-accent);
    fill: var(--color-accent);
}

.product-card-soldout {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-white);
    font-size: var(--font-size-lg);
    font-weight: 600;
}

/* 상품 정보: 사진 왼쪽 끝에 글자를 맞추고, 이름 → 원래 가격 → 할인율·판매가 순으로 눈이 가게 */
.product-card-info {
    padding: 12px 2px 4px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card-brand {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-bottom: 2px;
}

/* 이름은 내용만큼만 (한 줄이면 한 줄 높이), 최대 두 줄 */
.product-card-name {
    font-size: var(--font-size-md);
    font-weight: 500;
    color: #222;
    line-height: 1.45;
    word-break: keep-all;
    overflow-wrap: anywhere;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 가격은 이름 바로 아래에 붙인다 */
.product-card-price {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

/* 원래 가격: 작고 옅게 (할인 없는 상품은 이 줄이 없다) */
.product-card-original {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    text-decoration: line-through;
    line-height: 1.3;
}

/* 칸이 좁으면 할인율 다음에서만 줄을 바꾸고, 가격("45,000원")은 한 덩어리로 둔다 */
.product-card-current {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 6px;
    row-gap: 0;
    line-height: 1.3;
}

/* 할인율과 판매가는 같은 크기로 굵게: 할인율은 포인트 색, 판매가는 진한 글씨 */
.product-card-discount {
    font-size: var(--font-size-lg);
    font-weight: 800;
    color: var(--color-accent);
    letter-spacing: -0.01em;
}

.product-card-amount {
    white-space: nowrap;
    font-size: var(--font-size-lg);
    font-weight: 800;
    color: #111;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}

.product-card-rating {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-top: 6px;
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

.product-card-rating svg {
    width: 12px;
    height: 12px;
    fill: #ffc107;
}

/* 상품 그리드 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
}




/* ------------------------------------------------------------
   변형: 상품 목록 "목록 보기" (사진 왼쪽 · 정보 오른쪽)
   ------------------------------------------------------------ */
.products-grid.list-view .product-card {
    flex-direction: row;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
}

.products-grid.list-view .product-card-image {
    width: 120px;
    height: 120px;
    aspect-ratio: auto;
    flex-shrink: 0;
}

.products-grid.list-view .product-card-info {
    justify-content: center;
}

/* ------------------------------------------------------------
   변형: 메인 인기 상품 순위 번호 (2위부터, 1위는 큰 카드)
   ------------------------------------------------------------ */
.best-products .product-card {
    counter-increment: best-rank;
}

.best-products .product-card-image::before {
    content: counter(best-rank);
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border-radius: 0 0 var(--radius-md) 0;
    background: var(--color-primary);
    color: var(--color-text-white);
    font-size: var(--font-size-md);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* 순위 번호와 겹치지 않게 뱃지는 번호 아래로 */
.best-products .product-card-badges {
    top: 42px;
}

/* ------------------------------------------------------------
   변형: 찜 목록 (품절 흐리게 · 이름 링크 · 장바구니 담기 버튼 자리)
   ------------------------------------------------------------ */
.wishlist-grid .product-card.soldout {
    opacity: 0.6;
}

.product-card-name a {
    color: inherit;
    text-decoration: none;
}

.product-card .btn-add-cart {
    margin-top: var(--spacing-sm);
}

/* ============================================================
   타임딜 카드별 남은 시간 뱃지 (메인 타임딜 · 특가 페이지 공통, common.js TimedealBadges)
   ============================================================ */
.timedeal-left {
    position: absolute;
    left: var(--spacing-sm);
    bottom: var(--spacing-sm);
    display: inline-flex;
    align-items: center;
    gap: 3px;
    max-width: calc(100% - var(--spacing-sm) * 2);
    padding: 3px 7px;
    border-radius: var(--radius-sm);
    background: var(--color-point-coral);
    color: #fff;
    font-size: var(--font-size-xs);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    pointer-events: none;
}

.timedeal-left svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.timedeal-left.is-ended {
    background: rgba(0, 0, 0, 0.6);
}
