/**
 * Unified Premium Product Cards
 * Same design for Nouveauté, Produits, and Promotions sections
 */

/* Override all product card styles for consistency */
.product-card,
.promo-card {
    background: #ffffff;
    border-radius: 20px;
    /* More modern rounded corners */
    transition: all 0.45s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    /* Soft deep shadow */
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 320px;
    /* Professional breadth restored */
    margin: 0 auto;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.product-card:hover,
.promo-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    border-color: rgba(197, 160, 89, 0.3);
}

/* Uniform image container */
.product-image,
.promo-card .product-image {
    position: relative;
    width: 100%;
    height: 230px;
    /* Spacious image area */
    overflow: hidden;
    background: #ffffff;
    border-radius: 20px 20px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.product-image img,
.promo-card .product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.08));
}

/* Gallery container: transform-based, controlled by JS. No overflow scrolling to avoid layout shifts */
.product-gallery {
    display: flex;
    width: 100%;
    height: 100%;
    transform: translateX(0);
    transition: transform 360ms cubic-bezier(0.165, 0.84, 0.44, 1);
    will-change: transform;
}

.gallery-item {
    flex: 0 0 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Dots */
.gallery-dots {
    position: absolute;
    bottom: 10px;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 6px;
    pointer-events: auto;
    z-index: 3;
}

.gallery-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0,0,0,0.18);
    border: none;
    transition: opacity 220ms ease, transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
    opacity: 0.35;
    cursor: pointer;
    padding: 0;
}

.gallery-dots .dot.active {
    background: var(--accent-gold, #c5a059);
    opacity: 1;
    transform: translateY(-2px) scale(1.15);
}

/* Desktop-only micro-interactions: subtle brightness, saturation and dot polish */
@media (hover: hover) and (pointer: fine) {
    /* Use will-change only on hover-capable devices to hint the browser */
    /* Strong, theme-agnostic rules for image micro-interactions */
    .product-image img,
    .promo-card .product-image img {
        transition: transform 360ms cubic-bezier(0.165, 0.84, 0.44, 1), filter 420ms cubic-bezier(0.2, 0.9, 0.2, 1);
        will-change: transform, filter;
        transform-origin: center center;
    }

    .product-card.previewing .product-image img,
    .promo-card.previewing .product-image img {
        filter: brightness(1.06) saturate(1.06);
        transition: filter 420ms cubic-bezier(0.2, 0.9, 0.2, 1), transform 420ms cubic-bezier(0.2, 0.9, 0.2, 1);
        will-change: transform, filter;
        pointer-events: none;
    }

    /* Gentle scale for active dot when previewing */
    .product-card.previewing .gallery-dots .dot.active,
    .promo-card.previewing .gallery-dots .dot.active {
        transform: translateY(-2px) scale(1.18);
        transition: transform 420ms cubic-bezier(0.2, 0.9, 0.2, 1), opacity 260ms ease;
    }

    /* Default dot transition polish */
    .gallery-dots .dot {
        transition: opacity 260ms ease, transform 260ms cubic-bezier(0.2, 0.9, 0.2, 1);
        will-change: transform, opacity;
    }

    /* Hint the gallery will transform during preview (subtle) */
    .product-card.previewing .product-gallery,
    .promo-card.previewing .product-gallery {
        will-change: transform;
    }
}

[data-theme="dark"] .product-card,
[data-theme="dark"] .promo-card {
    background: #1c1c1e !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Theme-specific product-image backgrounds must live in theme files (dark-mode-premium.css). */

/* Allow subtle transform animations applied by JS (micro-parallax) */
.product-image img,
.promo-card .product-image img {
    transition: transform 360ms cubic-bezier(0.165, 0.84, 0.44, 1);
    transform-origin: center center;
}

/* Dots active visual tweak */
.gallery-dots .dot.active {
    background: var(--accent-gold, #c5a059);
    opacity: 1;
    transform: translateY(-2px) scale(1.15);
}

/* Uniform product info section */
.product-info,
.promo-card .product-info {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

/* Category label */
.product-info .category,
.promo-card .product-info .category {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--accent-color);
    font-weight: 600;
    margin-bottom: 4px;
}

/* Product title */
.product-info h3,
.promo-card .product-info h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 8px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
}

/* Price section */
.price,
.promo-card .price {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
}

.old-price {
    font-size: 0.85rem;
    color: var(--text-gray);
    text-decoration: line-through;
}

.new-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-color);
}

/* Badge styling */
.badge-sale,
.badge-new {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--accent-color);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(197, 160, 89, 0.3);
    z-index: 2;
}

.badge-new {
    background: linear-gradient(135deg, #c5a059 0%, #d4af61 100%);
}

/* Action buttons */
.actions,
.promo-card .actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.btn-primary,
.btn-add-cart {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-primary:hover,
.btn-add-cart:hover {
    background: #b08f4a;
    transform: scale(1.03);
    box-shadow: 0 4px 16px rgba(197, 160, 89, 0.3);
}

.btn-sold {
    background: #ddd;
    color: #999;
    cursor: not-allowed;
}

/* Overlay for sold items */
.overlay-sold {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.2rem;
    z-index: 1;
}

/* Responsive */
@media (max-width: 768px) {

    .product-image,
    .promo-card .product-image {
        height: 180px;
    }

    .product-info,
    .promo-card .product-info {
        padding: 14px;
    }

    .product-info h3,
    .promo-card .product-info h3 {
        font-size: 0.9rem;
    }
}