/* ============================================================
   base.css — tokens, tipografía, estructura y componentes base
   ============================================================ */

:root {
  --fondo:        #0B1120;
  --fondo-alto:   #0F1729;
  --panel:        #131E33;
  --panel-alto:   #1A2842;
  --borde:        #22314C;
  --borde-claro:  #2E4266;
  --azul:         #3B82F6;
  --azul-claro:   #60A5FA;
  --gema:         #38BDF8;
  --gema-honda:   #0EA5E9;
  --rojo:         #F0503A;
  --rojo-honda:   #B91C1C;
  --verde:        #22C55E;
  --ambar:        #F59E0B;
  --texto:        #E8EEF9;
  --texto-suave:  #8DA0BE;
  --texto-tenue:  #5B6E8E;

  --radio-s: 8px;
  --radio-m: 12px;
  --radio-l: 18px;

  --sombra-panel: 0 18px 40px rgba(3, 8, 20, .45);
  --fuente-display: "Sora", system-ui, sans-serif;
  --fuente-texto: "Inter", system-ui, sans-serif;
  --fuente-dato: "JetBrains Mono", ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 520px at 50% -10%, #16233C 0%, transparent 62%),
    var(--fondo);
  color: var(--texto);
  font-family: var(--fuente-texto);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

h1, h2, h3 { font-family: var(--fuente-display); margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

.contenedor {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}

.salto-contenido {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--azul);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 var(--radio-s) 0;
  z-index: 100;
}
.salto-contenido:focus { left: 0; }

/* ---------- Cabecera ---------- */

.cabecera {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(11, 17, 32, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--borde);
}

.cabecera-fila {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
}

.marca { display: flex; align-items: center; gap: 10px; }

.marca-icono {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: var(--gema);
  stroke-width: 2;
  stroke-linejoin: round;
}

.marca h1 { font-size: 19px; font-weight: 700; }

.etiqueta-beta {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--azul-claro);
  border: 1px solid rgba(96, 165, 250, .4);
  background: rgba(59, 130, 246, .12);
  padding: 3px 7px;
  border-radius: 999px;
}

.saldo { text-align: right; line-height: 1.2; }
.saldo-titulo {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--texto-tenue);
}
.saldo-monto {
  font-family: var(--fuente-dato);
  font-size: 20px;
  font-weight: 700;
  color: var(--texto);
}
.saldo-monto.parpadeo { animation: latido-saldo .5s ease; }

@keyframes latido-saldo {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.09); color: var(--gema); }
  100% { transform: scale(1); }
}

/* ---------- Disposición ---------- */

.disposicion {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  padding-top: 20px;
  padding-bottom: 32px;
  align-items: start;
}

/* Tablet: el tablero centrado y los paneles en dos columnas */
@media (min-width: 620px) and (max-width: 899px) {
  .columna-lateral { grid-template-columns: 1fr 1fr; align-items: start; }
  .columna-lateral > section:last-child { grid-column: 1 / -1; }
}

/* Laptop y escritorio */
@media (min-width: 900px) {
  .disposicion { grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; }
}

@media (min-width: 1440px) {
  .contenedor { max-width: 1280px; }
  .disposicion { grid-template-columns: minmax(0, 1fr) 370px; gap: 24px; }
  body { font-size: 16px; }
  .tarjeta { padding: 22px; }
}

.columna-lateral { display: grid; gap: 16px; }

.tarjeta {
  background: linear-gradient(180deg, var(--panel) 0%, var(--fondo-alto) 100%);
  border: 1px solid var(--borde);
  border-radius: var(--radio-l);
  box-shadow: var(--sombra-panel);
  padding: 18px;
}

.titulo-panel {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--texto-suave);
  margin-bottom: 14px;
}

.texto-suave { color: var(--texto-suave); font-size: 13px; margin-bottom: 14px; }

/* ---------- Campos ---------- */

.campo { margin-bottom: 16px; }

.campo > label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--texto-suave);
  margin-bottom: 6px;
}

.campo-caja {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0C1424;
  border: 1px solid var(--borde);
  border-radius: var(--radio-m);
  padding: 0 12px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.campo-caja:focus-within {
  border-color: var(--azul);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .2);
}

.campo-caja.con-error { border-color: var(--rojo); }

.campo-prefijo { color: var(--texto-tenue); font-family: var(--fuente-dato); }

.campo-icono {
  width: 17px; height: 17px;
  fill: none; stroke: var(--texto-tenue);
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  flex: none;
}

.campo-caja input,
.campo-caja select {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--texto);
  font-family: var(--fuente-dato);
  font-size: 15px;
  font-weight: 500;
  padding: 11px 0;
  letter-spacing: .02em;
}

.campo-caja select {
  font-family: var(--fuente-texto);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238DA0BE' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
  background-size: 16px;
  padding-right: 22px;
}

.campo-caja select option { background: var(--panel); color: var(--texto); }

.mensaje-campo {
  font-size: 12px;
  color: var(--rojo);
  min-height: 16px;
  margin-top: 5px;
}
.mensaje-campo.correcto { color: var(--verde); }

.pie-campo { font-size: 11.5px; color: var(--texto-tenue); margin-top: 8px; }

.fichas { display: flex; gap: 6px; margin-top: 8px; }

.ficha {
  flex: 1;
  background: var(--panel-alto);
  border: 1px solid var(--borde);
  color: var(--texto-suave);
  border-radius: var(--radio-s);
  padding: 7px 4px;
  font-family: var(--fuente-texto);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .1s ease;
}
.ficha:hover { background: #24344F; color: var(--texto); }
.ficha:active { transform: scale(.96); }

/* ---------- Botones ---------- */

.boton {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radio-m);
  padding: 13px 16px;
  font-family: var(--fuente-texto);
  font-size: 14.5px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: transform .1s ease, filter .15s ease, background .15s ease;
}

.boton + .boton { margin-top: 9px; }
.boton:hover { filter: brightness(1.08); }
.boton:active { transform: scale(.985); }

.boton:disabled {
  opacity: .45;
  cursor: not-allowed;
  filter: none;
  transform: none;
}

.boton-principal { background: linear-gradient(180deg, #3B82F6, #2563EB); }
.boton-cobrar { background: linear-gradient(180deg, #22C55E, #16A34A); }
.boton-cobrar:not(:disabled) { animation: respirar 2.4s ease-in-out infinite; }
.boton-retirar { background: var(--panel-alto); border: 1px solid var(--borde); color: var(--texto); }
.boton-retirar:hover { background: #24344F; }

@keyframes respirar {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
  50%      { box-shadow: 0 0 0 5px rgba(34, 197, 94, .13); }
}

.boton-monto { font-family: var(--fuente-dato); font-weight: 700; }

.boton-icono {
  width: 17px; height: 17px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.boton.cargando { pointer-events: none; opacity: .7; }

/* ---------- Avisos (toast) ---------- */

.avisos {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 60;
  display: grid;
  gap: 8px;
  width: calc(100% - 32px);
  max-width: 380px;
}

.aviso {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-alto);
  border: 1px solid var(--borde);
  border-left: 3px solid var(--azul);
  border-radius: var(--radio-m);
  padding: 12px 14px;
  font-size: 13.5px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
  animation: entrada-aviso .25s ease;
}
.aviso.exito { border-left-color: var(--verde); }
.aviso.error { border-left-color: var(--rojo); }
.aviso.saliendo { animation: salida-aviso .25s ease forwards; }

@keyframes entrada-aviso {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes salida-aviso {
  to { opacity: 0; transform: translateY(10px); }
}

/* ---------- Pie ---------- */

.pie {
  border-top: 1px solid var(--borde);
  padding: 18px 0 28px;
  color: var(--texto-tenue);
  font-size: 12.5px;
  text-align: center;
}

/* ---------- Móviles (Android / iPhone) ---------- */

@media (max-width: 600px) {
  .contenedor { padding: 0 12px; }
  .disposicion { gap: 12px; padding-top: 14px; }
  .tarjeta { padding: 14px; border-radius: var(--radio-m); }
  .cabecera-fila { min-height: 56px; }
  .marca h1 { font-size: 17px; }
  .saldo-monto { font-size: 18px; }
  .titulo-panel { margin-bottom: 11px; }

  /* áreas táctiles cómodas */
  .ficha { padding: 10px 4px; font-size: 12.5px; }
  .boton { padding: 14px 16px; }
  .campo-caja input,
  .campo-caja select { padding: 12px 0; font-size: 16px; } /* 16px evita el zoom de Android/iOS */

  .avisos { bottom: 12px; }
}

/* ---------- Accesibilidad ---------- */

:focus-visible {
  outline: 2px solid var(--azul-claro);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
