:root {
    --primary-bg: #0D1117;
    --card-bg: #161B22;
    --accent-blue: #2078F5; /* Adjusted for a fresher feel */
    --accent-blue-hover: #4090FC; /* Adjusted for a fresher feel */
    --text-primary: #C9D1D9;
    --text-secondary: #8B949E;
    --text-headlines: #F0F6FC;
    --border-color-subtle: #30363D;
    --border-color-darker: #21262D;
    --font-body: 'Manrope', sans-serif;
    --font-headings: 'Outfit', sans-serif;
    --border-radius: 8px;
    --section-padding: 60px 0;
}

nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    padding: 15px 30px; /* Adjusted padding for a more spacious feel */
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(13, 17, 23, 0.8); /* Slightly reduced alpha for a cleaner look */
    -webkit-backdrop-filter: blur(10px);  /* Safari */
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    transition: background 0.3s ease;
}

nav .logo img {
    height: 40px;
    width: auto;
    transition: transform 0.3s ease;
}
nav .logo img:hover {
    transform: scale(1.05);
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.desktop-nav-links {
    display: flex;
    align-items: center;
}

.desktop-nav-links li {
    margin-left: 30px; /* Increased margin for more breathing room */
}

.desktop-nav-links li a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500; /* Slightly lighter weight */
    font-size: 15px;
    font-family: var(--font-headings);
    letter-spacing: 0.5px; /* Added for refinement */
    transition: color 0.3s ease;
    position: relative;
}
.desktop-nav-links li a::after {
    content: '';
    position: absolute;
    bottom: -3px; /* Closer to the text */
    left: 0;
    width: 0;
    height: 2.5px; /* Slightly thicker underline */
    background: var(--accent-blue);
    transition: width 0.3s ease;
}
.desktop-nav-links li a:hover,
.desktop-nav-links li a.active {
    color: var(--accent-blue);
}
.desktop-nav-links li a:hover::after,
.desktop-nav-links li a.active::after {
    width: 100%;
}

/* Dropdown Menu Styles */
.nav-item-dropdown {
    position: relative; /* Establishes positioning context for the dropdown menu */
}

.nav-item-dropdown .dropdown-arrow {
    font-size: 0.7em; /* Smaller arrow */
    margin-left: 4px;
    display: inline-block;
    transition: transform 0.2s ease-in-out;
}

.nav-item-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.nav-item-dropdown .dropdown-menu {
    display: none; /* Hidden by default */
    position: absolute;
    top: 100%; /* Position it right below the parent link */
    left: 0;
    background-color: var(--card-bg, #161B22);
    border: 1px solid var(--border-color-subtle, #30363D);
    border-top: none; /* Optional: if you want the top border to merge or be less prominent */
    border-radius: 0 0 var(--border-radius, 8px) var(--border-radius, 8px); /* Rounded bottom corners */
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 1010; /* Ensure it's above other content but below modals if any */
    min-width: 160px; /* Minimum width for the dropdown */
    padding: 5px 0; /* Padding for the ul itself */
    list-style: none; /* Remove default list styling */
    margin: 0; /* Reset margin */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px); /* Start slightly lower for entry animation */
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.nav-item-dropdown:hover .dropdown-menu {
    display: block; /* Show on hover of the parent li */
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    margin-left: 0 !important; /* Override default li margin from nav ul li */
}

.dropdown-menu li a {
    display: block; /* Make links take full width of li */
    padding: 10px 20px; /* Padding for dropdown links */
    color: var(--text-primary, #C9D1D9);
    text-decoration: none;
    font-size: 14px; /* Slightly smaller font for dropdown items */
    white-space: nowrap; /* Prevent text wrapping */
}

.dropdown-menu li a:hover {
    background-color: var(--accent-blue, #2078F5);
    color: #fff; /* White text on accent color hover */
}

/* Remove the underline pseudo-element for dropdown links */
.dropdown-menu li a::after {
    display: none;
}

.hamburger {
    display: none;
    cursor: pointer;
    z-index: 1002;
}
.hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--text-headlines);
    margin: 5px 0;
    transition: all 0.3s ease;
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 300px;
    min-height: 100vh;
    background: var(--card-bg);
    box-shadow: -5px 0 15px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    z-index: 1001;
    transition: right 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    padding: 80px 20px 20px;
}
.mobile-menu.active { right: 0; }
.mobile-menu ul {
    display: block; /* Ensure vertical stacking of li items */
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
    text-align: left;
}
.mobile-menu ul li { margin-bottom: 20px; }
.mobile-menu ul li a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 500; /* Matched to desktop link style */
    font-family: var(--font-headings);
    letter-spacing: 0.5px; /* Matched to desktop link style */
}
.mobile-menu ul li a:hover { color: var(--accent-blue); }
.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 2rem;
    color: var(--text-headlines);
    cursor: pointer;
}

@media (max-width: 768px) {
    body { padding-top: 60px; }
    nav { padding: 8px 15px; }
    nav .logo img { height: 38px; }
    .desktop-nav-links {
        display: none; /* Hide desktop nav links */
    }
    .hamburger {
        display: block;
    }
    .desktop-search-container { /* Hide desktop search bar on mobile */
        display: none;
    }
    /* Styles for search bar inside mobile menu */
    .mobile-menu .nav-search-container {
        width: 100%;
        padding: 0 10px 15px; /* Add some padding around it */
        margin: 0 0 10px 0; /* Add some margin below it */
    }
    .mobile-menu .nav-search-container .form-control.typeahead.player-search-input {
        font-size: 0.9rem; /* Adjust font size if needed */
        height: auto;
        padding: 0.5rem 0.75rem; /* Adjust padding */
    }
    .mobile-menu .nav-search-container .input-group .input-group-text {
        font-size: 0.9rem; /* Adjust icon/text size if needed */
        padding: 0.5rem 0.75rem;
    }
}

/* --- Navbar Player Search --- */
/* Default styles for desktop search container */
.desktop-search-container {
    flex: 0 0 300px; /* Fixed width to avoid flex shrink on Safari */
    width: 300px;
    max-width: 300px;
    min-width: 180px;
    margin-left: 0.5rem;
    margin-right: 1rem; /* Adjusted default right margin */
}
.nav-search-container .input-group { /* General styles for any nav search input group */
    width: 100%;
}
.nav-search-container .input-group .input-group-text {
    background-color: #161B22;
    border: 1px solid #30363D;
    border-right: none;
    color: #8B949E;
    padding: 0.45rem 0.75rem;
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
    font-size: 0.9rem;
}
.nav-search-container .form-control.typeahead.player-search-input {
    background-color: #161B22;
    border: 1px solid #30363D;
    color: #C9D1D9;
    font-size: 0.9rem;
    height: auto; /* Keep auto or set to match logo if needed, but padding is better */
    padding: 0.7rem 0.75rem; /* Adjusted vertical padding to make input taller */
    line-height: normal; /* Ensure line height doesn't add extra space */
    border-radius: 6px;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box; /* Prevent width expansion from borders/padding */
}
.nav-search-container .form-control.typeahead.player-search-input:focus {
    border-color: #58A6FF;
    background-color: #0D1117;
    box-shadow: 0 0 0 0.2rem rgba(88, 166, 255, 0.25);
}
.nav-search-container .form-control.typeahead.player-search-input::placeholder {
    color: #8B949E;
    opacity: 0.7;
}

/* Typeahead dropdown styling */
.twitter-typeahead {
    width: 100% !important;
    position: relative;
    display: block !important;
    box-sizing: border-box; /* Maintain exact width across browsers */
}
.tt-input { position: relative; z-index: 1; }
.tt-hint { color: #8B949E; z-index: 0; font-size: 1rem; padding: 0.45rem 0.75rem; line-height: 1.5; }
.tt-menu {
    background-color: #1C2128;
    border: 1px solid #388BFD;
    border-top: none;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    top: 100%;
    margin-top: 1px;
    width: 100%;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1050;
}
.tt-suggestion {
    padding: 0.85rem 1.5rem;
    color: #E6EDF3;
    font-size: 1rem;
    cursor: pointer;
    border-bottom: 1px solid #30363D;
    transition: background-color 0.15s ease, color 0.15s ease;
    line-height: 1.4;
}
.tt-suggestion:last-child { border-bottom: none; }
.tt-suggestion:hover,
.tt-suggestion.tt-cursor {
    background-color: #388BFD;
    color: #FFFFFF;
}
.tt-dataset .tt-empty-message,
.tt-dataset .tt-pending-message {
    padding: 0.85rem 1.5rem;
    color: #7D8590;
    font-size: 0.9rem;
    text-align: center;
    font-style: italic;
}