/* ============================================
   MOBILE TOP BAR
   ============================================ */

.mobile-top-bar {
    display: none;
}

@media (max-width: 768px) {
    .mobile-top-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        background: #000000;
        border-bottom: 1px solid var(--border-primary);
        padding: 0 var(--spacing-md);
        z-index: var(--z-header);
    }
    
    .mobile-menu-btn {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        color: var(--text-primary);
        cursor: pointer;
    }
    
    .mobile-menu-btn svg {
        width: 24px;
        height: 24px;
    }
    
    .mobile-logo {
        display: flex;
        align-items: center;
        gap: var(--spacing-sm);
        text-decoration: none;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .mobile-logo img {
        width: 32px;
        height: 32px;
    }
    
    .mobile-logo span {
        font-size: 1.125rem;
        font-weight: 700;
        color: var(--text-primary);
        letter-spacing: -0.02em;
    }
    
    .mobile-profile-btn {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: var(--white);
        background-size: cover;
        background-position: center;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--black);
        font-weight: 700;
        font-size: 0.75rem;
        text-decoration: none;
    }
    
    .mobile-login-btn {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        color: var(--text-primary);
        cursor: pointer;
        text-decoration: none;
    }
    
    .mobile-login-btn svg {
        width: 24px;
        height: 24px;
    }
    
    /* Adjust main content for top bar */
    main {
        margin-top: 56px;
    }
}

/* ============================================
   MOBILE BOTTOM TAB BAR (ICON ONLY)
   ============================================ */

/* Mobile tab bar - only visible on mobile */
.mobile-tab-bar {
    display: none;
}

@media (max-width: 768px) {
    .mobile-tab-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(0, 0, 0, 0.75);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding: 0;
        z-index: var(--z-header);
        justify-content: space-around;
        align-items: center;
        height: 60px;
    }
    
    .tab-item {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
        background: transparent;
        border: none;
        color: var(--white);
        text-decoration: none;
        position: relative;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    
    .tab-item svg {
        width: 24px;
        height: 24px;
        stroke-width: 2;
    }
    
    .tab-item.active {
        color: var(--white);
    }
    

    
    /* Notification badge */
    .tab-badge {
        position: absolute;
        top: 10px;
        left: 50%;
        margin-left: 8px;
        background: #F4212E;
        color: var(--white);
        font-size: 0.625rem;
        font-weight: 700;
        padding: 2px 5px;
        border-radius: 10px;
        min-width: 16px;
        height: 16px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Profile avatar in tab */
    .tab-avatar {
        width: 28px;
        height: 28px;
        border-radius: 50%;
        background: var(--white);
        background-size: cover;
        background-position: center;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--black);
        font-weight: 700;
        font-size: 0.75rem;
    }
    
    /* Safe area padding for devices with notches */
    @supports (padding-bottom: env(safe-area-inset-bottom)) {
        .mobile-tab-bar {
            padding-bottom: env(safe-area-inset-bottom);
            height: calc(60px + env(safe-area-inset-bottom));
        }
        
        main {
            padding-bottom: calc(80px + env(safe-area-inset-bottom)) !important;
        }
        
        .toast {
            bottom: calc(100px + env(safe-area-inset-bottom));
        }
    }
    
    /* Adjust main content padding when tab bar is visible */
    main {
        padding-bottom: 80px; /* Increased to account for tab bar + spacing */
    }
    
    /* Hide FAB when keyboard is open (iOS) */
    @media (max-height: 500px) {
        .fab {
            display: none !important;
        }
    }
}

/* Desktop - hide mobile tab bar completely */
@media (min-width: 769px) {
    .mobile-tab-bar {
        display: none !important;
    }
}

/* ============================================
   MOBILE TAB BAR ANIMATIONS
   ============================================ */

@media (max-width: 768px) {
    /* Tap feedback animation */
    @keyframes tabTap {
        0% {
            transform: scale(1);
        }
        50% {
            transform: scale(0.9);
        }
        100% {
            transform: scale(1);
        }
    }
    
    .tab-item:active {
        animation: tabTap 0.2s ease;
    }
    
    /* Badge pulse animation */
    @keyframes badgePulse {
        0%, 100% {
            transform: scale(1);
        }
        50% {
            transform: scale(1.1);
        }
    }
    
    .tab-item .notification-badge {
        animation: badgePulse 2s infinite;
    }
}

/* ============================================
   MOBILE TAB BAR DARK MODE
   ============================================ */

.dark-mode .mobile-tab-bar {
    background: rgba(0, 0, 0, 0.95);
    border-top-color: var(--border-primary);
}

.dark-mode .tab-item {
    color: var(--text-secondary);
}

.dark-mode .tab-item.active {
    color: var(--primary);
}

.dark-mode .tab-item .notification-badge {
    background: var(--primary);
    color: var(--white);
}

.dark-mode .tab-item.active .tab-avatar {
    border-color: var(--primary);
}

/* ============================================
   MOBILE TAB BAR ACCESSIBILITY
   ============================================ */

@media (max-width: 768px) {
    /* High contrast mode support */
    @media (prefers-contrast: high) {
        .mobile-tab-bar {
            border-top-width: 2px;
        }
        
        .tab-item.active {
            font-weight: 700;
        }
        
        .tab-item.active::before {
            height: 4px;
        }
    }
    
    /* Reduced motion support */
    @media (prefers-reduced-motion: reduce) {
        .tab-item,
        .tab-avatar,
        .notification-badge {
            transition: none;
            animation: none;
        }
        
        .tab-item:active {
            transform: none;
            animation: none;
        }
    }
    
    /* Focus styles for keyboard navigation */
    .tab-item:focus-visible {
        outline: 2px solid var(--primary);
        outline-offset: -2px;
        border-radius: var(--radius-sm);
    }
}

/* ============================================
   LANDSCAPE MODE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) and (orientation: landscape) {
    .mobile-tab-bar {
        height: 52px;
        padding: 4px 0;
    }
    
    .tab-item {
        padding: 4px;
        gap: 0;
    }
    
    .tab-item svg {
        width: 22px;
        height: 22px;
    }
    
    .tab-item span {
        font-size: 0.65rem;
    }
    
    .tab-avatar {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
    }
}

/* ============================================
   VERY SMALL SCREENS (< 320px)
   ============================================ */

@media (max-width: 320px) {
    .mobile-tab-bar {
        height: 52px;
    }
    
    .tab-item {
        font-size: 0.65rem;
    }
    
    .tab-item svg {
        width: 20px;
        height: 20px;
    }
    
    .notification-badge {
        font-size: 0.65rem;
        min-width: 14px;
        height: 14px;
        padding: 1px 4px;
    }
}
