/* Movimiento inspirado en Cult UI (cult-ui.com), con los colores de la app y sin bordes de colores:
   selectores y pestañas que se deslizan (ver halo.js), interruptores, aviso tipo «Dynamic Island» en el PIN,
   avisos que entran suave, insignias que laten y barra de progreso con brillo.
   Hecho solo con CSS, sin React ni librerías. Se carga después de app.css: para quitarlo, basta con borrar su <link>.
   Con «reducir movimiento» del sistema, todo queda quieto. */

@keyframes halo-late { 0% { box-shadow: 0 0 0 0 rgba(240, 164, 58, .6); } 70% { box-shadow: 0 0 0 8px rgba(240, 164, 58, 0); } 100% { box-shadow: 0 0 0 0 rgba(240, 164, 58, 0); } }
@keyframes halo-entra { from { opacity: 0; transform: translateY(10px) scale(.96); filter: blur(4px); } }
@keyframes halo-brilla { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* ---------- Botones: se hunden un poco al tocarlos ---------- */
.btn, .btn-cobrar { transition: transform .15s ease-out, background-color .15s, box-shadow .2s; }
.btn:active:not(:disabled) { transform: scale(.96); }
.btn-cobrar:active:not(:disabled) { transform: scale(.98); }

/* ---------- Campos: foco con un anillo suave del color de la app ---------- */
:is(input:is([type="text"], [type="search"], [type="email"], [type="password"], [type="number"], [type="date"], [type="month"], :not([type])), select, textarea) {
  transition: border-color .15s, box-shadow .2s ease-out;
}
:is(input:is([type="text"], [type="search"], [type="email"], [type="password"], [type="number"], [type="date"], [type="month"], :not([type])), select, textarea):focus {
  outline: none; border-color: var(--petroleo);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--petroleo) 18%, transparent);
}

/* ---------- Selector (Contado/Crédito, Factura/Comprobante…): el fondo activo se desliza ---------- */
.segmentos { position: relative; isolation: isolate; padding: 3px; gap: 2px; border-radius: 12px; background: var(--superficie-2); }
.segmentos::before {
  content: ''; position: absolute; z-index: -1; top: 3px; bottom: 3px; left: 0;
  width: var(--halo-w, 0px); transform: translateX(var(--halo-x, 0px));
  border-radius: 9px; background: var(--activo); box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
  transition: transform .32s cubic-bezier(.34, 1.36, .64, 1), width .32s cubic-bezier(.34, 1.36, .64, 1);
}
.segmentos:not(.halo-listo)::before { display: none; }
.segmentos button { position: relative; border-radius: 9px; background: transparent; transition: color .2s; }
.segmentos button + button { border-left: 0; }
.segmentos.halo-listo button[aria-pressed="true"] { background: transparent; color: var(--activo-texto); }
.segmentos button[aria-pressed="true"]:disabled { background: transparent; }

/* ---------- Pestañas: la línea se desliza a la pestaña activa ---------- */
.pestanas { position: relative; }
.pestanas::after {
  content: ''; position: absolute; bottom: -1px; left: 0; height: 3px; border-radius: 3px;
  width: var(--halo-w, 0px); transform: translateX(var(--halo-x, 0px)); background: var(--petroleo);
  transition: transform .32s cubic-bezier(.34, 1.36, .64, 1), width .32s cubic-bezier(.34, 1.36, .64, 1);
}
.pestanas:not(.halo-listo)::after { display: none; }
.pestanas.halo-listo button[aria-selected="true"] { border-bottom-color: transparent; }

/* ---------- Interruptores: las casillas de sí/no ---------- */
@property --halo-perilla { syntax: '<length>'; inherits: false; initial-value: 13px; }
.casilla input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 46px; height: 28px; margin: 0; border-radius: 999px; cursor: pointer; border: 0;
  background: radial-gradient(circle at var(--halo-perilla) 50%, #fff 0 10px, transparent 11px), var(--linea-2);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .15);
  transition: --halo-perilla .28s cubic-bezier(.34, 1.56, .64, 1), background-color .2s;
}
.casilla input[type="checkbox"]:checked {
  --halo-perilla: 33px;
  background: radial-gradient(circle at var(--halo-perilla) 50%, #fff 0 10px, transparent 11px), var(--petroleo-fondo);
}
.casilla input[type="checkbox"]:focus-visible { outline: 3px solid #7FB3D8; outline-offset: 2px; }
.casilla input[type="checkbox"]:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Avisos: entran suave ---------- */
.toast { animation: halo-entra .35s cubic-bezier(.34, 1.36, .64, 1); backdrop-filter: blur(10px); }
.aviso { animation: halo-entra .3s ease-out; }

/* ---------- Aviso del PIN tipo «Dynamic Island»: crece desde una cápsula negra, como en el iPhone ---------- */
@keyframes isla-crece {
  0% { opacity: 0; clip-path: inset(0 calc(50% - 30px) round 999px); }
  35% { opacity: 1; clip-path: inset(0 calc(50% - 30px) round 999px); }
  100% { opacity: 1; clip-path: inset(0 0 round 22px); }
}
.pin-error {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px 12px 14px; border-radius: 22px; border: 0;
  background: #000; color: #fff;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .45);
  animation: isla-crece .5s cubic-bezier(.34, 1.3, .64, 1);
  transform: translateX(-50%);
}
.pin-error::before { content: ''; flex: none; width: 10px; height: 10px; border-radius: 999px; background: #EE7B6E; }
.pin-error.info { background: #000; border: 0; }
.pin-error.info::before { background: #7FB3D8; animation: halo-late 1.2s ease-out infinite; }
.pin-error:empty { display: none; }

/* ---------- Insignias: pendientes por sincronizar y la campana laten ---------- */
.insignia, .barra-btn.campana .globo { font-variant-numeric: tabular-nums; animation: halo-late 2s ease-out infinite; }

/* ---------- Barra de progreso: avanza con rebote suave y un brillo que la recorre ---------- */
.progreso div { position: relative; overflow: hidden; transition: width .45s cubic-bezier(.34, 1.36, .64, 1); }
.progreso div::after {
  content: ''; position: absolute; inset: 0; width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
  animation: halo-brilla 1.6s ease-in-out infinite;
}

/* ---------- Reducir movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
  .btn, .btn-cobrar, .segmentos::before, .pestanas::after, .casilla input[type="checkbox"], .toast, .aviso,
  .pin-error, .pin-error::before, .insignia, .barra-btn.campana .globo, .progreso div, .progreso div::after { animation: none !important; transition: none !important; }
  .btn:active:not(:disabled), .btn-cobrar:active:not(:disabled) { transform: none; }
}
