/* ==========================================================================
   Switch global InkaCode (.inka-switch) — interruptor on/off naranja.
   Es un <input type="checkbox"> nativo estilizado: sigue enviándose en el form
   ("on") y funciona con .prop('checked') / 'change' como cualquier checkbox.
   Cargado global desde app/views/common/ui_components_styles.volt.

   Markup:
     <label class="inka-switch">
       <input type="checkbox" class="inka-switch__input" id="x">
       <span class="inka-switch__track" aria-hidden="true"></span>
       <span class="inka-switch__label">Texto opcional</span>
     </label>
   Tamaño chico: .inka-switch--sm.

   Copias locales anteriores (migrar cuando se toque cada vista):
   .usr-toggle (gestionuser), .yp-toggle (branchoffice Yape/Plin),
   .pos-credito-toggle (documento electrónico), .imp-switch (impresión sucursal).
   ========================================================================== */

.inka-switch {
    --inka-switch-w: 46px;
    --inka-switch-h: 26px;
    --inka-switch-knob: 20px;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    cursor: pointer;
    vertical-align: middle;
    -webkit-tap-highlight-color: transparent;
}
.inka-switch--sm {
    --inka-switch-w: 38px;
    --inka-switch-h: 22px;
    --inka-switch-knob: 16px;
}

.inka-switch__input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

.inka-switch__track {
    position: relative;
    flex: 0 0 auto;
    width: var(--inka-switch-w);
    height: var(--inka-switch-h);
    border: 1px solid var(--ui-border-strong, #d0d5dd);
    border-radius: 999px;
    background: var(--ui-surface-muted, #eef0f3);
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.inka-switch__track::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 2px;
    width: var(--inka-switch-knob);
    height: var(--inka-switch-knob);
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .28);
    transform: translateY(-50%);
    transition: left .18s ease;
}

.inka-switch__input:checked + .inka-switch__track {
    border-color: var(--ui-accent, #ff6b00);
    background: var(--ui-accent, #ff6b00);
}
.inka-switch__input:checked + .inka-switch__track::after {
    left: calc(var(--inka-switch-w) - var(--inka-switch-knob) - 4px);
}
.inka-switch__input:focus-visible + .inka-switch__track {
    box-shadow: var(--ui-focus-ring, 0 0 0 3px rgba(255, 107, 0, .18));
}
.inka-switch:hover .inka-switch__input:not(:disabled):not(:checked) + .inka-switch__track {
    border-color: var(--ui-accent, #ff6b00);
}

.inka-switch__input:disabled + .inka-switch__track { opacity: .5; }
.inka-switch:has(.inka-switch__input:disabled) { cursor: not-allowed; }

.inka-switch__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ui-text, #172033);
}

@media (prefers-reduced-motion: reduce) {
    .inka-switch__track, .inka-switch__track::after { transition: none; }
}
