/* @h1 HEADER PUBLIC SIM */

/* @h2 CANDIDAT À MUTUALISATION — style.css — Variables et fondations */
:root {
    --sim-header-max: 1600px;
    --sim-header-height: 76px;
    --sim-ink: #202522;
    --sim-muted: #6f7772;
    --sim-line: #e5e9e6;
    --sim-surface: #ffffff;
    --sim-soft: #f4f6f4;
    --sim-accent: #4d8b62;
    --sim-accent-dark: #326846;
    --sim-radius: 18px;
    --sim-shadow: 0 22px 60px rgba(24, 35, 28, .14);
}

.sim-header *,
.sim-header *::before,
.sim-header *::after {
    box-sizing: border-box;
}

.sim-header {
    position: relative;
    z-index: 1000;
    width: 100%;
    color: var(--sim-ink);
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--sim-line);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.sim-header a {
    color: inherit;
    text-decoration: none;
}

.sim-header button {
    font: inherit;
}

.sim-header__inner {
    width: min(var(--sim-header-max), calc(100% - 40px));
    min-height: var(--sim-header-height);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 32px;
}

/* @h2 Identité SIM */
.sim-header__brand {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #171b18;
}

.sim-header__logo {
    height: 40px;
}

.sim-header__wordmark {
    font-size: 25px;
    font-weight: 800;
    letter-spacing: -.05em;
}

/* @h2 Navigation publique */
.sim-header__nav {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.sim-header__nav-link {
    min-height: 42px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 0;
    border-radius: 10px;
    color: #454c47;
    background: transparent;
    font-size: 14px;
    font-weight: 650;
    white-space: nowrap;
    cursor: pointer;
    transition: color .18s ease, background .18s ease;
}

.sim-header__nav-link:hover,
.sim-header__nav-link:focus-visible,
.sim-header__nav-trigger[aria-expanded="true"] {
    color: var(--sim-ink);
    background: var(--sim-soft);
    outline: none;
}

.sim-header__nav-trigger svg,
.sim-header__account-trigger > svg {
    width: 10px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    transition: transform .18s ease;
}

.sim-header__nav-trigger[aria-expanded="true"] svg,
.sim-header__account-trigger[aria-expanded="true"] > svg {
    transform: rotate(180deg);
}

/* @h2 Menu déroulant des modules */
.sim-header__dropdown {
    position: relative;
}

.sim-header__mega,
.sim-header__account-menu {
    position: absolute;
    top: calc(100% + 14px);
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-7px);
    transition: opacity .18s ease, transform .18s ease, visibility .18s;
}

.sim-header__dropdown.is-open > .sim-header__mega,
.sim-header__dropdown.is-open > .sim-header__account-menu {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.sim-header__mega {
    left: -120px;
    width: min(760px, calc(100vw - 40px));
    overflow: hidden;
    border: 1px solid var(--sim-line);
    border-radius: var(--sim-radius);
    background: var(--sim-surface);
    box-shadow: var(--sim-shadow);
}

.sim-header__mega-heading {
    padding: 20px 22px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid var(--sim-line);
}

.sim-header__mega-heading strong {
    display: block;
    margin-top: 4px;
    font-size: 22px;
    letter-spacing: -.025em;
}

.sim-header__mega-heading > a,
.sim-header__module-cta {
    color: var(--sim-accent-dark);
    font-size: 13px;
    font-weight: 750;
}

.sim-header__eyebrow {
    color: var(--sim-accent-dark);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.sim-header__mega-grid {
    min-height: 352px;
    display: grid;
    grid-template-columns: .94fr 1.06fr;
}

.sim-header__module-list {
    padding: 12px;
    background: var(--sim-soft);
    border-right: 1px solid var(--sim-line);
}

.sim-header__module-button {
    width: 100%;
    padding: 14px;
    display: block;
    border: 0;
    border-radius: 12px;
    color: var(--sim-ink);
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.sim-header__module-button + .sim-header__module-button {
    margin-top: 3px;
}

.sim-header__module-button span {
    display: block;
    font-size: 15px;
    font-weight: 750;
}

.sim-header__module-button small {
    margin-top: 4px;
    display: block;
    color: var(--sim-muted);
    font-size: 11px;
    line-height: 1.35;
}

.sim-header__module-button:hover,
.sim-header__module-button.is-active {
    background: #fff;
    box-shadow: 0 5px 16px rgba(20, 35, 25, .07);
}

.sim-header__service-panels {
    padding: 28px;
}

.sim-header__service-panel h2 {
    margin: 7px 0 7px;
    font-size: 25px;
    letter-spacing: -.035em;
}

.sim-header__service-panel > p {
    min-height: 40px;
    margin: 0 0 20px;
    color: var(--sim-muted);
    font-size: 13px;
    line-height: 1.5;
}

.sim-header__service-links {
    margin-bottom: 20px;
    display: grid;
    gap: 6px;
}

.sim-header__service-links a {
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    border: 1px solid var(--sim-line);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 650;
    transition: border-color .18s ease, transform .18s ease;
}

.sim-header__service-links a:hover {
    border-color: #b6cbbd;
    transform: translateX(2px);
}

/* @h2 Actions et compte utilisateur */
.sim-header__actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sim-header__icon-button,
.sim-header__mobile-trigger {
    width: 42px;
    height: 42px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--sim-line);
    border-radius: 50%;
    color: var(--sim-ink);
    background: #fff;
}

.sim-header__icon-button svg {
    width: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
}

.sim-header__search-button:disabled {
    opacity: .44;
    cursor: not-allowed;
}

.sim-header__login {
    min-height: 42px;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    color: #fff !important;
    background: var(--sim-ink);
    font-size: 13px;
    font-weight: 750;
}

.sim-header__login:hover {
    background: var(--sim-accent-dark);
}

.sim-header__account-trigger {
    min-height: 46px;
    padding: 4px 10px 4px 5px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--sim-line);
    border-radius: 999px;
    color: var(--sim-ink);
    background: #fff;
    cursor: pointer;
}

.sim-header__avatar {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: var(--sim-accent-dark);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .03em;
}

.sim-header__avatar--large {
    width: 44px;
    height: 44px;
    font-size: 13px;
}

.sim-header__account-name {
    max-width: 128px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.sim-header__account-menu {
    right: 0;
    width: 280px;
    padding: 10px;
    border: 1px solid var(--sim-line);
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--sim-shadow);
}

.sim-header__account-summary {
    padding: 10px 9px 15px;
    display: flex;
    align-items: center;
    gap: 11px;
    border-bottom: 1px solid var(--sim-line);
}

.sim-header__account-summary strong,
.sim-header__account-summary small {
    max-width: 180px;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sim-header__account-summary strong { font-size: 13px; }
.sim-header__account-summary small { margin-top: 3px; color: var(--sim-muted); font-size: 11px; }

.sim-header__account-menu nav,
.sim-header__account-section {
    padding: 8px 0;
}

.sim-header__account-menu nav a,
.sim-header__account-section a,
.sim-header__logout {
    padding: 10px 11px;
    display: block;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 650;
}

.sim-header__account-menu nav a:hover,
.sim-header__account-section a:hover,
.sim-header__logout:hover {
    background: var(--sim-soft);
}

.sim-header__account-section {
    border-top: 1px solid var(--sim-line);
    border-bottom: 1px solid var(--sim-line);
}

.sim-header__account-section > span {
    padding: 5px 11px;
    display: block;
    color: var(--sim-muted);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.sim-header__logout {
    margin-top: 8px;
    color: #8a3535 !important;
}

/* @h2 Navigation tablette et natel */
.sim-header__mobile-trigger,
.sim-header__mobile {
    display: none;
}

.sim-header__mobile-trigger {
    position: relative;
    cursor: pointer;
}

.sim-header__mobile-trigger > span:not(.sim-header__sr-only) {
    position: absolute;
    width: 17px;
    height: 1.5px;
    border-radius: 2px;
    background: currentColor;
    transition: transform .18s ease, opacity .18s ease;
}

.sim-header__mobile-trigger > span:nth-child(1) { transform: translateY(-5px); }
.sim-header__mobile-trigger > span:nth-child(3) { transform: translateY(5px); }
.sim-header__mobile-trigger[aria-expanded="true"] > span:nth-child(1) { transform: rotate(45deg); }
.sim-header__mobile-trigger[aria-expanded="true"] > span:nth-child(2) { opacity: 0; }
.sim-header__mobile-trigger[aria-expanded="true"] > span:nth-child(3) { transform: rotate(-45deg); }

.sim-header__sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 1080px) {
    .sim-header__nav > .sim-header__nav-link:nth-last-child(-n+2) {
        display: none;
    }

    .sim-header__inner {
        gap: 20px;
    }
}

@media (max-width: 860px) {
    .sim-header__inner {
        width: min(100% - 28px, var(--sim-header-max));
    }

    .sim-header__nav,
    .sim-header__search-button {
        display: none;
    }

    .sim-header__mobile-trigger {
        display: inline-grid;
    }

    .sim-header__mobile {
        border-top: 1px solid var(--sim-line);
        background: #fff;
    }

    .sim-header__mobile:not([hidden]) {
        display: block;
    }

    .sim-header__mobile > nav {
        width: min(100% - 28px, var(--sim-header-max));
        max-height: calc(100vh - var(--sim-header-height));
        margin: 0 auto;
        padding: 12px 0 20px;
        overflow-y: auto;
    }

    .sim-header__mobile > nav > a,
    .sim-header__mobile summary {
        min-height: 48px;
        padding: 0 4px;
        display: flex;
        align-items: center;
        border-bottom: 1px solid var(--sim-line);
        font-size: 14px;
        font-weight: 700;
        cursor: pointer;
    }

    .sim-header__mobile summary {
        justify-content: space-between;
        list-style: none;
    }

    .sim-header__mobile summary::after {
        content: '+';
        color: var(--sim-muted);
        font-size: 20px;
        font-weight: 400;
    }

    .sim-header__mobile details[open] summary::after { content: '−'; }

    .sim-header__mobile-submenu {
        padding: 7px 0 10px 15px;
        display: grid;
        gap: 3px;
    }

    .sim-header__mobile-submenu a {
        padding: 10px;
        border-radius: 8px;
        color: var(--sim-muted);
        font-size: 13px;
        font-weight: 650;
    }
}

@media (max-width: 560px) {
    :root { --sim-header-height: 66px; }

    .sim-header__logo { width: 34px; height: 34px; }
    .sim-header__wordmark { font-size: 22px; }
    .sim-header__account-name { display: none; }
    .sim-header__account-trigger { padding-right: 8px; }
    .sim-header__account-menu { position: fixed; top: 72px; right: 14px; width: min(300px, calc(100vw - 28px)); }
    .sim-header__login { padding: 0 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .sim-header *,
    .sim-header *::before,
    .sim-header *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}
