/* =========================================================
   CartoSoins — Header shortcode [cartosoins_header]
   Barre blanche : burger 9-dots / logo / module compte
   Drawer gauche : Primary Menu (#121234, blanc)
   Drawer droit  : User menu  (#121234, blanc, accents #f48e00)
   ========================================================= */

:root {
    --cso-hd-bg:        rgba(255, 255, 255, 0.1);
    --cso-hd-ink:       #121234;
    --cso-hd-orange:    #f48e00;
    --cso-hd-orange-dk: #d77c00;
    --cso-hd-drawer-bg: #121234;
    --cso-hd-drawer-fg: #ffffff;
    --cso-hd-shadow:    0 2px 14px rgba(255, 255, 255, 0.08);
    --cso-hd-h:         55px;
}

/* ── Barre principale ──────────────────────────────── */
.cso-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    width: 100%;
    height: var(--cso-hd-h);
    padding: 0 18px;
    background: linear-gradient(45deg,   rgba(255, 255, 255, 0.05) 20%,   rgba(255, 255, 255, 0.75) 50%,   rgba(255, 255, 255, 0.05) 100%);
   
    backdrop-filter: blur(14px);
    box-sizing: border-box;
    font-family: inherit;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.cso-header > .cso-hd-burger  { justify-self: start; }
.cso-header > .cso-hd-logo    { justify-self: center; }
.cso-header > .cso-hd-account { justify-self: end; }

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

/* ── Burger 9-dots ─────────────────────────────────── */
.cso-hd-burger {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--cso-hd-ink);
    border-radius: 10px;
    cursor: pointer;
    transition: background-color .2s ease, transform .2s ease;
}
.cso-hd-burger:hover {
    background: rgba(251, 251, 252, 0.06);
}
.cso-hd-burger:focus-visible {
    outline: 2px solid var(--cso-hd-orange);
    outline-offset: 2px;
}

.cso-hd-dots {
    display: grid;
    grid-template-columns: repeat(3, 4px);
    grid-template-rows:    repeat(3, 4px);
    gap: 4px;
    transition: transform .35s cubic-bezier(.5,.1,.3,1.3);
    transform-origin: center;
}
.cso-hd-dot {
    width: 4px;
    height: 4px;
    background:white;
    border-radius: 50%;
    transition: transform .25s ease, background-color .25s ease;
}

/* Hover : léger pop des dots */
.cso-hd-burger:hover .cso-hd-dots {
    transform: rotate(15deg) scale(1.05);
}
.cso-hd-burger:hover .cso-hd-dot {
    transform: scale(1.15);
}

/* Ouvert : rotation + accent orange */
.cso-hd-burger[aria-expanded="true"] .cso-hd-dots {
    transform: rotate(45deg) scale(.95);
}
.cso-hd-burger[aria-expanded="true"] .cso-hd-dot {
    background: var(--cso-hd-orange);
}

/* ── Logo (centré) ─────────────────────────────────── */
.cso-hd-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    text-decoration: none;
}
.cso-hd-logo img {
    display: block;
    height: 44px;
    max-height: calc(var(--cso-hd-h) - 16px);
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

/* ── Module compte (droite) ────────────────────────── */
.cso-hd-account {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 28px;
    padding: 0 14px 0 0;
    border: 0;
    border-radius: 999px;
    background: var(--cso-hd-orange);
    color: #fff;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .2s ease, transform .15s ease, box-shadow .2s ease;
    box-shadow: 0 2px 6px rgba(244,142,0,.25);
    max-width: 220px;
}
.cso-hd-account:hover {
    background: var(--cso-hd-orange-dk);
    color: #fff;
    box-shadow: 0 4px 10px rgba(244,142,0,.35);
}
.cso-hd-account:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}
.cso-hd-account--login {
    padding: 0 16px;
    gap: 8px;
}
.cso-hd-account-icon {
    flex: 0 0 auto;
    color: #fff;
}
.cso-hd-account-label {
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
    line-height: 1;
    font-size: 14px;
}

/* Avatar dans le bouton — touche les bords du bouton (height 36px) */
.cso-hd-avatar {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255,255,255,.25);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    line-height: 1;
}
.cso-hd-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.cso-hd-avatar--lg {
    width: 56px;
    height: 56px;
    font-size: 22px;
    border-color: var(--cso-hd-orange);
}

/* ── Backdrop ──────────────────────────────────────── */
.cso-hd-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(18,18,52,.55);
    z-index: 99998;
    opacity: 0;
    transition: opacity .25s ease;
    pointer-events: none;
}
.cso-hd-backdrop[data-open="true"] {
    opacity: 1;
    pointer-events: auto;
}

/* ── Drawers ───────────────────────────────────────── */
.cso-hd-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 320px;
    max-width: 88vw;
    background: var(--cso-hd-drawer-bg);
    color: var(--cso-hd-drawer-fg);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    transition: transform .32s cubic-bezier(.4,.05,.2,1);
    box-shadow: 0 0 30px rgba(0,0,0,.4);
}
.cso-hd-drawer[hidden] {
    display: flex;
}
.cso-hd-drawer--left  { left: 0;  transform: translateX(-105%); }
.cso-hd-drawer--right { right: 0; transform: translateX(105%); }

.cso-hd-drawer[data-open="true"] {
    transform: translateX(0);
}

.cso-hd-drawer-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: rgba(255,255,255,.08);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color .2s ease;
}
.cso-hd-drawer--left .cso-hd-drawer-close { right: auto; left: 14px; }
.cso-hd-drawer-close:hover { background: rgba(255,255,255,.18); }

.cso-hd-drawer-inner {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 70px 22px 28px;
    -webkit-overflow-scrolling: touch;
}

/* En-tête user dans le drawer droit */
.cso-hd-drawer-userhead {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 0 18px;
    margin: 0 0 18px;
    border-bottom: 1px solid rgba(255,255,255,.12);
}
.cso-hd-drawer-username {
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.25;
    word-break: break-word;
}

/* ── Menus WP ──────────────────────────────────────── */
.cso-hd-nav {
    display: block;
}
.cso-hd-drawer ul,
.cso-hd-drawer ol,
.cso-hd-drawer li,
.cso-hd-nav ul,
.cso-hd-nav li,
.cso-hd-menu,
.cso-hd-menu li,
.cso-hd-menu .sub-menu,
.cso-hd-menu .sub-menu li {
    list-style: none !important;
    list-style-type: none !important;
    list-style-image: none !important;
    background-image: none !important;
}
.cso-hd-drawer ul,
.cso-hd-drawer ol {
    margin: 0 !important;
    padding: 0 !important;
}
.cso-hd-drawer li {
    padding-left: 0 !important;
    text-indent: 0 !important;
}
.cso-hd-drawer li::before,
.cso-hd-drawer li::marker,
.cso-hd-nav li::before,
.cso-hd-nav li::marker,
.cso-hd-menu li::before,
.cso-hd-menu li::marker {
    content: none !important;
    display: none !important;
    background: none !important;
}
.cso-hd-menu > li {
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.cso-hd-menu > li:last-child { border-bottom: 0; }

.cso-hd-menu a {
    display: block;
    padding: 14px 4px;
    color: #fff;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.3;
    transition: color .2s ease, padding-left .2s ease;
}
.cso-hd-menu a:hover,
.cso-hd-menu .current-menu-item > a,
.cso-hd-menu .current_page_item > a {
    color: var(--cso-hd-orange);
    padding-left: 8px;
}

.cso-hd-menu .sub-menu {
    padding-left: 14px;
    margin-bottom: 6px;
    border-left: 2px solid rgba(255,255,255,.12);
}
.cso-hd-menu .sub-menu a {
    padding: 10px 4px;
    font-size: 14px;
    font-weight: 400;
    color: rgba(255,255,255,.85);
}

.cso-hd-menu-empty {
    color: rgba(255,255,255,.65);
    font-style: italic;
    font-size: 14px;
    margin: 0;
}

/* ── Logout link (drawer droit) ────────────────────── */
.cso-hd-logout {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 22px;
    padding: 10px 16px;
    border-radius: 999px;
    background: var(--cso-hd-orange);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color .2s ease;
}
.cso-hd-logout:hover {
    background: var(--cso-hd-orange-dk);
    color: #fff;
}

/* ── Body lock quand un drawer est ouvert ──────────── */
body.cso-hd-lock {
    overflow: hidden;
}

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 768px) {
    :root { --cso-hd-h: 60px; }
    .cso-header { padding: 0 12px; gap: 8px; }

    .cso-hd-logo img { height: 38px; }

    .cso-hd-burger { width: 40px; height: 40px; }

    /* Mobile : avatar touche toujours les bords */
    .cso-hd-account {
        height: 32px;
        padding: 0 10px 0 0;
        gap: 8px;
        max-width: 160px;
    }
    .cso-hd-account--login { padding: 0 12px; }
    .cso-hd-avatar { width: 32px; height: 32px; }
    .cso-hd-account-label { max-width: 90px; font-size: 13px; }
}

@media (max-width: 480px) {
    .cso-hd-logo img { height: 32px; }
    /* Sur très petits écrans : avatar seul (login garde son icone+texte court) */
    .cso-hd-account--user .cso-hd-account-label { display: none; }
    .cso-hd-account--user { padding: 0 4px; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
    .cso-hd-dots,
    .cso-hd-dot,
    .cso-hd-drawer,
    .cso-hd-backdrop,
    .cso-hd-account,
    .cso-hd-burger { transition: none; }
}
