/* ════════════════════════════════════════════════════════════
   HEADER MODERNO - OVERRIDE CON COLORES ORIGINALES
   Colores: #143B63 (azul institucional) + #A88F1D (dorado)
   ═══════════════════════════════════════════════════════════ */

:root {
    --color-primary: #143B63;
    --color-accent: #A88F1D;
    --tb-bg: #111111;
}

/* ══════════════════════════════════════════════════════════
   TOPBAR - Fondo negro original
   ══════════════════════════════════════════════════════════ */
div[x-show="topbarVisible"],
.header-modern + div {
    background-color: #111111 !important;
    border-bottom: 1px solid rgba(168, 143, 29, 0.2) !important;
}

/* ══════════════════════════════════════════════════════════
   HEADER PRINCIPAL - Gradiente azul original
   ══════════════════════════════════════════════════════════ */
.header-modern {
    background: linear-gradient(180deg, #143B63 0%, #0f2549 100%) !important;
    box-shadow: 0 2px 16px rgba(0,0,0,.35) !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
}

/* Logo - Tamaño del header original */
.header-modern .header-logo {
    display: flex !important;
    align-items: center !important;
    flex-shrink: 0 !important;
}

.header-modern .header-logo img {
    height: auto !important;
    width: 200px !important;
    max-height: 62px !important;
    transition: transform 0.3s ease !important;
}

.header-modern .header-logo:hover img {
    transform: scale(1.02) !important;
}

/* ══════════════════════════════════════════════════════════
   MENÚ DESKTOP - Horizontal con espaciado correcto
   ══════════════════════════════════════════════════════════ */
.nav-modern {
    display: flex !important;
    align-items: center !important;
    gap: 0.3rem !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.nav-modern > li {
    position: relative !important;
    display: inline-block !important;
}

.nav-modern > li > a {
    display: flex !important;
    align-items: center !important;
    gap: 0.3rem !important;
    padding: 0.5rem 0.9rem !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    color: rgba(255, 255, 255, 0.95) !important;
    text-decoration: none !important;
    border-radius: 6px !important;
    transition: color 0.2s ease, background 0.2s ease !important;
    position: relative !important;
}

.nav-modern > li > a:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.09) !important;
}

/* ══════════════════════════════════════════════════════════
   SUBMENUS - Sin límite de ancho, se ajusta al contenido
   ══════════════════════════════════════════════════════════ */
.nav-modern .sub-menu {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    margin-top: 0 !important;
    min-width: auto !important;
    width: max-content !important;
    max-width: 500px !important;
    background: #0A1E3C !important;
    border: 1px solid rgba(168, 143, 29, 0.3) !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
    overflow: visible !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(-10px) !important;
    transition: all 0.2s ease-out !important;
    z-index: 50 !important;
    list-style: none !important;
    padding: 0.5rem 0 !important;
    margin-left: 0 !important;
}

/* Mostrar submenu al hover */
.nav-modern > li:hover > .sub-menu,
.nav-modern > li.group:hover > .sub-menu {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

/* Items del submenu */
.nav-modern .sub-menu > li {
    position: relative !important;
    display: block !important;
    list-style: none !important;
    width: 100% !important;
}

.nav-modern .sub-menu > li > a {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 1rem !important;
    padding: 0.5rem 1rem !important;
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 0.875rem !important;
    transition: all 0.2s !important;
    white-space: normal !important;
    text-decoration: none !important;
    line-height: 1.4 !important;
    word-wrap: break-word !important;
}

.nav-modern .sub-menu > li > a:hover {
    background-color: rgba(168, 143, 29, 0.15) !important;
    color: #A88F1D !important;
}

/* Iconos de chevron en submenus */
.nav-modern .sub-menu > li > a > i {
    flex-shrink: 0 !important;
    margin-left: auto !important;
    opacity: 0.7 !important;
}

.nav-modern .sub-menu > li:hover > a > i {
    opacity: 1 !important;
    transform: translateX(3px) !important;
}

/* Submenus de segundo nivel */
.nav-modern .sub-menu .sub-menu {
    top: 0 !important;
    left: 100% !important;
    margin-top: 0 !important;
    margin-left: 0.5rem !important;
}

.nav-modern .sub-menu > li:hover > .sub-menu {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

/* ══════════════════════════════════════════════════════════
   BUSCADOR
   ══════════════════════════════════════════════════════════ */
button[aria-label="Buscar"],
button[aria-label="Menú"] {
    padding: 0.625rem !important;
    border-radius: 0.5rem !important;
    color: rgba(255, 255, 255, 0.8) !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
}

button[aria-label="Buscar"]:hover,
button[aria-label="Menú"]:hover {
    color: #A88F1D !important;
    background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Search bar */
input[type="search"] {
    width: 100% !important;
    padding: 1rem 3rem 1rem 1.5rem !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    border-radius: 9999px !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    outline: none !important;
    transition: all 0.2s !important;
}

input[type="search"]:focus {
    border-color: #A88F1D !important;
    box-shadow: 0 0 0 2px rgba(168, 143, 29, 0.3) !important;
}

input[type="search"]::placeholder {
    color: rgba(255, 255, 255, 0.5) !important;
}

/* Search button */
button[type="submit"] {
    position: absolute !important;
    right: 0.75rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 2.5rem !important;
    height: 2.5rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 9999px !important;
    background-color: #A88F1D !important;
    color: #143B63 !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
}

button[type="submit"]:hover {
    background-color: #8B7718 !important;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 1023px) {
    .lg\:hidden {
        display: block !important;
    }

    .lg\:flex {
        display: none !important;
    }
}

@media (min-width: 1024px) {
    .lg\:hidden {
        display: none !important;
    }

    .lg\:flex {
        display: flex !important;
    }
}

/* ══════════════════════════════════════════════════════════
   FIXES GENERALES
   ══════════════════════════════════════════════════════════ */
.header-modern * {
    box-sizing: border-box !important;
}

.header-modern a {
    text-decoration: none !important;
}

/* FontAwesome */
.header-modern .fas,
.header-modern .fab {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands" !important;
    font-weight: 900 !important;
}

/* Admin bar spacing */
.admin-bar .header-modern {
    top: 32px !important;
}

@media screen and (max-width: 782px) {
    .admin-bar .header-modern {
        top: 46px !important;
    }
}
