/* Header Styles */

.site-header {
    background-color: var(--bg-white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1500;
}

.site-header,
.site-header .container,
.logo,
.site-header h1 {
    transition: padding 0.2s ease, height 0.2s ease, font-size 0.2s ease;
}

.site-header.site-header--compact .container {
    padding: 0.55rem 20px;
}

.site-header.site-header--compact .logo {
    height: 72px;
}

.site-header.site-header--compact h1 {
    font-size: 1.25rem;
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    height: 100px;
    width: auto;
}

.site-header h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin: 0;
    line-height: 1.1;
}

.site-nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 0.55rem;
    flex: 1 1 auto;
    min-width: 0;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 0.1rem;
    align-items: center;
    margin: 0;
    padding: 0;
}

@media (max-width: 1120px) {
    .site-header .container {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 0.75rem;
    }

    .logo-container {
        flex: 1 1 420px;
        min-width: 280px;
    }

    nav {
        flex: 1 1 100%;
        order: 3;
    }

    .site-nav {
        gap: 0.45rem;
    }

    nav ul {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 0.35rem;
    }

    .nav-primary,
    .nav-utility {
        width: 100%;
    }
}

nav a,
.admin-dropdown-toggle {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease, background-color 0.3s ease;
}

nav a:hover,
nav a.active,
.admin-dropdown-toggle:hover,
.admin-dropdown-toggle.active,
.admin-dropdown.open .admin-dropdown-toggle {
    color: var(--primary-color);
    background-color: var(--bg-light);
}

.admin-dropdown {
    position: relative;
}

.nav-primary {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
}

.nav-utility {
    flex: 0 0 auto;
    align-self: center;
    justify-content: center;
    gap: 0.15rem;
    padding-left: 0;
    margin-left: 0;
    border-left: 0;
}

.admin-dropdown-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    gap: 0.4rem;
}

.admin-dropdown-toggle:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.admin-dropdown-toggle .chevron {
    width: 0.45rem;
    height: 0.45rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.admin-dropdown.open .chevron {
    transform: rotate(225deg);
}

.admin-dropdown-menu {
    list-style: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    border-radius: 8px;
    padding: 0.5rem 0;
    min-width: 220px;
    max-width: calc(100vw - 16px);
    display: none;
    z-index: 150;
}

.nav-utility > li > a,
.nav-utility > li > .admin-dropdown-toggle {
    padding: 0.45rem 0.7rem;
    font-size: 0.92rem;
    border-radius: 10px;
}

.nav-utility .user-menu-toggle {
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-dropdown.open .admin-dropdown-menu,
.admin-dropdown:focus-within .admin-dropdown-menu {
    display: block;
}

.admin-dropdown-menu li a {
    display: block;
    text-align: left;
    padding: 0.5rem 1rem;
    border-radius: 0;
}

.admin-dropdown-menu li + li {
    border-top: 1px solid var(--bg-light);
}

.admin-dropdown-menu a:hover,
.admin-dropdown-menu a.active {
    background-color: var(--bg-light);
}

.logo-container a {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Skip link: hidden off-screen by default, visible when focused for keyboard users */
.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
.skip-link:focus,
.skip-link:active {
    position: fixed;
    left: 20px;
    top: 20px;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    background: var(--bg-white);
    color: var(--primary-color);
    padding: 8px 12px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 1100;
}

/* Hamburger Menu */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 5000;
}

.hamburger span {
    width: 30px;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Header Responsive Design */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .logo {
        height: 70px;
    }

    .site-header h1 {
        font-size: 1.2rem;
    }


    .site-header .container {
        position: relative;
    }

    nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 70%;
        max-width: 300px;
        height: 100vh;
        background-color: var(--bg-white);
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
        transition: right 0.3s ease;
        z-index: 2000;
        padding-top: 80px;
    }

    nav.active {
        right: 0;
    }

    nav ul {
        flex-direction: column;
        gap: 0;
        padding: 0;
    }

    nav li {
        width: 100%;
        border-bottom: 1px solid var(--border-color);
    }

    nav a {
        display: block;
        padding: 1.2rem 2rem;
        width: 100%;
        border-radius: 0;
    }

    nav a:hover,
    nav a.active {
        background-color: var(--bg-light);
    }

    .admin-dropdown {
        width: 100%;
    }

    .admin-dropdown-toggle {
        width: 100%;
        justify-content: space-between;
    }

    .admin-dropdown-menu {
        position: static;
        box-shadow: none;
        border: 0;
        border-top: 1px solid var(--border-color);
        border-radius: 0;
    }

    /* Overlay when menu is open */
    body.menu-open::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1400;
        pointer-events: none;
    }
    
    .site-header h1 {
        font-size: 1.2rem;
    }

    .logo {
        height: 50px;
    }
}

@media (max-width: 480px) {
    .site-header h1 {
        font-size: 1rem;
    }

    .logo {
        height: 40px;
    }

    nav {
        width: 80%;
    }
}

/* Visual refresh overrides */
.site-header {
    background: linear-gradient(180deg, #0e2428 0%, #081518 100%);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 42px rgba(3, 12, 12, 0.16);
}

.site-header.site-header--compact {
    background: linear-gradient(180deg, rgba(14, 36, 40, 0.9) 0%, rgba(8, 21, 24, 0.82) 100%);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.site-header .container {
    gap: 1.25rem;
}

.logo-container {
    position: relative;
}

.logo-container a {
    gap: 0.9rem;
}

.logo {
    height: 100px;
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.22));
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
}

.site-header h1 {
    color: #ffffff;
    font-size: 1.4rem;
    letter-spacing: -0.02em;
}

.nav-primary {
    position: relative;
    gap: 0.2rem;
    padding: 0 0 0.4rem;
    border-radius: 0;
    background: transparent;
    border: 0;
    backdrop-filter: none;
}

.nav-utility {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.1rem;
    padding-top: 0.15rem;
    padding-bottom: 0.15rem;
    min-height: 2.5rem;
    flex-wrap: wrap;
}

.nav-utility > li > a,
.nav-utility > li > .admin-dropdown-toggle {
    background: transparent;
    border: 0;
    color: rgba(255, 255, 255, 0.74);
    font-weight: 500;
}

nav a,
.admin-dropdown-toggle {
    color: rgba(255, 255, 255, 0.88);
    border-radius: 12px;
    padding: 0.75rem 1rem;
}

.nav-primary > li > a {
    position: relative;
    padding: 0.72rem 0.95rem 0.9rem;
    border-radius: 12px 12px 0 0;
    color: rgba(255, 255, 255, 0.78);
    font-weight: 600;
    letter-spacing: 0.01em;
}

.nav-primary > li > a::after {
    content: '';
    position: absolute;
    left: 0.95rem;
    right: 0.95rem;
    bottom: 0.35rem;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(239, 201, 119, 0.95), rgba(67, 166, 132, 0.92));
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.22s ease;
}

nav a:hover,
nav a.active,
.admin-dropdown-toggle:hover,
.admin-dropdown-toggle.active,
.admin-dropdown.open .admin-dropdown-toggle {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(239, 201, 119, 0.24), rgba(47, 125, 102, 0.22));
}

.nav-primary > li > a:hover,
.nav-primary > li > a.active {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.nav-primary > li > a:hover::after,
.nav-primary > li > a.active::after {
    transform: scaleX(1);
}

.nav-utility > li > a:hover,
.nav-utility > li > a.active,
.nav-utility > li > .admin-dropdown-toggle:hover,
.nav-utility > li > .admin-dropdown-toggle.active,
.nav-utility .admin-dropdown.open > .admin-dropdown-toggle {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.nav-utility::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0));
}

.admin-dropdown-menu {
    background: rgba(10, 20, 25, 0.96);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
}

.admin-dropdown-menu li + li {
    border-top-color: rgba(255, 255, 255, 0.06);
}

.admin-dropdown-menu li a {
    color: rgba(255, 255, 255, 0.86);
}

.admin-dropdown-menu a:hover,
.admin-dropdown-menu a.active {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.hamburger span {
    background-color: #ffffff;
}

@media (max-width: 1120px) {
    .nav-primary {
        justify-content: flex-start;
    }

    .nav-utility {
        align-self: stretch;
        justify-content: flex-start;
    }

    .nav-utility::before {
        left: 0;
        right: auto;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .site-header .container {
        padding-top: 0.9rem;
        padding-bottom: 0.9rem;
    }

    .logo {
        height: 76px;
    }

    nav {
        background: linear-gradient(180deg, rgba(10, 20, 25, 0.98) 0%, rgba(7, 16, 19, 0.98) 100%);
        box-shadow: -16px 0 44px rgba(0, 0, 0, 0.28);
        padding-top: 88px;
    }

    .site-nav {
        display: block;
        gap: 0;
    }

    nav ul {
        background: transparent;
        border: 0;
        border-radius: 0;
        padding: 0;
        backdrop-filter: none;
        width: 100%;
    }

    nav li {
        border-bottom-color: rgba(255, 255, 255, 0.08);
    }

    nav a,
    .admin-dropdown-toggle {
        color: rgba(255, 255, 255, 0.92);
        border-radius: 0;
    }

    .admin-dropdown-menu {
        background: rgba(255, 255, 255, 0.03);
    }

    .nav-primary,
    .nav-utility {
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    .nav-utility {
        margin-top: 0;
        border-left: 0;
        padding-left: 0;
        align-items: stretch;
    }

    .nav-utility > li > a,
    .nav-utility > li > .admin-dropdown-toggle {
        border: 0;
        font-size: inherit;
        padding: 1.2rem 2rem;
        max-width: none;
        color: rgba(255, 255, 255, 0.92);
    }

    .nav-utility .user-menu-toggle {
        overflow: visible;
        text-overflow: clip;
    }

    .nav-utility::before {
        display: none;
    }
}
