/* =============================================================================
   uniform-switch.css — SWITCH para los `uniform bool`
   -----------------------------------------------------------------------------
   Los shaders declaran algunos uniforms como `uniform bool` (ima_flip:
   flipx/mirrorx/flipy/mirrory, gen_3Dmap: mirror, gen_eclipse: estrellas,
   u_transparent_bg, etc). Un slider 0..1 no sirve (0.5 = true); van con switch.

   Lo usan las TRES superficies:
     · editor     -> ShaderParser.createSwitchu() y actualizarUniformSlidersAllPasses()
     · performance-> performance.js (celdas / FX)
     · nodos      -> nodeeditor.js (.ne-uni-sw, definido más abajo)
   El valor que se guarda/escribe sigue siendo 0/1 (número), así todo el plumbing
   existente (DB, sockets, renderers) funciona igual.
   ============================================================================= */

/* ---------- editor / performance ---------- */
.uniform-switch {
    display: flex;
    align-items: center;
    gap: 9px;
}

.uniform-switch-check {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    pointer-events: none;
}

.uniform-switch-track {
    position: relative;
    flex: 0 0 auto;
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .10);
    border: 1px solid rgba(255, 255, 255, .18);
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease;
}

.uniform-switch-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #8b9aa8;
    transition: left .16s cubic-bezier(.2, .9, .3, 1.2), background .16s ease;
}

.uniform-switch-check:checked + .uniform-switch-track {
    background: rgba(0, 217, 255, .28);
    border-color: rgba(0, 217, 255, .7);
}

.uniform-switch-check:checked + .uniform-switch-track::after {
    left: 22px;
    background: #00d9ff;
    box-shadow: 0 0 9px rgba(0, 217, 255, .8);
}

.uniform-switch-check:focus-visible + .uniform-switch-track {
    outline: 2px solid rgba(0, 217, 255, .55);
    outline-offset: 2px;
}

.uniform-switch-estado {
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .06em;
    color: #7b8b99;
    min-width: 26px;
}

.uniform-switch-check:checked ~ .uniform-switch-estado { color: #00d9ff; }

.uniform-switch-label {
    font-size: 12px;
    color: #cfdae5;
    cursor: pointer;
}

/* ---------- nodos (panel del nodeeditor) ---------- */
.ne-uni.ne-uni-sw {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 9px;
}

.ne-uni.ne-uni-sw > label:first-child {
    flex: 1 1 auto;
    margin: 0;
    font-size: 10px;
    color: #9fb2c6;
    display: block;
}

.ne-uni.ne-uni-sw input[type=checkbox] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    pointer-events: none;
}

.ne-sw-track {
    position: relative;
    flex: 0 0 auto;
    width: 42px;
    height: 22px;
    border-radius: 11px;
    background: rgba(255, 255, 255, .10);
    border: 1px solid rgba(255, 255, 255, .18);
    cursor: pointer;
    display: block;
    transition: background .16s ease, border-color .16s ease;
}

.ne-sw-track > span {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #8b9aa8;
    transition: left .16s cubic-bezier(.2, .9, .3, 1.2), background .16s ease;
}

.ne-uni.ne-uni-sw input[type=checkbox]:checked + .ne-sw-track {
    background: rgba(0, 217, 255, .28);
    border-color: rgba(0, 217, 255, .7);
}

.ne-uni.ne-uni-sw input[type=checkbox]:checked + .ne-sw-track > span {
    left: 20px;
    background: #00d9ff;
    box-shadow: 0 0 9px rgba(0, 217, 255, .8);
}

.ne-uni.ne-uni-sw input[type=checkbox]:focus-visible + .ne-sw-track {
    outline: 2px solid rgba(0, 217, 255, .55);
    outline-offset: 2px;
}

/* en mobile el switch tiene que ser cómodo para el dedo */
@media (max-width: 820px) {
    .uniform-switch-track { width: 52px; height: 30px; border-radius: 15px; }
    .uniform-switch-track::after { width: 24px; height: 24px; }
    .uniform-switch-check:checked + .uniform-switch-track::after { left: 24px; }
    .ne-sw-track { width: 48px; height: 26px; border-radius: 13px; }
    .ne-sw-track > span { width: 20px; height: 20px; }
    .ne-uni.ne-uni-sw input[type=checkbox]:checked + .ne-sw-track > span { left: 24px; }
}
