/* ================================================================
   Shared Site Header

   Used by js/site-header.js on all top-level pages that render:
   <div data-site-header data-site-header-mode="..."></div>

   Keep global site navigation styling here. Tool-specific controls belong
   in the optional .tool-subbar directly below the site header.
   ================================================================ */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(135deg, #2d1660 0%, #3f1d9b 50%, #5a3baf 100%);
    box-shadow: 0 2px 12px rgba(45, 22, 96, 0.3);
}

.site-header,
.site-header a,
.site-header button {
    font-family: var(--font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
}

.site-header-inner {
    max-width: 1200px;
    min-height: 60px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.site-header-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #fff !important;
    text-decoration: none;
    flex-shrink: 0;
}

.site-header-logo-text {
    font-family: var(--font-heading, "Lora", Georgia, serif);
    font-weight: 700;
    font-size: 24px;
    line-height: 1;
    color: #fff;
    white-space: nowrap;
}

.site-header-back-icon,
.site-header-caret,
.site-header-user-caret {
    display: inline-flex;
}

.site-header-back-icon {
    color: rgba(255, 255, 255, 0.76);
}

.site-header-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 1;
}

.site-header-dropdown {
    position: relative;
}

.site-header-dropdown-btn,
.site-header-direct-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 0;
    background: none;
    color: #fff !important;
    border-radius: 6px;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.site-header-direct-link {
    color: rgba(255, 255, 255, 0.78) !important;
}

.site-header-dropdown-btn:hover,
.site-header-direct-link:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff !important;
}

.site-header-caret {
    opacity: 0.78;
    transition: transform 0.2s;
}

.site-header-dropdown.open .site-header-caret {
    transform: rotate(180deg);
}

.site-header-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 230px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color, #e8e4de);
    border-radius: var(--radius, 8px);
    box-shadow: var(--shadow-card-hover, 0 8px 24px rgba(0, 0, 0, 0.12));
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.18s, transform 0.18s, visibility 0.18s;
    z-index: 220;
    padding: 6px;
}

.site-header-dropdown.open .site-header-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.site-header-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border-radius: 6px;
    color: var(--text-body, #475569) !important;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: 0;
    background: none;
    text-align: left;
}

.site-header-dropdown-item:hover {
    background: var(--accent-subtle, rgba(63, 29, 155, 0.08));
    color: var(--accent, #3f1d9b) !important;
}

.site-header-item-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.site-header-item-label {
    flex: 1;
    min-width: 0;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.25;
}

.site-header-item-sub {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted, #94a3b8);
    margin-top: 1px;
}

.site-header-dropdown-item:hover .site-header-item-sub {
    color: var(--accent, #3f1d9b);
    opacity: 0.75;
}

/* ── Submenu flyout (PROVOKE → Tekst/Spraak) ─────────────────────── */

.site-header-dropdown-submenu-wrap {
    position: relative;
}

.site-header-dropdown-parent {
    width: 100%;
    cursor: pointer;
}

.site-header-submenu-caret {
    display: inline-flex;
    margin-left: auto;
    opacity: 0.6;
    transition: transform 0.15s, opacity 0.15s;
}

.site-header-dropdown-submenu-wrap:hover .site-header-submenu-caret,
.site-header-dropdown-submenu-wrap.open .site-header-submenu-caret {
    opacity: 1;
    transform: translateX(2px);
}

.site-header-dropdown-submenu {
    position: absolute;
    top: -6px; /* compensate parent dropdown's 6px padding */
    left: 100%;
    margin-left: 6px;
    min-width: 220px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color, #e8e4de);
    border-radius: var(--radius, 8px);
    box-shadow: var(--shadow-card-hover, 0 8px 24px rgba(0, 0, 0, 0.12));
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-6px);
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
    z-index: 221;
}

.site-header-dropdown-submenu-wrap:hover > .site-header-dropdown-submenu,
.site-header-dropdown-submenu-wrap.open > .site-header-dropdown-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.site-header-dropdown-submenu-wrap:hover > .site-header-dropdown-parent,
.site-header-dropdown-submenu-wrap.open > .site-header-dropdown-parent {
    background: var(--accent-subtle, rgba(63, 29, 155, 0.08));
    color: var(--accent, #3f1d9b) !important;
}

.site-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

.site-header-login-btn,
.site-header-icon-btn {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.14);
    color: #fff !important;
    text-decoration: none;
    cursor: pointer;
}

.site-header-login-btn {
    padding: 0 18px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.site-header-icon-btn {
    width: 36px;
    padding: 0;
}

.site-header-user-menu {
    position: relative;
}

.site-header-user-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.42);
    background: rgba(255, 255, 255, 0.94);
    color: var(--text-heading, #1e293b);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.site-header-user-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent, #3f1d9b);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

.site-header-user-name {
    color: var(--text-heading, #1e293b);
    white-space: nowrap;
}

.site-header-user-caret {
    color: var(--text-muted, #94a3b8);
}

.site-header-user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 190px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color, #e8e4de);
    border-radius: var(--radius, 8px);
    box-shadow: var(--shadow-card-hover, 0 8px 24px rgba(0, 0, 0, 0.12));
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.18s, transform 0.18s, visibility 0.18s;
    z-index: 230;
    padding: 4px;
}

.site-header-user-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.site-header-user-dropdown a,
.site-header-user-dropdown button {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--text-body, #475569) !important;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.site-header-user-dropdown-divider {
    height: 1px;
    background: var(--border-color, #e8e4de);
    margin: 4px 0;
}

.site-header-hamburger {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.42);
    background: rgba(255, 255, 255, 0.12);
    cursor: pointer;
}

.site-header-hamburger span {
    width: 18px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
}

.site-header-mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
    z-index: 999;
    opacity: 0;
}

.site-header-mobile-overlay.open {
    display: block;
    opacity: 1;
}

.site-header-mobile-menu {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    background: var(--bg-card, #fff);
    border-left: 1px solid var(--border-color, #e8e4de);
    box-shadow: -4px 0 24px rgba(15, 23, 42, 0.18);
    z-index: 1000;
    overflow-y: auto;
    transition: right 0.28s;
}

.site-header-mobile-menu.open {
    right: 0;
}

.site-header-mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, #e8e4de);
    font-family: var(--font-heading, "Lora", Georgia, serif);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-heading, #1e293b);
}

.site-header-mobile-close {
    border: 0;
    background: none;
    color: var(--text-muted, #94a3b8);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.site-header-mobile-menu-body {
    padding: 12px 0;
}

.site-header-mobile-link,
.site-header-mobile-group-trigger {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 11px 20px;
    border: 0;
    background: none;
    color: var(--text-body, #475569);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    text-align: left;
    cursor: pointer;
}

.site-header-mobile-link:hover,
.site-header-mobile-group-trigger:hover {
    background: var(--accent-subtle, rgba(63, 29, 155, 0.08));
    color: var(--accent, #3f1d9b);
}

.site-header-mobile-group {
    border-top: 1px solid var(--border-color, #e8e4de);
    border-bottom: 1px solid var(--border-color, #e8e4de);
}

.site-header-mobile-group-trigger {
    justify-content: space-between;
    color: var(--text-heading, #1e293b);
    font-weight: 600;
}

.site-header-mobile-caret {
    display: inline-flex;
    transition: transform 0.2s;
}

.site-header-mobile-group-trigger.open .site-header-mobile-caret {
    transform: rotate(180deg);
}

.site-header-mobile-group-items {
    display: none;
    padding-bottom: 8px;
}

.site-header-mobile-group-items.open {
    display: block;
}

.site-header-mobile-group-items .site-header-mobile-link {
    padding-left: 36px;
    font-size: 13px;
}

.site-header-mobile-user-actions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color, #e8e4de);
}

/* ================================================================
   Tool Subbar

   Optional row below the site header for page-specific controls.
   Examples: catalog search, demo scenario controls, feedback actions.
   ================================================================ */

.tool-subbar {
    position: sticky;
    top: 60px;
    z-index: 90;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--border-color, #e8e4de);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

.tool-subbar-inner {
    max-width: 1200px;
    min-height: 62px;
    margin: 0 auto;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.tool-subbar-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading, "Lora", Georgia, serif);
    font-size: 17px;
    font-weight: 700;
    color: var(--text-heading, #1e293b);
    white-space: nowrap;
}

.tool-subbar-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 9px;
    border-radius: 999px;
    background: var(--accent-subtle, rgba(63, 29, 155, 0.08));
    color: var(--accent, #3f1d9b);
    border: 1px solid rgba(63, 29, 155, 0.18);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tool-subbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex: 1;
}

.tool-subbar-search {
    position: relative;
    flex: 1;
    max-width: 520px;
}

.tool-subbar-search input {
    width: 100%;
    min-height: 42px;
    padding: 10px 68px 10px 40px;
    border: 1px solid var(--border-color, #e8e4de);
    border-radius: var(--radius, 8px);
    background: #fff;
    color: var(--text-body, #475569);
    font-size: 15px;
    outline: 0;
}

.tool-subbar-search-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    color: var(--text-muted, #94a3b8);
    pointer-events: none;
}

.tool-subbar-esc {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    padding: 2px 8px;
    border: 1px solid var(--border-color, #e8e4de);
    border-radius: 4px;
    background: var(--bg-primary, #faf8f5);
    color: var(--text-muted, #94a3b8);
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    line-height: 1;
}
.tool-subbar-esc:hover {
    background: var(--bg-card, #ffffff);
    color: var(--text-body, #1f2937);
    border-color: var(--accent, #3f1d9b);
}
.tool-subbar-esc:focus-visible {
    outline: 2px solid var(--accent, #3f1d9b);
    outline-offset: 2px;
}

.tool-subbar-select,
.tool-subbar-button {
    min-height: 38px;
    border-radius: 8px;
    font-size: 13px;
}

.tool-subbar-select {
    max-width: 280px;
    border: 1px solid var(--border-color, #e8e4de);
    background: #fff;
    color: var(--text-body, #475569);
    padding: 0 10px;
}

.tool-subbar-button {
    border: 1px solid rgba(63, 29, 155, 0.22);
    background: var(--accent-subtle, rgba(63, 29, 155, 0.08));
    color: var(--accent, #3f1d9b);
    padding: 0 14px;
    font-weight: 700;
    cursor: pointer;
}

.tool-subbar-button-primary {
    background: var(--accent, #3f1d9b);
    color: #fff;
    border-color: var(--accent, #3f1d9b);
}

@media (max-width: 768px) {
    .site-header-inner {
        min-height: 56px;
        padding: 0 16px;
    }

    .site-header-logo-text {
        font-size: 20px;
    }

    .site-header-links,
    .site-header-user-menu-btn {
        display: none;
    }

    .site-header-hamburger {
        display: inline-flex;
    }

    .tool-subbar {
        top: 56px;
    }

    .tool-subbar-inner {
        min-height: 0;
        padding: 10px 16px;
        align-items: stretch;
        flex-direction: column;
    }

    .tool-subbar-actions {
        width: 100%;
        justify-content: stretch;
        flex-wrap: wrap;
    }

    .tool-subbar-search {
        width: 100%;
        max-width: none;
    }

    .tool-subbar-select {
        max-width: none;
        flex: 1 1 220px;
    }
}

@media (max-width: 480px) {
    .site-header-inner {
        padding: 0 12px;
    }

    .site-header-logo-text {
        font-size: 18px;
    }

    .site-header-login-btn {
        min-height: 40px;
        padding: 0 16px;
        font-size: 14px;
    }
}
