/* ============================================================
   MOBILE CORE SUBSYSTEM (Dedicated to < 992px)
   ============================================================ */
@media (max-width: 991px) {
    body {
        padding-top: 75px; /* Space for fixed header */
        padding-bottom: 100px; /* Space for floating bottom nav */
        -webkit-font-smoothing: antialiased;
        overflow-x: clip; /* Replaced hidden with clip to prevent viewport unbinding */
    }
}

/* ── TOP HEADER ── */
.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 75px;
    background: #ffffff;
    box-shadow: 0 1px 8px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    z-index: 1040; /* Above content, below offcanvas */
}
.m-hdr-btn {
    background: transparent;
    border: none;
    color: var(--brand-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-radius: 10px;
    min-width: 50px; /* Expanded for massive thumb reliability */
    min-height: 50px; /* Expanded for massive thumb reliability */
}
.m-hdr-btn:active {
    background: var(--brand-light);
}
.m-hdr-logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
}
.m-hdr-logo img {
    height: 55px; /* Scaled up for modern central focus */
    width: auto;
}
.m-hdr-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}
.m-cart-btn {
    position: relative;
}
.m-cart-badge {
    position: absolute;
    top: 0px;
    right: 0px;
    background: var(--brand-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    height: 16px;
    min-width: 16px;
    border-radius: 99px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    border: 2px solid #fff;
}

/* ── BOTTOM NAV (DARK FLOATING GLASS DOCK) ── */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0; /* STRICT APPLE/ANDROID HARDWARE LOCK - MUST BE 0 */
    left: 0;
    width: 100%;
    /* 65px target height + 15px bottom safety gap = 80px total structural block */
    height: 80px; 
    padding: 0 15px 15px 15px; /* Push nav items to the top 65px */
    background: transparent; /* Container remains totally invisible to hide the layout gap */
    border: none;
    box-shadow: none;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1040;
}

/* The actual glass pill is painted exclusively by the GPU inside the boundary */
.mobile-bottom-nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: 15px;
    right: 15px;
    bottom: 15px; /* This carves the pill shape strictly out of the bottom 15px */
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: -1;
}
.m-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.55); /* Dimmed inactive white */
    text-decoration: none;
    flex: 1;
    height: 100%;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.m-nav-item svg {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
}
.m-nav-item span {
    font-size: 11px;
    font-weight: 600;
}
.m-nav-item.active {
    color: #ffffff; /* Pure white active pop */
    transform: translateY(-3px);
}

/* ── MODERN OFFCANVAS MENU ── */
.mobile-offcanvas {
    width: 320px;
    background-color: #f8fafc;
    border-right: 1px solid var(--brand-border);
}

.modern-offcanvas-header {
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--brand-border);
}

.m-menu-list {
    list-style: none;
    margin: 0;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modern-m-cat-card {
    background: #ffffff;
    border: 1px solid var(--brand-border);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    overflow: hidden;
}

.m-menu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    color: var(--brand-dark);
    font-weight: 700;
    font-size: 15px;
    text-decoration: none;
    min-height: 56px;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    transition: all 0.2s;
}

.m-menu-link:active {
    background-color: #f1f5f9;
}

.m-menu-link.collapsed .chevron-icon {
    transform: rotate(0deg);
}

.m-menu-link:not(.collapsed) {
    color: var(--brand-primary);
}
.m-menu-link:not(.collapsed) .chevron-icon {
    transform: rotate(180deg);
    color: var(--brand-primary);
}

.modern-subcat-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
}

.modern-subcat-item {
    border-bottom: 1px solid #f1f5f9;
}
.modern-subcat-item:last-child {
    border-bottom: none;
}

.modern-subcat-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 14px 24px;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    text-decoration: none;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    min-height: 50px;
}
.modern-subcat-link:not(.collapsed) {
    color: var(--brand-primary);
    background: #f1f5f9;
}
.modern-subcat-link:not(.collapsed) .chevron-icon {
    transform: rotate(180deg);
    color: var(--brand-primary);
}
.modern-subcat-link.collapsed .chevron-icon {
    transform: rotate(0deg);
}

.modern-subsubcat-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background: #f1f5f9;
    border-top: 1px solid #e2e8f0;
}
.modern-subsubcat-link {
    display: block;
    padding: 12px 16px 12px 36px;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    text-decoration: none;
    border-bottom: 1px solid #e2e8f0;
}
.modern-subsubcat-link:last-child {
    border-bottom: none;
}
.modern-subsubcat-link:active {
    color: var(--brand-primary);
}

/* ── NATIVE HORIZONTAL SCROLLER ── */
.m-scroller {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; /* Momentum scrolling on iOS */
    gap: 15px;
    padding: 10px 15px 20px 15px; /* Bottom padding for shadow cutoff */
}
.m-scroller::-webkit-scrollbar {
    display: none; /* Hide scrollbar for native app look */
}
.m-scroller {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.m-scroller-item {
    scroll-snap-align: start;
    flex: 0 0 75%; /* Items take 75% of screen width */
    max-width: 280px;
}

/* Slimmer Mobile Product Card */
.m-product-card {
    background: #fff;
    border: 1px solid var(--brand-border);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.m-product-img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: contain;
    margin-bottom: 10px;
}
.m-product-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-dark);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: auto;
}
.m-product-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--brand-primary);
    margin-top: 10px;
}
