/* ========================================
   TOGGLE SWITCH MEJORADO - MAX ASSISTANT
   ======================================== */

.max-toggle-switch {
    position: relative;
    display: inline-block;
    width: 64px;
    height: 34px;
    flex-shrink: 0;
}

.max-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* El slider (fondo del toggle) */
.max-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 34px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* El círculo que se mueve */
.max-toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 3px;
    bottom: 2px;
    background: linear-gradient(145deg, #ffffff, #e0e0e0);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.2),
        0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Hover effect */
.max-toggle-slider:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Estado ACTIVO (checked) */
.max-toggle-switch input:checked+.max-toggle-slider {
    background: linear-gradient(135deg, #4f46e5, #818cf8);
    border-color: #4f46e5;
    box-shadow:
        0 0 10px rgba(79, 70, 229, 0.3),
        inset 0 1px 3px rgba(255, 255, 255, 0.2);
}

.max-toggle-switch input:checked+.max-toggle-slider:before {
    transform: translateX(30px);
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    box-shadow:
        0 3px 6px rgba(0, 0, 0, 0.3),
        0 6px 12px rgba(0, 0, 0, 0.15);
}

/* Efecto de pulsación al hacer clic */
.max-toggle-switch input:active+.max-toggle-slider:before {
    width: 32px;
}

/* Focus para accesibilidad */
.max-toggle-switch input:focus+.max-toggle-slider {
    box-shadow:
        0 0 0 3px rgba(79, 70, 229, 0.2),
        inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Animación suave al cambiar */
.max-toggle-slider:after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    font-weight: 600;
    transition: opacity 0.2s;
}

/* Texto "OFF" cuando está desactivado */
.max-toggle-slider:after {
    content: 'OFF';
    right: 8px;
    color: rgba(255, 255, 255, 0.5);
    opacity: 1;
}

/* Texto "ON" cuando está activado */
.max-toggle-switch input:checked+.max-toggle-slider:after {
    content: 'ON';
    left: 8px;
    right: auto;
    color: rgba(255, 255, 255, 0.9);
    opacity: 1;
}

/* Responsive */
@media (max-width: 640px) {
    .max-toggle-switch {
        width: 56px;
        height: 30px;
    }

    .max-toggle-slider:before {
        height: 22px;
        width: 22px;
    }

    .max-toggle-switch input:checked+.max-toggle-slider:before {
        transform: translateX(26px);
    }
}