/* ==========================================================
   DigyFix — header
   Logo links, navigatie in het midden, account rechts.
   Op telefoon: logo en een burgerknop met een uitklapmenu.
   Werking: public/js/layouts/header.js
   ========================================================== */

.site-header {
    --header-height: 68px;
    --header-accent: #f3c332;

    position: relative;
    z-index: 50;
    border-bottom: 1px solid var(--site-border);
    background: var(--site-surface);
    font-family: 'Archivo', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

.header-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
    width: min(1200px, calc(100% - 48px));
    height: var(--header-height);
    margin: 0 auto;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.site-header a:focus-visible,
.site-header button:focus-visible {
    outline: 2px solid var(--site-link);
    outline-offset: 3px;
}

/* Logo */
.logo {
    display: inline-flex;
    justify-self: start;
    align-items: center;
    border-radius: 6px;
}

.logo img {
    display: block;
    width: auto;
    height: var(--logo-height);
    max-width: 160px;
    object-fit: contain;
}

/* Hoofdnavigatie */
.header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.header-nav a {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 14px;
    border-radius: 8px;
    color: var(--site-muted);
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
    transition: color 160ms ease, background 160ms ease;
}

.header-nav a:hover {
    background: #ffffff0d;
    color: var(--site-text);
}

.header-nav a[aria-current='page'] {
    color: var(--site-text);
}

/* Geel streepje onder de huidige pagina */
.header-nav a[aria-current='page']::after {
    content: '';
    position: absolute;
    right: 14px;
    bottom: 2px;
    left: 14px;
    height: 2px;
    border-radius: 2px;
    background: var(--header-accent);
}

/* Account: inlogknop en accountknop staan op exact dezelfde plek */
.header-account {
    display: flex;
    justify-self: end;
    align-items: center;
}

.button-header {
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 18px;
    border: 1px solid var(--site-border);
    border-radius: 8px;
    background: var(--site-surface-soft);
    color: var(--site-text);
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    transition: border-color 160ms ease, background 160ms ease;
}

.button-header:hover,
.button-header[aria-current='page'] {
    border-color: #55627a;
    background: #333c4a;
}

.account-menu {
    position: relative;
}

.account-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 40px;
    padding: 0 12px 0 16px;
    border: 1px solid var(--site-border);
    border-radius: 8px;
    background: var(--site-surface-soft);
    color: var(--site-text);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease;
}

.account-button:hover,
.account-button[aria-expanded='true'] {
    border-color: #55627a;
    background: #333c4a;
}

.account-name {
    max-width: 200px;
    overflow: hidden;
    color: var(--site-muted);
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-name strong {
    color: var(--site-text);
    font-weight: 650;
}

.account-chevron {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    color: var(--site-muted);
    transition: transform 160ms ease;
}

.account-button[aria-expanded='true'] .account-chevron {
    transform: rotate(180deg);
}

/* Uitklapmenu van het account */
.account-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 260px;
    padding: 6px;
    border: 1px solid var(--site-border);
    border-radius: 12px;
    background: var(--site-surface);
    box-shadow: 0 16px 40px -12px #00000080;
}

.account-dropdown[hidden] {
    display: none;
}

.account-dropdown-head {
    display: grid;
    gap: 2px;
    padding: 10px 12px 12px;
    border-bottom: 1px solid var(--site-border);
    margin-bottom: 6px;
}

.account-dropdown-head strong {
    color: var(--site-text);
    font-size: 0.9rem;
}

.account-dropdown-head span {
    overflow: hidden;
    color: var(--site-muted);
    font-size: 0.8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-dropdown nav {
    display: grid;
}

.account-dropdown nav a,
.account-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 38px;
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--site-text);
    font: inherit;
    font-size: 0.9rem;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.account-dropdown nav a:hover,
.account-logout:hover {
    background: var(--site-surface-soft);
}

.account-dropdown form {
    margin: 6px 0 0;
    padding-top: 6px;
    border-top: 1px solid var(--site-border);
}

.account-logout {
    color: #fca5a5;
}

.account-logout svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Burgerknop: alleen op telefoon en tablet */
.menu-toggle {
    display: none;
    justify-self: end;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--site-border);
    border-radius: 8px;
    background: var(--site-surface-soft);
    color: var(--site-text);
    cursor: pointer;
}

.menu-toggle-lines {
    position: relative;
    display: block;
    width: 18px;
    height: 12px;
}

.menu-toggle-lines span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform 200ms ease, opacity 200ms ease, top 200ms ease;
}

.menu-toggle-lines span:nth-child(1) { top: 0; }
.menu-toggle-lines span:nth-child(2) { top: 5px; }
.menu-toggle-lines span:nth-child(3) { top: 10px; }

/* Open: de drie streepjes worden een kruisje */
.menu-toggle[aria-expanded='true'] .menu-toggle-lines span:nth-child(1) {
    top: 5px;
    transform: rotate(45deg);
}

.menu-toggle[aria-expanded='true'] .menu-toggle-lines span:nth-child(2) {
    opacity: 0;
}

.menu-toggle[aria-expanded='true'] .menu-toggle-lines span:nth-child(3) {
    top: 5px;
    transform: rotate(-45deg);
}

/* Menu voor telefoon */
.mobile-menu {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    max-height: calc(100dvh - var(--header-height));
    overflow-y: auto;
    padding: 12px 20px 24px;
    border-bottom: 1px solid var(--site-border);
    background: var(--site-surface);
    box-shadow: 0 24px 40px -16px #00000099;
}

.mobile-menu[hidden] {
    display: none;
}

.mobile-menu-links {
    display: grid;
}

.mobile-menu-links a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    border-bottom: 1px solid var(--site-border);
    color: var(--site-text);
    font-size: 1.05rem;
    font-weight: 600;
    text-decoration: none;
}

.mobile-menu-links a[aria-current='page'] {
    color: var(--header-accent);
}

.mobile-menu-links svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: var(--site-muted);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mobile-menu-account {
    display: grid;
    gap: 12px;
    margin-top: 20px;
}

.mobile-menu-user {
    display: grid;
    gap: 2px;
    min-width: 0;
    padding: 14px 16px;
    border: 1px solid var(--site-border);
    border-radius: 10px;
    background: var(--site-surface-soft);
}

.mobile-menu-user strong {
    color: var(--site-text);
    font-size: 0.95rem;
}

.mobile-menu-user small {
    overflow: hidden;
    color: var(--site-muted);
    font-size: 0.8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-menu-sub {
    display: grid;
}

.mobile-menu-sub a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 4px;
    color: var(--site-text);
    font-size: 0.95rem;
    text-decoration: none;
}

.mobile-menu-account form {
    margin: 0;
}

.mobile-menu-login,
.mobile-menu-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    border-radius: 10px;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
}

.mobile-menu-login {
    border: 0;
    background: var(--header-accent);
    color: #0f1b2d;
}

.mobile-menu-logout {
    border: 1px solid var(--site-border);
    background: transparent;
    color: #fca5a5;
}

.mobile-menu-register {
    color: var(--site-muted);
    font-size: 0.9rem;
    text-align: center;
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* Telefoon en tablet: burgermenu in plaats van de losse links */
@media (max-width: 960px) {
    .header-inner {
        grid-template-columns: 1fr auto;
        width: calc(100% - 32px);
    }

    .header-nav,
    .header-account {
        display: none;
    }

    .menu-toggle {
        display: inline-flex;
    }
}

@media (min-width: 961px) {
    .mobile-menu {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .site-header * {
        transition: none !important;
    }
}
