/* ============================================================================
 *  INTERRUPTOR DE TEMA · estilo único del sistema
 * ----------------------------------------------------------------------------
 *  El index es la referencia: su interruptor vive en styles/styles.css y esta
 *  hoja lo reproduce con los MISMOS valores para las páginas que no cargan
 *  styles.css (cursos, eventos, RRHH). Así el control se ve igual en todas.
 *
 *  Marcado esperado:
 *      <div class="theme-switch">
 *        <label class="switch">
 *          <input type="checkbox" id="...">
 *          <span class="slider"></span>
 *        </label>
 *        <i class="fas fa-moon"></i>
 *      </div>
 *
 *  Si se cambia el interruptor del index, hay que cambiarlo aquí también.
 * ========================================================================== */

/* Contenedor "liquid glass", igual que el del index (.floating-controls > div
   en styles/styles.css). Si se cambia allí, cambiarlo aquí también. */
.theme-switch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 30px;
    padding: 6px 12px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.15);
    transition: all 0.35s ease;
    cursor: pointer;
}

.theme-switch:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.25);
}

body.dark-mode .theme-switch,
html[data-tema="oscuro"] .theme-switch {
    background: rgba(40, 40, 40, 0.65);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.switch {
    position: relative;
    display: inline-block;
    width: 35px;
    height: 15px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(180, 180, 180, 0.6);
    border-radius: 25px;
    transition: 0.4s;
}

.slider::before {
    position: absolute;
    content: "";
    height: 10px;
    width: 10px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.switch input:checked + .slider {
    background: linear-gradient(135deg, #1C68A9, #649FBE);
}

.switch input:checked + .slider::before {
    transform: translateX(20px);
}

/* El icono toma el color del texto que lo rodea. Antes se forzaba a blanco en
   cualquier <header>, y en las cabeceras claras (eventos, cursos) la luna
   quedaba blanca sobre blanco: invisible. */
.theme-switch i {
    color: inherit;
    font-size: 1rem;
    transition: color 0.3s ease;
}

/* En claro se ve la luna (a la derecha); en oscuro, el sol (a la izquierda). */
.theme-switch .icono-sol { display: none; }
.theme-switch .icono-luna { display: inline-block; }

body.dark-mode .theme-switch .icono-sol,
html[data-tema="oscuro"] .theme-switch .icono-sol { display: inline-block; }

body.dark-mode .theme-switch .icono-luna,
html[data-tema="oscuro"] .theme-switch .icono-luna { display: none; }

.switch input:focus-visible + .slider {
    outline: 2px solid #1C68A9;
    outline-offset: 2px;
}
