/**
 * Header Styles for BestPublicHealth Theme
 * Professional Academic Header - Oxford Blue & Teal
 */

/* Header Container */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--color-primary, #002147);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    color: var(--white, #ffffff);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
    gap: 1.5rem;
}

/* Logo Styling */
.site-branding {
    flex-shrink: 0;
}

.text-logo .logo-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    font-size: 1.8rem;
    line-height: 1;
    font-weight: normal;
    transition: transform 0.3s ease;
    font-family: var(--font-heading, 'Merriweather', serif);
}

.text-logo .logo-link:hover {
    transform: translateY(-1px);
}

.logo-best {
    font-weight: 800;
    color: var(--white, #ffffff);
    letter-spacing: -0.02em;
}

.logo-publichealth {
    font-style: italic;
    color: var(--color-secondary, #008080);
    /* Teal */
    font-weight: 500;
    letter-spacing: -0.01em;
}

.custom-logo img {
    max-height: 50px;
    width: auto;
    transition: transform 0.3s ease;
}

.custom-logo:hover img {
    transform: scale(1.05);
}

/* Desktop Navigation */
.main-navigation.desktop-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

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

.nav-menu li {
    position: relative;
}

.nav-menu a {
    display: block;
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: var(--radius-md, 6px);
    transition: all 0.3s ease;
    position: relative;
    font-family: var(--font-body, 'Inter', sans-serif);
}

.nav-menu a:hover,
.nav-menu .current-menu-item>a,
.nav-menu .current_page_item>a {
    color: var(--white, #ffffff);
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

/* Dropdown Menus */
.nav-menu .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--white, #ffffff);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-md, 6px);
    padding: 0.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    min-width: 220px;
    z-index: 100;
}

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

.nav-menu .sub-menu a {
    padding: 0.75rem 1rem;
    color: var(--color-text-main, #333333);
    font-size: 0.9rem;
    border-radius: 4px;
}

.nav-menu .sub-menu a:hover {
    color: var(--color-primary, #002147);
    background: rgba(0, 33, 71, 0.05);
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

/* Search Toggle Button */
.search-toggle-btn {
    background: none;
    border: none;
    padding: 0.75rem;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.search-toggle-btn:hover {
    color: var(--color-secondary, #008080);
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.search-toggle-btn .close-icon {
    display: none;
}

.search-toggle-btn.active .search-icon {
    display: none;
}

.search-toggle-btn.active .close-icon {
    display: block;
}

/* Header Search Form */
.header-search-form {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white, #ffffff);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding: 2rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    transition: all 0.4s ease;
    z-index: 999;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.header-search-form.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-form-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
}

.header-search-form-inner {
    display: flex;
    background: var(--white, #ffffff);
    border: 2px solid var(--color-primary, #002147);
    border-radius: var(--radius-md, 6px);
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.header-search-form-inner:focus-within {
    border-color: var(--color-secondary, #008080);
    box-shadow: 0 0 0 4px rgba(0, 128, 128, 0.1);
}

.header-search-form-inner .search-field {
    flex: 1;
    border: none;
    padding: 1.25rem 1.5rem;
    font-size: 1.1rem;
    background: transparent;
    outline: none;
    color: var(--color-text-main, #333333);
}

.header-search-form-inner .search-submit {
    background: var(--color-primary, #002147);
    border: none;
    padding: 1.25rem 1.5rem;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-search-form-inner .search-submit:hover {
    background: var(--color-secondary, #008080);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    background: none;
    border: none;
    padding: 0.75rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: none;
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.hamburger span {
    width: 24px;
    height: 2px;
    background: var(--white, #ffffff);
    border-radius: 1px;
    transition: all 0.3s ease;
}

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

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

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

/* Mobile Navigation - Side Drawer */
.mobile-navigation {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    pointer-events: none;
}

.mobile-navigation.active {
    display: block;
    pointer-events: auto;
}

/* Backdrop */
.mobile-navigation::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 21, 46, 0.7);
    /* Oxford Blue with opacity */
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
}

.mobile-navigation.active::before {
    opacity: 1;
}

/* Drawer Content */
.mobile-menu-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 85%;
    max-width: 350px;
    height: 100%;
    background: var(--color-primary, #002147);
    padding: 2rem;
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2;
    display: flex;
    flex-direction: column;
}

.mobile-navigation.active .mobile-menu-content {
    transform: translateX(0);
}

/* Close Button */
.mobile-menu-close {
    align-self: flex-end;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--white, #ffffff);
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.mobile-menu-close:hover {
    background: var(--color-secondary, #008080);
    transform: rotate(90deg);
}

/* Menu Items */
.mobile-nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
}

.mobile-nav-menu li {
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mobile-nav-menu li:last-child {
    border-bottom: none;
}

.mobile-nav-menu a {
    display: block;
    padding: 1rem 0;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.15rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.mobile-nav-menu a:hover,
.mobile-nav-menu .current-menu-item>a {
    color: var(--color-secondary, #008080);
    padding-left: 10px;
}

/* Submenu Handling */
.mobile-nav-menu .sub-menu {
    display: none;
    padding-left: 1.5rem;
    background: rgba(0, 0, 0, 0.1);
    margin-bottom: 0.5rem;
    border-radius: var(--radius-md, 6px);
}

.mobile-nav-menu .sub-menu a {
    font-size: 1rem;
    padding: 0.75rem 0;
    color: rgba(255, 255, 255, 0.7);
}

.mobile-nav-menu .sub-menu a:hover {
    color: var(--white, #ffffff);
}

/* CTA Button in Menu */
.mobile-cta {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-cta .btn-primary {
    display: block;
    text-align: center;
    background: var(--color-secondary, #008080);
    color: white;
    padding: 1rem;
    border-radius: var(--radius-md, 6px);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.mobile-cta .btn-primary:hover {
    background: white;
    color: var(--color-secondary, #008080);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 128, 128, 0.3);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .header-container {
        padding: 0 1.5rem;
    }

    .header-content {
        gap: 1.5rem;
    }

    .nav-menu {
        gap: 0.25rem;
    }

    .nav-menu a {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    .header-container {
        padding: 0 1rem;
    }

    .header-content {
        height: 70px;
        gap: 1rem;
    }

    .text-logo .logo-link {
        font-size: 1.5rem;
    }

    .desktop-nav {
        display: none !important;
    }

    .mobile-menu-toggle {
        display: block !important;
    }

    .search-form-wrapper {
        padding: 0 1rem;
    }
}

/* Ensure header is always visible on front page */
.front-page .site-header {
    position: sticky !important;
    z-index: 1000 !important;
}

/* Smooth transitions for all interactive elements */
.site-header * {
    transition: all 0.3s ease;
}

/* Fix for the header gap */
html {
    margin-top: 0 !important;
}

body {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Fix for the hero section */
.hero-section {
    margin-top: 0 !important;
    padding-top: 2rem !important;
}

/* Ensure content doesn't get hidden behind sticky header */
body {
    scroll-padding-top: 80px;
}