/**
 * POLIVERSO - Selector de Modo Visual Tipo Píldora (Light / Dark Mode Switch)
 * Implementa el patrón deslizante ergonómico con riel y perilla animada
 * para conmutación visual de temas sin recargas ni dependencias externas.
 */

.theme-switch-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 124px;
    height: 34px;
    border-radius: 9999px;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    padding: 0;
    overflow: hidden;
    transition: background-color 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
    flex-shrink: 0;
}

/* Estado Modo Oscuro: riel nocturno y profundidad */
html.dark .theme-switch-pill,
[data-bs-theme="dark"] .theme-switch-pill {
    background-color: #121522;
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Estado Modo Claro: riel diurno suave con borde definido */
html:not(.dark) .theme-switch-pill,
[data-bs-theme="light"] .theme-switch-pill {
    background-color: #eef2f6;
    border-color: #cbd5e1;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
}

/* Riel contenedor para el texto de estado */
.theme-switch-track {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    pointer-events: none;
}

.theme-switch-label-dark,
.theme-switch-label-light {
    position: absolute;
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Etiqueta Dark Mode: alineada a la derecha */
.theme-switch-label-dark {
    right: 12px;
    color: #f8fafc;
}

/* Etiqueta Light Mode: alineada a la izquierda */
.theme-switch-label-light {
    left: 12px;
    color: #475569;
}

/* Alternancia de visibilidad de textos */
html.dark .theme-switch-label-dark,
[data-bs-theme="dark"] .theme-switch-label-dark {
    opacity: 1;
    transform: translateX(0);
}

html.dark .theme-switch-label-light,
[data-bs-theme="dark"] .theme-switch-label-light {
    opacity: 0;
    transform: translateX(-8px);
    pointer-events: none;
}

html:not(.dark) .theme-switch-label-dark,
[data-bs-theme="light"] .theme-switch-label-dark {
    opacity: 0;
    transform: translateX(8px);
    pointer-events: none;
}

html:not(.dark) .theme-switch-label-light,
[data-bs-theme="light"] .theme-switch-label-light {
    opacity: 1;
    transform: translateX(0);
}

/* Perilla circular deslizable con sombra elevada */
.theme-switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background-color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.28), 0 0 1px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.35s cubic-bezier(0.34, 1.4, 0.64, 1), background-color 0.25s ease;
    z-index: 2;
}

/* Desplazamiento del botón: 0px en dark, 90px hacia la derecha en light */
html.dark .theme-switch-thumb,
[data-bs-theme="dark"] .theme-switch-thumb {
    transform: translateX(0);
}

html:not(.dark) .theme-switch-thumb,
[data-bs-theme="light"] .theme-switch-thumb {
    transform: translateX(90px);
}

/* Iconos de luna y sol dentro de la perilla */
.theme-icon-moon,
.theme-icon-sun {
    font-size: 11px;
    transition: opacity 0.2s ease, transform 0.25s ease;
}

html.dark .theme-icon-moon,
[data-bs-theme="dark"] .theme-icon-moon {
    opacity: 1;
    transform: scale(1) rotate(0deg);
    color: #1e1b4b;
    display: inline-block;
}

html.dark .theme-icon-sun,
[data-bs-theme="dark"] .theme-icon-sun {
    opacity: 0;
    transform: scale(0.4) rotate(90deg);
    display: none;
}

html:not(.dark) .theme-icon-sun,
[data-bs-theme="light"] .theme-icon-sun {
    opacity: 1;
    transform: scale(1) rotate(0deg);
    color: #c59b27;
    display: inline-block;
}

html:not(.dark) .theme-icon-moon,
[data-bs-theme="light"] .theme-icon-moon {
    opacity: 0;
    transform: scale(0.4) rotate(-90deg);
    display: none;
}
