/* ======================================================
   HEADER ESPECIAL – SIGv 2025
   Base estructural + skins por contexto
   Limpio · Escalable · Predecible
====================================================== */


/* ======================================================
   1️⃣ ESTRUCTURA BASE (NO DEPENDE DEL CONTEXTO)
====================================================== */

.header-especial {
    position: sticky;
    top: 0;
    z-index: 9999;
    width: 100%;
    background: var(--header-bg, #ffffff);
    backdrop-filter: saturate(1.05);
    box-shadow:
        0 2px 6px rgba(0,0,0,0.12),
        0 8px 20px rgba(0,0,0,0.08);
}

/* Contenedor principal */
.hm-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    gap: 12px;
    width: 100%;
}


/* ======================================================
   BRAND
====================================================== */

.hm-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.hm-logo {
    height: clamp(56px, 6vw, 76px);
    width: auto;
    object-fit: contain;
    border-radius: 8px;
    padding: 4px;
    background: #ffffff;
}

.hm-titles {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    min-width: 0;
}

.hm-title {
    font-size: clamp(18px, 3vw, 22px);
    font-weight: 700;
    white-space: nowrap;
    color: var(--header-title-color, var(--color-primario));
}

.hm-sub {
    font-size: clamp(11px, 2.5vw, 13px);
    opacity: 0.9;
    color: var(--header-subtitle-color, #7f8c8d);
}


/* ======================================================
   MENÚ
====================================================== */

.hm-nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--header-menu-bg, transparent);
}

.hm-nav a,
.hm-nav span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 14px;
    text-decoration: none;
    transition: background .2s ease, color .2s ease;
    white-space: nowrap;
}

/* Activo */
.hm-nav a.activo {
    font-weight: 600;
}

/* Logout */
.hm-nav .logout {
    background: #c0392b;
    color: #ffffff !important;
}


/* ======================================================
   INFO DE SESIÓN
====================================================== */

.sesion-info {
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    white-space: nowrap;
}


/* ======================================================
   BOTÓN MENÚ (MÓVIL)
====================================================== */

.hm-burger {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    font-size: 18px;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}


/* ======================================================
   RESPONSIVE (MÓVIL)
====================================================== */

@media (max-width: 768px) {

    .hm-burger {
        display: inline-flex;
    }

    .hm-nav {
        display: none;
        position: absolute;
        top: 100%;
        right: 16px;
        flex-direction: column;
        gap: 4px;
        min-width: 240px;
        padding: 10px;
        border-radius: 14px;
        background: var(--header-menu-bg, #ffffff);
        box-shadow: 0 8px 24px rgba(0,0,0,0.25);
        z-index: 10000;
    }

    .hm-nav.open {
        display: flex;
    }

    .hm-nav a,
    .hm-nav span {
        width: 100%;
        justify-content: flex-start;
        border-radius: 10px;
    }
}


/* ======================================================
   2️⃣ SKINS POR CONTEXTO (CLASE EN <body>)
====================================================== */


/* ===== DEFAULT ===== */
body.header-default {
    --header-bg: #ffffff;
    --header-title-color: var(--color-primario);
    --header-subtitle-color: #7f8c8d;
    --header-menu-bg: #ffffff;
}


/* ===== ADMIN ===== */
body.header-admin {
    --header-bg: #1e293b;
    --header-title-color: #f8fafc;
    --header-subtitle-color: #e5e7eb;
    --header-menu-bg: #1e293b;
}


/* ===== FINANZAS ===== */
body.header-finanzas {
    --header-bg: #f8fafc;
    --header-title-color: #2c3e50;
    --header-subtitle-color: #16a085;
    --header-menu-bg: #ffffff;
}


/* ===== OTROS ===== */
body.header-otros {
    --header-bg: #fafafa;
    --header-title-color: #34495e;
    --header-subtitle-color: #7f8c8d;
    --header-menu-bg: #fafafa;
}


/* ======================================================
   PROTECCIÓN UX
====================================================== */

header {
    -webkit-user-select: none;
    user-select: none;
}

.header-especial.scrolled {
    box-shadow:
        0 6px 16px rgba(0,0,0,0.18),
        0 14px 32px rgba(0,0,0,0.12);
}

/* El menú abierto debe quedar por encima del botón flotante de Xenia. */
.header-especial:has(.hm-nav.open) {
    z-index: 10001;
}

/* ======================================================
   🔒 MENÚ – CONTROLADO POR VARIABLES (NO HARD CODE)
====================================================== */


.hm-nav {
    background: var(--header-menu-bg);
}

.hm-nav a,
.hm-nav span {
    color: var(--header-menu-text, inherit);
}

.hm-nav a:hover {
    background: var(--header-menu-hover-bg, rgba(0,0,0,0.06));
}

.hm-nav a.activo {
    background: var(--header-menu-active-bg, var(--color-secundario));
    color: var(--header-menu-active-text, #ffffff);
}
