/* =================================================================
   WF Portal — Top Navigation Bar (Global)
   -----------------------------------------------------------------
   Styles are global (not scoped) because Blazor NavLink renders
   <a> tags outside the component's CSS-isolation scope.
   ================================================================= */

.wf-navbar {
    background: var(--theme-nav-background);
    border-bottom: 1px solid var(--theme-nav-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.wf-navbar-inner {
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    height: 3.5rem;
    max-width: 100%;
}

/* -- Brand -------------------------------------------------------- */

.wf-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none !important;
    color: var(--theme-nav-text-hover);
    font-weight: 700;
    font-size: 1.075rem;
    letter-spacing: -0.01em;
    white-space: nowrap;
    margin-right: 2.25rem;
    flex-shrink: 0;
    transition: opacity 150ms ease;
}
.wf-brand i {
    font-size: 1.35rem;
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-offset));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.wf-brand-logo {
    height: 28px;
    width: auto;
    object-fit: contain;
}
.wf-brand:hover {
    opacity: 0.85;
    color: var(--theme-nav-text-hover);
    text-decoration: none !important;
}

/* -- Mobile toggle ------------------------------------------------ */

.wf-nav-toggle {
    display: none;
    background: var(--theme-background-subtle);
    border: 1px solid var(--theme-border);
    border-radius: 0.5rem;
    color: var(--theme-text-secondary);
    padding: 0.35rem 0.6rem;
    font-size: 1.2rem;
    cursor: pointer;
    margin-left: auto;
    line-height: 1;
    transition: all 150ms ease;
}
.wf-nav-toggle:hover {
    color: var(--theme-text);
    background: var(--theme-background-hover);
    border-color: var(--theme-border-subtle);
}

/* -- Nav collapse container --------------------------------------- */

.wf-nav-collapse {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

/* -- Nav links (left side) ---------------------------------------- */

.wf-nav-links {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.25rem;
}

/* -- Nav right (user / language) ---------------------------------- */

.wf-nav-right {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0 0 0 auto;
    padding: 0;
    gap: 0.25rem;
}

/* -- Nav item / link ---------------------------------------------- */

.wf-nav-item { position: relative; }

.wf-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.85rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--theme-nav-text);
    text-decoration: none !important;
    border-radius: 0.5rem;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    white-space: nowrap;
    letter-spacing: 0.005em;
    transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease;
}
.wf-nav-link:hover {
    color: var(--theme-nav-text-hover);
    background-color: var(--theme-nav-hover-background);
    border-color: var(--theme-nav-hover-background);
    text-decoration: none !important;
}
.wf-nav-link.active {
    color: var(--theme-nav-text-active) !important;
    background: var(--theme-nav-hover-background) !important;
    border-color: var(--theme-nav-divider) !important;
}

.wf-nav-link i:first-child { font-size: 0.95rem; opacity: 0.75; }
.wf-nav-link:hover i:first-child,
.wf-nav-link.active i:first-child { opacity: 1; }

/* -- Header sections (MenuItemType 6 without children) ----------------
   Renders as a non-clickable, slightly faded label — useful as a
   section divider in the top nav. Explicitly overrides the hover +
   active states inherited from .wf-nav-link. */

.wf-nav-section .wf-nav-label {
    cursor: default;
    color: var(--theme-nav-text);
    opacity: 0.65;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.7rem;
}

.wf-nav-section .wf-nav-label:hover {
    background-color: transparent;
    border-color: transparent;
    color: var(--theme-nav-text);
}

/* -- Chevron ------------------------------------------------------ */

.wf-chevron {
    font-size: 0.55rem;
    opacity: 0.4;
    margin-left: -0.1rem;
    transition: transform 200ms ease, opacity 150ms ease;
}
.wf-dropdown-toggle:hover .wf-chevron { opacity: 0.7; }

/* Chevron flips when the dropdown is open — visual affordance that
   mirrors Bootstrap's native dropdown behavior. */
.wf-dropdown-toggle.open .wf-chevron {
    transform: rotate(180deg);
    opacity: 0.85;
}

/* -- Separator between left and right ----------------------------- */

.wf-nav-right::before {
    content: '';
    display: block;
    width: 1px;
    height: 1.25rem;
    background: var(--theme-nav-border);
    margin-right: 0.5rem;
    flex-shrink: 0;
}

/* -- Dropdown ----------------------------------------------------- */

.wf-dropdown { position: relative; }

.wf-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    min-width: 13rem;
    padding: 0.375rem;
    background: var(--theme-nav-dropdown-background);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--theme-nav-border);
    border-radius: 0.75rem;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, .2),
        0 12px 28px rgba(0, 0, 0, .35),
        inset 0 1px 0 rgba(255, 255, 255, .04);
    list-style: none;
    z-index: 1040;
    animation: wf-dropdown-in 120ms ease-out;
}
@keyframes wf-dropdown-in {
    from { opacity: 0; transform: translateY(-4px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.wf-dropdown-menu.show { display: block; }
.wf-dropdown-menu.wf-dropdown-end { left: auto; right: 0; }

.wf-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 450;
    color: var(--theme-nav-text-hover);
    text-decoration: none !important;
    border: none;
    background: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 120ms ease;
}
.wf-dropdown-item:hover {
    background: var(--theme-nav-dropdown-hover);
    color: var(--theme-nav-text-hover);
    text-decoration: none !important;
}
.wf-dropdown-item.active {
    background: var(--theme-primary-muted);
    color: var(--theme-primary);
}
.wf-dropdown-item i {
    font-size: 0.9rem;
    width: 1.25rem;
    text-align: center;
    opacity: 0.55;
    transition: opacity 120ms ease;
}
.wf-dropdown-item:hover i { opacity: 0.9; }

/* External-link glyph on items that open in a new tab. Applied via the
   target="_blank" attribute so leaf items keep rendering clean when they
   navigate in-app. Small trailing arrow, subtle until hover. */
.wf-dropdown-item[target="_blank"]::after {
    content: "\F142"; /* bi-arrow-up-right */
    font-family: "bootstrap-icons";
    font-size: 0.7rem;
    opacity: 0.35;
    margin-left: auto;
    padding-left: 0.5rem;
    transition: opacity 120ms ease, transform 120ms ease;
}
.wf-dropdown-item[target="_blank"]:hover::after {
    opacity: 0.75;
    transform: translate(1px, -1px);
}

.wf-dropdown-divider {
    height: 0;
    margin: 0.35rem 0;
    border-top: 1px solid var(--theme-border);
    list-style: none;
}

.wf-dropdown-header {
    padding: 0.5rem 0.75rem 0.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--theme-nav-text);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.wf-divider {
    margin: 0.3rem 0.5rem;
    border: none;
    height: 1px;
    background: var(--theme-nav-divider);
}

.wf-logout { color: var(--theme-danger) !important; }
.wf-logout i { opacity: 0.7 !important; }
.wf-logout:hover { background: rgba(248, 113, 113, .1) !important; }

/* -- User button / avatar ----------------------------------------- */

.wf-user-btn {
    gap: 0.5rem;
    padding-left: 0.5rem;
    padding-right: 0.65rem;
}

.wf-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.625rem;
    height: 1.625rem;
    border-radius: 0.45rem;
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-offset));
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.wf-user-name {
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

/* =================================================================
   Responsive — Mobile
   ================================================================= */

@media (max-width: 767.98px) {
    .wf-navbar-inner { padding: 0 1rem; }

    .wf-nav-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .wf-nav-collapse {
        display: none;
        flex-direction: column;
        align-items: stretch;
        position: absolute;
        top: 3.5rem;
        left: 0;
        right: 0;
        background: var(--theme-nav-background);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-bottom: 1px solid var(--theme-nav-divider);
        padding: 0.75rem;
        max-height: calc(100vh - 3.5rem);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        z-index: 1035;
        animation: wf-mobile-slide 200ms ease-out;
    }
    @keyframes wf-mobile-slide {
        from { opacity: 0; transform: translateY(-8px); }
        to   { opacity: 1; transform: translateY(0); }
    }
    .wf-nav-collapse.show { display: flex; }

    .wf-nav-links,
    .wf-nav-right {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        margin: 0;
        gap: 0.125rem;
    }

    .wf-nav-right {
        border-top: 1px solid var(--theme-nav-divider);
        margin-top: 0.625rem;
        padding-top: 0.625rem;
    }

    .wf-nav-right::before { display: none; }

    .wf-nav-link {
        padding: 0.6rem 0.75rem;
        border-radius: 0.5rem;
        font-size: 0.875rem;
    }

    .wf-dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        margin: 0;
        padding: 0.125rem 0 0.125rem 1rem;
        background: transparent;
        backdrop-filter: none;
        animation: none;
        border-left: 2px solid var(--theme-nav-border);
        border-radius: 0;
        margin-left: 0.75rem;
    }

    .wf-dropdown-item {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }
}
