/* Header and Navigation Styles */
header {
    background-color: var(--secondary);
    color: white;
    padding: 0; /* Remove padding from header */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    height: 50px;
}

header h1 {
    color:white;
}

/* --- New Nav Structure Styles --- */
nav {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Pushes left/right to edges */
    width: 100%;
    max-width: 1200px; /* Or your desired max width */
    height: 100%; /* Fill header height */
    margin: 0 auto; /* Center nav within header padding */
    position: relative; /* Needed for absolute positioning of center */
}

.nav-left, .nav-right {
    display: flex;
    align-items: center;
    flex-shrink: 0; /* Don't shrink */
}

.nav-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.nav-logo {
    display: block;
}

.role-badges-inline {
 position: absolute;
 left:100%; /* Position relative to the logo */
 bottom:0; /* Align badge with bottom of logo */
 display: inline-flex;
 gap:5px;
 margin-left:5px; /* Add some space between logo and badges */
}

.nav-logo {
    height: 1.2rem; /* Adjust as needed */
    display: block; /* Prevents extra space below */
}

.nav-left {
    margin-left: 0.6rem;
}

/* Language Selector Styling */
.language-selector {
    position: relative;
    display: inline-block;
}

.current-language {
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
    position: relative;
}

.current-language:hover,
.current-language:focus,
.current-language:focus-within {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Make the current language focusable */
.current-language {
    tabindex: 0;
}

.locale-flag {
    font-size: 1.2rem;
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
    user-select: none; /* Prevent text selection */
}

/* Dropdown Styling */
.language-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--secondary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 140px;
    margin-top: 4px;
    overflow: hidden;
    padding-left:0.5rem;
    padding-bottom:0.25rem;
}

/* Show dropdown on hover, focus, and focus-within (for mobile) */
.language-selector:hover .language-dropdown,
.current-language:focus .language-dropdown,
.current-language:focus-within .language-dropdown,
.language-dropdown:hover {
    display: block;
}

/* Keep dropdown visible when navigating with keyboard or touch */
.language-dropdown:focus-within {
    display: block;
}

.language-option {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    text-decoration: none;
    color: #333;
    gap: 1rem;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.language-option:last-child {
    border-bottom: none;
}

.language-option:hover {
    background-color: #f8f9fa;
    text-decoration: none !important;
    color: #333;
}

.language-option .locale-flag {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.language-name {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
}

/* Responsive adjustments */
@media (max-width: 400px) {
    .language-dropdown {
        right: 0;
        left: auto;
        min-width: 120px;
    }
    
    .language-name {
        font-size: 0.85rem;
    }
    
    .language-option {
        padding: 8px 10px;
        gap: 8px;
    }
}

.nav-right {
    margin-left: auto; /* Push to the far right */
    margin-right: 0.6rem;
    gap:0.8em;

}

/* --- Styling Nav Content --- */

/* Badges in Nav */
.nav-center .role-badges-inline {
    display: flex; /* Already inline-flex, ensure flex properties */
    gap: 5px;
    margin: 0; /* Reset margins */
}

.role-badges-inline .badge:not(:first-child) {
    display: none;
}

.nav-center .badge {
    background-color: var(--secondary);
    color: #eee;
    font-size: 0.7rem;
    padding: 2px 6px;
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.15);
}



/* Links within Nav Right (Login, Register, Logout) */
.nav-left a,
.nav-right a {
    color: white; /* Requirement: white links */
    text-decoration: none;
    padding: 5px 3px; /* Minimal padding */
    margin: 0; /* Reset margin */
    background: none !important; /* Ensure no background */
    border: none !important; /* Ensure no border */
    border-radius: 0 !important; /* Ensure no radius */
    font-size: 0.9em;
    font-weight: 600;
    line-height: normal;
    display: inline-block; /* Keep inline */
    width: auto; /* Auto width */
    margin-bottom: 0; /* Reset margin */
    margin-top: 0.1rem; /* baseline hack */
    white-space: nowrap; /* Prevent wrapping */
}

.nav-left a:hover,
.nav-right a:hover {
    background: none !important;
    text-decoration: none !important;
    color: #ccc !important;
}

/* Hide quick roles if it exists */
nav .quick-roles {
    display: none;
}

/* --- Media Queries for Desktop --- */
@media (min-width: 768px) {
    /* --- Desktop Navigation --- */
    /* Most desktop adjustments are handled by the base nav styles now */

    /* Ensure auth buttons are in a row on desktop (already default flex behavior) */
    .nav-right .auth-buttons {
        flex-direction: row;
    }
}

/* --- Responsive Nav Auth Links --- */
@media (max-width: 400px) {
    /* .nav-right a:not(:first-child) {
        display: none;
    }
    .nav-right .auth-buttons {
        gap: 5px;
    }
    .nav-right a {
        padding: 5px;
    } */

    .nav-right {
        margin-right: 0.2rem;
        gap:0.2em;
    }
}

/* Additional responsiveness for very narrow screens */
/* @media (max-width: 300px) {
    .nav-right .auth-buttons {
        flex-direction: column;
        align-items: flex-end;
    }
    .nav-right .auth-buttons a {
        margin-bottom: 5px;
    }
} */
