/* ==========================================================================
   MEDIOS CMS - COMPONENT: HEADER V5
   Estilos completos, responsivos y animaciones de la cabecera del portal
   ========================================================================== */

/* Logos adaptativos */
.logo-header-img, .logo-header-svg { 
    height: var(--logo-h-mobile, 45px) !important; 
    max-height: var(--logo-h-mobile, 45px) !important; 
    width: auto !important; 
    max-width: none !important; 
    object-fit: contain; 
    display: block; 
    border-radius: 0 !important; 
}
.logo-sticky-img, .logo-sticky-svg { 
    height: var(--logo-s-mobile, 36px) !important; 
    max-height: var(--logo-s-mobile, 36px) !important; 
    width: auto !important; 
    max-width: none !important; 
    object-fit: contain; 
    display: block; 
    border-radius: 0 !important; 
}
.logo-footer-img, .logo-footer-svg { 
    height: var(--logo-f-mobile, 90px) !important; 
    max-height: var(--logo-f-mobile, 90px) !important; 
    width: auto !important; 
    max-width: none !important; 
    object-fit: contain; 
    display: block; 
    border-radius: 0 !important; 
}
.logo-drawer-img { 
    height: 2.25rem !important; 
    width: auto !important; 
    max-width: none !important; 
    transform: var(--logo-d-mobile, scale(1)); 
    transform-origin: left center; 
    border-radius: 0 !important; 
}

.logo-header-desktop { display: none !important; }
.logo-header-mobile { display: flex !important; }

@media (min-width: 1024px) {
    .logo-header-img, .logo-header-svg { 
        height: var(--logo-h-desktop, 55px) !important; 
        max-height: var(--logo-h-desktop, 55px) !important; 
        width: auto !important; 
        max-width: none !important; 
    }
    .logo-header-desktop { display: flex !important; }
    .logo-header-mobile { display: none !important; }
    .logo-sticky-img, .logo-sticky-svg { 
        height: var(--logo-s-desktop, 36px) !important; 
        max-height: var(--logo-s-desktop, 36px) !important; 
        width: auto !important; 
        max-width: none !important; 
    }
    .logo-footer-img, .logo-footer-svg { 
        height: var(--logo-f-desktop, 90px) !important; 
        max-height: var(--logo-f-desktop, 90px) !important; 
        width: auto !important; 
        max-width: none !important; 
    }
    .logo-drawer-img { transform: var(--logo-d-desktop, scale(1)); }
}

.svg-logo-wrapper svg {
    height: 100%;
    width: auto;
    flex-shrink: 0;
    display: block;
    fill: currentColor;
}

/* Fila 1: Main Header Section */
.header-main-section {
    background: var(--h-main-bg, transparent) !important;
    height: var(--h-main-base, 130px) !important;
}

@media (max-width: 768px) {
    .header-main-section {
        height: var(--h-main-base-mobile, 130px) !important;
    }
}

/* Fila 2: Header Navigation */
.header-nav {
    background: var(--h-nav-bg, #ffffff) !important;
    transition: background-color 0.3s ease, backdrop-filter 0.3s ease, border-color 0.3s ease;
    border-bottom: 1px solid transparent;
}

.header-nav > div {
    height: var(--h-nav-h, 64px) !important;
    transition: height 0.3s ease;
}

.dark .header-nav {
    background-color: #1e293b !important;
}

/* Sticky Header (Desktop) */
#fade-sticky-header .header-nav {
    background: var(--h-sticky-bg, rgba(255, 255, 255, 0.75)) !important;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-bottom-color: rgba(0,0,0,0.05);
}

#fade-sticky-header .header-nav > div {
    height: var(--h-sticky-h, 64px) !important;
}

#fade-sticky-header.active {
    opacity: 1 !important;
    pointer-events: auto !important;
}

.dark #fade-sticky-header .header-nav {
    background-color: rgba(15, 23, 42, 0.85) !important;
}

@media (max-width: 1200px) {
    #fade-sticky-header .header-nav {
        border-bottom-color: transparent;
    }
}

/* Breakpoint 1200px: Comportamiento Sticky y Mobile Nav */
@media (max-width: 1200px) {
    #main-header {
        position: sticky;
        top: 0;
        z-index: 50;
        border-bottom: 1px solid rgba(0,0,0,0.06);
        box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
        background-color: var(--bg-body, #ffffff) !important;
    }
    #sticky-nav {
        display: none !important;
    }
    .desktop-nav-wrapper {
        display: none !important;
    }
    .mobile-radio-wrapper {
        display: flex !important;
    }
}

@media (min-width: 1201px) {
    .desktop-nav-wrapper {
        display: block !important;
    }
}

/* Nav Pills (Categorías y Páginas) */
.nav-pill {
    padding: 0.5rem 1.25rem;
    border-radius: 1.5rem;
    transition: all 0.2s ease-in-out;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
}

header .header-nav .nav-categories-wrapper {
    gap: var(--nav-gap, 0.5rem);
    justify-content: var(--nav-justify, center);
}

header .header-nav .nav-pill {
    font-weight: var(--h-nav-pill-weight, 700);
    font-size: var(--h-nav-pill-size, 0.875rem);
    color: var(--h-nav-pill-color, #111827);
    padding: var(--nav-py, 0.5rem) var(--nav-px, 1.25rem);
    font-family: var(--h-nav-pill-font, inherit);
}

.dark header .header-nav .nav-pill:not(.active) {
    color: var(--h-nav-pill-color, #e2e8f0);
}

header .header-nav .nav-pill:hover {
    background-color: #f3f4f6;
    color: var(--h-nav-pill-hover, #111827) !important;
}

.dark header .header-nav .nav-pill:hover {
    background-color: #334155;
    color: var(--h-nav-pill-hover, #f8fafc) !important;
}

header .header-nav:not(.active-style-underline) .nav-pill.active {
    background-color: var(--h-nav-pill-hover, var(--cat-color, var(--primary-color))) !important;
    color: white !important;
}

/* Nav Pills en Sticky Header */
#fade-sticky-header .header-nav .nav-categories-wrapper {
    gap: var(--sticky-gap, 0.5rem);
    justify-content: var(--sticky-justify, center);
}

#fade-sticky-header .header-nav .nav-pill {
    font-weight: var(--h-sticky-pill-weight, 700);
    font-size: var(--h-sticky-pill-size, 0.875rem);
    color: var(--h-sticky-pill-color, #111827);
    padding: var(--sticky-py, 0.5rem) var(--sticky-px, 1.25rem);
    font-family: var(--h-sticky-pill-font, inherit);
}

.dark #fade-sticky-header .header-nav .nav-pill:not(.active) {
    color: var(--h-sticky-pill-color, #e2e8f0);
}

#fade-sticky-header .header-nav:not(.active-style-underline) .nav-pill:hover {
    background-color: #f3f4f6;
    color: var(--h-sticky-pill-hover, #111827) !important;
}

.dark #fade-sticky-header .header-nav:not(.active-style-underline) .nav-pill:hover {
    background-color: #334155;
    color: var(--h-sticky-pill-hover, #f8fafc) !important;
}

#fade-sticky-header .header-nav:not(.active-style-underline) .nav-pill.active {
    background-color: var(--h-sticky-pill-hover, var(--cat-color, var(--primary-color))) !important;
    color: white !important;
}

/* Modo Subrayado (Underline) - SIN fondo, solo línea inferior activa */
.active-style-underline .nav-pill {
    border-radius: 0 !important;
    background-color: transparent !important;
    border: none !important;
}

.active-style-underline .nav-pill span {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding-bottom: 4px;
    transform: translateY(5px);
    border-bottom: 3px solid transparent;
    transition: border-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.active-style-underline .nav-pill:hover {
    background-color: transparent !important;
}

.active-style-underline .nav-pill:hover span {
    color: var(--h-nav-pill-hover, var(--cat-color, var(--primary-color))) !important;
    border-bottom-color: var(--h-nav-pill-hover, var(--cat-color, var(--primary-color))) !important;
}

.active-style-underline .nav-pill.active {
    background-color: transparent !important;
    border-radius: 0 !important;
    border: none !important;
}

.active-style-underline .nav-pill.active span {
    color: var(--h-nav-pill-hover, var(--cat-color, var(--primary-color))) !important;
    border-bottom-color: var(--h-nav-pill-hover, var(--cat-color, var(--primary-color))) !important;
}

#fade-sticky-header .active-style-underline .nav-pill:hover span,
#fade-sticky-header .active-style-underline .nav-pill.active span {
    color: var(--h-sticky-pill-hover, var(--cat-color, var(--primary-color))) !important;
    border-bottom-color: var(--h-sticky-pill-hover, var(--cat-color, var(--primary-color))) !important;
}

@media (max-width: 1143px) {
    .nav-categories-wrapper {
        display: none !important;
    }
}

.nav-container-wrapper {
    margin: 0;
    padding: 0;
}

/* Botones de Acción (Lupa, Dark mode, Menú) */
.btn-action {
    width: 44px;
    height: 44px;
    border-radius: 1.5rem;
    background-color: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.22s, color 0.22s, transform 0.22s;
    color: #1f2937;
}

.dark .btn-action {
    background-color: #1e293b;
    color: white;
}

.btn-action:hover {
    background-color: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

/* Transición de Iconos en Sticky */
.sticky-icons {
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.4s ease;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: absolute;
    right: 0;
}

#main-header.is-sticky .sticky-icons {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

/* Botón de Radio Player y Animación Pulse */
.btn-radio-sticky {
    background: transparent;
    border: none;
    outline: none;
    padding: 0;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.btn-radio-sticky:hover {
    opacity: 0.85;
}

#main-header .header-nav .btn-radio-sticky {
    margin-left: var(--nav-gap, 0.5rem);
}

.btn-radio-live {
    background-color: var(--radio-btn-color, #2ecc71);
    color: white !important;
    padding: 0.5rem 1.25rem;
    border-radius: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 0.875rem;
    transition: filter 0.2s ease-in-out, background-color 0.2s ease-in-out;
    white-space: nowrap;
}

.btn-radio-live:hover {
    filter: brightness(0.9);
}

.btn-radio-live .play-icon {
    font-size: 16px;
}

.btn-radio-live .live-dot {
    width: 7px;
    height: 7px;
    background-color: white;
    border-radius: 50%;
    position: relative;
}

.btn-radio-live .live-dot::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background-color: white;
    opacity: 0.4;
    animation: radio-pulse 2s infinite;
}

@keyframes radio-pulse {
    0% { transform: scale(1); opacity: 0.45; }
    100% { transform: scale(2.5); opacity: 0; }
}

/* Panel Desplegable Móvil (Drawer) */
#menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#menu-backdrop.active {
    opacity: 1;
    visibility: visible;
}

#mobile-menu-panel {
    position: fixed;
    top: 0;
    right: -320px;
    width: 300px;
    height: 100%;
    background: var(--h-drawer-bg, #fff) !important;
    z-index: 1000;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    border-top-left-radius: var(--h-drawer-radius, 1.5rem) !important;
    border-bottom-left-radius: var(--h-drawer-radius, 1.5rem) !important;
}

#mobile-menu-panel.open {
    right: 0;
}

.dark #mobile-menu-panel {
    background: #0f172a;
}

#mobile-menu-panel nav a:not(.text-primary) {
    color: var(--h-drawer-text, inherit);
}

#mobile-menu-panel nav a.text-primary {
    color: var(--h-drawer-text-hover, var(--primary-color)) !important;
    border-left-color: var(--h-drawer-text-hover, var(--primary-color)) !important;
}

#mobile-menu-panel nav a:hover {
    color: var(--h-drawer-text-hover, var(--primary-color)) !important;
    border-left-color: var(--h-drawer-text-hover, var(--primary-color)) !important;
}

/* Responsividad Fina del Clima */
@media (min-width: 700px) {
    .cms-weather-premium > div:last-child {
        display: flex !important;
    }
}

@media (max-width: 664px) {
    #main-header .cms-container,
    #main-header .cms-container > .flex.gap-4 {
        gap: 0rem !important;
    }
}

/* Entrada Suave de Acciones del Header */
.header-main-section .btn-action,
.header-main-section .cms-weather-wrapper,
.header-main-section .cms-weather-premium,
.header-main-section .mobile-radio-wrapper,
.header-main-section .mobile-radio-left {
    opacity: 0;
    animation: headerSoftFade 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.8s forwards;
}

@keyframes headerSoftFade {
    0% {
        opacity: 0;
        transform: translateY(-2px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .header-main-section .btn-action,
    .header-main-section .cms-weather-wrapper,
    .header-main-section .cms-weather-premium,
    .header-main-section .mobile-radio-wrapper,
    .header-main-section .mobile-radio-left {
        opacity: 1 !important;
        animation: none !important;
        transform: none !important;
    }
}

/* Clases Helper de Radio Button */
.btn-radio-pulse {
    background-color: var(--radio-btn-color) !important;
    animation: radio-pulse 2s infinite !important;
}

.btn-radio-disc {
    background-color: var(--radio-btn-color) !important;
}

.icon-fill-1 {
    font-variation-settings: 'FILL' 1 !important;
}

.btn-radio-title {
    color: var(--radio-btn-color) !important;
}

