/* ============================================================
   WISHRITE — GLOBAL PREMIUM PRODUCT CARD & GRID UI SYSTEM
   Unified luxury styling applied across ALL product listing pages:
   - Homepage (New Arrivals, Best Sellers)
   - /shop (All Jewellery with Sidebar Filters)
   - Category Pages (Pendants, Earrings, Rings, Necklaces, etc.)
   - Collections Pages
   - New Arrivals & Best Sellers Dedicated Pages
   - Search Results & Related Product Grids
   UI ONLY: no backend/database/auth/payment changes.
   ============================================================ */

/* ── 1. GLOBAL FULL-WIDTH PRODUCT GRIDS ── */
.product-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: clamp(16px, 1.5vw, 24px);
    align-items: start;
    width: 100%;
    box-sizing: border-box;
}

/* Desktop (>= 1200px): Exactly 5 products per row */
@media (min-width: 1200px) {
    .product-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: clamp(16px, 1.5vw, 24px);
    }
}

/* Tablet Landscape (992px – 1199px): 4 columns */
@media (min-width: 992px) and (max-width: 1199px) {
    .product-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 18px 14px;
    }
}

/* Tablet Portrait (768px – 991px): 3 columns */
@media (min-width: 768px) and (max-width: 991px) {
    .product-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 16px 12px;
    }
}

/* Mobile (< 768px): Exactly 2 columns across all product recommendation and listing grids */
@media (max-width: 767px) {
    .product-grid,
    .related-section .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        width: 100%;
    }
}

/* Very Small Mobile (<= 380px): Still 2 columns, slightly reduced gap */
@media (max-width: 380px) {
    .product-grid,
    .related-section .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px 10px;
    }
}

/* ── 2. /SHOP PAGE PRODUCT GRID (WITH SIDEBAR) ── */
/* When sidebar is present, keep grid balanced without crowding cards */
.shop-main .product-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(14px, 1.3vw, 20px);
}

@media (min-width: 1400px) {
    .shop-main .product-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: clamp(16px, 1.4vw, 22px);
    }
}

@media (min-width: 1200px) and (max-width: 1399px) {
    .shop-main .product-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 16px 14px;
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .shop-main .product-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 16px 12px;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .shop-main .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px 10px;
    }
}

@media (max-width: 767px) {
    .shop-main .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        width: 100%;
    }
}

@media (max-width: 380px) {
    .shop-main .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px 10px;
    }
}

/* ── 3. CURVED / FLOATING PRODUCT CARDS (GLOBAL) ── */
.product-card {
    background: transparent;
    border: 0;
    border-radius: 18px;
    overflow: visible;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    transform: translateY(0);
    transition: transform 350ms cubic-bezier(.2, .7, .2, 1);
}

.product-card:hover {
    transform: translateY(-5px);
}

/* ── 4. PRODUCT IMAGE (FLOATING CURVED PANEL) ── */
.product-card-image {
    aspect-ratio: 4 / 5;
    margin-bottom: 12px;
    border-radius: 18px;
    overflow: hidden;
    position: relative;
    background: #f7f5f2;
    border: 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
    transition: box-shadow 350ms ease, transform 350ms cubic-bezier(.2, .7, .2, 1);
}

.product-card:hover .product-card-image {
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.10);
}

/* Subtle luxury lighting gradient overlay */
.product-card-image::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 75%, rgba(255, 255, 255, 0.08) 100%);
    z-index: 2;
    border-radius: 18px;
}

/* Primary Product Image */
.product-card-image > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 18px;
    transition: opacity 350ms ease, transform 550ms cubic-bezier(.2, .7, .2, 1);
}

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

/* ── 5. SECOND IMAGE ON HOVER (SMOOTH CROSSFADE) ── */
.product-card-image .img-secondary {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 18px;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
    transform: scale(1.015);
    transition: opacity 380ms ease, transform 450ms cubic-bezier(.2, .7, .2, 1);
}

.product-card:hover .product-card-image .img-secondary {
    opacity: 1;
    transform: scale(1.03);
}

/* Cleanly hide secondary crossfade if JS multi-image slideshow is running */
.product-card-image.slideshow-running .img-secondary {
    opacity: 0 !important;
}

/* ── 6. CIRCULAR WISHLIST BUTTON ── */
.product-card-wishlist {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 4;
    transition: transform 220ms ease, background 200ms ease, box-shadow 200ms ease;
}

.product-card-wishlist svg {
    width: 18px;
    height: 18px;
    transition: transform 200ms ease;
}

.product-card-wishlist:hover {
    background: #ffffff;
    transform: scale(1.08);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}

.product-card-wishlist.active svg {
    fill: var(--wr-heart, #C62828);
    stroke: var(--wr-heart, #C62828);
}

/* ── 7. SALE / FEW LEFT / STATUS BADGES ── */
.product-card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 5px 9px;
    border-radius: 5px;
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 4;
    line-height: 1.1;
    background: #53374F;
    color: #ffffff;
}

/* SALE: compact red premium badge */
.product-card-badge.badge-sale {
    background: #C62828;
    color: #ffffff;
}

/* FEW LEFT / GOLD: WishRite luxury rosewood badge */
.product-card-badge.badge-gold,
.product-card-badge.badge-few-left {
    background: #53374F;
    color: #ffffff;
}

/* NEW: deep carbon black badge */
.product-card-badge.badge-new {
    background: #261816;
    color: #ffffff;
}

/* ── 8. PRODUCT INFORMATION & EDITORIAL HIERARCHY ── */
.product-card-info {
    padding: 4px 2px 0;
    display: flex;
    flex-direction: column;
}

.product-card-meta-line {
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Product Code: small uppercase light text */
.product-card-sku {
    color: #9e8e89;
    font-size: 9px;
    letter-spacing: .08em;
    text-transform: uppercase;
    font-family: inherit;
}

/* Category: subtle gold accent */
.product-card-category {
    color: var(--wr-gold, #c49a45);
    font-size: 9px;
    letter-spacing: .08em;
    text-transform: uppercase;
    font-weight: 600;
}

/* Product Name: clean readable text with 2-line clamp */
.product-card-name {
    margin-bottom: 5px;
    font-size: clamp(13px, .92vw, 15px);
    line-height: 1.35;
    font-weight: 500;
    color: var(--wr-text, #261816);
    letter-spacing: .005em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.7em;
}

.product-card-price {
    margin-bottom: 0;
    gap: 8px;
    display: flex;
    align-items: baseline;
}

/* Selling Price: strong prominent price */
.product-card-price .price-current {
    font-size: 15px;
    font-weight: 600;
    color: #53374F;
}

/* MRP: smaller grey struck-through */
.product-card-price .price-original {
    font-size: 12px;
    color: #9e8e89;
    text-decoration: line-through;
}

/* Discount: green */
.product-card-price .price-discount {
    font-size: 11px;
    letter-spacing: .02em;
    font-weight: 600;
    color: #2e7d32;
}

/* ── 9. FLOATING QUICK ADD PILL ── */
.product-card-quick {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: calc(100% - 24px);
    border-radius: 10px;
    background: #53374F;
    color: #FFFFFF;
    border: 1.5px solid #53374F;
    box-shadow: 0 8px 24px rgba(83, 55, 79, 0.20);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 300ms cubic-bezier(.2, .7, .2, 1), transform 300ms cubic-bezier(.2, .7, .2, 1), background 200ms ease, color 200ms ease, border-color 200ms ease;
    z-index: 4;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 10px 14px;
    text-align: center;
}

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

.product-card-quick:hover {
    background: #FFFFFF !important;
    color: #53374F !important;
    border-color: #53374F !important;
}

/* ── 10. MOBILE PRODUCT CARD & RECOMMENDATION GRID SYSTEM (< 768px) ── */
@media (max-width: 767px) {
    /* Full-width 2-column mobile recommendation and listing grids */
    .product-grid,
    .related-section .product-grid,
    .shop-main .product-grid {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        box-sizing: border-box;
    }

    /* Product card occupies 100% of its grid cell, no fixed desktop widths */
    .product-card {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
        border-radius: 14px;
        transform: none;
        box-shadow: none;
    }

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

    /* Floating curved image panel on mobile: 14px radius, 1:1.12 ratio */
    .product-card-image {
        aspect-ratio: 1 / 1.12;
        margin-bottom: 8px;
        border-radius: 14px;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
        width: 100%;
        overflow: hidden;
        position: relative;
    }

    .product-card:hover .product-card-image {
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
        transform: none;
    }

    .product-card-image::after {
        border-radius: 14px;
    }

    .product-card-image > img,
    .product-card-image .img-secondary {
        border-radius: 14px;
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        transform: none;
    }

    .product-card:hover .product-card-image > img,
    .product-card:hover .product-card-image .img-secondary {
        transform: none;
    }

    /* Mobile Wishlist Button: 34px × 34px inside upper-right corner */
    .product-card-wishlist {
        width: 34px;
        height: 34px;
        top: 8px;
        right: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    }

    .product-card-wishlist svg {
        width: 15px;
        height: 15px;
    }

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

    /* Mobile Status Badges: compact, clearly readable, staying inside */
    .product-card-badge {
        top: 8px;
        left: 8px;
        font-size: 8.5px;
        padding: 5px 8px;
        border-radius: 4px;
        box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
        letter-spacing: .06em;
    }

    /* Hide desktop hover quick-add on mobile touch screens */
    .product-card-quick {
        display: none !important;
    }

    /* Mobile Typography: clearly readable luxury ecommerce hierarchy */
    .product-card-info {
        padding: 4px 1px 0;
    }

    .product-card-meta-line {
        margin-bottom: 3px;
    }

    .product-card-sku {
        font-size: 9.5px;
        letter-spacing: .06em;
    }

    .product-card-category {
        font-size: 9.5px;
        letter-spacing: .06em;
    }

    .product-card-name {
        font-size: 13.5px;
        line-height: 1.3;
        min-height: 2.6em;
        margin-bottom: 4px;
    }

    .product-card-price {
        gap: 6px;
    }

    .product-card-price .price-current {
        font-size: 14.5px;
        font-weight: 600;
    }

    .product-card-price .price-original {
        font-size: 11px;
    }

    .product-card-price .price-discount {
        font-size: 10.5px;
    }
}

/* ── 11. EXTRA SMALL MOBILE (≤ 380px) ── */
@media (max-width: 380px) {
    .product-grid,
    .related-section .product-grid,
    .shop-main .product-grid {
        gap: 8px 10px;
    }

    .product-card-name {
        font-size: 12.5px;
    }

    .product-card-price .price-current {
        font-size: 13.5px;
    }

    .product-card-price .price-original {
        font-size: 10.5px;
    }

    .product-card-price .price-discount {
        font-size: 10px;
    }
}