/* ============================================================
   03-HEADER.CSS — Header, Nav, Submenús, Live, Theme Switch, Nieve
   dimonix.gg
   ============================================================ */

/* ── 1. HEADER PRINCIPAL ── */
.main-header {
    background-color: var(--bg-nav);
    width: 100%;
    height: var(--header-height);
    position: fixed;
    top: 0; left: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(46, 15, 215, 0.3);
    padding: 0 10% 0 15%;
    display: flex;
    align-items: center;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    transition: background-color 0.3s ease;
}

/* ── 2. LOGO ── */
.logo {
    flex-shrink: 0;
    margin-left: -5%;
    margin-right: 5%;
    display: flex;
    align-items: center;
    height: 100%;
}
.logo a         { display: block; line-height: 0; }
.logo img       { height: 55px; width: auto; object-fit: contain; transition: var(--transition); }
.logo a:hover img { opacity: 0.8; transform: scale(1.05); }

/* Modo claro: cambiar logo */
[data-theme="light"] .logo img { content: url('../img/logo-negro-web.png'); }

/* ── 3. NAV ── */
nav { flex: 1; height: 100%; }

.nav-menu {
    display: flex;
    height: 100%;
    align-items: center;
    list-style: none;
    width: 100%;
    justify-content: space-between;
}
.nav-menu > li { height: 100%; display: flex; align-items: center; }

.nav-link {
    font-family: var(--font-headings);
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--text-main);
    text-decoration: none;
    text-transform: uppercase;
    transition: var(--transition);
    position: relative;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.nav-link:hover {
    color: var(--brand-primary);
    text-shadow: 0 0 15px rgba(46, 15, 215, 0.8);
}
.nav-link.active {
    color: var(--brand-primary);
    text-shadow: 0 0 15px rgba(46, 15, 215, 0.6);
}
.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -5px; left: 0;
    width: 100%; height: 2px;
    background-color: var(--brand-primary);
    box-shadow: 0 0 10px var(--brand-primary);
}

/* ── 4. SUBMENÚS ── */
.has-submenu { position: relative; }

.submenu {
    position: absolute;
    top: 100%; left: 50%;
    transform: translateX(-50%);
    background-color: var(--bg-card);
    display: flex;
    flex-direction: row;
    gap: 0;
    padding: 0;
    min-width: max-content;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    border: 1px solid rgba(46, 15, 215, 0.2);
    border-top: 2px solid var(--brand-primary);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 2000;
}
.has-submenu:hover .submenu { opacity: 1; visibility: visible; }

.submenu li a {
    display: block;
    padding: 15px 20px;
    color: var(--text-muted);
    font-family: var(--font-headings);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    transition: var(--transition);
    white-space: nowrap;
    line-height: 1.2;
}
.submenu li a:hover { color: var(--brand-primary); background-color: var(--glass-bg); }

/* ── SUBMENU TEAMS ── */
.submenu-teams { padding: 10px; gap: 10px; }

.submenu-teams li a.team-box {
    width: 50px; height: 50px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--glass-bg);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}
.submenu-teams li a.team-box img {
    max-width: 70%; max-height: 70%;
    filter: grayscale(0%);
    transition: var(--transition);
}
.submenu-teams li a.team-box:hover {
    border-color: var(--brand-primary);
    background-color: rgba(46, 15, 215, 0.2);
}
.submenu-teams li a.team-box:hover img { transform: scale(1.1); }

/* ── SUBMENU REDES SOCIALES ── */
.social-menu-item .submenu {
    flex-direction: column;
    width: 40px; min-width: 40px;
    left: 50%; transform: translateX(-50%);
    right: auto; top: 100%;
    padding: 5px 0; gap: 0;
    border-radius: 0 0 4px 4px;
}
.social-menu-item:hover .submenu { transform: translateX(-50%); }
.social-menu-item .submenu li { width: 100%; text-align: center; }
.social-menu-item .submenu li a {
    padding: 10px 0;
    font-size: 1rem;
    display: flex;
    justify-content: center;
    width: 100%;
}
.social-menu-item .submenu li a:hover {
    background: transparent;
    color: var(--brand-primary);
    transform: scale(1.2);
}

/* ── SUBMENU LIVE ── */
.submenu-live {
    flex-direction: column;
    width: 120px; min-width: auto;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 0;
    gap: 15px;
    align-items: center;
}
.submenu-live li { width: 100%; display: flex; justify-content: center; }

/* ── 5. LIVE BOXES ── */

/* Estado OFFLINE */
.live-box {
    width: 60px !important;
    height: 60px !important;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    padding: 0;
    flex-shrink: 0;
    transition: all 0.3s ease;
    overflow: visible;
}
.submenu-live .live-box {
    border-radius: 50% !important;
    padding: 0 !important;
    overflow: hidden !important;
}
.live-box img {
    width: 60px !important;
    height: 60px !important;
    min-width: 60px; min-height: 60px;
    object-fit: cover;
    clip-path: circle(50% at 50% 50%);
    -webkit-clip-path: circle(50% at 50% 50%);
    border-radius: 50%;
    filter: grayscale(100%);
    transition: var(--transition);
    z-index: 2;
    display: block;
}
.submenu-live .live-box img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    border-radius: 50% !important;
    clip-path: none !important;
    -webkit-clip-path: none !important;
}

/* Punto de estado (offline) */
.live-status-dot {
    position: absolute;
    bottom: 3px; right: 3px;
    width: 13px; height: 13px;
    background-color: #666;
    border: 2px solid #0f1012;
    border-radius: 50%;
    z-index: 100;
    transform: translateZ(10px);
    will-change: transform;
    pointer-events: none;
}
.submenu-live .live-status-dot { bottom: 2px; right: 2px; z-index: 9; }

/* Hover offline */
.live-box:not(.is-live):hover { border-color: var(--text-main); transform: scale(1.05); }
.live-box:not(.is-live):hover img { filter: grayscale(0%); }

/* Estado ONLINE */
.live-box.is-live {
    width: 100% !important;
    height: auto !important;
    border: none;
    background-color: transparent;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 5px;
}
.live-box.is-live img {
    filter: grayscale(0%);
    border: 2px solid var(--live-red);
    box-shadow: 0 0 15px rgba(255, 59, 59, 0.3);
}
.live-box.is-live .live-status-dot { display: none; }

/* Badge EN DIRECTO */
.submenu-live .live-box.is-live {
    position: relative;
    width: 100% !important;
    height: auto !important;
    border-radius: 0 !important;
    overflow: visible !important;
}
.submenu-live .live-box.is-live img {
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    position: relative;
    z-index: 2;
}
.submenu-live .live-box.is-live::after,
.submenu-live a.live-box.is-live::after {
    content: "EN DIRECTO" !important;
    display: block;
    width: 100%;
    position: relative;
    z-index: 3;
    background-color: var(--live-red);
    color: #fff;
    font-family: var(--font-headings);
    font-weight: 800;
    font-size: 0.65rem;
    letter-spacing: 0.5px;
    text-align: center;
    padding: 10px 0 5px 0;
    margin-top: -15px;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    animation: pulse 2s infinite;
}

/* Limpiar ::before/::after en items offline */
.submenu-live .live-box:not(.is-live)::after,
.submenu-live .live-box::before { content: none !important; display: none !important; }

/* ── 6. LIVE SPECIAL & LIVE DOT ── */
.special-live .nav-link { color: var(--live-red); display: flex; align-items: center; gap: 8px; }
.live-dot {
    width: 8px; height: 8px;
    background-color: var(--live-red);
    border-radius: 50%;
    box-shadow: 0 0 15px var(--live-red);
    animation: pulse 1.5s infinite;
}

/* ── 7. SHARE BUTTON ── */
.share-btn {
    width: 40px; height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--glass-bg);
    border: 1px solid var(--border-color);
    font-size: 1.1rem;
    border-radius: 4px;
    transition: var(--transition);
    color: var(--text-main);
    margin: 0;
}
.share-btn:hover,
.has-submenu:hover .share-btn {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
    box-shadow: 0 0 20px rgba(46, 15, 215, 0.6);
}

/* ── 8. THEME SWITCH ── */
.theme-switch-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 140px;
    height: 36px;
    background-color: rgba(0,0,0,0.4);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    cursor: pointer;
    padding: 0 5px;
    overflow: hidden;
    transition: border-color 0.3s;
}
.theme-switch-wrapper:hover { border-color: var(--brand-primary); }

.switch-label {
    flex: 1;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 800;
    z-index: 2;
    color: #888;
    transition: color 0.3s ease;
    user-select: none;
}
.switch-slider {
    position: absolute;
    top: 3px; left: 3px;
    width: calc(50% - 3px);
    height: calc(100% - 6px);
    background-color: var(--brand-primary);
    border-radius: 25px;
    z-index: 1;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    transform: translateX(100%);
}
html:not([data-theme="light"]) .label-dark  { color: #fff; }
html[data-theme="light"]       .switch-slider { transform: translateX(0%); }
html[data-theme="light"]       .label-light  { color: #fff; }

/* ── 9. HAMBURGER ── */
.hamburger { display: none; cursor: pointer; font-size: 2rem; color: var(--text-main); margin-left: 20px; }

/* ── 10. NIEVE ── */
.snow-container {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}
.snowflake {
    position: absolute;
    top: -20px;
    color: #00d2ff;
    text-shadow: 0 0 5px rgba(0, 210, 255, 0.6);
    animation-name: fall, sway;
    animation-timing-function: linear, ease-in-out;
    animation-iteration-count: infinite, infinite;
}

/* ── 11. RESPONSIVE HEADER ── */

/* 4K */
@media (min-width: 1921px) {
    .nav-link    { font-size: 1.5rem; }
    .logo img    { height: 80px; }
    .share-btn   { width: 60px; height: 60px; font-size: 1.5rem; }
    .theme-switch-wrapper { width: 160px; height: 44px; }
}

/* iPad Pro horizontal → laptop pequeño (1025-1400px) */
@media (max-width: 1400px) and (min-width: 1025px) {
    .nav-link { font-size: 1rem; }
}

/* Tablet / iPad (≤ 1200px): menú hamburguesa */
@media (max-width: 1200px) {
    .main-header { padding: 0 5%; justify-content: space-between; }
    .logo        { margin-right: 0; }
    .hamburger   { display: block; }
    .theme-switch-wrapper { width: 120px; height: 40px; margin-top: 10px; }

    /* Menú desplegable */
    .nav-menu {
        display: none;
        flex-direction: column;
        position: fixed;
        top: var(--header-height); left: 0;
        width: 100%;
        height: calc(100vh - var(--header-height));
        background: var(--bg-body);
        justify-content: flex-start;
        padding: 50px 20px;
        gap: 20px;
        overflow-y: auto;
        border-top: 1px solid var(--border-color);
    }
    .nav-menu.active { display: flex; z-index: 3000; }

    .nav-menu > li {
        height: auto; width: 100%;
        justify-content: center;
        flex-direction: column;
        align-items: center;
    }
    .nav-link { font-size: 1.5rem; margin-bottom: 10px; width: 100%; text-align: center; }

    /* Ocultar redes en móvil */
    .social-menu-item { display: none !important; }

    /* Submenús: estáticos en móvil */
    .has-submenu:hover .submenu, .submenu {
        position: static;
        opacity: 1; visibility: visible;
        transform: none;
        background: transparent;
        box-shadow: none; border: none;
        flex-direction: column;
        padding: 10px 0;
        width: 100%;
        text-align: center;
        min-width: auto;
    }

    /* Live centrado */
    .submenu-live { align-items: center !important; width: 100% !important; }
    .submenu-live li { justify-content: center !important; }

    /* Teams en fila */
    .submenu-teams {
        flex-direction: row !important;
        flex-wrap: wrap;
        justify-content: center !important;
        gap: 15px;
        padding-bottom: 20px;
    }
    .submenu-teams li { width: auto !important; display: flex; justify-content: center; margin: 0 !important; }
    .submenu-teams li a.team-box:hover { transform: none; }

    /* Botón live centrado */
    .special-live .nav-link {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100%;
        text-align: center;
    }
    .special-live .live-dot { margin-right: 8px; }

    /* Ocultar streamers offline en móvil */
    .submenu-live li:has(.live-box:not(.is-live)) { display: none !important; }
    .submenu-live .live-box:not(.is-live) { display: none !important; }
}

/* iPad Air/Pro en vertical (820px) - ajuste específico */
@media (max-width: 912px) and (min-width: 768px) {
    .main-header { padding: 0 4%; }
    .nav-link { font-size: 1.4rem; }
}

/* Móvil pequeño (≤ 480px) */
@media (max-width: 480px) {
    .nav-link { font-size: 1.3rem; }
    .theme-switch-wrapper { width: 110px; height: 38px; }
}
