/* ===================================================================
   SHIYAO - MOBILE OVERRIDE
   Ce fichier force l'affichage mobile des sections produits
   À charger APRÈS tous les autres CSS
   =================================================================== */

@media (max-width: 768px) {

    /* ===== FORCER BODY ET CONTAINER SANS MARGES ===== */
    body {
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin: 0 !important;
        overflow-x: hidden !important;
    }

    .container {
        padding-left: 0 !important;
        padding-right: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    /* Header sans marges */
    .header {
        margin: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        width: 100% !important;
    }

    /* Header content avec padding interne */
    .header-content {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    /* Search bar avec padding interne */
    .search-bar {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    /* ===== AGRANDIR LES DEUX CARRÉS DU HAUT ===== */
    .hero-premium {
        margin-bottom: 24px !important;
        padding-bottom: 16px !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .hero-premium__right {
        margin-bottom: 0 !important;
    }

    .hero-carousel-box,
    .hero-hotdeal-box {
        height: 280px !important;
        min-height: 280px !important;
        padding: 12px !important;
    }

    .hero-carousel-slides,
    .hero-slide {
        min-height: 268px !important;
        height: 268px !important;
        border-radius: 12px !important;
        overflow: hidden !important;
        padding-bottom: 8px !important;
        box-sizing: border-box !important;
    }
    
    /* Image remplit le slide avec bordure arrondie */
    .hero-slide img {
        height: calc(100% - 8px) !important;
        width: 100% !important;
        object-fit: cover !important;
        display: block !important;
        border-radius: 12px !important;
        filter: brightness(0.75) !important;
    }

    /* Ajuster l'overlay - Badge en haut, Titre en bas */
    .hero-slide__overlay {
        padding: 8px 16px 16px 16px !important;
        justify-content: space-between !important;
        display: flex !important;
        flex-direction: column !important;
        top: 0 !important;
        bottom: 12px !important;
        height: auto !important;
        border-radius: 12px !important;
    }

    /* Badge Tendance en haut comme étiquette */
    .hero-slide__badge {
        margin: 0 !important;
        align-self: flex-start !important;
        padding: 6px 14px !important;
        font-size: 0.75rem !important;
        border-radius: 20px !important;
    }

    /* Titre en bas avec marge */
    .hero-slide__title {
        margin: 0 !important;
        margin-top: auto !important;
        margin-bottom: 8px !important;
        padding-bottom: 4px !important;
        line-height: 1.2 !important;
        font-size: 1.25rem !important;
    }

    /* Cacher le bouton Découvrir */
    .hero-slide__btn {
        display: none !important;
    }

    /* Dots carousel - centré en bas avec plus d'espace */
    .hero-carousel-dots {
        bottom: 14px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        background: rgba(0, 0, 0, 0.5) !important;
        border-radius: 20px !important;
        padding: 4px 8px !important;
    }
    
    .hero-dot {
        width: 5px !important;
        height: 5px !important;
    }
    
    .hero-dot.active {
        width: 16px !important;
    }

    /* Hot Deals - Ajuster le contenu pour que l'image soit visible */
    .hero-hotdeal-box {
        padding: 10px 12px 12px 12px !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .hotdeal-icon {
        margin-bottom: 3px !important;
        font-size: 22px !important;
    }

    .hotdeal-title {
        margin-bottom: 4px !important;
        font-size: 0.95rem !important;
    }

    .hotdeal-timer {
        margin-bottom: 6px !important;
        padding: 5px 12px !important;
        font-size: 0.75rem !important;
    }

    .hotdeal-product {
        flex: 1 !important;
        display: flex !important;
        align-items: stretch !important;
        justify-content: center !important;
        min-height: 0 !important;
    }

    .hotdeal-single-row {
        flex-direction: column !important;
        gap: 4px !important;
        height: auto !important;
    }
    
    .hotdeal-product-img {
        width: 100% !important;
        height: 150px !important;
        flex: 0 0 150px !important;
        min-height: 150px !important;
        max-height: 150px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 12px !important;
        overflow: hidden !important;
        position: relative !important;
        margin-left: 0 !important;
        margin-bottom: 0 !important;
        padding: 0 !important;
        border: none !important;
    }

    .hotdeal-product-img img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
        border-radius: 12px !important;
    }

    .hotdeal-badge {
        font-size: 0.65rem !important;
        padding: 4px 10px !important;
        position: absolute !important;
        top: 8px !important;
        left: 8px !important;
        z-index: 10 !important;
    }

    /* FORCER LA STRUCTURE EN COLONNE UNIQUE */
    .products-premium-container {
        display: block !important;
        grid-template-columns: 1fr !important;
        width: 100% !important;
        padding: 12px 8px !important;
        overflow: hidden !important;
    }

    /* FORCER LES COLONNES EN PLEINE LARGEUR */
    .trending-column,
    .top-sales-column {
        width: 100% !important;
        max-width: 100% !important;
        display: block !important;
        margin-bottom: 12px !important;
        float: none !important;
        flex: none !important;
        overflow: hidden !important;
    }

    /* FORCER LES WRAPPERS EN RECTANGLES HORIZONTAUX */
    .trending-wrapper,
    .top-sales-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        min-height: auto !important;
        background: #FFFFFF !important;
        border-radius: 16px !important;
        border: 1px solid rgba(184, 70, 31, 0.15) !important;
        box-shadow: 0 2px 12px rgba(184, 70, 31, 0.08) !important;
        padding: 16px !important;
        overflow: hidden !important;
    }

    /* HEADERS - STYLE SIMPLE COMME LA PHOTO */
    .section-header-premium,
    .top-sales-header-premium {
        margin-bottom: 16px !important;
        padding-bottom: 0 !important;
        border-bottom: none !important;
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    .section-title-premium,
    .top-sales-title-premium {
        font-size: 17px !important;
        font-weight: 800 !important;
        color: #8B2F0F !important;
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        margin: 0 !important;
        font-family: 'Inter', -apple-system, sans-serif !important;
    }

    /* Cacher les icônes CSS générées */
    .section-title-premium::before,
    .top-sales-title-premium::before {
        display: none !important;
    }

    /* Styliser les icônes HTML en rouge */
    .fire-icon,
    .trophy-icon {
        color: #B8461F !important;
        font-size: 22px !important;
        display: inline-block !important;
        filter: grayscale(0%) !important;
    }

    .section-subtitle,
    .top-sales-subtitle {
        display: none !important;
    }

    .view-all-link-premium,
    .top-sales-view-all {
        display: inline-flex !important;
        padding: 10px 20px !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        background: #B8461F !important;
        color: #FFFFFF !important;
        border-radius: 25px !important;
        text-decoration: none !important;
        align-items: center !important;
        gap: 6px !important;
        box-shadow: none !important;
        font-family: 'Inter', -apple-system, sans-serif !important;
    }

    /* FORCER LE SCROLL HORIZONTAL DES CAROUSELS */
    .carousel-container-premium {
        width: 100% !important;
        overflow: hidden !important;
    }

    /* CAROUSEL TENDANCE ET TOP VENTES - SCROLL HORIZONTAL */
    .trending-carousel,
    .top-sales-list {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        gap: 10px !important;
        width: 100% !important;
        padding: 4px 0 !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: thin !important;
    }

    .trending-carousel::-webkit-scrollbar,
    .top-sales-list::-webkit-scrollbar {
        height: 4px !important;
    }

    .trending-carousel::-webkit-scrollbar-thumb,
    .top-sales-list::-webkit-scrollbar-thumb {
        background: rgba(184, 70, 31, 0.3) !important;
        border-radius: 4px !important;
    }

    /* CARTES PRODUITS TENDANCE - STYLE SHIYAO */
    .trending-carousel .product-card {
        flex: 0 0 120px !important;
        min-width: 120px !important;
        max-width: 120px !important;
        height: auto !important;
        border-radius: 10px !important;
        background: #FFFFFF !important;
        border: 1px solid rgba(184, 70, 31, 0.15) !important;
        box-shadow: 0 2px 8px rgba(184, 70, 31, 0.1) !important;
        overflow: hidden !important;
        transition: all 0.3s ease !important;
    }

    .trending-carousel .product-card:hover {
        transform: translateY(-2px) !important;
        box-shadow: 0 4px 12px rgba(184, 70, 31, 0.2) !important;
    }

    .trending-carousel .product-image-container {
        height: 120px !important;
        border-radius: 10px 10px 0 0 !important;
    }

    .trending-carousel .product-info {
        padding: 6px !important;
        background: #FFFFFF !important;
    }

    .trending-carousel .product-rating {
        margin-bottom: 2px !important;
    }

    .trending-carousel .product-name {
        font-size: 0.8rem !important;
        font-weight: 600 !important;
        line-height: 1.2 !important;
        margin-bottom: 2px !important;
        color: #1D1D1F !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }
    
    .trending-carousel .product-price {
        margin-top: 2px !important;
    }

    .trending-carousel .price-current {
        font-size: 13px !important;
        font-weight: 700 !important;
        color: #B8461F !important;
    }

    .trending-carousel .price-original {
        font-size: 10px !important;
        color: #999 !important;
    }
    
    .trending-carousel .product-rating .stars {
        font-size: 9px !important;
        color: #fbbf24 !important;
    }
    
    .trending-carousel .product-rating .rating-count {
        font-size: 8px !important;
        color: #999 !important;
    }

    /* TOP VENTES CARDS - STYLE SHIYAO */
    .top-sale-card {
        flex: 0 0 240px !important;
        min-width: 240px !important;
        max-width: 240px !important;
        padding: 14px !important;
        min-height: auto !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: flex-start !important;
        gap: 12px !important;
        background: #FFFFFF !important;
        border-radius: 12px !important;
        border: 1px solid rgba(184, 70, 31, 0.15) !important;
        box-shadow: 0 2px 10px rgba(184, 70, 31, 0.12) !important;
        position: relative !important;
        transition: all 0.3s ease !important;
    }

    .top-sale-card:hover {
        transform: translateX(4px) !important;
        box-shadow: 0 4px 16px rgba(184, 70, 31, 0.2) !important;
    }

    .top-sale-badge {
        width: 32px !important;
        height: 32px !important;
        font-size: 14px !important;
        font-weight: 900 !important;
        top: 10px !important;
        left: 10px !important;
        position: absolute !important;
        z-index: 10 !important;
        border-radius: 8px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: linear-gradient(135deg, #D95F2F 0%, #B8461F 50%, #8B2F0F 100%) !important;
        color: #FFFFFF !important;
        box-shadow: 0 4px 14px rgba(184, 70, 31, 0.5) !important;
    }

    .top-sale-badge.rank-1 {
        background: linear-gradient(135deg, #FFD700 0%, #FFB800 25%, #D95F2F 55%, #B8461F 100%) !important;
        box-shadow: 0 6px 18px rgba(255, 184, 0, 0.65) !important;
        animation: goldPulse 2.5s ease-in-out infinite !important;
    }
    
    @keyframes goldPulse {
        0%, 100% { 
            transform: scale(1);
            box-shadow: 0 6px 18px rgba(255, 184, 0, 0.65);
        }
        50% { 
            transform: scale(1.08);
            box-shadow: 0 8px 24px rgba(255, 184, 0, 0.85);
        }
    }

    .top-sale-image-container {
        width: 80px !important;
        height: 80px !important;
        flex-shrink: 0 !important;
        border-radius: 10px !important;
        overflow: hidden !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    }

    .top-sale-info {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
        padding-top: 2px !important;
    }

    .top-sale-name {
        font-size: 13px !important;
        font-weight: 600 !important;
        line-height: 1.3 !important;
        color: #1D1D1F !important;
        margin-bottom: 4px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 100% !important;
        display: block !important;
    }
    
    /* Afficher version mobile (2 mots) */
    .top-sale-name-mobile {
        display: inline !important;
    }
    
    /* Masquer version desktop (3 mots) */
    .top-sale-name-desktop {
        display: none !important;
    }

    .top-sale-rating {
        display: flex !important;
        align-items: center !important;
        gap: 5px !important;
        margin-bottom: 2px !important;
    }

    .top-sale-stars {
        font-size: 12px !important;
        color: #fbbf24 !important;
        letter-spacing: 0.5px !important;
    }

    .top-sale-count {
        font-size: 11px !important;
        color: #999 !important;
    }

    .top-sale-price {
        display: flex !important;
        align-items: baseline !important;
        gap: 8px !important;
        margin-bottom: 5px !important;
    }

    .top-sale-price-current {
        font-size: 17px !important;
        font-weight: 700 !important;
        color: #B8461F !important;
    }

    .top-sale-price-old {
        font-size: 13px !important;
        color: #999 !important;
        text-decoration: line-through !important;
    }

    .best-seller-badge {
        font-size: 9px !important;
        padding: 5px 10px !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 4px !important;
        background: linear-gradient(135deg, #B8461F 0%, #8B2F0F 100%) !important;
        color: #FFFFFF !important;
        border-radius: 5px !important;
        font-weight: 800 !important;
        text-transform: uppercase !important;
        align-self: flex-start !important;
        box-shadow: 0 3px 10px rgba(184, 70, 31, 0.4) !important;
        letter-spacing: 0.5px !important;
    }
}


/* ===================================================================
   iOS SAFE AREA & STATUS BAR
   =================================================================== */

/* Support pour la barre d'état iOS */
@supports (padding-top: env(safe-area-inset-top)) {
    body {
        padding-top: env(safe-area-inset-top) !important;
    }
    
    .header {
        padding-top: max(20px, env(safe-area-inset-top)) !important;
        background: rgba(255, 255, 255, 0.98) !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
    }
    
    /* Modale produit - ajuster pour iOS */
    .product-modal-overlay {
        top: calc(140px + env(safe-area-inset-top)) !important;
        height: calc(100% - 140px - env(safe-area-inset-top)) !important;
    }
}

/* Styles de modale produit déplacés vers product-modal.css */

/* Forcer le fond blanc opaque sur iOS */
@media (max-width: 768px) {
    .header,
    .header--glass {
        background: rgba(255, 255, 255, 0.98) !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
    }
}


/* Styles de modale produit pour petits écrans déplacés vers product-modal.css */


/* Uniformiser les cartes sur très petits écrans */
@media (max-width: 480px) {
    .trending-carousel .product-card {
        flex: 0 0 115px !important;
        min-width: 115px !important;
        max-width: 115px !important;
    }
    
    .trending-carousel .product-image-container {
        height: 115px !important;
    }
    
    .trending-carousel .product-info {
        padding: 7px !important;
    }
    
    .trending-carousel .product-name {
        font-size: 0.75rem !important;
        margin-bottom: 3px !important;
        line-height: 1.2 !important;
    }
    
    .trending-carousel .price-current {
        font-size: 12px !important;
    }
    
    .trending-carousel .price-original {
        font-size: 9px !important;
    }
    
    .trending-carousel .product-rating .stars {
        font-size: 8px !important;
    }
    
    .trending-carousel .product-rating .rating-count {
        font-size: 7px !important;
    }
    
    .top-sale-card {
        flex: 0 0 220px !important;
        min-width: 220px !important;
    }
    
    .top-sale-image-container {
        width: 72px !important;
        height: 72px !important;
    }
    
    .top-sale-name {
        font-size: 12px !important;
    }
    
    .top-sale-price-current {
        font-size: 15px !important;
    }
}


    /* GRILLE CATALOGUE - TOUS LES PRODUITS */
    .product-card-catalogue .product-card-body {
        padding: 3px !important;
    }
    
    .product-card-catalogue .product-rating {
        margin-bottom: 0 !important;
        gap: 2px !important;
    }
    
    .product-card-catalogue .product-name-catalogue {
        font-size: 10px !important;
        line-height: 1.2 !important;
        margin-bottom: 0 !important;
        margin-top: 1px !important;
        font-weight: 600 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        max-height: 24px !important;
    }
    
    .product-card-catalogue .product-price-row {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        gap: 4px !important;
    }
    
    /* Uniformiser tous les prix sur mobile */
    .product-price,
    .product-price-current,
    .product-card-catalogue .product-price-current,
    .price-current,
    .trending-carousel .price-current,
    .top-sale-price-current {
        font-size: 14px !important;
        font-weight: 700 !important;
    }
    
    /* Prix barrés uniformisés */
    .product-price-old,
    .product-card-catalogue .product-price-old,
    .price-original,
    .trending-carousel .price-original,
    .top-sale-price-old {
        font-size: 11px !important;
    }
    
    .product-card-catalogue .product-stars {
        color: #fbbf24 !important;
        font-size: 9px !important;
    }

    .product-card-catalogue .product-reviews {
        color: #999 !important;
        font-size: 8px !important;
    }

    .product-card-catalogue .product-price-current {
        background: linear-gradient(135deg, #B8461F 0%, #8B2F0F 100%) !important;
        -webkit-background-clip: text !important;
        -webkit-text-fill-color: transparent !important;
        background-clip: text !important;
        font-weight: 700 !important;
        font-size: 14px !important;
    }

    .product-card-catalogue .product-price-old {
        color: #999 !important;
        text-decoration: line-through !important;
        font-size: 11px !important;
    }
}

/* ===================================================================
   FOOTER - Styles gérés par css/footer-premium.css
   =================================================================== */
@media (max-width: 768px) {
    .footer-social-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .social-icons a {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }
}


/* ===================================================================
   MODAL AUTHENTIFICATION - OVERLAY NOIR
   =================================================================== */

#authOverlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

#authOverlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* S'assurer que la modale auth est au-dessus de l'overlay */
#authModal {
    position: fixed;
    z-index: 1000;
}

/* Sur mobile, l'overlay doit être visible */
@media (max-width: 768px) {
    #authOverlay {
        background: rgba(0, 0, 0, 0.5);
    }
}


/* ===================================================================
   MODALE TRI MOBILE
   =================================================================== */

.mobile-sort-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-sort-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-sort-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #FFFFFF;
    border-radius: 20px 20px 0 0;
    z-index: 1101;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    max-height: 70vh;
    overflow-y: auto;
}

.mobile-sort-modal.active {
    transform: translateY(0);
}

.mobile-sort-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #E5E5E5;
}

.mobile-sort-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #1D1D1F;
    margin: 0;
}

.mobile-sort-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F5F5F5;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    color: #666;
    cursor: pointer;
}

.mobile-sort-option {
    padding: 16px 20px;
    border-bottom: 1px solid #F5F5F5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
}

.mobile-sort-option:active {
    background: #F5F5F5;
}

.mobile-sort-option.active {
    color: #8B2F0F;
    font-weight: 600;
}

.mobile-sort-option.active::after {
    content: '✓';
    color: #8B2F0F;
    font-size: 18px;
    font-weight: 700;
}
