/* ============================================================================
APP SHELL CSS - OPTIMIZED APP-UI VERSION
Fokus: Transformasi Web ke Mobile App UI (MD3 Standards)
Path: /assets/css/05-mobile-app/app-shell.css
Version: 1.3.0 (FIXED: Removed ALL Filter Overlay CSS)
============================================================================ */

/* --- 1. GLOBAL FIX: MEMBERSIHKAN JALUR SCROLL (Sticky-Compatible) --- */
html {
    overflow-x: clip;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    overflow-x: clip;
    background-color: var(--bg-color);
    scrollbar-width: none;
    -ms-overflow-style: none;
}

body::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
}

/* Default: Hide mobile elements on desktop */
.md3-navigation-bar,
.st-mobile-app-header,
.mobile-only {
    display: none !important;
}

/* ============================================================================
2. BOTTOM NAVIGATION BAR (MD3 - APP-LIKE UI)
============================================================================ */
/* A. MOBILE (< 768px) - Show Bottom Nav */
@media (max-width: 767px) {
    .mobile-only {
        display: block !important;
    }
    nav.md3-navigation-bar.mobile-only { 
        display: flex !important; 
    }
    .st-mobile-app-header {
        display: block !important;
    }
    body {
        padding-bottom: 80px !important;
    }

    /* Suppress generic bottom nav on PDP single product pages for dedicated buy bar */
    body[class*="single-st_"] nav.md3-navigation-bar,
    body[class*="single-st_"] .st-pwa-banner {
        display: none !important;
    }
    body[class*="single-st_"] {
        padding-bottom: 0 !important;
    }
}

/* B. DESKTOP & TABLET (>= 768px) - Hide Bottom Nav */
@media (min-width: 768px) {
    .mobile-only {
        display: none !important;
    }
    nav.md3-navigation-bar {
        display: none !important;
    }
    .st-mobile-app-header {
        display: none !important;
    }
    body {
        padding-bottom: 0 !important;
    }
}

/* --- Bottom Nav Styling --- */
.md3-navigation-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background-color: var(--header-bg);
    display: flex;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.05);
    border-top: 1px solid var(--border-color);
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    gap: 4px;
}

.nav-icon-container {
    position: relative;
    width: 64px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-muted);
}

.nav-label {
    font-family: var(--font-body);
    font-size: var(--st-text-xs, 0.75rem);
    font-weight: 500;
    color: var(--text-muted);
    text-transform: var(--btn-text-transform);
}

/* --- 3. STATE AKTIF --- */
.nav-item.active .nav-icon-container {
    background-color: var(--st-brand-50, #FFF1F2);
}

.nav-item.active .material-symbols-outlined {
    color: var(--st-brand-700, #be0038) !important;
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.nav-item.active .nav-label {
    color: var(--st-brand-700, #be0038);
    font-weight: 700;
}

/* --- 4. OVERRIDE KHUSUS SKIN LUXE --- */
.skin-luxe .nav-item.active .nav-icon-container,
.skin-luxury .nav-item.active .nav-icon-container {
    background-color: var(--primary-soft, rgba(197, 168, 128, 0.16));
    border-radius: var(--border-radius, 8px);
}

.skin-luxe .nav-item.active .material-symbols-outlined,
.skin-luxury .nav-item.active .material-symbols-outlined {
    color: var(--accent-color) !important;
}

.skin-luxe .nav-item.active .nav-label,
.skin-luxury .nav-item.active .nav-label {
    color: var(--primary-color);
}

/* ============================================================================
5. MOBILE APP HEADER (Sticky)
============================================================================ */
/* A. MOBILE (< 768px) - Show Mobile Header */
@media (max-width: 767px) {
    .st-site-header.desktop-only,
    .st-topbar.desktop-only {
        display: none !important;
    }
    .st-mobile-app-header {
        display: flex !important;
        align-items: center !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 1000 !important;
        height: 58px !important;
        background: rgba(255, 255, 255, 0.98) !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
        border-bottom: 1px solid var(--st-stone-200, #e7e5e4) !important;
        padding: 0 16px !important;
        box-shadow: 0 2px 10px -2px rgba(17, 24, 39, 0.05) !important;
    }
    .st-mobile-header-container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        width: 100%;
    }
    .st-mobile-logo {
        display: flex;
        align-items: center;
        flex-shrink: 0;
    }
    .st-mobile-logo-link {
        display: flex;
        align-items: center;
        text-decoration: none;
    }
    .st-mobile-logo img {
        height: 36px;
        width: auto;
        display: block;
        filter: contrast(1.08);
        image-rendering: -webkit-optimize-contrast;
    }
    .st-mobile-logo .st-brand-text {
        font-family: var(--font-heading, 'Plus Jakarta Sans', sans-serif);
        font-size: 1.15rem;
        font-weight: 800;
        letter-spacing: -0.02em;
        color: var(--st-charcoal-900, #111827);
        text-transform: uppercase;
    }
    .st-header-fake-search {
        flex: 1;
        min-width: 0;
        height: 38px;
        background: var(--st-surface-subtle, #FAF8F7);
        border: 1px solid var(--st-stone-200, #e7e5e4);
        border-radius: var(--st-radius-full, 9999px);
        display: flex;
        align-items: center;
        padding: 0 10px;
        gap: 6px;
        color: var(--st-charcoal-600, #4b5563);
        cursor: pointer;
        transition: all 0.2s ease;
    }
    .st-header-fake-search:hover,
    .st-header-fake-search:active {
        background: var(--st-surface-card, #ffffff);
        border-color: var(--st-brand-700, #be0038);
    }
    .st-header-fake-search:active {
        transform: scale(0.98);
    }
    .st-mobile-search-icon {
        color: var(--st-brand-700, #be0038);
        width: 15px;
        height: 15px;
        flex-shrink: 0;
    }
    .st-placeholder {
        font-size: 12.5px;
        font-weight: 500;
        color: var(--st-charcoal-500, #6b7280);
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        flex: 1;
        min-width: 0;
        line-height: 1.2;
    }
    /* Mobile Language Switcher Dropdown */
    .st-mobile-app-header .st-lang-dropdown {
        flex-shrink: 0;
    }
    .st-mobile-app-header .st-lang-trigger-btn {
        width: 38px;
        height: 38px;
        border-radius: var(--st-radius-md, 12px);
    }
    .st-mobile-app-header .st-lang-popover {
        top: calc(100% + 8px);
        right: 0;
    }
    .st-mobile-menu-open {
        background: var(--st-surface-subtle, #FAF8F7);
        border: 1px solid var(--st-stone-200, #e7e5e4);
        width: 38px;
        height: 38px;
        border-radius: var(--st-radius-md, 12px);
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--st-charcoal-800, #1f2937);
        cursor: pointer;
        transition: all 0.2s ease;
        flex-shrink: 0;
    }
    .st-mobile-menu-open svg {
        width: 20px;
        height: 20px;
    }
    .st-mobile-menu-open:hover,
    .st-mobile-menu-open:active {
        background: var(--st-brand-50, #fff1f2);
        border-color: var(--st-brand-200, #fecdd3);
        color: var(--st-brand-700, #be0038);
    }
    .st-mobile-menu-open:active {
        transform: scale(0.95);
    }
}

/* B. TABLET & DESKTOP (>= 768px) - Hide Mobile Header */
@media (min-width: 768px) {
    .st-mobile-app-header {
        display: none !important;
    }
}

/* ============================================================================
6. SIDEBAR & OVERLAY (Core Logic) - MOBILE SIDEBAR BLUR KEPT HERE
============================================================================ */
.st-mobile-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 85%;
    max-width: 320px;
    height: 100dvh;
    background: #ffffff;
    z-index: 1200;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s;
    box-shadow: -10px 0 30px rgba(0,0,0,0.1);
    border-radius: 24px 0 0 24px;
    display: flex;
    flex-direction: column; 
    overflow: hidden;
}

.st-mobile-sidebar.active {
    transform: translateX(0);
    visibility: visible;
}

/* --- BAGIAN MENU (SCROLLABLE) --- */
.st-mobile-menu-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
}

/* --- BAGIAN FOOTER SIDEBAR (WA BUTTON) --- */
.st-sidebar-footer {
    margin-top: auto;
    padding: 20px;
    background: #f9f9f9;
    border-top: 1px solid rgba(0,0,0,0.05);
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

/* ✅ MOBILE SIDEBAR OVERLAY - BLUR KEPT (INTENTIONAL DESIGN) */
#body-overlay, .st-body-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#body-overlay.active, .st-body-overlay.active {
    opacity: 1;
    visibility: visible;
    background-color: rgba(255, 255, 255, 0.2); /* Must be semi-transparent */
    backdrop-filter: blur(10px);

}

/* 5. UTILITY */
body.sidebar-open {
    overflow: hidden;
}

.nav-item:active {
    transform: scale(0.92);
}

/* ============================================================================
7. RESPONSIVE ADJUSTMENTS FOR SMALL SCREENS (< 360px)
============================================================================ */
@media (max-width: 360px) {
    .st-placeholder {
        font-size: var(--st-text-xs, 0.75rem);
    }
    .st-header-fake-search {
        padding: 0 8px;
        gap: 6px;
    }
}

/* ============================================================================
8. KATALOG BOTTOM SHEET (SKIN SYNCED)
============================================================================ */
.st-katalog-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-color);
    z-index: 100001;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    transform: translateY(100%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -10px 30px rgba(0,0,0,0.1);
}

@media (min-width: 1024px) {
    .st-katalog-sheet,
    #katalogSheet {
        display: none !important;
    }
}

.st-katalog-sheet.active {
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
}

.st-sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--border-color, rgba(0,0,0,0.1));
    margin: 12px auto;
    border-radius: 2px;
}

/* Header & Title */
.st-sheet-header {
    padding: 10px 20px 15px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    position: relative;
}

.st-sheet-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
}

.st-sheet-title h3 {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--text-color);
    text-transform: var(--btn-text-transform);
}

/* Close Button */
.st-sheet-close {
    margin-left: auto;
    background: var(--bg-light);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    cursor: pointer;
}

.st-sheet-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 20px 40px 20px;
}

/* Menu Grid/List */
.st-katalog-grid {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.st-katalog-grid > li {
    list-style: none !important;
    margin-bottom: 8px !important;
}

.st-katalog-grid > li > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-light);
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--text-color);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 15px;
    border: 1px solid rgba(0,0,0,0.03);
    text-transform: var(--btn-text-transform);
    transition: 0.2s ease;
}

/* Indikator Panah */
.st-katalog-grid .menu-item-has-children > a::after {
    content: 'expand_more';
    font-family: 'Material Symbols Outlined' !important;
    font-size: 20px;
    line-height: 1;
    width: auto !important;
    height: auto !important;
    border: none !important;
    transform: none !important;
    transition: transform 0.3s ease;
}

.st-katalog-grid .menu-item-has-children.is-open > a::after {
    transform: rotate(180deg) !important;
    color: var(--primary-color);
}

.st-katalog-grid .sub-menu .menu-item-has-children > a::after {
    border: none !important;
    transform: none !important;
}

/* Sub-Menu */
.st-katalog-grid .sub-menu {
    list-style: none !important;
    padding: 5px 0 10px 15px !important;
    margin: 0 !important;
    display: none;
    border-left: 2px solid var(--accent-hover);
    margin-left: 20px !important;
}

.st-katalog-grid .menu-item-has-children.is-open > .sub-menu {
    display: block;
}

.st-katalog-grid .sub-menu li a {
    display: block;
    padding: 12px 15px;
    color: var(--text-muted);
    text-decoration: none;
    font-family: var(--font-body);
    font-size: 14px;
}

/* State Aktif */
.st-katalog-grid li a:active {
    background-color: var(--accent-color);
    color: var(--primary-color);
}

/* ============================================================================
9. MOBILE MENU DROPDOWN LOGIC
============================================================================ */
.st-mobile-menu .sub-menu {
    display: none;
    list-style: none;
    padding-left: 15px;
    background: rgba(0,0,0,0.03);
    margin: 5px 0;
    border-left: 2px solid var(--primary-color, #ff4757);
}

.st-mobile-menu .menu-item-has-children.is-open > .sub-menu {
    display: block !important;
}

.menu-item-has-children > a {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-item-has-children.is-open > a i,
.menu-item-has-children.is-open > a span.material-symbols-outlined {
    transform: rotate(180deg);
    transition: transform 0.3s ease;
}

/* Indikator Panah */
.st-mobile-menu .menu-item-has-children > a::after {
    content: '\e5cf';
    font-family: 'Material Symbols Outlined';
    font-size: 18px;
    transition: transform 0.3s;
}

.st-mobile-menu .menu-item-has-children.is-open > a::after {
    transform: rotate(180deg);
}

/* ============================================================================
10. PWA CAROUSEL (FORCE SNAP & NO SCROLLBAR)
============================================================================ */
@media (max-width: 1024px) {
    .st-nav-carousel-wrapper {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important; 
        scroll-snap-type: x mandatory !important;
        -webkit-overflow-scrolling: touch !important; 
        gap: 15px !important;
        padding: 20px 15px !important;
        scrollbar-width: none !important;
    }
    .st-nav-carousel-wrapper::-webkit-scrollbar {
        display: none !important;
        height: 0 !important;
    }
    .st-nav-item {
        flex: 0 0 120px !important; 
        width: 120px !important;
        scroll-snap-align: start !important; 
        scroll-snap-stop: always !important;
    }
}

/* Force hide scrollbar di PWA mode */
@media (display-mode: standalone) {
    .st-nav-carousel-wrapper {
        scrollbar-width: none !important;
    }
    .st-nav-carousel-wrapper::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }
    html {
        scrollbar-width: none;
    }
    html::-webkit-scrollbar {
        display: none;
    }
}

/* ============================================================================
11. SEARCH PAGE STYLING
============================================================================ */
.st-search-page {
    padding-top: 20px;
    min-height: 80vh;
}

.search-results-header {
    padding: 0 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 20px;
}

.st-page-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
    color: var(--text-dark);
}

.st-results-count {
    font-size: 0.9rem;
    color: #888;
    margin-top: 4px;
}

/* ============================================================================
⚠️ IMPORTANT: FILTER OVERLAY CSS ADA DI filter-overlay-container.php
TIDAK ADA CSS FILTER OVERLAY DI FILE INI!
============================================================================ */
/* ============================================================================
12. PWA OFFLINE TOAST & STANDALONE SAFE AREA
============================================================================ */

/* Standalone Header Safe Area for iOS Dynamic Island / Notch */
@media (display-mode: standalone) {
    .st-mobile-app-header {
        padding-top: env(safe-area-inset-top) !important;
        height: calc(58px + env(safe-area-inset-top)) !important;
    }
}

/* Offline Toast Indicator */
.st-pwa-network-toast {
    position: fixed;
    top: calc(10px + env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%) translateY(-150%);
    background: rgba(17, 24, 39, 0.95);
    color: #fff;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 500;
    z-index: 99999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.st-pwa-network-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.st-pwa-network-toast.offline {
    background: rgba(220, 38, 38, 0.95); /* Red for offline */
}

.st-pwa-network-toast.online {
    background: rgba(16, 185, 129, 0.95); /* Green for online */
}

/* ============================================================================
13. PWA MODERN IN-APP UPDATE SNACKBAR (UNICORN GLASSMORPHISM)
============================================================================ */
.st-pwa-update-toast {
    position: fixed;
    bottom: calc(75px + env(safe-area-inset-bottom));
    left: 16px;
    right: 16px;
    max-width: 440px;
    margin: 0 auto;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    z-index: 99998;
    transform: translateY(120%);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    pointer-events: none;
}

.st-pwa-update-toast.show {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.st-pwa-update-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.st-pwa-update-badge {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.st-pwa-update-text strong {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #FFFFFF;
    line-height: 1.25;
}

.st-pwa-update-text span {
    display: block;
    font-size: 11px;
    color: #94A3B8;
    margin-top: 2px;
    line-height: 1.3;
}

.st-pwa-update-btn {
    background: #25D366;
    color: #0F172A;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    padding: 8px 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.st-pwa-update-btn:active {
    transform: scale(0.96);
    background: #1EBE5D;
}

