/* Top Navigation Bar Styles */

nav.top-nav {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    box-shadow: none;
}

/* Optional second line: site announcement (only present when set in admin) */
nav.top-nav .top-nav-announcement-wrapper.dismissed {
    display: none !important;
}

nav.top-nav .top-nav-announcement-wrapper {
    width: 100%;
}

nav.top-nav .top-nav-announcement {
    position: relative;
    width: 100%;
    margin-top: 10px;
    padding: 6px 40px 6px 20px;
    text-align: center;
    font-size: 14px;
    line-height: 1.4;
    background: var(--button-primary);
    color: white;
    box-sizing: border-box;
}

nav.top-nav .top-nav-announcement-text {
    display: block;
}

nav.top-nav .top-nav-announcement-dismiss {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: white;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.85;
    border-radius: 4px;
}

nav.top-nav .top-nav-announcement-dismiss:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

nav.top-nav .top-nav-container {
    max-width: none;
    margin: 0;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav.top-nav .top-nav-left {
    display: flex;
    align-items: center;
    gap: 20px;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

nav.top-nav .top-nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* Inactive navigation links - use inactive blue */
.nav-link,
nav.top-nav .nav-link {
    background-color: rgb(100, 170, 235);
    color: white !important;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.2s;
    font-weight: 500;
    border-bottom: none;
    font-size: 14px;
    border: none;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-block;
}

/* Hover state for inactive links */
.nav-link:hover,
nav.top-nav .nav-link:hover {
    background-color: var(--button-primary);
    color: white;
    text-decoration: none;
}

/* Active navigation link - use active blue */
.nav-link.active,
nav.top-nav .nav-link.active {
    background-color: var(--button-primary);
    color: white;
    border-bottom: none;
}

/* Active link hover state */
.nav-link.active:hover,
nav.top-nav .nav-link.active:hover {
    background-color: var(--button-primary);
    color: white;
    text-decoration: none;
}

nav.top-nav .nav-username {
    font-weight: 600;
}

/* Logout button styling */
nav.top-nav .logout-btn {
    background-color: rgb(100, 170, 235);
    color: white;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.2s;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

nav.top-nav .logout-btn:hover {
    background-color: var(--button-primary);
    color: white;
    text-decoration: none;
}

/* Notification indicator for news */
.notification-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #ff4444;
    border-radius: 50%;
    margin-left: 6px;
    vertical-align: top;
    margin-top: 2px;
    box-shadow: 0 0 3px rgba(255, 68, 68, 0.5);
}

/* Responsive visibility classes */
.desktop-only {
    display: flex;
}

.mobile-only {
    display: none !important;
}

/* ── Burger header row (visible <1000px) ── */
.top-nav-burger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.top-nav-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Hamburger button */
.top-nav-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.top-nav-hamburger-line {
    display: block;
    width: 100%;
    height: 3px;
    background-color: rgb(100, 170, 235);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.top-nav-hamburger.open .top-nav-hamburger-line:nth-child(1) {
    transform: translateY(8.5px) rotate(45deg);
}

.top-nav-hamburger.open .top-nav-hamburger-line:nth-child(2) {
    opacity: 0;
}

.top-nav-hamburger.open .top-nav-hamburger-line:nth-child(3) {
    transform: translateY(-8.5px) rotate(-45deg);
}

/* ── Collapsible menu panel ── */
.top-nav-menu {
    flex-direction: column;
    background: transparent;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, background 0s 0.3s;
}

.top-nav-menu.open {
    max-height: 600px;
    background: var(--bg-primary);
    transition: max-height 0.3s ease, background 0s;
}

.top-nav-menu-link {
    display: block;
    padding: 14px 20px;
    color: white;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    background-color: rgb(100, 170, 235);
    margin: 4px 12px;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.top-nav-menu-link:visited {
    color: white;
}

.top-nav-menu-link:first-child {
    margin-top: 8px;
}

.top-nav-menu-link:hover,
.top-nav-menu-link:active {
    background-color: var(--button-primary);
    color: white;
    text-decoration: none;
}

.top-nav-menu-link.active {
    background-color: var(--button-primary);
}

.top-nav-menu-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 8px 12px;
}

.top-nav-menu-logout-form {
    margin: 4px 12px 14px 12px;
    padding: 0;
    border: none;
}

.top-nav-menu-link-logout {
    display: block;
    width: 100%;
    margin: 0;
    padding: 14px 20px;
    color: white;
    font-size: 16px;
    font-weight: 500;
    background-color: rgb(100, 170, 235);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: background-color 0.2s;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.top-nav-menu-link-logout:hover,
.top-nav-menu-link-logout:active {
    background-color: var(--button-primary);
    color: white;
}

/* Overlay */
.top-nav-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.top-nav-menu-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* ── Responsive breakpoint: <1000px shows burger, hides desktop ── */
@media (max-width: 999px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: flex !important;
    }

    /* Nav floats over content, takes no vertical space */
    nav.top-nav {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: transparent;
        border: 0;
        padding: 0;
        z-index: 1000;
        pointer-events: none;
        box-shadow: none;
        outline: none;
    }

    nav.top-nav .top-nav-container {
        padding: 0;
    }

    .top-nav-title {
        display: none;
    }

    .top-nav-burger {
        justify-content: flex-end;
        padding: 10px 12px;
    }

    /* Frosted-glass background so the button is visible over any content */
    .top-nav-hamburger {
        pointer-events: auto;
        background: rgba(30, 30, 30, 0.5);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        padding: 10px;
        border-radius: 8px;
        box-sizing: content-box;
    }

    /* Menu panel must sit above the overlay */
    .top-nav-menu {
        position: relative;
        z-index: 1001;
        pointer-events: auto;
        border: 0;
        box-shadow: none;
        outline: 0;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }

    /* Ensure absolutely no stray line under the burger button on mobile */
    .top-nav-burger,
    .top-nav-hamburger {
        border: none !important;
        box-shadow: none !important;
    }

    .top-nav-hamburger:focus,
    .top-nav-hamburger:focus-visible {
        outline: none;
        box-shadow: none;
    }

    .top-nav-menu-overlay {
        pointer-events: auto;
    }

    nav.top-nav .top-nav-announcement-wrapper {
        pointer-events: auto;
    }

    nav.top-nav .top-nav-announcement {
        padding-left: 15px;
        padding-right: 40px;
        pointer-events: auto;
    }
}

