/**
 * Mobile Bottom Navigation - Improved with 6 items + horizontal scroll
 * Ensures all navigation options fit and are scrollable
 */

/* Bottom Navigation Container */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
    border-top: 2px solid #FFB81C;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1), 0 -1px 4px rgba(255, 184, 28, 0.15);
    z-index: 997;
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding-bottom: env(safe-area-inset-bottom);
    overflow-x: auto; /* Enable horizontal scrolling */
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Hide scrollbar but keep functionality */
.mobile-bottom-nav::-webkit-scrollbar {
    display: none;
}

.mobile-bottom-nav {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

/* Hide on scroll down */
.mobile-bottom-nav.hidden {
    transform: translateY(100%);
}

/* Navigation List - Allow horizontal scroll */
.mobile-bottom-nav ul {
    display: flex;
    justify-content: flex-start; /* Changed from space-around to flex-start for scrolling */
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0 8px; /* Add padding for better scroll experience */
    height: 60px;
    min-width: fit-content; /* Allow ul to be wider than container */
    gap: 4px; /* Add gap between items */
}

.mobile-bottom-nav li {
    flex-shrink: 0; /* Prevent items from shrinking */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Navigation Links */
.mobile-bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 10px; /* Slightly reduced padding for 6 items */
    min-width: 60px; /* Slightly reduced from 64px */
    min-height: 48px;
    text-decoration: none;
    color: rgba(4, 30, 66, 0.6);
    font-size: 10px; /* Slightly smaller font */
    font-weight: 600;
    transition: all 0.2s ease;
    position: relative;
    border-radius: 12px;
    white-space: nowrap; /* Prevent text wrapping */
}

/* Icon Container */
.mobile-bottom-nav .nav-icon {
    width: 22px; /* Slightly smaller icons */
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.mobile-bottom-nav .nav-icon svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* Active State */
.mobile-bottom-nav a.active {
    color: #FFB81C;
    font-weight: 700;
}

.mobile-bottom-nav a.active .nav-icon {
    transform: scale(1.1);
}

.mobile-bottom-nav a.active::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 3px;
    background: linear-gradient(90deg, #FFB81C 0%, #f0a800 100%);
    border-radius: 0 0 3px 3px;
}

/* Hover/Touch State */
.mobile-bottom-nav a:active {
    background: rgba(255, 184, 28, 0.1);
    transform: scale(0.95);
}

/* Label */
.mobile-bottom-nav .nav-label {
    font-size: 9px; /* Slightly smaller */
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

/* Scroll Indicator (subtle hint that more items exist) */
.mobile-bottom-nav::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 30px;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(250, 251, 252, 0.9) 100%);
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.mobile-bottom-nav.scrolled-end::after {
    opacity: 0;
}

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

    /* Add padding to body to prevent content being hidden behind nav */
    body.has-bottom-nav {
        padding-bottom: calc(60px + env(safe-area-inset-bottom));
    }

    /* Adjust for very small screens (< 360px) */
    @media (max-width: 360px) {
        .mobile-bottom-nav {
            height: 56px;
        }

        .mobile-bottom-nav ul {
            height: 56px;
            padding: 0 4px;
        }

        .mobile-bottom-nav a {
            min-width: 54px;
            min-height: 44px;
            padding: 4px 8px;
        }

        .mobile-bottom-nav .nav-icon {
            width: 20px;
            height: 20px;
        }

        .mobile-bottom-nav .nav-icon svg {
            width: 20px;
            height: 20px;
        }

        .mobile-bottom-nav .nav-label {
            font-size: 8px;
        }
    }

    /* Medium screens (361px - 480px) - 6 items should fit but allow scroll */
    @media (min-width: 361px) and (max-width: 480px) {
        .mobile-bottom-nav a {
            min-width: 56px;
            padding: 6px 9px;
        }
    }

    /* Larger mobile screens (481px+) - All 6 items fit nicely */
    @media (min-width: 481px) and (max-width: 1024px) {
        .mobile-bottom-nav ul {
            justify-content: space-around; /* Distribute evenly on larger screens */
            padding: 0 12px;
        }

        .mobile-bottom-nav a {
            min-width: 64px;
            padding: 8px 12px;
        }

        .mobile-bottom-nav .nav-label {
            font-size: 10px;
        }

        /* Hide scroll indicator on larger screens where all items fit */
        .mobile-bottom-nav::after {
            display: none;
        }
    }
}
