/* ============================================
   Modern Bottom Navigation Bar
   5-Item Balanced Navigation (Kindle/Play Books Style)
   ============================================ */

/* Bottom Navigation Container */
.bottom-nav-modern {
    position: fixed;
    bottom: 2px;
    left: 50%;
    width: 92%;
    max-width: 500px;
    height: 70px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 35px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    z-index: 1000;
    transform: translateX(-50%) translateZ(0);
    -webkit-transform: translateX(-50%) translateZ(0);
    will-change: transform;
    isolation: isolate;
}

/* Hide on desktop */
@media (min-width: 768px) {
    .bottom-nav-modern {
        display: none;
    }
}

/* Navigation Items */
.nav-item-modern {
    display: flex;
    flex: 1;
    /* Enforce equal width */
    max-width: none;
    /* remove limit if needed, or set uniformly */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 0;
    /* Remove horizontal padding since we flex */
    color: #9ca3af;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s ease;
    border-radius: 12px;
    position: relative;
    text-decoration: none;
}

.nav-item-modern i {
    font-size: 22px;
    transition: all 0.2s ease;
}

.nav-item-modern span {
    font-size: 11px;
    letter-spacing: 0.01em;
}

/* Active State */
.nav-item-modern.active {
    color: #1a237e;
    /* Deep Blue */
}

.nav-item-modern.active i {
    transform: scale(1.1);
}

/* Top indicator for active tab */
/* Top indicator removed for pill style */
.nav-item-modern.active::before {
    display: none;
}

/* Hover/Active feedback */
.nav-item-modern:active {
    background: rgba(102, 126, 234, 0.08);
    transform: scale(0.95);
}

/* ============================================
   Floating Action Button (Upload - Center)
   ============================================ */
.nav-fab {
    position: relative;
    padding-top: 0;
}

.nav-fab::before {
    display: none;
    /* Remove top indicator */
}

.fab-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF6B95 0%, #FF867C 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 20px rgba(255, 107, 149, 0.4);
    transform: translateY(-30px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 4px solid rgba(255, 255, 255, 0.2);
}

.fab-button i {
    font-size: 24px;
    color: white;
}

.nav-fab span {
    display: none;
}

/* FAB Hover/Active */
.nav-fab:active .fab-button {
    transform: translateY(-10px) scale(0.95);
    box-shadow: 0 6px 12px rgba(245, 87, 108, 0.4);
}

/* FAB Pulse Animation (optional) */
@keyframes fabPulse {

    0%,
    100% {
        box-shadow: 0 8px 16px rgba(245, 87, 108, 0.35);
    }

    50% {
        box-shadow: 0 8px 20px rgba(245, 87, 108, 0.5);
    }
}

.fab-button {
    animation: none;
}

/* ============================================
   More Menu Overlay
   ============================================ */
.more-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.more-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.more-menu-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 24px 24px 0 0;
    max-height: 70vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.more-menu-overlay.active .more-menu-content {
    transform: translateY(0);
}

.more-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.more-menu-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
}

.close-menu {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f3f4f6;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-menu:hover {
    background: #e5e7eb;
}

.close-menu i {
    font-size: 18px;
    color: #6b7280;
}

.more-menu-items {
    padding: 12px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    color: #2d3748;
    text-decoration: none;
    transition: all 0.2s ease;
}

.menu-item:active {
    background: #f3f4f6;
}

.menu-item i {
    width: 24px;
    font-size: 20px;
    color: #667eea;
}

.menu-item span {
    font-size: 16px;
    font-weight: 500;
}

.menu-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 8px 24px;
}

/* ============================================
   Safe Area Support (iOS/Android)
   ============================================ */
@supports (padding: max(0px)) {
    .bottom-nav-modern {
        padding-bottom: max(0px, env(safe-area-inset-bottom));
        height: calc(64px + env(safe-area-inset-bottom));
    }

    body {
        padding-bottom: calc(64px + env(safe-area-inset-bottom));
    }
}

/* ============================================
   Hide Bottom Nav in Full-Screen PDF Reader
   ============================================ */
body.pdf-fullscreen .bottom-nav-modern {
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 375px) {
    .nav-item-modern {
        min-width: 50px;
        padding: 8px 8px;
    }

    .nav-item-modern i {
        font-size: 20px;
    }

    .nav-item-modern span {
        font-size: 10px;
    }

    .fab-button {
        width: 52px;
        height: 52px;
    }

    .fab-button i {
        font-size: 22px;
    }
}

/* Landscape Mode */
@media (max-width: 767px) and (orientation: landscape) {
    .bottom-nav-modern {
        height: 56px;
    }

    .fab-button {
        width: 48px;
        height: 48px;
        transform: translateY(-8px);
    }

    .fab-button i {
        font-size: 20px;
    }

    .nav-item-modern {
        padding: 6px 10px;
    }

    @supports (padding: max(0px)) {
        .bottom-nav-modern {
            height: calc(56px + env(safe-area-inset-bottom));
        }

        body {
            padding-bottom: calc(56px + env(safe-area-inset-bottom));
        }
    }
}

/* ============================================
   Accessibility
   ============================================ */
.nav-item-modern:focus,
.menu-item:focus {
    outline: 3px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {

    .nav-item-modern,
    .fab-button,
    .more-menu-content {
        transition: none;
    }

    .fab-button {
        animation: none;
    }
}

/* ============================================
   Dark Mode Support (Optional)
   ============================================ */
@media (prefers-color-scheme: dark) {
    .bottom-nav-modern {
        background: #1f2937;
        border-top-color: rgba(255, 255, 255, 0.1);
    }

    .nav-item-modern {
        color: #9ca3af;
    }

    .nav-item-modern.active {
        color: #818cf8;
    }

    .more-menu-content {
        background: #1f2937;
    }

    .more-menu-header {
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }

    .more-menu-header h3 {
        color: white;
    }

    .menu-item {
        color: #e5e7eb;
    }

    .menu-item:active {
        background: #374151;
    }

    .close-menu {
        background: #374151;
    }

    .close-menu:hover {
        background: #4b5563;
    }

    .menu-divider {
        background: rgba(255, 255, 255, 0.1);
    }
}