/* ==========================================================================
   GZM MOBILE APP NAVIGATION
   Native app-style bottom navigation with gestures
   ========================================================================== */

/* Mobile breakpoint activation */
@media (max-width: 900px) {
    
    /* ======================================================================
       BOTTOM NAVIGATION BAR
       iOS-style tab bar with blur effect
       ====================================================================== */
    .mobile-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: rgba(16, 16, 16, 0.92);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        padding-bottom: env(safe-area-inset-bottom);
        transform: translateZ(0);
        will-change: transform;
    }
    
    .mobile-nav__list {
        list-style: none;
        margin: 0;
        padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
        display: flex;
        align-items: center;
        justify-content: space-around;
        gap: 8px;
        max-width: 500px;
        margin: 0 auto;
    }
    
    .mobile-nav__item {
        flex: 1;
        display: flex;
        justify-content: center;
    }
    
    /* Navigation Link/Button */
    .mobile-nav__link {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 6px 12px;
        min-height: 48px;
        min-width: 64px;
        color: #888;
        text-decoration: none;
        font-size: 11px;
        font-weight: 500;
        letter-spacing: 0.2px;
        border-radius: 12px;
        position: relative;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        -webkit-tap-highlight-color: transparent;
        user-select: none;
    }
    
    .mobile-nav__link:active {
        transform: scale(0.92);
    }
    
    /* Active State */
    .mobile-nav__link.active {
        color: #c94635;
    }
    
    .mobile-nav__link.active::before {
        content: '';
        position: absolute;
        inset: 0;
        background: rgba(201, 70, 53, 0.12);
        border-radius: 12px;
        z-index: -1;
    }
    
    /* Icon Container */
    .mobile-nav__icon-wrapper {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 28px;
    }
    
    .mobile-nav__icon {
        width: 24px;
        height: 24px;
        stroke-width: 1.8;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .mobile-nav__link.active .mobile-nav__icon {
        transform: translateY(-2px);
    }
    
    /* Badge on Nav Item */
    .mobile-nav__badge {
        position: absolute;
        top: -2px;
        right: -4px;
        min-width: 18px;
        height: 18px;
        padding: 0 5px;
        background: #c94635;
        color: white;
        font-size: 10px;
        font-weight: 700;
        border-radius: 9px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 2px solid #101010;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
    
    /* Label */
    .mobile-nav__label {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
        transition: all 0.2s ease;
    }
    
    /* ======================================================================
       BOTTOM SHEET NAVIGATION
       Full screen bottom sheets for extended navigation
       ====================================================================== */
    .mobile-nav-sheet {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0);
        backdrop-filter: blur(0);
        z-index: 2000;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .mobile-nav-sheet.active {
        opacity: 1;
        visibility: visible;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
    }
    
    /* Sheet Panel */
    .mobile-nav-sheet__panel {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(180deg, #1a1a1a 0%, #141414 100%);
        border-radius: 24px 24px 0 0;
        padding: 8px 0 calc(24px + env(safe-area-inset-bottom));
        max-height: 85vh;
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        display: flex;
        flex-direction: column;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
    }
    
    .mobile-nav-sheet.active .mobile-nav-sheet__panel {
        transform: translateY(0);
    }
    
    /* Drag Handle */
    .mobile-nav-sheet__handle {
        width: 40px;
        height: 5px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 3px;
        margin: 8px auto 16px;
        flex-shrink: 0;
    }
    
    /* Sheet Header */
    .mobile-nav-sheet__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 20px 16px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        flex-shrink: 0;
    }
    
    .mobile-nav-sheet__title {
        font-size: 20px;
        font-weight: 700;
        color: #ffffff;
        letter-spacing: -0.3px;
    }
    
    .mobile-nav-sheet__close {
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.05);
        border: none;
        border-radius: 10px;
        color: #888;
        font-size: 13px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    .mobile-nav-sheet__close:active {
        background: rgba(255, 255, 255, 0.1);
        color: #e0e0e0;
        transform: scale(0.92);
    }
    
    /* Sheet Content */
    .mobile-nav-sheet__content {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        flex: 1;
        padding: 8px 16px;
    }
    
    /* Sheet List */
    .mobile-nav-sheet__list {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .mobile-nav-sheet__link {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 16px;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid rgba(255, 255, 255, 0.06);
        border-radius: 12px;
        color: #e0e0e0;
        text-decoration: none;
        font-size: 16px;
        font-weight: 500;
        transition: all 0.2s ease;
        -webkit-tap-highlight-color: transparent;
    }
    
    .mobile-nav-sheet__link:active {
        background: rgba(201, 70, 53, 0.1);
        border-color: rgba(201, 70, 53, 0.3);
        transform: scale(0.98);
    }
    
    .mobile-nav-sheet__link span {
        color: #666;
        font-size: 13px;
        font-weight: 400;
    }
    
    .mobile-nav-sheet__link svg {
        width: 20px;
        height: 20px;
        color: #666;
        flex-shrink: 0;
    }
    
    /* Sheet Section */
    .mobile-nav-sheet__section {
        display: flex;
        justify-content: flex-end;
        margin-bottom: 12px;
        padding: 0 4px;
    }
    
    .mobile-nav-sheet__action {
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: #c94635;
        border-radius: 10px;
        padding: 8px 14px;
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    .mobile-nav-sheet__action:active {
        background: rgba(201, 70, 53, 0.1);
        transform: scale(0.95);
    }
    
    /* Shop List Specific */
    .mobile-nav-sheet__list--shops {
        gap: 10px;
    }
    
    .mobile-nav-sheet__item {
        list-style: none;
    }
    
    .mobile-nav-sheet__shop {
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding: 16px;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid rgba(255, 255, 255, 0.06);
        border-radius: 12px;
        text-decoration: none;
        transition: all 0.2s ease;
        -webkit-tap-highlight-color: transparent;
    }
    
    .mobile-nav-sheet__shop:active {
        background: rgba(201, 70, 53, 0.08);
        border-color: rgba(201, 70, 53, 0.2);
        transform: scale(0.98);
    }
    
    .mobile-nav-sheet__shop-title {
        font-size: 16px;
        font-weight: 600;
        color: #ffffff;
    }
    
    .mobile-nav-sheet__shop-meta {
        font-size: 13px;
        color: #888;
    }
    
    .mobile-nav-sheet__empty {
        color: #666;
        font-size: 14px;
        padding: 24px;
        text-align: center;
    }
    
    /* ======================================================================
       CONTEXTUAL NAVIGATION
       Floating back button for sub-pages
       ====================================================================== */
    .mobile-back-nav {
        position: fixed;
        top: calc(env(safe-area-inset-top) + 12px);
        left: 12px;
        z-index: 999;
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px 16px;
        background: rgba(26, 26, 26, 0.9);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 20px;
        color: #e0e0e0;
        font-size: 15px;
        font-weight: 500;
        text-decoration: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        transition: all 0.2s ease;
        opacity: 0;
        transform: translateX(-20px);
        pointer-events: none;
    }
    
    .mobile-back-nav.visible {
        opacity: 1;
        transform: translateX(0);
        pointer-events: all;
    }
    
    .mobile-back-nav:active {
        transform: scale(0.95);
        background: rgba(201, 70, 53, 0.2);
    }
    
    .mobile-back-nav svg {
        width: 20px;
        height: 20px;
    }
    
    /* ======================================================================
       NAVIGATION TRANSITIONS
       Page transition animations
       ====================================================================== */
    .page-transition-enter {
        animation: pageEnter 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .page-transition-exit {
        animation: pageExit 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    @keyframes pageEnter {
        from {
            opacity: 0;
            transform: translateX(30px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }
    
    @keyframes pageExit {
        from {
            opacity: 1;
            transform: translateX(0);
        }
        to {
            opacity: 0;
            transform: translateX(-30px);
        }
    }
    
    /* ======================================================================
       GESTURE INDICATORS
       Visual feedback for swipe gestures
       ====================================================================== */
    .gesture-indicator {
        position: fixed;
        top: 50%;
        width: 8px;
        height: 60px;
        background: rgba(201, 70, 53, 0.3);
        border-radius: 4px;
        opacity: 0;
        transform: translateY(-50%);
        transition: opacity 0.2s ease;
        pointer-events: none;
        z-index: 100;
    }
    
    .gesture-indicator.left {
        left: 4px;
    }
    
    .gesture-indicator.right {
        right: 4px;
    }
    
    .gesture-indicator.active {
        opacity: 1;
    }
    
    /* ======================================================================
       NAVIGATION LOADING STATE
       ====================================================================== */
    .mobile-nav__loading {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 2px;
        background: linear-gradient(90deg, transparent, #c94635, transparent);
        animation: navLoading 1.5s infinite;
        opacity: 0;
    }
    
    .mobile-nav__loading.active {
        opacity: 1;
    }
    
    @keyframes navLoading {
        0% {
            transform: translateX(-100%);
        }
        100% {
            transform: translateX(100%);
        }
    }
}

/* ==========================================================================
   SMALL PHONES (max-width: 380px)
   Compact navigation
   ========================================================================== */
@media (max-width: 380px) {
    .mobile-nav__list {
        padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
    }
    
    .mobile-nav__link {
        min-width: 56px;
        padding: 4px 8px;
        font-size: 10px;
        gap: 2px;
    }
    
    .mobile-nav__icon {
        width: 22px;
        height: 22px;
    }
    
    .mobile-nav__label {
        font-size: 9px;
    }
}

/* ==========================================================================
   LARGE PHONES (381px - 480px)
   ========================================================================== */
@media (min-width: 381px) and (max-width: 480px) {
    .mobile-nav__link {
        padding: 8px 16px;
    }
    
    .mobile-nav__icon {
        width: 26px;
        height: 26px;
    }
}

/* ==========================================================================
   TABLETS (481px - 900px)
   Wider spacing
   ========================================================================== */
@media (min-width: 481px) and (max-width: 900px) {
    .mobile-nav__list {
        justify-content: center;
        gap: 24px;
    }
    
    .mobile-nav__link {
        flex: 0 0 auto;
        min-width: 80px;
        padding: 8px 20px;
    }
    
    .mobile-nav__icon {
        width: 26px;
        height: 26px;
    }
    
    .mobile-nav__label {
        font-size: 12px;
    }
}

/* ==========================================================================
   LANDSCAPE ORIENTATION
   ========================================================================== */
@media (max-width: 900px) and (orientation: landscape) {
    @media (max-height: 500px) {
        .mobile-nav {
            display: none;
        }
    }
}

/* ==========================================================================
   TOUCH DEVICE OPTIMIZATIONS
   ========================================================================== */
@media (hover: none) and (pointer: coarse) {
    .mobile-nav__link,
    .mobile-nav-sheet__link,
    .mobile-nav-sheet__shop,
    .mobile-nav-sheet__close,
    .mobile-nav-sheet__action {
        cursor: default;
    }
    
    /* Remove hover states on touch devices */
    .mobile-nav__link:hover {
        background: transparent;
    }
    
    .mobile-nav__link.active:hover {
        background: rgba(201, 70, 53, 0.12);
    }
}

/* ==========================================================================
   REDUCED MOTION (Accessibility)
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .mobile-nav-sheet,
    .mobile-nav-sheet__panel,
    .mobile-nav__link,
    .mobile-back-nav {
        transition: none;
    }
    
    .mobile-nav__loading {
        animation: none;
    }
}

/* ==========================================================================
   HIGH CONTRAST MODE
   ========================================================================== */
@media (prefers-contrast: high) {
    .mobile-nav {
        background: #000;
        border-top: 2px solid rgba(255, 255, 255, 0.3);
    }
    
    .mobile-nav__link {
        color: #fff;
    }
    
    .mobile-nav__link.active {
        background: #fff;
        color: #000;
    }
    
    .mobile-nav-sheet__panel {
        background: #000;
        border-top: 2px solid rgba(255, 255, 255, 0.3);
    }
}

/* ==========================================================================
   DARK MODE ENHANCEMENTS
   ========================================================================== */
@media (prefers-color-scheme: dark) {
    @media (max-width: 900px) {
        .mobile-nav {
            background: rgba(10, 10, 10, 0.95);
        }
        
        .mobile-nav-sheet__panel {
            background: linear-gradient(180deg, #0f0f0f 0%, #0a0a0a 100%);
        }
        
        .mobile-nav-sheet__link,
        .mobile-nav-sheet__shop {
            background: rgba(255, 255, 255, 0.02);
        }
    }
}

/* Desktop - Hide mobile navigation */
@media (min-width: 901px) {
    .mobile-nav,
    .mobile-nav-sheet,
    .mobile-back-nav {
        display: none !important;
    }
}
