/* =====================================================================
   PREMIUM RESPONSIVE OVERLAY
   Corrections ciblées pour les composants premium (slider hero,
   sidebar categories, cards produits, infoProduit) et les hotspots
   typiquement cassés sur mobile/tablette.
   ===================================================================== */

/* =================== UTILITAIRES GLOBAUX =================== */

/* Empêcher le scroll horizontal sur toutes les pages clients */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Images responsive par défaut */
.main img,
.product-cart-wrap img,
.banner-img img,
.hero-slider-1 img {
    max-width: 100%;
    height: auto;
}

/* Empêcher les longs mots de casser la mise en page */
.product-card-bottom .add-cart,
.product-content-wrap h2,
.product-category,
.btn,
.section-title h3,
.section-title h4 {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* =================== TABLETTE (≤ 991px) =================== */
@media (max-width: 991.98px) {

    /* Container principal — moins de padding */
    .main .container-fluid {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    /* La row flex-row-reverse devient en colonne pour mettre la sidebar dessous */
    .row.flex-row-reverse {
        flex-direction: column !important;
    }
    .col-lg-4-5,
    .col-lg-1-5 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }

    /* Sidebar Categories — passe en collapse-friendly */
    .primary-sidebar.sticky-sidebar {
        position: static !important;
        top: auto !important;
        padding-top: 16px !important;
    }
    .categorie-sidebar-list .categorie-sidebar-item {
        padding: 10px 14px;
        font-size: 0.95rem;
    }

    /* Grille produits — 3 colonnes sur tablette, plus 4 */
    .product-grid-4 .col-lg-3 {
        flex: 0 0 33.333% !important;
        max-width: 33.333% !important;
    }

    /* Section title moins gros */
    .section-title h3,
    .section-title h4 {
        font-size: 1.2rem !important;
    }

    /* Pagination + reset */
    .pagination-area .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Hero slider hauteur réduite (déjà géré dans index.blade.php mais on renforce) */
    .premium-hero-slider .single-hero-slider {
        height: 360px !important;
    }
}

/* =================== TABLETTE PETIT (≤ 767px) =================== */
@media (max-width: 767.98px) {

    /* Header — adapter les paddings */
    .header-top {
        padding: 6px 0 !important;
    }
    .header-bottom {
        padding: 8px 0 !important;
    }
    .header-middle .header-info ul li {
        font-size: 12px;
    }

    /* Grille produits — 2 colonnes */
    .product-grid-4 .col-lg-3,
    .product-grid-4 .col-md-4,
    .product-grid-4 .col-sm-6 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        padding-left: 6px;
        padding-right: 6px;
    }

    /* Carte produit — texte plus compact */
    .product-cart-wrap {
        margin-bottom: 14px !important;
    }
    .product-cart-wrap .product-content-wrap {
        padding: 10px 12px !important;
    }
    .product-cart-wrap .product-content-wrap h2 {
        font-size: 12px !important;
        line-height: 1.2 !important;
    }
    .product-cart-wrap .product-price span {
        font-size: 14px !important;
    }
    .product-cart-wrap .add-cart .add {
        padding: 6px 12px !important;
        font-size: 11px !important;
    }

    /* Catégories sur grille — 2 colonnes pour la section "Achat par catégorie" */
    .popular-categories .card-1 {
        margin: 0 4px;
    }

    /* Sections — moins de padding vertical */
    .section-padding {
        padding-top: 30px !important;
        padding-bottom: 30px !important;
    }

    /* Slider — caché ou adapté */
    .premium-hero-slider .single-hero-slider {
        height: 280px !important;
        border-radius: 12px;
    }
    .premium-hero-slider .slider-content {
        padding: 22px 24px !important;
        max-width: 100% !important;
    }
    .premium-hero-slider .slider-title {
        font-size: 1.3rem !important;
        line-height: 1.2 !important;
    }
    .premium-hero-slider .slider-desc {
        font-size: 0.8rem !important;
        margin-bottom: 12px !important;
    }
    .premium-hero-slider .slider-features {
        gap: 8px !important;
        margin-bottom: 14px !important;
    }
    .premium-hero-slider .slider-feature {
        font-size: 0.72rem !important;
    }
    .premium-hero-slider .slider-actions {
        gap: 6px;
    }
    .premium-hero-slider .btn-slider-primary,
    .premium-hero-slider .btn-slider-outline {
        padding: 8px 14px !important;
        font-size: 0.78rem !important;
    }
    .premium-hero-slider .slider-decoration {
        display: none !important;
    }

    /* Page détail produit — empilage des colonnes */
    .product-detail .col-md-6,
    .product-detail .col-md-5,
    .product-detail .col-md-7 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    .product-detail .product-image-slider {
        margin-bottom: 20px;
    }

    /* Cart / checkout — colonnes empilées */
    .cart-wrap .table th,
    .cart-wrap .table td {
        font-size: 11px;
        padding: 8px 4px;
    }
    .cart-wrap .img-product {
        width: 50px;
        height: 50px;
    }

    /* Quick view modal — full screen sur mobile */
    .modal-dialog.modal-lg {
        max-width: 95vw !important;
        margin: 10px auto;
    }

    /* Footer — colonnes empilées proprement */
    .main-footer .col-lg-2,
    .main-footer .col-md-3,
    .main-footer .col-md-4 {
        margin-bottom: 24px;
    }
}

/* =================== MOBILE (≤ 575px) =================== */
@media (max-width: 575.98px) {

    /* Grille produits — 1 colonne */
    .product-grid-4 .col-lg-3,
    .product-grid-4 .col-md-4,
    .product-grid-4 .col-sm-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    /* Carte produit — plus aérée en colonne pleine */
    .product-cart-wrap {
        margin-bottom: 16px !important;
        max-width: 380px;
        margin-left: auto;
        margin-right: auto;
    }
    .product-cart-wrap .product-img-action-wrap .product-img a {
        max-height: 200px !important;
    }
    .product-cart-wrap .product-img-action-wrap .product-img a img {
        height: 200px !important;
    }

    /* Hero slider encore plus compact */
    .premium-hero-slider .single-hero-slider {
        height: 240px !important;
    }
    .premium-hero-slider .slider-content {
        padding: 16px 18px !important;
    }
    .premium-hero-slider .slider-title {
        font-size: 1.05rem !important;
        margin-bottom: 8px !important;
    }
    .premium-hero-slider .slider-desc {
        font-size: 0.75rem !important;
        line-height: 1.3 !important;
        margin-bottom: 10px !important;
    }
    .premium-hero-slider .slider-features {
        display: none !important;
    }
    .premium-hero-slider .slider-price {
        margin-bottom: 10px !important;
    }
    .premium-hero-slider .btn-slider-primary {
        padding: 7px 12px !important;
        font-size: 0.72rem !important;
    }
    .premium-hero-slider .btn-slider-outline {
        display: none !important;
    }
    .premium-hero-slider .slider-badge {
        font-size: 0.6rem;
        padding: 4px 9px;
        margin-bottom: 8px;
    }

    /* Titres de sections */
    .section-title h3,
    .section-title h4,
    .section-title .title h3 {
        font-size: 1.05rem !important;
    }

    /* Boutons standards */
    .btn {
        font-size: 0.85rem;
        padding: 8px 14px;
    }

    /* Container padding plus serré */
    .container,
    .main .container-fluid {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    /* Header logo plus petit */
    .header-middle .logo img,
    .brand-wrap img {
        max-height: 38px;
    }

    /* Section padding réduit */
    .section-padding {
        padding-top: 20px !important;
        padding-bottom: 20px !important;
    }

    /* Page détail produit — image principale */
    .product-detail .detail-gallery .product-image-slider .slick-slide img {
        max-height: 280px !important;
    }

    /* Cart — affichage type liste sur mobile */
    .cart-wrap .table thead {
        display: none;
    }
    .cart-wrap .table tr {
        display: block;
        margin-bottom: 12px;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        padding: 8px;
    }
    .cart-wrap .table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border: none !important;
        padding: 6px 4px;
    }
    .cart-wrap .table td::before {
        content: attr(data-label);
        font-weight: 600;
        margin-right: 8px;
        color: #6b7280;
    }

    /* Quick view modal — encore plus compact */
    .modal-dialog.modal-lg {
        max-width: 100vw !important;
        margin: 0;
    }
    .modal-content {
        border-radius: 0;
    }

    /* Categories popular — 2 par ligne pour le carousel sur mobile */
    .carausel-8-columns .card-1 {
        margin: 0 4px;
    }

    /* Footer copyright */
    .main-footer .footer-bottom {
        text-align: center;
    }
}

/* =================== TRÈS PETIT (≤ 380px) =================== */
@media (max-width: 380px) {
    .premium-hero-slider .single-hero-slider {
        height: 220px !important;
    }
    .premium-hero-slider .slider-title {
        font-size: 0.95rem !important;
    }
    .premium-hero-slider .slider-content {
        padding: 14px 14px !important;
    }
    .product-cart-wrap .product-content-wrap h2 {
        font-size: 11px !important;
    }
}

/* =================== TOUCH-FRIENDLY =================== */
@media (hover: none) and (pointer: coarse) {
    /* Tap targets minimum 44x44px (recommandation Apple/Google) */
    .btn,
    .menu-link,
    .dropdown-item,
    .nav-link,
    .categorie-sidebar-item,
    .product-action-1 .action-btn {
        min-height: 36px;
    }
    /* Désactiver hover effects qui peuvent rester collés sur touch */
    .categorie-sidebar-list .categorie-sidebar-item:hover {
        transform: none;
    }
}
