/**
 * Mobile Bottom Navigation Bar
 * Purpose: Persistent mobile navigation (iOS/Android native feel)
 * Visibility: Only on screens < 768px
 * Version: 1.0.0
 * Created: 2025-10-11
 */

/* ===================================
   MOBILE BOTTOM NAV BASE
   =================================== */

.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #ffffff;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1040;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    padding: 0 4px;
    padding-bottom: env(safe-area-inset-bottom, 0); /* iOS notch support */
}

/* Nav item */
.mobile-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    text-decoration: none;
    color: #6c757d;
    transition: all 0.2s ease;
    font-size: 0.625rem;
    gap: 2px;
    position: relative;
    min-width: 0; /* Allow flex item to shrink */
    padding: 2px 4px;
}

.mobile-bottom-nav .nav-item i {
    font-size: 1.5rem;
    transition: all 0.2s ease;
    flex-shrink: 0; /* Keep icon size consistent */
}

.mobile-bottom-nav .nav-item span {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-align: center;
    line-height: 1.1;
    display: block;
}

/* For very long labels, allow two lines */
.mobile-bottom-nav .nav-item.long-label span {
    white-space: normal;
    line-height: 1;
    max-height: 2.2em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Active state */
.mobile-bottom-nav .nav-item.active {
    color: #0d6efd;
}

.mobile-bottom-nav .nav-item.active i {
    transform: scale(1.1);
}

/* Active indicator (top border) */
.mobile-bottom-nav .nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 3px;
    background: #0d6efd;
    border-radius: 0 0 3px 3px;
}

/* Tap feedback */
.mobile-bottom-nav .nav-item:active {
    background: rgba(0, 0, 0, 0.05);
}

/* ===================================
   MOBILE BACK BUTTON (Floating)
   =================================== */

.mobile-back-btn {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1050;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid #dee2e6;
    border-radius: 20px;
    padding: 8px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    cursor: pointer;
    color: #2c3e50;
    font-weight: 500;
}

.mobile-back-btn i {
    font-size: 1rem;
}

.mobile-back-btn:hover {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.mobile-back-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ===================================
   RESPONSIVE DESIGN FOR DIFFERENT SCREENS
   =================================== */

/* Small screens (320px - 375px) - iPhone SE, etc. */
@media (max-width: 375px) {
    .mobile-bottom-nav .nav-item span {
        font-size: 0.5rem; /* Smaller text */
        line-height: 1;
    }
    
    .mobile-bottom-nav .nav-item i {
        font-size: 1.25rem; /* Smaller icons */
    }
    
    .mobile-bottom-nav .nav-item {
        gap: 1px;
        padding: 1px 2px;
    }
}

/* Medium screens (376px - 414px) - iPhone 12, etc. */
@media (min-width: 376px) and (max-width: 414px) {
    .mobile-bottom-nav .nav-item span {
        font-size: 0.5625rem; /* 9px */
    }
    
    .mobile-bottom-nav .nav-item i {
        font-size: 1.375rem; /* 22px */
    }
}

/* Large screens (415px+) - iPhone Pro Max, etc. */
@media (min-width: 415px) {
    .mobile-bottom-nav .nav-item span {
        font-size: 0.625rem; /* 10px */
    }
    
    .mobile-bottom-nav .nav-item i {
        font-size: 1.5rem; /* 24px */
    }
}

/* ===================================
   BODY PADDING (for fixed bottom nav)
   =================================== */

@media (max-width: 767px) {
    body {
        padding-bottom: 64px; /* Height of bottom nav */
    }
    
    /* Remove padding on full-screen pages (practice questions) */
    body.practice-question-page {
        padding-bottom: 0;
    }
}

/* ===================================
   DARK MODE SUPPORT
   =================================== */

@media (prefers-color-scheme: dark) {
    .mobile-bottom-nav {
        background: #2d2d2d;
        border-top-color: #444;
    }
    
    .mobile-bottom-nav .nav-item {
        color: #adb5bd;
    }
    
    .mobile-bottom-nav .nav-item.active {
        color: #4dabf7;
    }
    
    .mobile-back-btn {
        background: rgba(45, 45, 45, 0.95);
        border-color: #444;
        color: #e0e0e0;
    }
}

/* ===================================
   HIDE ON DESKTOP
   =================================== */

@media (min-width: 768px) {
    .mobile-bottom-nav,
    .mobile-back-btn {
        display: none !important;
    }
}

