/* ============================================
   Modern Motorsport Navbar
   Premium Redesign for NXRC
   ============================================ */

:root {
    --navbar-height: 80px;
    --navbar-bg: rgba(5, 5, 5, 0.75);
    --navbar-blur: 20px;
    --navbar-border: rgba(255, 255, 255, 0.08);
    --navbar-z-index: 1000;
    --navbar-active-color: var(--color-primary);
    /* Sync with Global */
    --navbar-text-color: rgba(255, 255, 255, 0.85);
}

/* Base Navbar Layout */
.navbar-modern {
    position: sticky;
    top: 0;
    width: 100%;
    height: var(--navbar-height);
    background: var(--navbar-bg);
    backdrop-filter: blur(var(--navbar-blur));
    -webkit-backdrop-filter: blur(var(--navbar-blur));
    border-bottom: 1px solid var(--navbar-border);
    z-index: var(--navbar-z-index);
    transition: all 0.3s ease;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    max-width: 1400px;
    /* Aligns with global container max-width broadly */
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

/* Brand */
.navbar-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    position: relative;
    z-index: 10;
}

.navbar-logo {
    height: 48px;
    /* Slightly larger */
    width: auto;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.1));
}

.navbar-brand:hover .navbar-logo {
    transform: scale(1.08) rotate(-2deg);
    filter: drop-shadow(0 0 12px rgba(230, 0, 0, 0.4));
}

/* Desktop Menu */
.navbar-menu-desktop {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    /* Reduced gap for better fit */
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Navigation Links */
.nav-link {
    color: var(--navbar-text-color);
    font-family: var(--font-heading);
    font-weight: 500;
    text-transform: uppercase;
    font-style: italic;
    letter-spacing: 0.3px;
    font-size: 0.875rem;
    /* Refined size for better fit */
    position: relative;
    padding: 0.5rem 0.75rem;
    /* Optimized padding */
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

/* Hover State - No Background Skew to avoid artifacts */
.nav-link:hover,
.nav-link.active {
    color: white;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

/* Underline Effect - Simplified and Verified */
.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    /* Slightly thicker for racing look */
    background: var(--navbar-active-color);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Smoother easing */
    box-shadow: 0 0 10px var(--navbar-active-color);
    transform: skewX(-20deg);
    /* Skew only the line */
    transform-origin: left;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* Analytics Pill - Special Styling */
.nav-pill-analytics {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 215, 0, 0.05);
    /* Gold tint */
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 50px;
    padding: 6px 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
}

.nav-pill-analytics:hover {
    background: rgba(255, 215, 0, 0.15);
    border-color: #ffd700;
    transform: translateY(-1px);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.2);
}

.pill-icon {
    font-size: 1rem;
    color: #ffd700;
}

.pill-text {
    font-weight: 700;
    color: #ffd700;
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
    font-size: 0.85rem;
    /* Balanced with nav links */
}

/* ============================================
   NAVBAR ACTIONS
   ============================================ */

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    position: relative;
    z-index: 10;
}

.navbar-guest-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* User Dropdown */
.dropdown {
    position: relative;
}

.dropdown-user-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    padding: 4px;
    padding-right: 16px;
    border-radius: 50px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.dropdown-user-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.user-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-primary);
}

.user-name {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

/* Dropdown Menu - Glass */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 15px);
    right: 0;
    min-width: 240px;
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    list-style: none;
    padding: 8px;
    z-index: 1001;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(5px);
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 8px 0;
}

/* Language Switcher */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.lang-switcher a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    padding: 2px 4px;
    transition: color 0.2s;
}

.lang-switcher a.text-white {
    color: white !important;
    font-weight: 700;
}

.lang-switcher a:hover {
    color: white;
}

/* Register Button - Matches Global but smaller */
.navbar-actions .btn-primary {
    font-size: 0.8rem;
    /* Refined size */
    padding: 0.5rem 1rem;
    border-radius: 4px;
    background: linear-gradient(135deg, var(--color-primary) 0%, #a00 100%);
    border: none;
    box-shadow: 0 4px 15px rgba(230, 0, 0, 0.3);
}

.navbar-actions .btn-primary:hover {
    text-transform: uppercase;
}

/* ============================================
   MOBILE DRAWER
   ============================================ */
.navbar-hamburger {
    display: none;
    flex-direction: column;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    margin-left: 10px;
}

.bar {
    width: 24px;
    height: 2px;
    background: white;
    transition: all 0.3s;
}

.mobile-drawer {
    position: fixed;
    top: 0;
    right: 0; /* Align to right */
    width: 320px; /* Standard drawer width */
    max-width: 85%;
    height: 100vh;
    background: rgba(10, 10, 10, 0.85); /* Darker base */
    backdrop-filter: blur(30px) saturate(150%);
    -webkit-backdrop-filter: blur(30px) saturate(150%);
    z-index: 2000; /* Above everything */
    padding: 0; /* Use inner padding */
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    visibility: hidden;
}

.mobile-drawer.open {
    transform: translateX(0);
    visibility: visible;
}

/* Drawer Header with Close */
.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.drawer-logo {
    height: 32px;
    width: auto;
}

.drawer-close {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.drawer-close:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

/* Mobile User Card */
.drawer-user-card {
    padding: 1.5rem;
}

.user-card-inner {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar-wrapper {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid var(--color-primary);
    padding: 2px;
    background: rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
    overflow: hidden;
}

.user-avatar-lg {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.user-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name-main {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email-sub {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Navigation List */
.drawer-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0 1rem;
}

.mobile-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 1rem;
    text-transform: uppercase;
    border-radius: 8px;
    transition: all 0.2s;
}

.icon-fw {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
    background: rgba(230, 0, 0, 0.1);
    color: white;
}

.mobile-nav-link.active {
    border-left: 3px solid var(--color-primary);
    border-radius: 2px 8px 8px 2px;
}

.analytics-premium {
    background: rgba(255, 215, 0, 0.05);
    color: #ffd700 !important;
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.analytics-premium:hover {
    background: rgba(255, 215, 0, 0.1);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.15);
}

.mobile-nav-link.link-secondary {
    font-size: 0.9rem;
    text-transform: none;
    color: rgba(255, 255, 255, 0.45);
}

.logout-item {
    background: rgba(230, 0, 0, 0.05);
    border: 1px solid rgba(230, 0, 0, 0.1);
}

/* Mobile Language Selector (Top of Drawer) */
.lang-selector-mobile-top {
    display: flex;
    gap: 10px;
    padding: 1.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 1rem;
}

.lang-link-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.lang-link-btn.active {
    background: rgba(230, 0, 0, 0.1);
    border-color: var(--color-primary);
    color: white;
    box-shadow: 0 0 15px rgba(230, 0, 0, 0.1);
}

.lang-link-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.drawer-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.2);
    text-align: center;
}

.footer-legal-text {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.2);
    font-family: var(--font-heading);
    letter-spacing: 1px;
}



/* Responsive Breakpoints */
@media (max-width: 992px) {
    .navbar-menu-desktop {
        display: none;
    }

    .navbar-hamburger {
        display: flex;
    }

    /* Hide User Dropdown on Mobile Navbar (Moved to drawer) */
    .dropdown {
        display: none;
    }

    /* Hide Guest Actions on small screens to make room for Menu */
    .navbar-guest-actions {
        display: none;
    }

    .navbar-container {
        padding: 0 1rem;
    }

    .navbar-logo {
        height: 38px; /* Slightly smaller for mobile */
    }

    .lang-switcher {
        display: none !important;
    }
}

@media (min-width: 993px) {
    .mobile-drawer {
        display: none !important;
    }
}