/* validacion.css — Validación de etiquetas.
 * Dos estados:
 *   1. Pantalla de intro (dentro de <main>, flujo normal de la app).
 *   2. Overlay fullscreen (encima de todo, se inyecta en <body>).
 */

/* =============================================
   INTRO (dentro de la app, antes de escanear)
   ============================================= */

.valid-intro {
  display: grid;
  place-items: center;
  min-height: 50vh;
}
.valid-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--space-8) var(--space-6);
  max-width: 440px;
  width: 100%;
  text-align: center;
}
.valid-icon { color: var(--c-D); margin-bottom: var(--space-4); }
.valid-card h2 { margin: 0 0 var(--space-3); font-size: 20px; }
.valid-card > p {
  margin: 0 0 var(--space-5);
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.valid-form label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
  margin-bottom: var(--space-2);
}
.valid-input-row {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  align-items: stretch;
}
.valid-form input[type=number] {
  width: 80px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font: inherit;
  font-size: 18px;
  text-align: center;
  background: var(--bg);
  color: var(--ink);
}
.valid-form input[type=number]:focus {
  outline: none;
  border-color: var(--c-D);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.15);
}
.valid-hint {
  display: block;
  margin-top: var(--space-2);
  font-size: 12px;
  color: var(--ink-mute);
}
.valid-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background: var(--c-D);
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.valid-btn-primary:active { filter: brightness(0.9); }

@media (max-width: 420px) {
  .valid-card { padding: var(--space-5) var(--space-3); }
  .valid-card h2 { font-size: 17px; }
  .valid-input-row { flex-direction: column; align-items: stretch; }
  .valid-form input[type=number] { width: 100%; }
}


/* =============================================
   OVERLAY FULLSCREEN (durante el escaneo)
   ============================================= */

/* Cuando el overlay está activo, ocultamos la app detrás */
body.valid-fullscreen .topbar,
body.valid-fullscreen .app-shell {
  display: none !important;
}

.valid-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #111;
  color: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
}

/* — Barra superior del overlay — */
.vsc-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(0,0,0,0.6);
  flex-shrink: 0;
  z-index: 2;
}
.vsc-cancel {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
}
.vsc-cancel:active { background: rgba(255,255,255,0.1); }
.vsc-counter {
  font-size: 15px;
  font-weight: 700;
  background: rgba(255,255,255,0.15);
  padding: 4px 14px;
  border-radius: 20px;
}

/* — Zona de cámara — */
.vsc-camera {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: #000;
}
#vsc-reader {
  width: 100%;
  height: 100%;
}
#vsc-reader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

/* — Zona inferior con instrucción — */
.vsc-bottom {
  flex-shrink: 0;
  padding: 16px 20px 28px;
  background: rgba(0,0,0,0.7);
  text-align: center;
  z-index: 2;
}
.vsc-instruction {
  margin: 12px 0 0;
  font-size: 16px;
  color: #fff;
}
.vsc-instruction strong {
  color: #facc15;
}

/* — Barra de progreso (compartida) — */
.vsc-progress {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
  overflow: hidden;
}
.vsc-progress-fill {
  height: 100%;
  background: #facc15;
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* — Pantalla de confirmación (entre escaneos) — */
.vsc-confirm {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
  gap: 16px;
}
.vsc-confirm-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 36px;
  font-weight: 800;
}
.vsc-ok {
  background: rgba(46, 168, 100, 0.15);
  color: #4ade80;
  border: 2px solid #4ade80;
}
.vsc-confirm h2 {
  margin: 0;
  font-size: 22px;
  color: #fff;
}
.vsc-value {
  display: block;
  background: rgba(255,255,255,0.08);
  color: #e2e8f0;
  padding: 8px 16px;
  border-radius: 8px;
  font-family: var(--font-mono, monospace);
  font-size: 14px;
  word-break: break-all;
  max-width: 100%;
}
.vsc-confirm .vsc-progress {
  max-width: 300px;
}

/* Botón grande para siguiente escaneo */
.vsc-next-btn {
  display: block;
  width: 100%;
  max-width: 340px;
  padding: 18px 24px;
  margin: 8px auto 0;
  background: #facc15;
  color: #1a1a1a;
  border: none;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.01em;
}
.vsc-next-btn:active {
  filter: brightness(0.9);
  transform: scale(0.98);
}
.vsc-done-btn {
  display: block;
  width: 100%;
  max-width: 340px;
  padding: 14px 24px;
  margin: 8px auto 0;
  background: transparent;
  color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.vsc-done-btn:active {
  background: rgba(255,255,255,0.08);
}

.vsc-next-hint {
  margin: 8px 0 0;
  font-size: 13px;
  color: rgba(255,255,255,0.5);
}

/* — Pantallas de resultado (éxito / error) — */
.vsc-result {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
  gap: 16px;
}
.vsc-result-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 40px;
  font-weight: 800;
}
.vsc-result h2 {
  margin: 0;
  font-size: 22px;
}
.vsc-result p {
  margin: 0;
  font-size: 15px;
  color: rgba(255,255,255,0.7);
}

/* Éxito */
.vsc-result--success .vsc-result-icon {
  background: rgba(46, 168, 100, 0.15);
  color: #4ade80;
  border: 3px solid #4ade80;
}
.vsc-result--success h2 { color: #4ade80; }
.vsc-result--success .vsc-next-btn {
  background: #4ade80;
  color: #052e16;
}

/* Error */
.vsc-result--error .vsc-result-icon {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 3px solid #f87171;
}
.vsc-result--error h2 { color: #f87171; }
.vsc-result--error .vsc-next-btn {
  background: #f87171;
  color: #450a0a;
}

/* Detalle del mismatch */
.vsc-mismatch {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  width: 100%;
  max-width: 340px;
}
.vsc-mismatch-item {
  background: rgba(255,255,255,0.06);
  padding: 12px 14px;
  border-radius: 10px;
}
.vsc-mismatch-bad {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.3);
}
.vsc-mismatch-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.5);
  margin-bottom: 4px;
}
.vsc-mismatch-item code {
  display: block;
  font-family: var(--font-mono, monospace);
  font-size: 14px;
  color: #e2e8f0;
  word-break: break-all;
}

/* — Safe area para móviles con notch — */
@supports (padding: env(safe-area-inset-top)) {
  .vsc-topbar { padding-top: max(12px, env(safe-area-inset-top)); }
  .vsc-bottom { padding-bottom: max(28px, env(safe-area-inset-bottom)); }
  .vsc-result { padding-bottom: max(32px, env(safe-area-inset-bottom)); }
  .vsc-confirm { padding-bottom: max(32px, env(safe-area-inset-bottom)); }
}
