/* ============================================================
 *  DIBAL UIX v1.0 – Bootstrap Toggle Override
 * ============================================================ */

/* Alinea el toggle al resto de formularios DIBAL */
.dibal-theme .checkbox label .toggle,
.dibal-theme .checkbox-inline .toggle {
    margin-left: 0;
    margin-right: .5rem;
}

/* Contenedor principal */
.dibal-theme .toggle {
    position: relative;
    overflow: hidden;
    border-radius: 999px;
}

/* Botón base (usa clases .btn del plugin) */
.dibal-theme .toggle.btn {
    min-width: 3.25rem;
    min-height: 1.8rem;
    padding: 0;
    border-radius: 999px;
    border: 1px solid var(--dibal-gray-300);
    background-color: var(--dibal-gray-200);
    box-shadow: 0 0 0 1px rgba(15,23,42,0.03);
    transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
}

/* Tamaños coherentes con DIBAL */
.dibal-theme .toggle.btn-sm {
    min-width: 3rem;
    min-height: 1.6rem;
}

.dibal-theme .toggle.btn-lg {
    min-width: 3.8rem;
    min-height: 2rem;
}

/* Focus / active */
.dibal-theme .toggle.btn:focus,
.dibal-theme .toggle.btn:active {
    outline: none;
    box-shadow: 0 0 0 2px rgba(37,157,205,0.25);
}

/* Group core (animación original) */
.dibal-theme .toggle-group {
    position: absolute;
    width: 200%;
    top: 0;
    bottom: 0;
    left: 0;
    transition: left .25s ease;
}

/* Estados (se mantiene lógica original) */
.dibal-theme .toggle.off .toggle-group {
    left: -100%;
}

/* Texto ON / OFF */
.dibal-theme .toggle-on,
.dibal-theme .toggle-off {
    position: absolute;
    top: 0;
    bottom: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: 0 .75rem;
}

/* Lado ON */
.dibal-theme .toggle-on {
    left: 0;
    right: 50%;
    background-color: var(--dibal-primary);
    color: #ffffff;
}

/* Lado OFF */
.dibal-theme .toggle-off {
    left: 50%;
    right: 0;
    background-color: var(--dibal-gray-200);
    color: var(--dibal-gray-600);
}

/* Si el plugin aplica clases .btn-* las neutralizamos dentro del toggle */
.dibal-theme .toggle-on.btn,
.dibal-theme .toggle-off.btn {
    background-image: none !important;
    border: none !important;
}

/* Handle (la “bolita”) */
.dibal-theme .toggle-handle {
    position: relative;
    margin: 0 auto;
    padding: 0;
    height: 100%;
    width: 0;              /* el JS del plugin ajusta el width; sólo estilizamos */
    border-width: 0;
}

.dibal-theme .toggle-handle::before {
    content: '';
    position: absolute;
    top: 2px;
    bottom: 2px;
    left: 2px;
    right: 2px;
    border-radius: 999px;
    background-color: #ffffff;
    box-shadow: 0 4px 10px rgba(15,23,42,0.18);
}

/* Tamaños del handle */
.dibal-theme .toggle.btn-sm .toggle-handle::before {
    top: 2px;
    bottom: 2px;
}

.dibal-theme .toggle.btn-lg .toggle-handle::before {
    top: 3px;
    bottom: 3px;
}

/* Disabled (cuando el plugin deshabilite el input / btn) */
.dibal-theme .toggle.btn.disabled,
.dibal-theme .toggle.btn[disabled] {
    opacity: .6;
    cursor: not-allowed;
    box-shadow: none;
}

/* Opcional: variante “suave” cuando está apagado */
.dibal-theme .toggle.off.btn {
    border-color: var(--dibal-gray-300);
    background-color: var(--dibal-gray-100);
}

/* Opcional: si quieres una versión compacta para tablas / filtros */
.dibal-theme .dibal-toggle-compact.toggle.btn {
    min-width: 2.8rem;
    min-height: 1.4rem;
}

.dibal-theme .dibal-toggle-compact .toggle-on,
.dibal-theme .dibal-toggle-compact .toggle-off {
    font-size: .65rem;
    padding: 0 .55rem;
}

.dibal-theme .dibal-toggle-compact .toggle-handle::before {
    top: 1px;
    bottom: 1px;
}
