/**
 * Enhanced Mobile Menu Styles
 * Modern, animated mobile navigation with better UX
 */

/* Enhanced Hamburger Button */
.navbar-toggler {
    border: none !important;
    padding: 8px 10px !important;
    background: transparent !important;
    position: relative;
    z-index: 1002;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
}

.navbar-toggler:hover {
    background: rgba(255, 214, 0, 0.1) !important;
    transform: scale(1.05);
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgba(255, 214, 0, 0.3) !important;
    outline: none;
}

/* Custom Hamburger Icon with Animation */
.navbar-toggler-icon {
    width: 24px;
    height: 20px;
    position: relative;
    display: block;
    background-image: none !important;
}

.navbar-toggler-icon::before,
.navbar-toggler-icon::after,
.navbar-toggler-icon span {
    content: '';
    position: absolute;
    width: 100%;
    height: 3px;
    background: var(--primary-yellow);
    border-radius: 3px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    left: 0;
}

.navbar-toggler-icon span {
    top: 50%;
    transform: translateY(-50%);
}

.navbar-toggler-icon::before {
    top: 0;
}

.navbar-toggler-icon::after {
    bottom: 0;
}

/* Animated X when menu is open */
.navbar-toggler[aria-expanded="true"] .navbar-toggler-icon span {
    opacity: 0;
    transform: translateY(-50%) scale(0);
}

.navbar-toggler[aria-expanded="true"] .navbar-toggler-icon::before {
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    background: var(--primary-yellow);
}

.navbar-toggler[aria-expanded="true"] .navbar-toggler-icon::after {
    bottom: 50%;
    transform: translateY(50%) rotate(-45deg);
    background: var(--primary-yellow);
}

/* Hide toggler on desktop */
@media (min-width: 992px) {
    .navbar-toggler {
        display: none !important;
    }
}

/* Removed global hide to allow toggler on mobile */

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Enhanced Mobile Menu */
@media (max-width: 991.98px) {
    .navbar-collapse {
        position: fixed;
        top: 0;
        right: -100%;
        width: min(86vw, 420px);
        height: 100vh;
        background:
            radial-gradient(900px 500px at 10% -10%, rgba(255,214,0,0.1) 0, transparent 60%),
            linear-gradient(180deg, #141414 0%, #1e1e1e 100%);
        box-shadow: -18px 0 36px rgba(0, 0, 0, 0.45);
        padding: 24px 22px 28px 22px;
        margin: 0 !important;
        border-top-left-radius: 16px;
        border-bottom-left-radius: 16px;
        border-left: 1px solid rgba(255,214,0,0.18);
        z-index: 1001;
        overflow-y: auto;
        transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        display: block !important;
    }

    .navbar-collapse.show {
        right: 0;
    }

    /* Make sure brand and toggler align cleanly on mobile header */
    .navbar .container,
    .navbar .container-fluid {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    /* Ensure all menu items and action buttons align to the left */
    .navbar-nav,
    .navbar-nav .nav-item,
    .navbar-nav .nav-link,
    .nav-link-profile {
        text-align: left !important;
        justify-content: flex-start !important;
        align-items: center !important;
    }

    /* Menu Header */
    .navbar-collapse::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 64px;
        background: linear-gradient(180deg, rgba(255, 214, 0, 0.12) 0%, transparent 100%);
        border-bottom: 1px solid rgba(255, 214, 0, 0.2);
        border-top-left-radius: 16px;
    }

    /* Menu Items */
    .navbar-nav {
        padding: 12px 0 0 0;
        margin: 0;
        list-style: none;
        gap: 6px;
        align-items: stretch;
    }

    .navbar-nav .nav-item {
        margin: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        width: 100%;
    }

    .navbar-nav .nav-link {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        padding: 14px 16px;
        color: var(--primary-white);
        font-size: 18px;
        font-weight: 600;
        text-decoration: none;
        transition: all 0.25s ease;
        position: relative;
        margin: 0 !important;
        text-align: left;
        border-radius: 12px;
        width: 100%;
    }

    .navbar-nav .nav-link::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 4px;
        background: var(--primary-yellow);
        transform: scaleY(0);
        transition: transform 0.3s ease;
    }

    .navbar-nav .nav-link:hover,
    .navbar-nav .nav-link.active {
        background: rgba(255, 214, 0, 0.12);
        color: var(--primary-yellow);
        padding-left: 22px !important;
    }

    .navbar-nav .nav-link:hover::before,
    .navbar-nav .nav-link.active::before {
        transform: scaleY(1);
    }

    .navbar-nav .nav-link.active::after {
        display: none;
    }

    /* Profile Item in Navigation List */
    .nav-item-profile {
        margin-top: 16px;
        border-top: 1px dashed rgba(255, 255, 255, 0.12);
        padding-top: 16px;
    }

    .nav-link-profile {
        display: flex !important;
        align-items: center;
        gap: 12px;
        width: 100%;
        background: linear-gradient(135deg, rgba(255, 214, 0, 0.15) 0%, rgba(255, 214, 0, 0.05) 100%);
        border: 2px solid rgba(255, 214, 0, 0.3);
        cursor: pointer;
        text-align: left;
        font-family: inherit;
        font-size: 18px;
        font-weight: 600;
        padding: 14px 18px !important;
        margin: 0 !important;
        border-radius: 50px;
        position: relative;
        overflow: hidden;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 4px 15px rgba(255, 214, 0, 0.2);
        backdrop-filter: blur(10px);
    }

    .nav-link-profile::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: linear-gradient(135deg, var(--primary-yellow) 0%, var(--secondary-yellow) 100%);
        transform: translate(-50%, -50%);
        transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 0;
    }

    .nav-link-profile:hover::before,
    .nav-link-profile.active::before {
        width: 300%;
        height: 300%;
    }

    .nav-link-profile i {
        font-size: 24px;
        color: var(--primary-white);
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
        z-index: 1;
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    }

    .nav-link-profile span {
        color: var(--primary-white);
        font-weight: 600;
        transition: all 0.3s ease;
        position: relative;
        z-index: 1;
        letter-spacing: 0.3px;
    }

    .nav-link-profile:hover,
    .nav-link-profile.active {
        background: linear-gradient(135deg, var(--primary-yellow) 0%, var(--secondary-yellow) 100%);
        border-color: var(--primary-yellow);
        color: var(--primary-black);
        box-shadow: 0 6px 25px rgba(255, 214, 0, 0.5), 0 0 30px rgba(255, 214, 0, 0.3);
        transform: translateY(-2px) scale(1.02);
        padding-left: 18px !important;
    }

    .nav-link-profile:hover i,
    .nav-link-profile.active i {
        transform: scale(1.15) rotate(5deg);
        color: var(--primary-black);
        filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
    }

    .nav-link-profile:hover span,
    .nav-link-profile.active span {
        color: var(--primary-black);
        font-weight: 700;
        letter-spacing: 0.5px;
    }

    /* Profile button when logged in */
    .nav-link-profile.logged-in {
        background: linear-gradient(135deg, rgba(255, 214, 0, 0.25) 0%, rgba(255, 214, 0, 0.15) 100%);
        border-color: rgba(255, 214, 0, 0.5);
        box-shadow: 0 4px 20px rgba(255, 214, 0, 0.3), 0 0 20px rgba(255, 214, 0, 0.2);
        animation: accountPulseMobile 2s ease-in-out infinite;
    }

    @keyframes accountPulseMobile {
        0%, 100% {
            box-shadow: 0 4px 20px rgba(255, 214, 0, 0.3), 0 0 20px rgba(255, 214, 0, 0.2);
        }
        50% {
            box-shadow: 0 6px 30px rgba(255, 214, 0, 0.4), 0 0 30px rgba(255, 214, 0, 0.3);
        }
    }

    .nav-link-profile.logged-in i {
        color: var(--primary-yellow);
    }

    .nav-link-profile.logged-in span {
        color: var(--primary-yellow);
    }

    .nav-link-profile.logged-in:hover {
        background: linear-gradient(135deg, var(--primary-yellow) 0%, var(--secondary-yellow) 100%);
        animation: none;
        box-shadow: 0 8px 35px rgba(255, 214, 0, 0.6), 0 0 40px rgba(255, 214, 0, 0.4);
    }

    /* Ensure profile item is full-width and not pushed to the right in mobile menu */
    .navbar .nav-item-profile {
        margin-left: 0 !important;
        padding-left: 0 !important;
        width: 100%;
    }
    .navbar .nav-link-profile {
        width: 100%;
        justify-content: flex-start;
    }

    /* Optional: container for CTA buttons within the slide-in menu */
    .navbar-actions {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 12px 4px 0 4px;
        width: 100%;
    }
    .navbar-actions .btn {
        /* Keep left alignment, without forcing full width */
        align-self: flex-start;
    }

    /* Close Button */
    .mobile-menu-close {
        position: absolute;
        top: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        background: rgba(255, 255, 255, 0.1);
        border: none;
        border-radius: 50%;
        color: var(--primary-white);
        font-size: 20px;
        cursor: pointer;
        display: none; /* hidden by default */
        align-items: center;
        justify-content: center;
        z-index: 1002;
        transition: all 0.3s ease;
    }

    /* close button removed per new UX */

    .mobile-menu-close:hover {
        background: rgba(255, 214, 0, 0.2);
        color: var(--primary-yellow);
        transform: rotate(90deg);
    }

    /* Stagger Animation for Menu Items */
    .navbar-nav .nav-item {
        opacity: 0;
        transform: translateX(20px);
        animation: slideInRight 0.4s ease forwards;
    }

    .navbar-collapse.show .navbar-nav .nav-item:nth-child(1) {
        animation-delay: 0.1s;
    }

    .navbar-collapse.show .navbar-nav .nav-item:nth-child(2) {
        animation-delay: 0.15s;
    }

    .navbar-collapse.show .navbar-nav .nav-item:nth-child(3) {
        animation-delay: 0.2s;
    }

    .navbar-collapse.show .navbar-nav .nav-item:nth-child(4) {
        animation-delay: 0.25s;
    }

    .navbar-collapse.show .navbar-actions {
        opacity: 0;
        transform: translateY(20px);
        animation: fadeInUp 0.4s ease 0.3s forwards;
    }
}

/* Animations */
@keyframes slideInRight {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Prevent body scroll when menu is open */
body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Smooth scrollbar for mobile menu */
.navbar-collapse::-webkit-scrollbar {
    width: 6px;
}

.navbar-collapse::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.navbar-collapse::-webkit-scrollbar-thumb {
    background: rgba(255, 214, 0, 0.3);
    border-radius: 3px;
}

.navbar-collapse::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 214, 0, 0.5);
}

