/*
 * styles.css — Móvil-first, alto contraste, botones grandes, uso con una mano.
 */

:root {
  --bg: #0b1020;
  --surface: #151b30;
  --surface-2: #1e2743;
  --text: #f5f7ff;
  --muted: #a7b0cc;
  --accent: #3b82f6;
  --accent-strong: #2563eb;
  --ok: #16a34a;
  --ok-strong: #22c55e;
  --error: #dc2626;
  --error-strong: #ef4444;
  --warn: #f59e0b;
  --radius: 16px;
  --tap: 64px; /* altura mínima táctil grande */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------- Aviso de compatibilidad ---------- */
.compat {
  background: var(--warn);
  color: #1a1200;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.4;
  padding: 14px 16px;
  text-align: center;
}
.compat div + div { margin-top: 6px; }

/* ---------- Header ---------- */
.header { text-align: center; }
.title {
  margin: 6px 0 2px;
  font-size: 1.6rem;
  letter-spacing: 0.5px;
}
.status {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 999px;
  display: inline-block;
}
.status--idle { background: var(--surface-2); color: var(--muted); }
.status--scanning { background: var(--accent-strong); color: #fff; }
.status--error { background: var(--error); color: #fff; }

/* ---------- Selector de acción ---------- */
.actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.action-btn {
  min-height: var(--tap);
  border: 2px solid var(--surface-2);
  background: var(--surface);
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 800;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform .05s ease, background .1s ease, border-color .1s ease;
}
.action-btn:last-child { grid-column: 1 / -1; } /* Consultar a lo ancho */
.action-btn:active { transform: scale(0.98); }
.action-btn--active {
  background: var(--accent);
  border-color: #fff;
  color: #fff;
}

/* ---------- Cantidad ---------- */
.amount-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}
.qty-btn {
  width: var(--tap);
  min-height: var(--tap);
  font-size: 2rem;
  font-weight: 900;
  border: none;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.qty-btn:active { transform: scale(0.96); }
.amount-input {
  flex: 1;
  min-height: var(--tap);
  text-align: center;
  font-size: 2rem;
  font-weight: 900;
  border: 2px solid var(--surface-2);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

/* ---------- Resultado grande ---------- */
.result {
  border-radius: var(--radius);
  padding: 22px 16px;
  text-align: center;
  border: 3px solid var(--surface-2);
  background: var(--surface);
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.result--neutral { border-color: var(--surface-2); }
.result--ok { border-color: var(--ok-strong); background: rgba(34,197,94,0.12); }
.result--error { border-color: var(--error-strong); background: rgba(239,68,68,0.12); }
.result-balance {
  font-size: 5.5rem;
  font-weight: 900;
  line-height: 1;
}
.result--ok .result-balance { color: var(--ok-strong); }
.result--error .result-balance { color: var(--error-strong); }
.result-label {
  font-size: 1.25rem;
  font-weight: 700;
}
.result-serial {
  font-size: 0.95rem;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
}

/* ---------- Botones escanear / detener ---------- */
.scan-btn, .stop-btn {
  min-height: 72px;
  font-size: 1.5rem;
  font-weight: 900;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  color: #fff;
}
.scan-btn { background: var(--ok); }
.scan-btn:active { transform: scale(0.99); }
.scan-btn.is-disabled, .scan-btn:disabled {
  background: var(--surface-2);
  color: var(--muted);
  cursor: not-allowed;
}
.stop-btn { background: var(--surface-2); color: var(--text); }

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
  line-height: 1.4;
}

/* ---------- Overlays (PIN / confirmación) ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.overlay[hidden] { display: none; }
.overlay-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 2px solid var(--surface-2);
}
.overlay-title { margin: 0; font-size: 1.35rem; }
.overlay-text { margin: 0; color: var(--muted); }
.pin-input {
  min-height: var(--tap);
  font-size: 2rem;
  text-align: center;
  letter-spacing: 0.3em;
  border: 2px solid var(--surface-2);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}
.pin-error { margin: 0; color: var(--error-strong); font-weight: 700; }
.overlay-btn {
  min-height: var(--tap);
  font-size: 1.2rem;
  font-weight: 800;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
.overlay-btn--ghost { background: var(--surface-2); color: var(--text); }
.overlay-btn--danger { background: var(--error); color: #fff; }
.confirm-serial {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.2rem;
  font-weight: 800;
  text-align: center;
  word-break: break-all;
  background: var(--bg);
  padding: 12px;
  border-radius: var(--radius);
}

/* ---------- Panel de simulación ---------- */
.mock-panel {
  border: 2px dashed var(--warn);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mock-panel[hidden] { display: none; }
.mock-title { margin: 0; font-weight: 800; color: var(--warn); }
.mock-input {
  min-height: 52px;
  font-size: 1.1rem;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 2px solid var(--surface-2);
  background: var(--bg);
  color: var(--text);
}
.mock-btn {
  min-height: 52px;
  font-size: 1.1rem;
  font-weight: 800;
  border: none;
  border-radius: var(--radius);
  background: var(--warn);
  color: #1a1200;
  cursor: pointer;
}

@media (min-width: 480px) {
  .result-balance { font-size: 6.5rem; }
}
