/* Responsive Styles for masfiMobiles - Mobile First Approach */

/* Color Theme Variables */
:root {
    --primary-color: #D10024;
    --dark-color: #2B2D42;
    --grey-light: #E4E7ED;
    --grey-medium: #8D99AE;
    --grey-dark: #B9BABC;
}

/* Mobile First - Base Styles (320px and up) */
@media screen and (max-width: 991px) {

    /* Hide Header Cart on Mobile/Tablet */
    #header-cart-dropdown {
        display: none !important;
    }

    /* Show FAB on Mobile/Tablet */
    #fab-cart-toggle {
        display: flex !important;
    }
}

@media screen and (min-width: 992px) {

    /* Hide FAB on Desktop */
    #fab-cart-toggle {
        display: none !important;
    }

    /* Show Header Cart on Desktop */
    #header-cart-dropdown {
        display: inline-block !important;
    }
}

@media screen and (max-width: 767px) {

    /* Global Mobile Fixes */
    * {
        box-sizing: border-box;
    }

    /* Reveal FABs on mobile and Common FAB Styles */
    .fab-btn {
        display: flex !important;
        position: fixed;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background-color: #D10024;
        /* Red Theme */
        border: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
        z-index: 10002;
        /* Top of everything */
        align-items: center;
        justify-content: center;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
        cursor: pointer;
        outline: none;
        text-decoration: none !important;
    }

    .fab-btn:active {
        transform: scale(0.95);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    }

    /* Menu FAB (Right) */
    #fab-menu-toggle {
        bottom: 30px;
        right: 30px;
    }

    /* Cart FAB (Left) */
    #fab-cart-toggle {
        bottom: 30px;
        left: 30px;
    }

    /* Cart Badge */
    .fab-badge {
        position: absolute;
        top: -5px;
        right: -5px;
        background-color: #FFF;
        color: #D10024;
        font-size: 12px;
        font-weight: 700;
        min-width: 22px;
        height: 22px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        border: 2px solid #D10024;
    }

    /* Fixed Navigation Drawer Width */
    #responsive-nav {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        background: #15161D !important;
        height: 100vh !important;
        width: 250px !important;
        max-width: 80vw !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        z-index: 10003 !important;
        /* Higher than FAB */
        padding-top: 60px !important;
        padding-left: 20px !important;
        padding-right: 20px !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1) !important;
        display: block !important;
    }

    #responsive-nav.active {
        transform: translateX(0%) !important;
        width: 250px !important;
    }

    /* Brand Card Mobile Fixes */
    .brand-card {
        padding: 5px !important;
        margin-bottom: 20px !important;
    }

    .brand-card .product-body {
        padding: 10px !important;
    }

    .brand-card .primary-btn {
        width: 100% !important;
        padding: 8px 5px !important;
        font-size: 11px !important;
        white-space: nowrap !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }

    .brand-card .product-name {
        font-size: 16px !important;
        margin-bottom: 8px !important;
    }

    .brand-card p {
        font-size: 12px !important;
        margin-bottom: 10px !important;
    }

    body {
        overflow-x: hidden;
        width: 100%;
    }

    img {
        max-width: 100%;
        height: auto;
    }

    .container {
        padding-left: 15px;
        padding-right: 15px;
        width: 100%;
        overflow: hidden;
        /* Prevent child overflow */
    }

    .row {
        margin-left: -10px;
        margin-right: -10px;
    }

    /* Header Layout */
    #top-header {
        display: none;
        /* Hide top header to save space on mobile */
    }

    #header {
        padding-top: 10px;
        padding-bottom: 10px;
    }

    /* Stack Header Elements */
    #header .row {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    #header .col-md-3,
    #header .col-md-6,
    #header .col-xs-6,
    #header .col-xs-12 {
        width: 100% !important;
        float: none;
        padding: 0 10px;
        display: block;
    }

    /* Logo */
    .header-logo {
        text-align: center;
        margin-bottom: 15px;
        float: none;
    }

    /* Search Bar */
    .header-search {
        padding: 0 !important;
        margin-bottom: 15px !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .header-search form {
        display: flex !important;
        width: 100% !important;
        flex-wrap: wrap;
        /* Allow wrapping if needed, but normally column */
    }

    .header-search .input {
        width: 100% !important;
        margin-bottom: 10px;
        /* Stack button below input */
        border-radius: 40px !important;
    }

    .header-search .search-btn {
        width: 100% !important;
        /* Full width button */
        border-radius: 40px !important;
        display: block;
    }

    /* Account / Cart / Menu */
    .header-ctn {
        float: none;
        width: 100%;
        display: flex;
        justify-content: space-between;
        /* Space out menu and cart */
        padding: 10px 20px;
    }

    .header-ctn>div {
        display: inline-block;
    }

    /* Mobile Menu Toggle */
    .menu-toggle {
        display: inline-block !important;
    }

    /* Product Grid - Force 1 Column */
    .col-xs-6 {
        width: 100% !important;
        /* Force full width */
        max-width: 100% !important;
        flex: 0 0 100%;
    }

    .product-card {
        width: 100% !important;
        margin-bottom: 20px;
    }

    /* Product Images */
    .product-img-container {
        height: auto !important;
        /* Let height adjust or keep fixed? User said consistent spacing */
        min-height: 250px;
        max-height: 300px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #fff;
    }

    .product-img-container img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
        /* Ensure no overflow */
    }

    /* Typography */
    .section-title .title {
        font-size: 20px;
        text-align: center;
    }

    /* Remove horizontal scroll issues */
    .slick-list,
    .slick-track {
        max-width: 100%;
    }

    /* --- Page Specific Mobile Fixes --- */

    /* Pagination */
    .store-pagination {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        width: 100%;
    }

    .store-pagination li {
        margin: 5px 2px;
    }

    /* Cart Page */
    .table-responsive {
        border: 1px solid #E4E7ED;
        margin-bottom: 20px;
    }

    .cart-table .btn {
        width: 100%;
        display: block;
        margin-bottom: 5px;
    }

    /* Cart Buttons Stack */
    form[method="post"]>div[style="margin-top: 20px;"] {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    form[method="post"]>div[style="margin-top: 20px;"] .btn {
        width: 100%;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Auth Pages (Login/Register) */
    .login-form,
    .register-form {
        width: 100%;
        padding: 0;
    }

    .login-form input,
    .register-form input {
        width: 100% !important;
    }

    /* Footer */
    #footer {
        text-align: center;
    }

    .footer-links li {
        text-align: center;
    }

    .footer-links li a {
        display: block;
        padding: 5px 0;
    }
}

/* Desktop - Hide Mobile Menu Toggle */
@media screen and (min-width: 992px) {
    .menu-toggle {
        display: none !important;
    }

    .nav-close-btn {
        display: none !important;
    }

    .nav-overlay {
        display: none !important;
    }

    #responsive-nav {
        position: static !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        background: transparent !important;
        padding-top: 0 !important;
        transform: none !important;
        overflow: visible !important;
    }

    #responsive-nav.active {
        transform: none !important;
    }
}

/* Tablet Styles (768px - 1023px) */
@media screen and (min-width: 768px) and (max-width: 1023px) {

    /* Show menu toggle on tablet */
    /* Show menu toggle on tablet */
    #fab-menu-toggle {
        display: flex !important;
        bottom: 30px;
        right: 30px;
    }

    /* Navigation still needs to be toggleable on tablet */
    #responsive-nav {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        background: #15161D !important;
        height: 100vh !important;
        max-width: 280px !important;
        width: 280px !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        z-index: 10000 !important;
        padding: 100px 20px 40px 20px !important;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        /* Top align items */
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
        /* Right shadow */

        /* Initial State: Hidden to Left */
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1) !important;
        visibility: visible;
        /* Always visible for slide in */
        opacity: 1;
    }

    #responsive-nav.active {
        transform: translateX(0%) !important;
    }

    /* Menu Items */
    .main-nav {
        margin: 0 !important;
        float: none !important;
        padding: 0 !important;
        width: 100%;
        text-align: center;
    }

    .main-nav li {
        display: block !important;
        width: 100% !important;
        float: none !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    .main-nav li:last-child {
        border-bottom: none !important;
    }

    .main-nav li+li {
        margin-left: 0px !important;
    }

    .main-nav li a {
        padding: 20px 0 !important;
        display: block !important;
        font-size: 18px !important;
        font-weight: 700 !important;
        color: #FFF !important;
        text-transform: uppercase;
        text-decoration: none !important;
        transition: all 0.3s ease !important;
        letter-spacing: 1px;
    }

    .main-nav li a:hover,
    .main-nav li.active a {
        background-color: transparent !important;
        color: #D10024 !important;
        padding-left: 10px !important;
    }

    .main-nav li a i,
    .main-nav li a .material-icons {
        margin-right: 15px !important;
        font-size: 24px !important;
        display: inline-block !important;
        vertical-align: middle !important;
        color: #D10024;
    }

    .col-md-3.col-xs-6 {
        width: 50%;
    }

    .modal-dialog {
        max-width: 90%;
    }

    .admin-sidebar {
        width: 200px;
    }

    .admin-content {
        margin-left: 200px;
    }

    /* Header search bar - horizontal layout with proportional sizing */
    /* Override base styles with higher specificity */
    #header .header-search {
        padding: 15px 0 !important;
        width: 100% !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    #header .header-search form,
    #header .header-search .header-search-form {
        position: relative !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        max-width: 100% !important;
        width: 100% !important;
        gap: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    #header .header-search .header-search-inner {
        display: flex !important;
        align-items: center !important;
        flex: 1 !important;
        margin-bottom: 0 !important;
        position: relative !important;
    }

    #header .header-search .header-search-inner .input,
    #header .header-search form .header-search-inner .input,
    #header .header-search #header-search-input {
        width: auto !important;
        flex: 1 !important;
        border-radius: 40px 0 0 40px !important;
        padding: 0 40px 0 15px !important;
        height: 40px !important;
        font-size: 14px !important;
        margin-right: 0 !important;
        box-sizing: border-box !important;
    }

    #header .header-search form .search-btn,
    #header .header-search .search-btn,
    #header .header-search #header-search-submit {
        width: auto !important;
        min-width: 100px !important;
        height: 40px !important;
        padding: 0 20px !important;
        border-radius: 0 40px 40px 0 !important;
        font-size: 14px !important;
        font-weight: 700 !important;
        white-space: nowrap !important;
        background: #D10024 !important;
        color: #FFF !important;
        border: none !important;
        box-sizing: border-box !important;
    }

    #header .header-search form .search-btn .material-icons,
    #header .header-search .search-btn .material-icons {
        font-size: 18px !important;
        margin-right: 5px !important;
    }

    /* Clear button positioning on tablet */
    #header .header-search .header-clear-search,
    #header .header-search #header-clear-search {
        position: absolute !important;
        right: 10px !important;
        z-index: 10 !important;
        padding: 0 8px !important;
        min-height: 40px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: transparent !important;
        border: none !important;
        color: #D10024 !important;
        cursor: pointer !important;
    }

    #header .header-search .header-clear-search .material-icons {
        font-size: 18px !important;
    }

    /* Bootstrap grid override for tablet */
    #header .col-md-6 {
        padding-left: 15px !important;
        padding-right: 15px !important;
        display: flex !important;
        justify-content: center !important;
    }

    #header .col-md-6 .header-search {
        max-width: 100% !important;
        width: 100% !important;
    }
}

/* Large Tablet / Small Laptop (992px - 1023px) */
@media screen and (min-width: 992px) and (max-width: 1023px) {

    /* Header search bar - horizontal layout with proportional sizing */
    #header .header-search {
        padding: 15px 0 !important;
        width: 100% !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    #header .header-search form,
    #header .header-search .header-search-form {
        position: relative !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        max-width: 100% !important;
        width: 100% !important;
        gap: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    #header .header-search .header-search-inner {
        display: flex !important;
        align-items: center !important;
        flex: 1 !important;
        margin-bottom: 0 !important;
        position: relative !important;
    }

    #header .header-search .header-search-inner .input,
    #header .header-search form .header-search-inner .input,
    #header .header-search #header-search-input {
        width: auto !important;
        flex: 1 !important;
        border-radius: 40px 0 0 40px !important;
        padding: 0 40px 0 15px !important;
        height: 40px !important;
        font-size: 14px !important;
        margin-right: 0 !important;
        box-sizing: border-box !important;
    }

    #header .header-search form .search-btn,
    #header .header-search .search-btn,
    #header .header-search #header-search-submit {
        width: auto !important;
        min-width: 100px !important;
        height: 40px !important;
        padding: 0 20px !important;
        border-radius: 0 40px 40px 0 !important;
        font-size: 14px !important;
        font-weight: 700 !important;
        white-space: nowrap !important;
        background: #D10024 !important;
        color: #FFF !important;
        border: none !important;
        box-sizing: border-box !important;
    }

    #header .header-search form .search-btn .material-icons,
    #header .header-search .search-btn .material-icons {
        font-size: 18px !important;
        margin-right: 5px !important;
    }

    #header .header-search .header-clear-search,
    #header .header-search #header-clear-search {
        position: absolute !important;
        right: 10px !important;
        z-index: 10 !important;
        padding: 0 8px !important;
        min-height: 40px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: transparent !important;
        border: none !important;
        color: #D10024 !important;
        cursor: pointer !important;
    }

    #header .header-search .header-clear-search .material-icons {
        font-size: 18px !important;
    }

    /* Bootstrap grid adjustments - ensure col-md-6 doesn't force full width */
    #header .col-md-6 {
        padding-left: 15px !important;
        padding-right: 15px !important;
        display: flex !important;
        justify-content: center !important;
    }

    #header .col-md-6 .header-search {
        max-width: 100% !important;
        width: 100% !important;
    }
}

/* Desktop Styles (≥1024px) */
@media screen and (min-width: 1024px) {

    /* Header search bar - horizontal layout, center-aligned, with max-width */
    /* Use high specificity to override base styles */
    #header .header-search {
        padding: 15px 0 !important;
        width: 100% !important;
        margin: 0 !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    /* Override base form styles with higher specificity */
    #header .header-search form,
    #header .header-search .header-search-form {
        position: relative !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        width: 100% !important;
        max-width: 600px !important;
        /* Limit width on large screens */
        margin: 0 auto !important;
        gap: 0 !important;
        transition: all 0.3s ease;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    /* Override base header-search-inner styles */
    #header .header-search .header-search-inner {
        display: flex !important;
        align-items: center !important;
        flex: 1 !important;
        margin-bottom: 0 !important;
        position: relative !important;
        width: auto !important;
    }

    /* Override base input styles - critical for proper layout */
    #header .header-search .header-search-inner .input,
    #header .header-search form .header-search-inner .input,
    #header .header-search #header-search-input {
        width: auto !important;
        flex: 1 !important;
        border-radius: 40px 0 0 40px !important;
        padding: 0 45px 0 15px !important;
        height: 40px !important;
        font-size: 14px !important;
        margin-right: 0 !important;
        transition: all 0.3s ease;
        box-sizing: border-box !important;
    }

    /* Override base search button styles */
    #header .header-search form .search-btn,
    #header .header-search .search-btn,
    #header .header-search #header-search-submit {
        width: auto !important;
        min-width: 120px !important;
        height: 40px !important;
        padding: 0 25px !important;
        border-radius: 0 40px 40px 0 !important;
        font-size: 14px !important;
        font-weight: 700 !important;
        white-space: nowrap !important;
        background: #D10024 !important;
        color: #FFF !important;
        border: none !important;
        transition: all 0.3s ease;
        box-sizing: border-box !important;
    }

    #header .header-search form .search-btn .material-icons,
    #header .header-search .search-btn .material-icons {
        font-size: 18px !important;
        margin-right: 5px !important;
        vertical-align: middle !important;
    }

    /* Clear button positioning on desktop - inside input */
    #header .header-search .header-clear-search,
    #header .header-search #header-clear-search {
        position: absolute !important;
        right: 10px !important;
        z-index: 10 !important;
        padding: 0 8px !important;
        height: 40px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: transparent !important;
        border: none !important;
        color: #D10024 !important;
        cursor: pointer !important;
        transition: all 0.2s ease;
    }

    #header .header-search .header-clear-search:hover {
        opacity: 0.8 !important;
        transform: scale(1.1);
    }

    #header .header-search .header-clear-search .material-icons {
        font-size: 18px !important;
    }

    /* Ensure proper spacing from logo and cart - Bootstrap grid override */
    #header .row {
        align-items: center !important;
    }

    #header .col-md-6 {
        display: flex !important;
        justify-content: center !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    /* Ensure col-md-6 doesn't force full width */
    #header .col-md-6 {
        display: flex !important;
        justify-content: center !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    #header .col-md-6 .header-search {
        max-width: 100% !important;
        width: 100% !important;
    }
}

/* Small Mobile (480px and below) */
@media screen and (max-width: 480px) {

    /* Header */
    #header {
        padding: 10px 0;
    }

    .header-logo h1 {
        font-size: 20px;
    }

    /* Search bar adjustments for very small screens - override base styles */
    #header .header-search {
        padding: 8px 0 !important;
        margin: 8px 0 12px 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    #header .header-search form,
    #header .header-search .header-search-form {
        width: 100% !important;
        max-width: 100% !important;
    }

    #header .header-search .header-search-inner .input,
    #header .header-search form .header-search-inner .input,
    #header .header-search #header-search-input {
        padding: 10px 38px 10px 12px !important;
        font-size: 16px !important;
        min-height: 44px !important;
        width: 100% !important;
    }

    #header .header-search .header-clear-search,
    #header .header-search #header-clear-search {
        right: 8px !important;
        padding: 0 6px !important;
        min-height: 44px !important;
        min-width: 44px !important;
    }

    #header .header-search .header-clear-search .material-icons {
        font-size: 18px !important;
    }

    #header .header-search form .search-btn,
    #header .header-search .search-btn,
    #header .header-search #header-search-submit {
        padding: 10px 12px !important;
        font-size: 15px !important;
        min-height: 44px !important;
        width: 100% !important;
    }

    /* Bootstrap grid override for small mobile */
    #header .col-md-6 {
        padding-left: 10px !important;
        padding-right: 10px !important;
        width: 100% !important;
    }

    /* Navigation */
    .main-nav {
        padding: 10px 0;
    }

    /* Product Cards */
    .product-card {
        padding: 15px;
        min-height: auto !important;
    }

    .product-card .product-img-container {
        height: 200px !important;
    }

    .product-card .card-img-top {
        height: 100% !important;
    }

    /* Modal */
    .modal-header h5 {
        font-size: 18px;
    }

    .modal-body {
        padding: 20px 15px;
    }

    /* Buttons */
    .btn {
        font-size: 12px;
        padding: 10px 15px;
    }

    /* Icons */
    .material-icons {
        font-size: 18px !important;
    }

    /* Buttons with icons */
    .btn .material-icons,
    .primary-btn .material-icons {
        font-size: 16px !important;
        margin-right: 5px;
    }

    /* Section titles */
    .section-title .title .material-icons {
        font-size: 24px !important;
    }

    /* Breadcrumb icons */
    .breadcrumb-header .material-icons {
        font-size: 18px !important;
    }

    .breadcrumb-tree .material-icons {
        font-size: 14px !important;
    }

    /* Footer */
    .footer-title {
        font-size: 16px;
    }
}

/* Large Mobile (481px - 767px) */
@media screen and (min-width: 481px) and (max-width: 767px) {
    .col-md-3.col-xs-6 {
        width: 50%;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {

    /* Larger touch targets */
    a,
    button,
    .btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    .btn:hover {
        transform: none;
    }
}

/* Landscape Mobile */
@media screen and (max-width: 767px) and (orientation: landscape) {
    .modal-dialog {
        max-width: 80%;
    }

    .admin-sidebar {
        width: 200px;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
    .product-card img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ============================================================
   COMPREHENSIVE RESPONSIVE STYLES FOR ALL COMPONENTS
   ============================================================ */

/* Product Grid Layouts - Enhanced Responsive Behavior */
@media screen and (max-width: 767px) {

    /* Product cards - full width on mobile */
    .col-md-3.col-xs-6,
    .col-md-3 {
        width: 100% !important;
        margin-bottom: 20px !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .product-card {
        width: 100% !important;
        margin: 0 auto !important;
        min-height: auto !important;
    }

    .product-card .product-img-container {
        height: 250px !important;
        max-height: 250px !important;
    }

    .product-card .card-img-top {
        height: 100% !important;
        object-fit: cover !important;
    }

    .product-card .card-body {
        padding: 15px !important;
    }

    .product-card h5 {
        font-size: 16px !important;
        min-height: auto !important;
        max-height: none !important;
        height: auto !important;
    }

    .product-card h4 {
        font-size: 20px !important;
    }

    /* Products row container */
    #products-row {
        margin-left: -10px !important;
        margin-right: -10px !important;
    }
}

/* Tablet - 2 columns */
@media screen and (min-width: 768px) and (max-width: 991px) {
    .col-md-3.col-xs-6 {
        width: 50% !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    .product-card .product-img-container {
        height: 280px !important;
    }
}

/* Product Detail Page - Stack on Mobile */
@media screen and (max-width: 767px) {

    .product-detail-page .col-md-5,
    .product-detail-page .col-md-7,
    #product-main-img,
    .product-details {
        width: 100% !important;
        margin-bottom: 20px !important;
    }

    #product-main-img {
        margin-bottom: 20px !important;
    }

    #product-main-img .product-preview {
        min-height: 300px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    #product-main-img .product-preview img {
        max-width: 100% !important;
        max-height: 400px !important;
        object-fit: contain !important;
    }

    /* Product thumbnails - horizontal scroll on mobile */
    #product-imgs {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        gap: 10px !important;
        padding-bottom: 10px !important;
        margin-bottom: 20px !important;
    }

    #product-imgs .product-preview {
        flex: 0 0 80px !important;
        width: 80px !important;
        height: 80px !important;
    }

    .product-details {
        padding: 15px 0 !important;
    }

    .product-details .product-name {
        font-size: 20px !important;
    }

    .product-details .product-price {
        font-size: 28px !important;
    }

    .add-to-cart {
        margin-bottom: 20px !important;
    }

    .add-to-cart .add-to-cart-btn {
        width: 100% !important;
        margin-bottom: 10px !important;
    }
}

/* Cart Page - Responsive Layout */
@media screen and (max-width: 767px) {

    /* Cart table - horizontal scroll on mobile */
    .cart-page .table-responsive {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        margin-bottom: 20px !important;
    }

    .cart-page table {
        min-width: 600px !important;
        width: 100% !important;
    }

    .cart-page .table th,
    .cart-page .table td {
        padding: 10px 8px !important;
        font-size: 14px !important;
        white-space: nowrap !important;
    }

    .cart-page .table th:first-child,
    .cart-page .table td:first-child {
        padding-left: 10px !important;
    }

    .cart-page .table th:last-child,
    .cart-page .table td:last-child {
        padding-right: 10px !important;
    }

    /* Cart item image */
    .cart-page .table img {
        width: 60px !important;
        height: 60px !important;
        object-fit: cover !important;
    }

    /* Quantity input - touch friendly */
    .cart-page .input-number input[type="number"],
    .cart-page .qty-input {
        width: 60px !important;
        height: 44px !important;
        font-size: 16px !important;
        text-align: center !important;
        padding: 0 !important;
    }

    /* Cart buttons */
    .cart-page .btn {
        min-height: 44px !important;
        padding: 10px 15px !important;
        font-size: 14px !important;
    }

    /* Cart summary */
    .cart-summary {
        margin-top: 20px !important;
        padding: 15px !important;
    }
}

/* Checkout Page - Stack Layout on Mobile */
@media screen and (max-width: 767px) {

    .checkout-page .col-md-6,
    .checkout-page .col-md-5,
    .checkout-page .col-md-7,
    .billing-details,
    .order-details {
        width: 100% !important;
        margin-bottom: 20px !important;
    }

    .order-details {
        border-left: none !important;
        border-right: none !important;
        padding: 20px 15px !important;
        margin-top: 20px !important;
    }

    .order-details:before {
        display: none !important;
    }

    .order-summary .order-col {
        display: block !important;
    }

    .order-summary .order-col>div {
        display: block !important;
        width: 100% !important;
        padding: 8px 0 !important;
    }

    .order-summary .order-col>div:last-child {
        text-align: left !important;
    }

    /* Checkout forms */
    .checkout-page .form-group {
        margin-bottom: 20px !important;
    }

    .checkout-page .input,
    .checkout-page input[type="text"],
    .checkout-page input[type="email"],
    .checkout-page input[type="tel"],
    .checkout-page textarea,
    .checkout-page select {
        width: 100% !important;
        font-size: 16px !important;
        padding: 12px !important;
        min-height: 44px !important;
        box-sizing: border-box !important;
    }

    .checkout-page .order-submit {
        width: 100% !important;
        padding: 15px !important;
        font-size: 16px !important;
        min-height: 50px !important;
    }
}

/* Footer - Stack Columns on Mobile/Tablet */
@media screen and (max-width: 991px) {
    #footer .col-md-3 {
        width: 100% !important;
        margin-bottom: 30px !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    #footer .col-md-3:last-child {
        margin-bottom: 0 !important;
    }

    .footer {
        text-align: center !important;
    }

    .footer-links {
        text-align: center !important;
    }

    .footer-links li {
        margin-bottom: 10px !important;
    }
}

@media screen and (min-width: 768px) and (max-width: 991px) {

    /* Tablet - 2 columns for footer */
    #footer .col-md-3 {
        width: 50% !important;
        float: left !important;
    }

    #footer .col-md-3:nth-child(2n+1) {
        clear: left !important;
    }
}

/* Forms - Responsive Design */
@media screen and (max-width: 767px) {

    /* All form containers */
    .form-container,
    .login-form,
    .register-form,
    .contact-form {
        padding: 15px !important;
    }

    /* Form groups */
    .form-group {
        margin-bottom: 20px !important;
    }

    /* All form inputs */
    .input,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"],
    textarea,
    select,
    .input-select,
    .input-number input {
        width: 100% !important;
        padding: 12px !important;
        font-size: 16px !important;
        /* Prevents zoom on iOS */
        min-height: 44px !important;
        box-sizing: border-box !important;
    }

    textarea.input {
        min-height: 120px !important;
    }

    /* Form labels */
    .form-group label {
        display: block !important;
        margin-bottom: 8px !important;
        font-size: 14px !important;
    }

    /* Form buttons */
    .form-group .btn,
    .form-group .primary-btn,
    form .btn,
    form .primary-btn {
        width: 100% !important;
        min-height: 44px !important;
        padding: 12px 20px !important;
        font-size: 16px !important;
        margin-bottom: 10px !important;
    }

    /* Checkbox and radio inputs */
    .input-checkbox,
    .input-radio {
        margin-bottom: 15px !important;
    }

    .input-checkbox label,
    .input-radio label {
        padding-left: 30px !important;
        font-size: 14px !important;
    }
}

/* Tables - Responsive Design */
@media screen and (max-width: 767px) {

    /* All tables get horizontal scroll */
    .table-responsive {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        margin-bottom: 20px !important;
    }

    table {
        min-width: 600px !important;
        width: 100% !important;
    }

    .table th,
    .table td {
        padding: 10px 8px !important;
        font-size: 14px !important;
    }

    .table th {
        font-size: 12px !important;
        white-space: nowrap !important;
    }

    /* Order history and order details tables */
    .order-history table,
    .order-details table {
        min-width: 700px !important;
    }

    /* Admin tables */
    .admin-content table {
        min-width: 800px !important;
    }
}

/* Breadcrumbs - Mobile Responsive */
@media screen and (max-width: 767px) {
    #breadcrumb {
        padding: 20px 0 !important;
    }

    .breadcrumb-header {
        font-size: 18px !important;
        margin-bottom: 10px !important;
        text-align: center !important;
    }

    .breadcrumb-header .material-icons {
        font-size: 18px !important;
        margin-right: 5px !important;
    }

    .breadcrumb-tree {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        font-size: 12px !important;
    }

    .breadcrumb-tree li {
        margin: 5px 5px !important;
        font-size: 12px !important;
    }

    .breadcrumb-tree li .material-icons {
        font-size: 12px !important;
        margin-right: 3px !important;
    }

    .breadcrumb-tree li+li:before {
        margin: 0 8px !important;
    }
}

/* General Layout Improvements */
@media screen and (max-width: 767px) {

    /* Container padding */
    .container {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

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

    /* Section titles */
    .section-title {
        margin-bottom: 20px !important;
        text-align: center !important;
    }

    .section-title .title {
        font-size: 20px !important;
        text-align: center !important;
    }

    .section-title .title .material-icons {
        font-size: 24px !important;
        margin-right: 8px !important;
    }

    /* Row spacing */
    .row {
        margin-left: -10px !important;
        margin-right: -10px !important;
    }

    .row>[class*="col-"] {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    /* Prevent horizontal scroll */
    body {
        overflow-x: hidden !important;
    }

    html {
        overflow-x: hidden !important;
    }

    * {
        max-width: 100% !important;
    }

    img {
        max-width: 100% !important;
        height: auto !important;
    }
}

/* Admin Pages - Responsive Design - Override ALL Inline Styles */
@media screen and (max-width: 991px) {

    /* Admin Menu Toggle Button - Highest Specificity */
    body .admin-menu-toggle,
    html body .admin-menu-toggle {
        display: block !important;
        position: fixed !important;
        top: 15px !important;
        left: 15px !important;
        z-index: 1002 !important;
        background: #D10024 !important;
        color: white !important;
        border: none !important;
        padding: 12px 15px !important;
        border-radius: 5px !important;
        cursor: pointer !important;
        min-width: 44px !important;
        min-height: 44px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
        transition: all 0.3s ease !important;
    }

    body .admin-menu-toggle:hover,
    html body .admin-menu-toggle:hover {
        background: #b8001f !important;
    }

    body .admin-menu-toggle i,
    html body .admin-menu-toggle i {
        font-size: 24px !important;
    }

    /* Admin Overlay - Highest Specificity */
    body .admin-overlay,
    html body .admin-overlay {
        display: block !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        background-color: rgba(0, 0, 0, 0.5) !important;
        z-index: 998 !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transition: all 0.3s ease !important;
        pointer-events: none !important;
    }

    body .admin-overlay.active,
    html body .admin-overlay.active {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    /* Admin Sidebar - Override ALL inline styles with highest specificity */
    body .admin-sidebar,
    html body .admin-sidebar,
    body #admin-sidebar,
    html body #admin-sidebar {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        height: 100vh !important;
        width: 250px !important;
        max-width: 280px !important;
        background-color: #15161D !important;
        padding-top: 20px !important;
        z-index: 1001 !important;
        transform: translateX(-100%) !important;
        -webkit-transform: translateX(-100%) !important;
        -ms-transform: translateX(-100%) !important;
        transition: transform 0.3s ease !important;
        -webkit-transition: transform 0.3s ease !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    body .admin-sidebar.active,
    html body .admin-sidebar.active,
    body #admin-sidebar.active,
    html body #admin-sidebar.active {
        transform: translateX(0) !important;
        -webkit-transform: translateX(0) !important;
        -ms-transform: translateX(0) !important;
    }

    /* Admin content - Override ALL inline styles */
    body .admin-content,
    html body .admin-content {
        padding: 15px 10px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-top: 70px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        position: relative !important;
        z-index: 1 !important;
    }

    /* Admin tables - responsive wrapper for horizontal scroll */
    body .admin-content .admin-table-responsive,
    html body .admin-content .admin-table-responsive {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        margin-bottom: 15px !important;
    }

    body .admin-content .admin-table-responsive .table,
    html body .admin-content .admin-table-responsive .table {
        min-width: 600px !important;
    }

    /* Admin header - Override inline styles with highest specificity */
    body .admin-header,
    html body .admin-header,
    body div.admin-header,
    html body div.admin-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 15px !important;
        margin-bottom: 20px !important;
        display: flex !important;
    }

    body .admin-header h2,
    html body .admin-header h2 {
        font-size: 20px !important;
        margin-bottom: 10px !important;
        line-height: 1.4 !important;
        word-wrap: break-word !important;
    }

    body .admin-header p,
    html body .admin-header p {
        font-size: 14px !important;
        margin-top: 5px !important;
    }

    /* Admin header with inline flex style - override */
    body .admin-header[style*="flex"],
    html body .admin-header[style*="flex"],
    body div.admin-header[style*="flex"],
    html body div.admin-header[style*="flex"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        justify-content: flex-start !important;
    }

    /* Admin header inner divs */
    body .admin-header>div,
    html body .admin-header>div {
        width: 100% !important;
        margin-bottom: 10px !important;
    }

    body .admin-header>div:last-child,
    html body .admin-header>div:last-child {
        margin-bottom: 0 !important;
    }

    body .admin-header .primary-btn,
    html body .admin-header .primary-btn,
    body .admin-header a.primary-btn,
    body .admin-header a.btn,
    body .admin-header .btn,
    html body .admin-header a.primary-btn,
    html body .admin-header a.btn,
    html body .admin-header .btn {
        width: 100% !important;
        margin-top: 15px !important;
        text-align: center !important;
        padding: 12px 20px !important;
        min-height: 44px !important;
        box-sizing: border-box !important;
        display: block !important;
    }

    /* Admin tables - Override inline styles */
    body .admin-content .table-responsive,
    html body .admin-content .table-responsive {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        margin-bottom: 20px !important;
    }

    body .admin-content table,
    html body .admin-content table,
    body .admin-content .table,
    html body .admin-content .table {
        min-width: 800px !important;
        width: 100% !important;
    }

    body .admin-content table thead th,
    html body .admin-content table thead th,
    body .admin-content .table thead th,
    html body .admin-content .table thead th {
        padding: 10px 8px !important;
        font-size: 12px !important;
        white-space: nowrap !important;
    }

    body .admin-content table tbody td,
    html body .admin-content table tbody td,
    body .admin-content .table tbody td,
    html body .admin-content .table tbody td {
        padding: 10px 8px !important;
        font-size: 14px !important;
    }

    body .admin-content table img,
    html body .admin-content table img {
        width: 40px !important;
        height: 40px !important;
        object-fit: cover !important;
    }

    body .admin-content .btn-sm,
    html body .admin-content .btn-sm {
        padding: 8px 12px !important;
        font-size: 12px !important;
        min-height: 36px !important;
        white-space: nowrap !important;
    }

    /* Admin forms - Override inline styles */
    body .admin-content .form-group,
    html body .admin-content .form-group {
        margin-bottom: 20px !important;
    }

    body .admin-content .input,
    body .admin-content input[type="text"],
    body .admin-content input[type="email"],
    body .admin-content input[type="number"],
    body .admin-content input[type="password"],
    body .admin-content textarea,
    body .admin-content select,
    html body .admin-content .input,
    html body .admin-content input[type="text"],
    html body .admin-content input[type="email"],
    html body .admin-content input[type="number"],
    html body .admin-content input[type="password"],
    html body .admin-content textarea,
    html body .admin-content select {
        width: 100% !important;
        font-size: 16px !important;
        padding: 12px !important;
        min-height: 44px !important;
        box-sizing: border-box !important;
    }

    body .admin-content textarea,
    html body .admin-content textarea {
        min-height: 120px !important;
    }

    /* Admin buttons - Override inline styles */
    body .admin-content .btn,
    body .admin-content .primary-btn,
    html body .admin-content .btn,
    html body .admin-content .primary-btn {
        width: 100% !important;
        margin-bottom: 10px !important;
        min-height: 44px !important;
        padding: 12px 20px !important;
        box-sizing: border-box !important;
    }

    body .admin-content .btn:last-child,
    html body .admin-content .btn:last-child {
        margin-bottom: 0 !important;
    }

    /* Admin stat cards - Override inline styles */
    body .stat-card,
    html body .stat-card {
        width: 100% !important;
        margin-bottom: 15px !important;
        padding: 20px !important;
        box-sizing: border-box !important;
    }

    body .stat-card h3,
    html body .stat-card h3 {
        font-size: 24px !important;
        margin: 10px 0 !important;
    }

    body .stat-card .icon,
    html body .stat-card .icon {
        width: 50px !important;
        height: 50px !important;
        font-size: 20px !important;
    }

    body .stat-card p,
    html body .stat-card p {
        font-size: 13px !important;
    }

    /* Admin panels - Override inline styles */
    body .panel,
    html body .panel {
        margin-bottom: 20px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    body .panel-heading,
    html body .panel-heading {
        padding: 12px 15px !important;
    }

    body .panel-heading h4,
    html body .panel-heading h4 {
        font-size: 16px !important;
        margin: 0 !important;
    }

    body .panel-body,
    html body .panel-body {
        padding: 15px !important;
    }

    /* Admin row and columns */
    body .admin-content .row,
    html body .admin-content .row {
        margin-left: -10px !important;
        margin-right: -10px !important;
    }

    body .admin-content .row>[class*="col-"],
    html body .admin-content .row>[class*="col-"] {
        padding-left: 10px !important;
        padding-right: 10px !important;
        width: 100% !important;
        margin-bottom: 15px !important;
    }

    body .admin-content .col-md-3,
    body .admin-content .col-md-4,
    body .admin-content .col-md-6,
    body .admin-content .col-md-8,
    body .admin-content .col-md-10,
    body .admin-content .col-md-12,
    html body .admin-content .col-md-3,
    html body .admin-content .col-md-4,
    html body .admin-content .col-md-6,
    html body .admin-content .col-md-8,
    html body .admin-content .col-md-10,
    html body .admin-content .col-md-12 {
        width: 100% !important;
        float: none !important;
    }

    /* Admin column offsets - remove on mobile */
    body .admin-content .col-md-offset-1,
    body .admin-content .col-md-offset-2,
    html body .admin-content .col-md-offset-1,
    html body .admin-content .col-md-offset-2 {
        margin-left: 0 !important;
    }

    /* Admin page specific fixes */
    body .admin-content .alert,
    html body .admin-content .alert {
        padding: 12px 15px !important;
        font-size: 14px !important;
        margin-bottom: 15px !important;
    }

    /* Admin action buttons in tables */
    body .admin-content table .btn,
    body .admin-content .table .btn,
    html body .admin-content table .btn,
    html body .admin-content .table .btn {
        width: auto !important;
        min-width: 80px !important;
        margin: 2px !important;
        display: inline-block !important;
    }

    /* Admin form layouts */
    body .admin-content form .row,
    html body .admin-content form .row {
        margin-left: -10px !important;
        margin-right: -10px !important;
    }

    body .admin-content form .row>[class*="col-"],
    html body .admin-content form .row>[class*="col-"] {
        padding-left: 10px !important;
        padding-right: 10px !important;
        width: 100% !important;
        margin-bottom: 15px !important;
    }

    /* Admin file inputs */
    body .admin-content input[type="file"],
    html body .admin-content input[type="file"] {
        width: 100% !important;
        padding: 10px !important;
        font-size: 14px !important;
        min-height: 44px !important;
        box-sizing: border-box !important;
    }

    /* Admin select inputs */
    body .admin-content .input-select,
    body .admin-content select,
    html body .admin-content .input-select,
    html body .admin-content select {
        width: 100% !important;
        padding: 12px !important;
        font-size: 16px !important;
        min-height: 44px !important;
        box-sizing: border-box !important;
    }

    /* Admin textarea */
    body .admin-content textarea.input,
    html body .admin-content textarea.input {
        width: 100% !important;
        min-height: 120px !important;
        padding: 12px !important;
        font-size: 16px !important;
        box-sizing: border-box !important;
    }

    /* Admin form submit buttons */
    body .admin-content form .btn,
    body .admin-content form .primary-btn,
    body .admin-content form button[type="submit"],
    html body .admin-content form .btn,
    html body .admin-content form .primary-btn,
    html body .admin-content form button[type="submit"] {
        width: 100% !important;
        margin-bottom: 10px !important;
        min-height: 44px !important;
        padding: 12px 20px !important;
        box-sizing: border-box !important;
    }

    /* Admin image uploads */
    body .admin-content img,
    html body .admin-content img {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Admin text alignment */
    body .admin-content .text-center,
    html body .admin-content .text-center {
        text-align: center !important;
    }

    body .admin-content .text-left,
    html body .admin-content .text-left {
        text-align: left !important;
    }

    body .admin-content .text-right,
    html body .admin-content .text-right {
        text-align: left !important;
        /* Force left on mobile for readability */
    }
}

/* Desktop - Hide Admin Toggle and Reset Styles */
@media screen and (min-width: 992px) {

    body .admin-menu-toggle,
    html body .admin-menu-toggle {
        display: none !important;
    }

    body .admin-overlay,
    html body .admin-overlay {
        display: none !important;
    }

    body .admin-sidebar,
    html body .admin-sidebar,
    body #admin-sidebar,
    html body #admin-sidebar {
        transform: translateX(0) !important;
        -webkit-transform: translateX(0) !important;
        -ms-transform: translateX(0) !important;
    }

    body .admin-content,
    html body .admin-content {
        margin-left: 250px !important;
        padding: 30px !important;
        padding-top: 30px !important;
        width: calc(100% - 250px) !important;
        position: relative !important;
        z-index: 1 !important;
    }

    /* Reset admin header flex on desktop */
    body .admin-header[style*="flex"],
    html body .admin-header[style*="flex"] {
        flex-direction: row !important;
        align-items: center !important;
    }

    body .admin-header .primary-btn,
    html body .admin-header .primary-btn,
    body .admin-header a.primary-btn,
    html body .admin-header a.primary-btn {
        width: auto !important;
        margin-top: 0 !important;
    }

    /* Reset column widths on desktop */
    body .admin-content .col-md-3,
    html body .admin-content .col-md-3 {
        width: 25% !important;
    }

    body .admin-content .col-md-4,
    html body .admin-content .col-md-4 {
        width: 33.333333% !important;
    }

    body .admin-content .col-md-6,
    html body .admin-content .col-md-6 {
        width: 50% !important;
    }

    body .admin-content .col-md-12,
    html body .admin-content .col-md-12 {
        width: 100% !important;
    }

    /* Reset admin column offsets on desktop */
    body .admin-content .col-md-offset-1,
    html body .admin-content .col-md-offset-1 {
        margin-left: 8.33333333% !important;
    }

    body .admin-content .col-md-offset-2,
    html body .admin-content .col-md-offset-2 {
        margin-left: 16.66666667% !important;
    }

    body .admin-content .col-md-8,
    html body .admin-content .col-md-8 {
        width: 66.66666667% !important;
    }

    body .admin-content .col-md-10,
    html body .admin-content .col-md-10 {
        width: 83.33333333% !important;
    }
}

/* Tablet Enhancements */
@media screen and (min-width: 768px) and (max-width: 991px) {

    /* Product cards - 2 columns */
    .col-md-3.col-xs-6 {
        width: 50% !important;
    }

    /* Container padding */
    .container {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    /* Section titles */
    .section-title .title {
        font-size: 24px !important;
    }
}

/* Desktop Enhancements */
@media screen and (min-width: 1024px) {

    /* Ensure proper max-widths */
    .container {
        max-width: 1200px !important;
    }

    /* Product cards - 4 columns */
    .col-md-3 {
        width: 25% !important;
    }
}

/* Print Styles */
@media print {

    .header,
    .navigation,
    .footer,
    .btn,
    .primary-btn,
    .admin-sidebar {
        display: none !important;
    }

    .admin-content {
        margin-left: 0 !important;
    }
}

/* =========================================
   Extracted from index.php & Mobile Fixes
   ========================================= */

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Fix product card alignment issues - Flexbox Grid */
#products-row {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
}

/* Explicitly target columns to ensure flex behavior */
#products-row>[class*='col-'] {
    display: flex;
    flex-direction: column;
}

#products-row .product-card {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
}

#products-row .product-card .card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
}

#products-row .product-card h5 {
    height: 50px;
    max-height: 50px;
    overflow: hidden;
}

/* Mobile Layout Override */
@media screen and (max-width: 767px) {

    /* Force 2 columns per row on mobile, overriding any previous 100% width rules */
    .col-md-3.col-xs-6 {
        width: 50% !important;
    }
}