/* ============================================================
   RackForest Top Bar
   Desktop: full bar (>= 994px)
   Mobile:  announcement only (<= 993px, when present)
   ============================================================ */

:root {
    --rf-topbar-bg: #F3F8F6;
    --rf-topbar-color: #32413F;
    --rf-topbar-hover: #0ABF22;
    --rf-topbar-dropdown-bg: #fff;
    --rf-topbar-dropdown-border: #e5e7eb;
    --rf-topbar-text-secondary: #6b7280;
    --rf-topbar-dropdown-hover-bg: #f9fafb;
}

/* --- Top Bar Container --- */

.rf-top-bar {
    display: none;
}

/* Mobile: show announcement-only bar (<= 993px) */
@media (max-width: 993px) {
    .rf-top-bar.has-announcement {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 1031;
        background: var(--rf-topbar-bg);
        color: var(--rf-topbar-color);
    }

    .rf-top-bar.has-announcement .rf-top-bar-inner {
        justify-content: center;
        height: auto;
        min-height: 40px;
        padding: 8px 16px;
    }

    .rf-top-bar.has-announcement .rf-top-bar-nav {
        display: none;
    }

    .rf-top-bar.has-announcement .rf-top-bar-announcement {
        margin-right: 0;
        flex-wrap: wrap;
        justify-content: center;
        overflow: visible;
        width: 100%;
    }
}

/* Desktop: full bar (>= 994px) */
@media (min-width: 994px) {
    .rf-top-bar {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 1031;
        background: var(--rf-topbar-bg);
        color: var(--rf-topbar-color);
    }

    /* Push everything down by 40px to account for top bar */
    .navbar.fixed-top {
        top: 40px;
        height: 72px;
    }

    body .body-content .section-main {
        margin-top: calc(30px + 72px + 40px);
    }

    .sidebar {
        top: calc(72px + 40px);
        min-height: calc(100vh - 72px - 40px);
    }
}

/* --- Inner Layout --- */

.rf-top-bar-inner {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    height: 40px;
    padding: 0 16px;
}

/* --- Announcement --- */

.rf-top-bar-announcement {
    margin-right: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
}

.rf-top-bar-announcement-text {
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    color: var(--rf-topbar-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rf-top-bar-announcement-link {
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    white-space: nowrap;
    color: var(--rf-topbar-hover);
    transition: color 300ms;
}

.rf-top-bar-announcement-link:hover,
.rf-top-bar-announcement-link:focus {
    color: var(--rf-topbar-hover);
    text-decoration: none;
}

/* --- Nav --- */

.rf-top-bar-nav {
    display: flex;
    align-items: center;
    gap: 32px;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    font-weight: 600;
    line-height: 20px;
}

/* Force all links in the top bar to inherit the bar color, not Bootstrap blue */
.rf-top-bar-nav a,
.rf-top-bar-nav a:link,
.rf-top-bar-nav a:visited {
    color: var(--rf-topbar-color);
    text-decoration: none;
}

.rf-top-bar-nav a:hover,
.rf-top-bar-nav a:focus {
    color: var(--rf-topbar-hover);
    text-decoration: none;
}

/* --- Links --- */

.rf-top-bar-link {
    transition: color 300ms;
}

/* --- Language Switcher --- */

.rf-lang-switcher {
    position: relative;
}

.rf-lang-switcher-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--rf-topbar-color);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 20px;
    transition: color 300ms;
}

.rf-lang-switcher-toggle:hover {
    color: var(--rf-topbar-hover);
}

/* Flag */
.rf-lang-flag {
    width: 24px;
    height: 18px;
    border-radius: 3px;
    box-shadow: 0px -1px 6px rgba(0,0,0,0.08), 0px 2px 6px rgba(0,0,0,0.08);
    object-fit: cover;
}

/* Chevron rotation */
.rf-lang-chevron {
    transition: transform 300ms;
}

.rf-lang-switcher.is-open .rf-lang-chevron {
    transform: rotate(180deg);
}

/* Dropdown */
.rf-lang-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    inset-inline-end: 0;
    margin-top: 4px;
    min-width: 180px;
    background: var(--rf-topbar-dropdown-bg);
    border: 1px solid var(--rf-topbar-dropdown-border);
    border-radius: 8px;
    box-shadow: 0px -1px 8px rgba(0,0,0,0.12), 0px 4px 8px rgba(0,0,0,0.12);
    z-index: 1100;
    padding: 4px 0;
}

.rf-lang-switcher.is-open .rf-lang-dropdown {
    display: block;
}

.rf-lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    color: var(--rf-topbar-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    transition: background-color 200ms;
}

.rf-lang-option:hover {
    background: var(--rf-topbar-dropdown-hover-bg);
    color: var(--rf-topbar-color);
    text-decoration: none;
}

.rf-lang-option.is-active {
    font-weight: 700;
}

/* --- Site Switcher --- */

.rf-site-switcher {
    position: relative;
}

.rf-site-switcher-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    border-radius: 6px;
    padding: 0;
    cursor: pointer;
    color: var(--rf-topbar-color);
    transition: color 300ms, background-color 300ms;
}

.rf-site-switcher-toggle:hover {
    color: var(--rf-topbar-hover);
    background-color: var(--rf-topbar-dropdown-border);
}

.rf-site-switcher-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    inset-inline-end: 0;
    margin-top: 4px;
    min-width: 220px;
    background: var(--rf-topbar-dropdown-bg);
    border: 1px solid var(--rf-topbar-dropdown-border);
    border-radius: 8px;
    box-shadow: 0px -1px 8px rgba(0,0,0,0.12), 0px 4px 8px rgba(0,0,0,0.12);
    z-index: 1100;
    padding: 4px 0;
}

.rf-site-switcher.is-open .rf-site-switcher-dropdown {
    display: block;
}

.rf-site-switcher-option {
    display: flex;
    flex-direction: column;
    padding: 10px 16px;
    text-decoration: none;
    transition: background-color 200ms;
}

.rf-site-switcher-option:hover {
    background: var(--rf-topbar-dropdown-hover-bg);
    text-decoration: none;
}

.rf-site-switcher-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    color: var(--rf-topbar-color);
}

.rf-site-switcher-desc {
    font-size: 13px;
    font-weight: 400;
    line-height: 18px;
    color: var(--rf-topbar-text-secondary);
}

/* --- Logout Link --- */

.rf-top-bar-logout,
.rf-top-bar-login {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 300ms;
}

.rf-top-bar-logout svg {
    width: 16px;
    height: 16px;
}

.rf-top-bar-login svg {
    width: 20px;
    height: 20px;
}
