/* =================================================
   RESPONSIVE.CSS - Mobile-first responsive design
   ================================================= */

/* ---------- GLOBAL FIXES ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    overflow-x: hidden;
    width: 100%;
    /* position: relative retiré : casse le position:fixed (cart-sidebar,
       categories-sidebar...) sur Safari iOS quand combiné à overflow-x:hidden */
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

table {
    max-width: 100%;
}

/* Container fluid fix */
.container-fluid {
    overflow-x: hidden;
}

/* ---------- CONTAINER FIX ---------- */
.container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding-left: 15px;
    padding-right: 15px;
}

@media (max-width: 576px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* ---------- SMALL (max-width: 576px) ---------- */
@media (max-width: 576px) {
    /* Hide desktop-only elements */
    .desktop-only,
    .hide-mobile {
        display: none !important;
    }

    .mobile-only {
        display: block !important;
    }

    /* Hero section */
    .hero {
        height: 350px !important;
        min-height: 350px;
    }
    .hero-content h1 {
        font-size: 1.75rem !important;
        line-height: 1.2;
    }
    .hero-content p {
        font-size: 0.9rem !important;
    }
    .hero-buttons .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    .hero-content {
        padding: 1rem !important;
        max-width: 100% !important;
    }

    /* Grids - single column */
    .categories-grid,
    .features-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    .products-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }

    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Product cards */
    .product-card {
        margin-bottom: 0;
    }
    .product-image {
        height: 110px !important;
    }
    .product-info h3 {
        font-size: 0.75rem;
        height: 2rem;
    }
    .product-price {
        font-size: 0.85rem;
    }

    /* Category cards */
    .category-card {
        height: 180px !important;
    }

    /* Features */
    .feature-card {
        padding: 1rem !important;
    }

    /* Page header */
    .page-header {
        padding: 1.5rem 0 !important;
    }
    .page-header h1 {
        font-size: 1.5rem !important;
    }

    /* Filters */
    .filters-container {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    /* Newsletter */
    .newsletter-form {
        flex-direction: column !important;
    }
    .newsletter-form input {
        width: 100%;
    }
    .newsletter h2 {
        font-size: 1.5rem !important;
    }

    /* Section spacing */
    .categories,
    .products,
    .features,
    .testimonials,
    .newsletter {
        padding: 2rem 0 !important;
    }
    .section-header {
        margin-bottom: 1.5rem !important;
    }
    .section-header h2 {
        font-size: 1.5rem !important;
    }

    /* Cart sidebar full width */
    .cart-sidebar {
        width: 100%;
        height: 100vh;
        height: 100dvh;
        right: -100%;
    }

    /* Categories sidebar full width */
    .categories-sidebar {
        width: 85% !important;
    }

    /* Toast container */
    .toast-container {
        left: 10px;
        right: 10px;
        top: 10px;
    }
    .toast {
        max-width: none !important;
    }

    /* Pagination */
    .pagination-numbers button {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    /* Footer */
    .footer-main {
        padding: 2rem 0 !important;
    }
    .footer-logo {
        height: 45px !important;
    }

    /* Misc */
    .section-header p {
        font-size: 0.9rem;
    }
    .product-category {
        font-size: 0.7rem;
    }

    /* Empty cart */
    .empty-cart-wrapper {
        padding: 40px 15px !important;
    }
}

/* ---------- MEDIUM (max-width: 768px) ---------- */
@media (max-width: 768px) {
    .hide-tablet {
        display: none !important;
    }

    /* Grids - 2 columns */
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Hero */
    .hero {
        height: 450px;
    }
    .hero h1 {
        font-size: 2.2rem;
    }

    /* Filters - 2 cols */
    .filters-container {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Cart responsive */
    .cart-layout {
        flex-direction: column !important;
    }
    .cart-right {
        width: 100% !important;
        margin-left: 0 !important;
    }

    /* Split container (homepage) */
    .split-container {
        grid-template-columns: 1fr !important;
    }

    /* Section spacing */
    .categories,
    .products,
    .features,
    .testimonials,
    .newsletter {
        padding: 2.5rem 0;
    }

    /* Product card adjustments */
    .product-image {
        height: 190px;
    }

    /* Cart table scrollable */
    .shop-table {
        min-width: 500px;
    }
    .cart-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Testimonials */
    .testimonial-card {
        flex-direction: column !important;
        text-align: center !important;
        padding: 1.5rem !important;
    }
    .testimonial-profile {
        margin-right: 0 !important;
        margin-bottom: 1rem !important;
    }
    .rating {
        justify-content: center !important;
    }

    /* News letter */
    .newsletter-form {
        max-width: 100%;
    }

    /* Footer bottom */
    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    /* Promotional cards */
    .promotional-cards-side {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 12px;
    }
    .promotional-card {
        flex: 1 1 calc(50% - 6px);
        max-width: none !important;
        height: 150px !important;
    }
}

/* ---------- LARGE (max-width: 992px) ---------- */
@media (max-width: 992px) {
    /* Navbar responsive */
    .navbar-links {
        display: none;
    }
    .navbar-search {
        max-width: 250px;
    }
    .menu-toggle {
        display: block !important;
    }

    /* Secondary nav */
    .secondary-nav {
        display: none !important;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Account pages */
    .account-layout {
        flex-direction: column;
    }
    .account-sidebar {
        width: 100%;
        margin-bottom: 1rem;
    }

    /* Tables scrollable */
    .table-responsive-wrap {
        overflow-x: auto;
    }
}

/* ---------- EXTRA LARGE (max-width: 1200px) ---------- */
@media (max-width: 1200px) {
    .container {
        max-width: 100%;
    }
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ---------- MIN-WIDTH BREAKPOINTS ---------- */
@media (min-width: 577px) {
    .mobile-only {
        display: none !important;
    }
    .desktop-only {
        display: block;
    }
}

@media (min-width: 769px) {
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .footer-grid {
        grid-template-columns: 2fr 1fr 1fr 1fr;
    }
    .filters-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 993px) {
    .categories-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .features-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .navbar-search {
        max-width: 400px;
    }
    .hero h1 {
        font-size: 3rem;
    }
}

/* ---------- ADMIN / TABLE FIXES ---------- */
@media (max-width: 768px) {
    .sidebar {
        width: 100% !important;
        height: auto !important;
        position: relative !important;
    }
    .content-wrapper {
        margin-left: 0 !important;
        padding: 15px !important;
    }
    table.dataTable {
        font-size: 0.85rem;
    }
    table.dataTable td,
    table.dataTable th {
        padding: 6px 8px !important;
    }
    div.dataTables_wrapper div.dataTables_filter {
        text-align: left !important;
        width: 100%;
    }
    div.dataTables_wrapper div.dataTables_filter input {
        width: 100% !important;
        max-width: 100% !important;
    }
    div.dataTables_wrapper div.dataTables_length {
        width: 100%;
        text-align: left !important;
        margin-bottom: 10px;
    }
    div.dataTables_wrapper div.dataTables_info {
        text-align: center !important;
        width: 100%;
    }
    div.dataTables_wrapper div.dataTables_paginate {
        text-align: center !important;
        width: 100%;
    }

    /* Admin cards */
    .admin-stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }
    .admin-stat-card {
        padding: 1rem !important;
    }
    .admin-stat-card h3 {
        font-size: 1rem !important;
    }
}

@media (max-width: 576px) {
    .admin-stats-grid {
        grid-template-columns: 1fr !important;
    }
    table.dataTable {
        font-size: 0.8rem;
    }
    .btn-sm {
        padding: 0.25rem 0.4rem;
        font-size: 0.75rem;
    }
}

/* ---------- CHECKOUT RESPONSIVE ---------- */
@media (max-width: 768px) {
    .checkout-layout {
        flex-direction: column !important;
    }
    .checkout-left,
    .checkout-right {
        width: 100% !important;
    }
    .payment-methods {
        flex-direction: column !important;
    }
    .payment-method-card {
        width: 100% !important;
    }
}

/* ---------- DEVIS / CONTACT RESPONSIVE ---------- */
@media (max-width: 768px) {
    .devis-form .row {
        flex-direction: column;
    }
    .devis-form .col-md-6 {
        width: 100%;
    }
    .contact-info-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ---------- PRODUCT DETAIL RESPONSIVE ---------- */
@media (max-width: 768px) {
    .alc-product-main {
        grid-template-columns: 1fr !important;
    }
    .alc-main-image {
        min-height: 280px !important;
    }
}

/* ---------- TRACKING RESPONSIVE ---------- */
@media (max-width: 576px) {
    .tracking-steps {
        flex-direction: column !important;
        gap: 10px !important;
    }
    .tracking-step {
        width: 100% !important;
    }
}

/* ---------- FAVORIS RESPONSIVE ---------- */
@media (max-width: 768px) {
    .wishlist-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }
}

@media (max-width: 576px) {
    .wishlist-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ---------- SUPPORT RESPONSIVE ---------- */
@media (max-width: 768px) {
    .support-float {
        bottom: 15px !important;
        right: 15px !important;
    }
    .support-btn {
        width: 50px !important;
        height: 50px !important;
        font-size: 1.1rem !important;
    }
}

/* ---------- UTILITY ---------- */
.text-center-mobile {
    text-align: center;
}

@media (min-width: 769px) {
    .text-center-mobile {
        text-align: inherit;
    }
}

.overflow-x-auto {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}