/*
 * Site header / navigation styles.
 *
 * Extracted from the inline <style> block that previously lived in
 * Shared/NavMenu.razor. NavMenu renders on every page, so shipping this CSS
 * inline meant re-sending ~15 KB of identical, uncacheable markup on every
 * response. Moving it to this static file lets the browser cache it once.
 *
 * NOTE: these selectors are intentionally GLOBAL (not a scoped .razor.css).
 * A few of them cross component boundaries and therefore cannot be scoped:
 *   - .dropdown-nav .nav-link targets the <a> rendered by the <NavLink> child
 *     component (which does not inherit NavMenu's scope attribute).
 *   - .vrag-main styles <main class="vrag-main"> which is rendered by
 *     Shared/MainLayout.razor, not NavMenu.
 * This file must be linked AFTER VragguidenBlazor.styles.css so the original
 * cascade/source order is preserved (e.g. .dropdown-nav .nav-link ties with
 * the scoped .nav-item ::deep a rule and must win by coming later).
 */

.vrag-header {
    background: #0c2d48;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.vrag-header .navbar {
    padding: 0.5rem 0;
    display: flex;
    flex-direction: column;
}

.vrag-header .container-fluid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1920px;
    margin: 0 auto;
    flex-wrap: nowrap;
    min-width: 0;
}

/* Logo and Brand */
.vrag-header .navbar-brand {
    color: #2ee5ff;
    text-decoration: none;
    padding: 0.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    flex-shrink: 1;
}

.vrag-header .navbar-brand:hover .logo-container svg {
    transform: scale(1.05);
    filter: drop-shadow(0 0 8px rgba(46, 229, 255, 0.5));
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.logo-container svg {
    width: 36px;
    height: 36px;
    transition: transform 0.2s ease, filter 0.2s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
}

.brand-name {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: #2ee5ff;
    white-space: nowrap;
}

.brand-tagline {
    font-size: 0.55rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: rgba(46, 229, 255, 0.7);
    white-space: nowrap;
}

/* Right side actions - always on same line */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Login Button - Always visible */
.login-btn {
    background: rgba(46, 229, 255, 0.15);
    border: 1px solid rgba(46, 229, 255, 0.4);
    border-radius: 50px;
    color: #2ee5ff;
    padding: 0.4rem 0.75rem;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: background 0.2s ease;
    white-space: nowrap;
}

.login-btn:hover {
    background: rgba(46, 229, 255, 0.25);
    color: #2ee5ff;
}

/* Auth loading state - prevents flicker during prerender->hydration */
.auth-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: rgba(46, 229, 255, 0.1);
    border: 1px solid rgba(46, 229, 255, 0.3);
    border-radius: 50px;
}

.auth-loading .spin-icon {
    color: rgba(46, 229, 255, 0.6);
    font-size: 0.9rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.login-text {
    display: none;
}

/* User Menu (when logged in) */
.user-menu {
    position: relative;
}

.user-btn {
    background: rgba(46, 229, 255, 0.15);
    border: 1px solid rgba(46, 229, 255, 0.4);
    border-radius: 50px;
    color: #2ee5ff;
    padding: 0.4rem 0.75rem;
    font-weight: 500;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
}

.user-btn:hover {
    background: rgba(46, 229, 255, 0.25);
}

.user-name {
    display: none;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chevron-icon {
    font-size: 0.6rem;
    transition: transform 0.2s ease;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #0a2540;
    border: 1px solid rgba(46, 229, 255, 0.3);
    border-radius: 12px;
    min-width: 200px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    z-index: 1001;
    overflow: hidden;
}

.user-dropdown-scroll {
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Custom scrollbar for dropdown */
.user-dropdown-scroll::-webkit-scrollbar {
    width: 6px;
}

.user-dropdown-scroll::-webkit-scrollbar-track {
    background: rgba(46, 229, 255, 0.05);
}

.user-dropdown-scroll::-webkit-scrollbar-thumb {
    background: rgba(46, 229, 255, 0.3);
    border-radius: 3px;
}

.user-dropdown-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(46, 229, 255, 0.5);
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: rgba(46, 229, 255, 0.85);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s ease, color 0.2s ease;
}

.user-dropdown-item:hover {
    background: rgba(46, 229, 255, 0.1);
    color: #2ee5ff;
}

.user-dropdown-item .oi {
    width: 16px;
    text-align: center;
}

.user-dropdown-divider {
    height: 1px;
    background: rgba(46, 229, 255, 0.15);
    margin: 0.25rem 0;
}

.logout-item {
    color: #ff6b6b;
}

.logout-item:hover {
    background: rgba(255, 107, 107, 0.1);
    color: #ff6b6b;
}

/* Submenu styles */
.user-dropdown-submenu {
    position: relative;
}

.user-dropdown-submenu-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: rgba(46, 229, 255, 0.85);
    font-size: 0.9rem;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.user-dropdown-submenu-toggle:hover {
    background: rgba(46, 229, 255, 0.1);
    color: #2ee5ff;
}

.user-dropdown-submenu-toggle.open {
    background: rgba(46, 229, 255, 0.08);
    color: #2ee5ff;
}

.user-dropdown-submenu-toggle .oi:first-child {
    width: 16px;
    text-align: center;
}

.submenu-chevron {
    margin-left: auto;
    font-size: 0.65rem;
    transition: transform 0.2s ease;
}

.user-dropdown-submenu-toggle.open .submenu-chevron {
    transform: rotate(90deg);
}

.submenu-items {
    background: rgba(0, 0, 0, 0.15);
    border-left: 2px solid rgba(46, 229, 255, 0.3);
    margin-left: 0.5rem;
}

.submenu-item {
    padding-left: 1.5rem !important;
    font-size: 0.85rem !important;
}

.submenu-item .oi {
    font-size: 0.8rem;
}

/* JS-styret synlighed (erstatter tidligere if-conditional rendering - ingen circuit) */
.user-dropdown { display: none; }
.user-menu.open .user-dropdown { display: block; }
.submenu-items { display: none; }
.user-dropdown-submenu-toggle.open + .submenu-items { display: block; }

/* Burger Button */
.burger-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 38px;
    height: 38px;
    padding: 8px;
    background: rgba(46, 229, 255, 0.1);
    border: 1px solid rgba(46, 229, 255, 0.3);
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.burger-btn:hover {
    background: rgba(46, 229, 255, 0.2);
}

.burger-line {
    width: 18px;
    height: 2px;
    background: #2ee5ff;
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Dropdown Navigation */
.dropdown-nav {
    display: none;
    width: 100%;
    background: #0a2540;
    overflow: hidden;
}

.dropdown-nav.show {
    display: block;
}

.dropdown-nav .navbar-nav {
    list-style: none;
    margin: 0 auto;
    padding: 0.5rem 1rem;
    max-width: 1920px;
}

.dropdown-nav .nav-item {
    border-bottom: 1px solid rgba(46, 229, 255, 0.1);
}

.dropdown-nav .nav-item:last-child {
    border-bottom: none;
}

.dropdown-nav .nav-link {
    color: rgba(46, 229, 255, 0.85);
    padding: 0.875rem 0.5rem;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: color 0.2s ease;
}

.dropdown-nav .nav-link:hover,
.dropdown-nav .nav-link.active {
    color: #2ee5ff;
}

.dropdown-nav .nav-link .oi {
    width: 18px;
    text-align: center;
}

/* Medium screens */
@media (min-width: 400px) {
    .logo-container svg {
        width: 40px;
        height: 40px;
    }

    .brand-name {
        font-size: 1.4rem;
        letter-spacing: 2px;
    }

    .brand-tagline {
        font-size: 0.6rem;
        letter-spacing: 1px;
    }

    .login-btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.85rem;
    }

    .burger-btn {
        width: 42px;
        height: 42px;
    }

    .burger-line {
        width: 20px;
    }

    .nav-actions {
        gap: 0.625rem;
    }
}

/* Larger screens */
@media (min-width: 540px) {
    .login-text {
        display: inline;
    }

    .user-name {
        display: inline;
    }

    .brand-name {
        font-size: 1.6rem;
        letter-spacing: 3px;
    }

    .brand-tagline {
        font-size: 0.65rem;
    }

    .logo-container svg {
        width: 44px;
        height: 44px;
    }

    .login-btn {
        padding: 0.5rem 1rem;
        gap: 0.375rem;
    }

    .user-btn {
        padding: 0.5rem 1rem;
    }

    .nav-actions {
        gap: 0.75rem;
    }
}

@media (min-width: 768px) {
    .brand-name {
        font-size: 1.8rem;
        letter-spacing: 4px;
    }

    .brand-tagline {
        font-size: 0.7rem;
        letter-spacing: 2px;
    }

    .logo-container svg {
        width: 48px;
        height: 48px;
    }

    .login-btn {
        padding: 0.5rem 1.25rem;
    }

    .burger-btn {
        width: 44px;
        height: 44px;
    }
}

/* Very small screens */
@media (max-width: 340px) {
    .brand-tagline {
        display: none;
    }

    .brand-name {
        font-size: 1rem;
        letter-spacing: 0.5px;
    }

    .logo-container svg {
        width: 30px;
        height: 30px;
    }

    .login-btn {
        padding: 0.35rem 0.5rem;
        font-size: 0.75rem;
    }

    .burger-btn {
        width: 34px;
        height: 34px;
        padding: 6px;
        gap: 3px;
    }

    .burger-line {
        width: 16px;
    }

    .nav-actions {
        gap: 0.375rem;
    }

    .navbar-brand {
        gap: 0.375rem;
    }
}

/* Layout wrapper rendered by Shared/MainLayout.razor (<main class="vrag-main">).
   Kept here (global) because it was authored in this block and styles another
   component's markup. */
.vrag-main {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.vrag-main > .container-fluid {
    flex: 1;
}
