/* EventSika — Header compact.
   Navigation, notifications, thèmes et adaptations mobiles. */

#esHeader.es-header {
    display: block;
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 0;
    margin: 0;
    --es-bg: #101629;
    --es-text: #edf2ff;
    --es-muted: #a9b6d0;
    --es-border: #2b3650;
    --es-soft: #211b3e;
    --es-accent: #c4b5fd;
    position: fixed;
    inset: 0 0 auto;
    z-index: 1000;
    background: var(--es-bg);
    color: var(--es-text);
    border-bottom: 1px solid var(--es-border);
    box-shadow: 0 4px 20px rgba(15, 23, 42, .06);
    font: 500 14px/1.5 "Segoe UI", Arial, sans-serif;
}

html[data-theme="light"] #esHeader.es-header {
    --es-bg: #fff;
    --es-text: #172033;
    --es-muted: #52617c;
    --es-border: #e2e7f1;
    --es-soft: #f3efff;
    --es-accent: #6d28d9;
}

.es-header * {
    box-sizing: border-box;
}

.es-header [hidden] {
    display: none !important;
}

.es-header a {
    text-decoration: none;
}

.es-header button,
.es-header summary {
    font: inherit;
}

.es-header-inner {
    width: min(1280px, 94%);
    min-height: 82px;
    margin: auto;
    display: flex;
    align-items: center;
    gap: 22px;
    position: relative;
}

.es-header .es-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    color: var(--es-text);
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -.05em;
    white-space: nowrap;
}

.es-brand img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    flex: none;
}

.es-brand strong {
    color: #a855f7;
}

.es-nav-panel {
    flex: 1;
    min-width: 0;
}

.es-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.es-header .es-nav-link,
.es-disclosure>summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    color: var(--es-muted);
    border-radius: 10px;
    white-space: nowrap;
    cursor: pointer;
    list-style: none;
    border: 1px solid transparent;
}

.es-disclosure>summary::-webkit-details-marker {
    display: none;
}

.es-disclosure>summary::marker {
    content: "";
}

.es-header .es-nav-link:hover,
.es-header .es-nav-link[aria-current="page"],
.es-disclosure>summary:hover,
.es-disclosure[open]>summary {
    background: var(--es-soft);
    color: var(--es-accent);
}

.es-disclosure {
    position: relative;
    flex-shrink: 0;
}

.es-chevron {
    font-size: 9px;
    transition: transform .18s ease;
}

.es-disclosure[open] .es-chevron {
    transform: rotate(180deg);
}

.es-header .es-admin>summary {
    background: var(--es-soft);
    color: var(--es-accent);
    border-color: var(--es-border);
}

.es-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    width: 270px;
    max-width: calc(100vw - 28px);
    max-height: calc(100vh - 115px);
    max-height: calc(100dvh - 115px);
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--es-border);
    border-radius: 16px;
    background: var(--es-bg);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .15);
    z-index: 2;
}

.es-dropdown-right {
    left: auto;
    right: 0;
}

.es-header .es-dropdown a,
.es-header .es-logout {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 12px;
    border: 0;
    border-radius: 9px;
    color: var(--es-text);
    background: transparent;
    text-align: left;
    font-size: 13px;
    line-height: 1.5;
    cursor: pointer;
}

.es-header .es-dropdown a:hover {
    background: var(--es-soft);
    color: var(--es-accent);
}

.es-dropdown a>i,
.es-logout>i {
    width: 18px;
    text-align: center;
    flex: none;
    color: var(--es-accent);
}

.es-menu-label {
    display: block;
    padding: 9px 12px 7px;
    color: var(--es-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .12em;
}

.es-separator {
    height: 1px;
    background: var(--es-border);
    margin: 8px 4px;
}

.es-header .es-dropdown a.es-highlight {
    color: var(--es-accent);
    background: var(--es-soft);
}

.es-avatar {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    background: var(--es-soft);
    color: var(--es-accent);
    border-radius: 50%;
    font-size: 12px;
    font-weight: 750;
}

.es-disclosure.es-account>summary {
    padding: 6px 10px;
    border-color: var(--es-border);
}

/* Évite qu'un nom de compte long élargisse le header. */
.es-header .es-account-name {
    display: block;
    min-width: 0;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.es-account-info {
    padding: 10px 12px 14px;
    overflow-wrap: anywhere;
}

.es-account-info strong,
.es-account-info span,
.es-account-info small {
    display: block;
}

.es-account-info strong {
    color: var(--es-text);
}

.es-account-info span {
    color: var(--es-muted);
    font-size: 12px;
    margin: 5px 0;
}

.es-account-info small {
    font-size: 11px;
    color: var(--es-accent);
}

.es-logout-form {
    margin: 0;
}

.es-header .es-logout {
    color: #fca5a5;
}

html[data-theme="light"] .es-header .es-logout {
    color: #b91c1c;
}

.es-header .es-logout:hover {
    background: var(--es-soft);
}

.es-quick-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.es-header .es-icon-button {
    position: relative;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    flex: none;
    border: 1px solid var(--es-border);
    border-radius: 11px;
    background: var(--es-bg);
    color: var(--es-text);
    cursor: pointer;
}

.es-header .es-icon-button:hover {
    background: var(--es-soft);
    color: var(--es-accent);
}

.es-header .es-mobile-toggle {
    display: none;
}

.es-header :is(a, button, summary):focus-visible {
    outline: 3px solid #a78bfa;
    outline-offset: 3px;
}

.es-auth {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-left: 12px;
}

.es-header .es-login,
.es-header .es-register {
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 13px;
    white-space: nowrap;
}

.es-header .es-login {
    border: 1px solid var(--es-border);
    color: var(--es-accent);
}

.es-header .es-register {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #6d28d9;
    color: #fff;
}

.es-header .es-register:hover {
    background: #5b21b6;
}

.es-header .es-notifications {
    position: relative;
}

.es-header .notification-badge {
    position: absolute;
    right: -5px;
    top: -5px;
    display: grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 20px;
    background: #ef4444;
    color: #fff;
    font: 700 10px/1 "Segoe UI", sans-serif;
    border: 2px solid var(--es-bg);
}

.es-header .notification-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 18px);
    width: min(360px, calc(100vw - 28px));
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--es-border);
    border-radius: 16px;
    background: var(--es-bg);
    color: var(--es-text);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .16);
}

.es-header .notification-dropdown-header {
    padding: 18px;
    border-bottom: 1px solid var(--es-border);
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.es-header .notification-dropdown-header h3 {
    margin: 0;
    font-size: 14px;
    color: var(--es-text);
}

.es-header .notification-dropdown-header span {
    font-size: 11px;
    color: var(--es-muted);
}

.es-header .notification-dropdown-list {
    max-height: min(340px, 55dvh);
    overflow-y: auto;
}

.es-header .notification-dropdown-item {
    display: flex;
    align-items: start;
    gap: 10px;
    padding: 16px;
    border-bottom: 1px solid var(--es-border);
}

.es-header .notification-dropdown-item.unread {
    background: var(--es-soft);
}

.es-header .notification-dropdown-icon {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: none;
    border-radius: 9px;
    background: var(--es-soft);
    color: var(--es-accent);
}

.es-header .notification-dropdown-body {
    min-width: 0;
    overflow-wrap: anywhere;
}

.es-header .notification-dropdown-body strong {
    color: var(--es-text);
    font-size: 12px;
}

.es-header .notification-dropdown-body p {
    font-size: 12px;
    color: var(--es-muted);
    margin: 5px 0;
    line-height: 1.6;
}

.es-header .notification-dropdown-body small {
    font-size: 10px;
    color: var(--es-muted);
}

.es-header .notification-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #8b5cf6;
    flex: none;
    margin-top: 7px;
}

.es-header .notification-dropdown-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    color: var(--es-accent);
    font-size: 12px;
    background: var(--es-bg);
}

.es-header .notification-dropdown-empty {
    text-align: center;
    padding: 30px;
    color: var(--es-muted);
}

.es-header .notification-dropdown-empty p {
    margin: 10px 0 0;
}

@media (max-width:1060px) {
    .es-header-inner {
        min-height: 74px;
        width: 94%;
        gap: 12px;
        flex-wrap: wrap;
    }

    .es-header .es-brand {
        margin-right: auto;
    }

    .es-header .es-brand img {
        width: 38px;
        height: 38px;
    }

    .es-quick-actions {
        margin-left: auto;
    }

    .es-nav-panel {
        flex: 1 0 100%;
        order: 3;
        border-top: 1px solid var(--es-border);
        padding: 10px 0 16px;
        max-height: calc(100vh - 80px);
        max-height: calc(100dvh - 80px);
        overflow-y: auto;
    }

    .es-nav {
        flex-direction: column;
        align-items: stretch;
        gap: 5px;
    }

    .es-header.es-ready .es-nav-panel {
        display: none;
    }

    .es-header.es-ready.es-mobile-open .es-nav-panel {
        display: block;
    }

    .es-header.es-ready .es-mobile-toggle {
        display: grid;
    }

    .es-disclosure>summary,
    .es-header .es-nav-link {
        padding: 13px 14px;
    }

    .es-disclosure>summary {
        justify-content: space-between;
    }

    .es-disclosure>summary .es-chevron {
        margin-left: auto;
    }

    .es-dropdown {
        position: static;
        width: 100%;
        max-height: none;
        border-radius: 12px;
        margin: 5px 0 10px;
        box-shadow: none;
        background: var(--es-bg);
    }

    .es-header .es-dropdown a {
        padding: 12px 16px;
    }

    .es-auth {
        margin: 10px 0 0;
    }

    .es-auth a {
        flex: 1;
        text-align: center;
    }

    .es-header .es-register {
        justify-content: center;
    }

    .es-disclosure.es-account>summary {
        padding: 9px 14px;
    }

    .es-account-name {
        margin-right: auto;
    }

    .es-header .notification-dropdown {
        position: fixed;
        right: 3vw;
        top: 70px;
    }
}

@media (max-width:380px) {
    .es-header .es-brand {
        font-size: 18px;
        gap: 5px;
    }

    .es-header .es-brand img {
        width: 33px;
        height: 33px;
    }

    .es-header .es-icon-button {
        width: 35px;
        height: 35px;
    }

    .es-quick-actions {
        gap: 5px;
    }
}

@media (prefers-reduced-motion:reduce) {
    .es-chevron {
        transition: none;
    }
}

.es-header .es-current-group,
.es-header .es-dropdown a[aria-current="page"] {
    background: var(--es-soft);
    color: var(--es-accent);
    font-weight: 700;
}

/* Mobile : colonnes latérales égales pour un logo réellement centré. */
@media (max-width: 1060px) {
    #esHeader .es-header-inner {
        display: grid;
        grid-template-columns: 80px minmax(0, 1fr) 80px;
        grid-template-rows: minmax(74px, auto);
        column-gap: 4px;
        row-gap: 0;
    }

    #esHeader .es-mobile-toggle {
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
    }

    #esHeader .es-brand {
        grid-column: 2;
        grid-row: 1;
        justify-self: center;
        min-width: 0;
        margin: 0;
        gap: 6px;
        font-size: 20px;
    }

    #esHeader .es-brand img {
        width: 30px;
        height: 30px;
    }

    #esHeader .es-quick-actions {
        grid-column: 3;
        grid-row: 1;
        justify-self: end;
        margin: 0;
        gap: 4px;
    }

    #esHeader .es-icon-button {
        width: 38px;
        height: 40px;
        border-radius: 10px;
    }

    #esHeader .es-nav-panel {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
        min-width: 0;
    }

    #esHeader .notification-dropdown {
        top: 74px;
        right: 3vw;
    }
}

@media (max-width: 380px) {
    #esHeader .es-header-inner {
        grid-template-columns: 76px minmax(0, 1fr) 76px;
    }

    #esHeader .es-brand {
        font-size: 18px;
        gap: 4px;
    }

    #esHeader .es-brand img {
        width: 27px;
        height: 27px;
    }

    #esHeader .es-icon-button {
        width: 36px;
    }
}