/* =========================================
   Svea Header  [svea_header]
   Desktop: logo | mega menu | search, account, Boka tid
   <= 1100px: menu + search move into a slide-down drawer behind the burger

   Every selector starts with header.svh so it outranks the theme reset
   (Hello Elementor styles bare a/button/input) and the Elementor kit
   (.elementor-kit-N a, .elementor-kit-N input:not(...)).
   ========================================= */
header.svh {
    --svh-bg:           transparent;
    --svh-panel-bg:     #ffffff;
    --svh-text:         #111111;
    --svh-hover:        #6b6b6b;
    --svh-accent:       var(--svea-accent, #F5B400);
    --svh-accent-hover: var(--svea-accent-hover, #d9a200);
    --svh-underline:    var(--svea-blue, #2FA9E0);
    --svh-border:       rgba(17, 17, 17, 0.12);
    --svh-shadow:       0 12px 32px rgba(14, 58, 92, 0.12);
    --svh-drawer-top:   0px;

    position: relative;
    z-index: 1000;
    width: 100%;
    background: var(--svh-bg);
    color: var(--svh-text);
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    line-height: 1.4;
}

/* Elementor flex containers shrink the shortcode widget to its content; make it span the row */
.elementor-widget:has(header.svh) {
    align-self: stretch;
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
}

/* ---------- Reset theme/kit styles inside the header ---------- */
header.svh *, header.svh *::before, header.svh *::after { box-sizing: border-box; }

header.svh a,
header.svh a:hover,
header.svh a:focus,
header.svh a:active,
header.svh a:visited {
    color: inherit;
    background: none;
    text-decoration: none;
}
header.svh button,
header.svh button:hover,
header.svh button:focus,
header.svh button:active {
    display: inline-flex;
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    margin: 0;
    min-height: 0;
    cursor: pointer;
    text-transform: none;
    letter-spacing: normal;
}
header.svh ul { list-style: none; margin: 0; padding: 0; }
header.svh li { margin: 0; padding: 0; }
header.svh p { margin: 0; padding: 0; }
header.svh label { display: block; margin: 0; line-height: inherit; }

header.svh .svh-sr {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

header.svh button:focus:not(:focus-visible) { outline: none; }
header.svh a:focus-visible,
header.svh button:focus-visible,
header.svh input:focus-visible {
    outline: 2px solid var(--svh-text);
    outline-offset: 2px;
}

/* ---------- Layout ---------- */
header.svh .svh-inner {
    display: flex;
    align-items: center;
    gap: 32px;
    max-width: 1520px;
    margin: 0 auto;
    padding: 8px 24px 10px;
}

/* ---------- Brand: Privat / Företag + logo ---------- */
header.svh .svh-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex-shrink: 0;
}
header.svh .svh-audience { display: flex; gap: 8px; margin-bottom: 4px; }
header.svh .svh-audience-link,
header.svh .svh-audience-link:hover,
header.svh .svh-audience-link:focus {
    padding: 2px 10px 4px;
    font-size: 14px;
    font-weight: 400;
    color: var(--svh-text);
    border-bottom: 2px solid transparent;
}
header.svh .svh-audience-link.is-active { border-bottom-color: var(--svh-underline); }
header.svh .svh-audience-link:not(.is-active):hover { border-bottom-color: var(--svh-border); }

header.svh .svh-logo { display: block; }
header.svh .svh-logo img { display: block; width: 120px; max-width: none; height: auto; }

/* ---------- Drawer wrapper (plain flex item on desktop) ---------- */
header.svh .svh-drawer { flex: 1 1 auto; display: flex; justify-content: center; min-width: 0; }
header.svh .svh-drawer-audience,
header.svh .svh-drawer-search,
header.svh .svh-drawer-actions { display: none; }

/* ---------- Main menu ---------- */
header.svh .svh-menu { display: flex; align-items: center; gap: 28px; }
header.svh .svh-item { position: relative; }
header.svh .svh-row { display: flex; align-items: center; gap: 4px; padding: 18px 0; }
header.svh .svh-link,
header.svh a.svh-link:hover,
header.svh a.svh-link:focus {
    font-weight: 600;
    white-space: nowrap;
    color: var(--svh-text);
    transition: color .15s;
}
header.svh .svh-toggle,
header.svh .svh-toggle:hover,
header.svh .svh-toggle:focus {
    align-items: center;
    padding: 2px;
    border-radius: 4px;
    color: var(--svh-text);
    transition: color .15s;
}
header.svh .svh-toggle svg { display: block; transition: transform .2s; }

header.svh .svh-item.is-open > .svh-row .svh-link,
header.svh .svh-item.is-open > .svh-row .svh-toggle,
header.svh .svh-row:hover .svh-link,
header.svh .svh-row:hover .svh-toggle { color: var(--svh-hover); }

/* ---------- Dropdown panel ---------- */
header.svh .svh-panel {
    position: absolute;
    top: 100%;
    left: 0;
    display: grid;
    grid-template-columns: repeat(var(--svh-cols, 1), minmax(150px, max-content));
    column-gap: 56px;
    width: max-content;
    max-width: calc(100vw - 32px);
    padding: 24px 32px 28px;
    background: var(--svh-panel-bg);
    border-radius: 0 0 24px 24px;
    box-shadow: var(--svh-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity .15s, transform .15s, visibility 0s linear .15s;
}
/* hover bridge so the cursor can travel from label to panel */
header.svh .svh-panel::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 14px; }

header.svh .svh-item.is-open > .svh-panel {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity .15s, transform .15s;
}
header.svh .svh-item.is-open > .svh-row .svh-toggle svg { transform: rotate(180deg); }

@media (hover: hover) and (min-width: 1101px) {
    header.svh .svh-item.has-panel:hover > .svh-panel {
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: opacity .15s, transform .15s;
    }
    header.svh .svh-item.has-panel:hover > .svh-row .svh-link,
    header.svh .svh-item.has-panel:hover > .svh-row .svh-toggle { color: var(--svh-hover); }
}

header.svh .svh-col { display: flex; flex-direction: column; gap: 22px; }
header.svh .svh-group-title {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 10px;
    color: var(--svh-text);
}
header.svh .svh-group-title a:hover { color: var(--svh-hover); }
header.svh .svh-group-toggle,
header.svh .svh-group-toggle:hover,
header.svh .svh-group-toggle:focus { display: none; }
header.svh .svh-links { display: flex; flex-direction: column; gap: 8px; }
header.svh .svh-links a {
    display: inline-block;
    max-width: 190px;
    font-size: 15px;
    color: var(--svh-text);
    transition: color .15s;
}
header.svh .svh-links a:hover,
header.svh .svh-links a[aria-current="page"] { color: var(--svh-hover); }

/* ---------- Actions ---------- */
header.svh .svh-actions { display: flex; align-items: center; gap: 20px; flex-shrink: 0; }

/* Search: Relevanssi markup (form.search-form > label > input.search-field + input.search-submit) */
header.svh .svh-search {
    position: relative;
    display: flex;
    align-items: center;
    width: 200px;
    height: 52px;
    margin: 0;
    padding: 0 7px 0 20px;
    background: #fff;
    border: 1px solid var(--svh-border);
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(14, 58, 92, 0.06);
}
header.svh .svh-search:focus-within { border-color: var(--svh-text); }
header.svh .svh-search label { flex: 1 1 auto; min-width: 0; height: 100%; }
/* !important: the Elementor kit's input:focus:not(...) rule outranks any sane selector */
header.svh .svh-search input.search-field,
header.svh .svh-search input.search-field:focus {
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    font: inherit !important;
    color: var(--svh-text) !important;
}
header.svh .svh-search input.search-field::placeholder { color: #8a8a8a; opacity: 1; }
header.svh .svh-search input.search-field::-webkit-search-cancel-button { display: none; }

header.svh .svh-search input.search-submit,
header.svh .svh-search input.search-submit:hover,
header.svh .svh-search input.search-submit:focus {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--svh-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='18' height='18'%3E%3Ccircle cx='11' cy='11' r='7' fill='none' stroke='%23fff' stroke-width='2'/%3E%3Cpath d='M20 20l-4-4' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / 18px no-repeat;
    color: transparent;
    font-size: 0;
    box-shadow: none;
    cursor: pointer;
    transition: background-color .15s;
}
header.svh .svh-search input.search-submit:hover { background-color: var(--svh-accent-hover); }

header.svh .svh-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 5;
}

header.svh .svh-account,
header.svh .svh-account:hover,
header.svh .svh-account:focus {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1.5px solid var(--svh-text);
    border-radius: 50%;
    color: var(--svh-text);
    transition: background-color .15s, color .15s;
}
header.svh .svh-account:hover { background: var(--svh-text); color: #fff; }

header.svh .svh-cta,
header.svh .svh-cta:hover,
header.svh .svh-cta:focus {
    display: inline-flex;
    align-items: center;
    padding: 13px 22px;
    border-radius: 999px;
    background: var(--svh-accent);
    color: var(--svh-text);
    font-weight: 600;
    white-space: nowrap;
    transition: background-color .15s;
}
header.svh .svh-cta:hover { background: var(--svh-accent-hover); }

header.svh .svh-burger,
header.svh .svh-burger:hover,
header.svh .svh-burger:focus { display: none; }
header.svh .svh-burger-close { display: none; }

/* ---------- Tighter desktop ---------- */
@media (max-width: 1360px) {
    header.svh .svh-inner { gap: 20px; }
    header.svh .svh-menu { gap: 18px; }
    header.svh .svh-actions { gap: 14px; }
    header.svh .svh-search { width: 160px; }
}

/* =========================================
   Mobile / tablet: drawer
   ========================================= */
@media (max-width: 1100px) {
    header.svh .svh-inner { justify-content: space-between; padding: 6px 16px 8px; }
    header.svh .svh-logo img { width: 100px; }
    /* Privat/Företag, the account link and Boka tid live in the drawer on mobile */
    header.svh .svh-brand .svh-audience,
    header.svh .svh-actions .svh-account,
    header.svh .svh-actions .svh-cta,
    header.svh .svh-actions-search { display: none; }
    header.svh .svh-actions { margin-left: auto; }

    header.svh .svh-burger,
    header.svh .svh-burger:hover,
    header.svh .svh-burger:focus {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        margin-right: -8px;
        color: var(--svh-text);
    }
    header.svh.is-drawer-open .svh-burger-open { display: none; }
    header.svh.is-drawer-open .svh-burger-close { display: inline; }

    /* Open drawer sits above floating widgets (Varden chat iframe is z-index 9999)
       but stays below Cookiebot's consent dialog (2147483630+) */
    header.svh.is-drawer-open { z-index: 2147483000; }
    /* Cookiebot's floating settings icon would still cover the drawer buttons; hide it only while the menu is open */
    html.svh-lock #CookiebotWidget { display: none !important; }

    header.svh .svh-drawer {
        position: fixed;
        top: var(--svh-drawer-top);
        left: 0;
        right: 0;
        bottom: 0;
        display: none;
        flex-direction: column;
        justify-content: flex-start;
        /* extra bottom room so floating chat bubbles don't cover the drawer buttons */
        padding: 16px 16px 110px;
        background: var(--svh-panel-bg);
        border-top: 1px solid var(--svh-border);
        overflow-y: auto;
        overscroll-behavior: contain;
    }
    header.svh.is-drawer-open .svh-drawer { display: flex; }

    header.svh .svh-drawer-audience { display: block; margin-bottom: 16px; }
    header.svh .svh-drawer-audience .svh-audience { gap: 4px; margin: 0; }
    header.svh .svh-drawer-audience .svh-audience-link,
    header.svh .svh-drawer-audience .svh-audience-link:hover,
    header.svh .svh-drawer-audience .svh-audience-link:focus { padding: 4px 12px 6px; font-size: 15px; }

    header.svh .svh-drawer-search { display: block; margin-bottom: 8px; }
    header.svh .svh-drawer-search .svh-search { width: 100%; }

    header.svh .svh-drawer-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 24px;
    }
    header.svh .svh-drawer-btn,
    header.svh .svh-drawer-btn:hover,
    header.svh .svh-drawer-btn:focus {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 14px 20px;
        border-radius: 999px;
        font-weight: 600;
        color: var(--svh-text);
        transition: background-color .15s, color .15s;
    }
    header.svh .svh-drawer-btn-account,
    header.svh .svh-drawer-btn-account:focus { border: 1.5px solid var(--svh-text); background: none; }
    header.svh .svh-drawer-btn-account:hover { border: 1.5px solid var(--svh-text); background: var(--svh-text); color: #fff; }
    header.svh .svh-drawer-btn-cta,
    header.svh .svh-drawer-btn-cta:focus { background: var(--svh-accent); }
    header.svh .svh-drawer-btn-cta:hover { background: var(--svh-accent-hover); }

    header.svh .svh-menu { flex-direction: column; align-items: stretch; gap: 0; }
    header.svh .svh-item { border-bottom: 1px solid var(--svh-border); }
    header.svh .svh-row { justify-content: space-between; padding: 0; }
    header.svh .svh-link,
    header.svh a.svh-link:hover,
    header.svh a.svh-link:focus { flex: 1 1 auto; padding: 15px 0; font-size: 16px; }
    header.svh .svh-toggle,
    header.svh .svh-toggle:hover,
    header.svh .svh-toggle:focus { justify-content: center; width: 44px; height: 44px; margin-right: -10px; }
    header.svh .svh-toggle svg { width: 20px; height: 20px; }

    header.svh .svh-panel {
        position: static;
        display: none;
        width: auto;
        max-width: none;
        padding: 0 0 16px 12px;
        background: none;
        border-radius: 0;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: none;
    }
    header.svh .svh-panel::before { display: none; }
    header.svh .svh-item.is-open > .svh-panel { display: block; }

    header.svh .svh-col { gap: 16px; }
    header.svh .svh-col + .svh-col { margin-top: 16px; }
    header.svh .svh-group-title { font-size: 16px; margin-bottom: 6px; }
    header.svh .svh-links { gap: 0; }
    header.svh .svh-links a { display: block; max-width: none; padding: 6px 0; }

    /* Region fold-outs (menu items with 'collapse_groups') */
    header.svh .svh-panel.has-collapsible-groups .svh-col { gap: 0; }
    header.svh .svh-panel.has-collapsible-groups .svh-col + .svh-col { margin-top: 0; }
    header.svh .svh-group.is-collapsible > .svh-group-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        cursor: pointer;
    }
    header.svh .svh-group.is-collapsible .svh-group-title { margin: 0; padding: 8px 0; }
    header.svh .svh-group-toggle,
    header.svh .svh-group-toggle:hover,
    header.svh .svh-group-toggle:focus {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 40px;
        margin-right: -10px;
        color: var(--svh-text);
    }
    header.svh .svh-group-toggle svg { display: block; transition: transform .2s; }
    header.svh .svh-group.is-open .svh-group-toggle svg { transform: rotate(180deg); }
    header.svh .svh-group.is-collapsible > .svh-links { display: none; padding: 0 0 8px 12px; }
    header.svh .svh-group.is-collapsible.is-open > .svh-links { display: flex; }
}

@media (max-width: 400px) {
    header.svh .svh-logo img { width: 88px; }
}

html.svh-lock, html.svh-lock body { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
    header.svh *, header.svh *::before, header.svh *::after { transition: none !important; }
}
