/* ========================================
   Bottom Navigation Bar - Mobile Only
   ======================================== */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--header-bg);
    backdrop-filter: blur(18px);
    border-top: 1px solid var(--header-border);
    z-index: 999;
    display: none;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.35s ease,
                border-color 0.35s ease;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
}

.bottom-nav::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at center bottom, var(--header-glow-primary), transparent 70%);
    opacity: 0.5;
    z-index: -1;
}

/* Navigation Container */
.bottom-nav__container {
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: 100%;
    max-width: 100%;
    padding: 0 0.5rem;
    gap: 0.25rem;
}

/* Navigation Items */
.bottom-nav__item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 0;
    padding: 0.45rem 0.35rem;
    border-radius: var(--radius-sm);
    color: var(--nav-link-color);
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav__item::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(14, 165, 233, 0.15));
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: -1;
}

.bottom-nav__item:active {
    transform: scale(0.95);
}

/* Icon Wrapper */
.bottom-nav__icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-bottom: 0.15rem;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.bottom-nav__icon i {
    font-size: 1.4rem;
    transition: color 0.25s ease;
}

/* Text Label */
.bottom-nav__text {
    font-size: 0.68rem;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    transition: color 0.25s ease, transform 0.25s ease;
}

/* Active State */
.bottom-nav__item.active {
    color: var(--nav-link-active);
}

.bottom-nav__item.active::before {
    opacity: 1;
}

.bottom-nav__item.active .bottom-nav__icon {
    transform: translateY(-2px);
}

.bottom-nav__item.active .bottom-nav__icon i {
    color: var(--primary-light);
}

.bottom-nav__item.active .bottom-nav__text {
    font-weight: 600;
    transform: scale(1.05);
}

/* Hover State (for devices with pointer) */
@media (hover: hover) {
    .bottom-nav__item:hover {
        color: var(--nav-link-active);
    }

    .bottom-nav__item:hover::before {
        opacity: 0.6;
    }

    .bottom-nav__item:hover .bottom-nav__icon {
        transform: translateY(-2px);
    }

    .bottom-nav__item:hover .bottom-nav__icon i {
        color: var(--primary-light);
    }
}

/* Active Indicator */
.bottom-nav__item::after {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 32px;
    height: 3px;
    border-radius: 0 0 999px 999px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease;
}

.bottom-nav__item.active::after {
    transform: translateX(-50%) scaleX(1);
    opacity: 1;
}

/* Responsive Breakpoints */

/* Show bottom nav on mobile only (up to 880px) */
@media (max-width: 880px) {
    .bottom-nav {
        display: block;
    }

    /* Hide the old mobile hamburger menu */
    .mobile-menu-toggle {
        display: none !important;
    }

    /* Hide the old slide-out mobile nav */
    .mobile-nav,
    .mobile-nav-overlay {
        display: none !important;
    }

    /* Add bottom padding to main content */
    .main-content {
        padding-bottom: calc(var(--bottom-nav-height) + var(--spacing-xl));
    }
}

/* Optimize for smaller screens */
@media (max-width: 480px) {
    .bottom-nav {
        height: 68px;
    }

    .bottom-nav__item {
        padding: 0.4rem 0.25rem;
        border-radius: var(--radius-xs);
    }

    .bottom-nav__icon {
        width: 26px;
        height: 26px;
    }

    .bottom-nav__icon i {
        font-size: 1.3rem;
    }

    .bottom-nav__text {
        font-size: 0.65rem;
    }
}

/* Extra small screens */
@media (max-width: 375px) {
    .bottom-nav {
        height: 66px;
    }

    .bottom-nav__container {
        gap: 0.15rem;
        padding: 0 0.35rem;
    }

    .bottom-nav__item {
        padding: 0.35rem 0.2rem;
    }

    .bottom-nav__icon {
        width: 24px;
        height: 24px;
        margin-bottom: 0.1rem;
    }

    .bottom-nav__icon i {
        font-size: 1.25rem;
    }

    .bottom-nav__text {
        font-size: 0.62rem;
    }
}

/* Very small screens */
@media (max-width: 320px) {
    .bottom-nav {
        height: 64px;
    }

    .bottom-nav__icon i {
        font-size: 1.2rem;
    }

    .bottom-nav__text {
        font-size: 0.6rem;
    }
}

/* Theme-specific adjustments */
[data-theme="light"] .bottom-nav {
    box-shadow: 0 -4px 20px rgba(148, 163, 184, 0.15);
}

[data-theme="dark"] .bottom-nav {
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.35);
}

/* Smooth scroll behavior adjustment for iOS */
@supports (-webkit-touch-callout: none) {
    .bottom-nav {
        padding-bottom: env(safe-area-inset-bottom, 0);
        height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0));
    }
}

/* Hide scroll when bottom nav is visible (prevent double scrollbar) */
@media (max-width: 880px) {
    body {
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
}
