/* =============================================
   estilos.css — Sistema de Asistencia QR
   Diseñado para tablet/PC y compatible móvil
   ============================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --verde:       #16a34a;
  --verde-claro: #dcfce7;
  --verde-txt:   #14532d;
  --rojo:        #dc2626;
  --rojo-claro:  #fee2e2;
  --rojo-txt:    #7f1d1d;
  --azul:        #2563eb;
  --azul-claro:  #dbeafe;
  --gris-50:     #f8fafc;
  --gris-100:    #f1f5f9;
  --gris-200:    #e2e8f0;
  --gris-400:    #94a3b8;
  --gris-600:    #475569;
  --gris-800:    #1e293b;
  --radio:       12px;
  --sombra:      0 4px 24px rgba(0,0,0,0.10);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gris-100);
  color: var(--gris-800);
  -webkit-tap-highlight-color: transparent;
}

/* ===== CABECERA ===== */
.cabecera {
  background: #1e3a5f;
  color: #fff;
  padding: 14px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.cabecera-contenido {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.titulo-app {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.subtitulo-reunion {
  font-size: 13px;
  opacity: 0.78;
  margin-top: 2px;
}
.btn-admin-link {
  background: rgba(255,255,255,0.15);
  color: #fff;
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.2s;
}
.btn-admin-link:hover { background: rgba(255,255,255,0.25); }

/* ===== BARRA DE PROGRESO ===== */
.barra-seccion {
  max-width: 720px;
  margin: 16px auto 0;
  padding: 0 16px;
}
.barra-info {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  color: var(--gris-600);
  margin-bottom: 6px;
}
.barra-fondo {
  background: var(--gris-200);
  border-radius: 999px;
  height: 14px;
  overflow: hidden;
}
.barra-progreso {
  height: 100%;
  background: linear-gradient(90deg, #16a34a, #22c55e);
  border-radius: 999px;
  transition: width 0.6s ease;
  min-width: 2px;
}
.barra-detalle {
  font-size: 12px;
  color: var(--gris-400);
  margin-top: 4px;
  text-align: right;
}

/* ===== ZONA PRINCIPAL ===== */
.zona-principal {
  max-width: 720px;
  margin: 16px auto 30px;
  padding: 0 16px;
  position: relative;
}

/* ===== TARJETA ESCÁNER ===== */
.escaner-card {
  background: #fff;
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 20px;
}
.escaner-titulo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.icono-modo { font-size: 22px; }
.escaner-titulo h2 { font-size: 18px; font-weight: 600; }

/* ===== VISOR QR ===== */
.visor-container {
  position: relative;
  width: 100%;
  max-width: 340px;
  margin: 0 auto 16px;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
}

/* El visor interno de html5-qrcode */
#visor-qr {
  border-radius: 14px;
  overflow: hidden;
  background: #000;
}
#visor-qr video {
  border-radius: 14px;
  /* Mejora contraste y nitidez para QR */
  filter: contrast(1.1) saturate(0.9);
  display: block;
  width: 100% !important;
}
/* Ocultar UI por defecto de la librería */
#visor-qr img { display: none !important; }
#visor-qr select { display: none !important; }

/* Línea de escaneo animada */
.visor-container::after {
  content: '';
  position: absolute;
  left: 10%;
  width: 80%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #22c55e, transparent);
  border-radius: 2px;
  animation: scanLine 2s ease-in-out infinite;
  pointer-events: none;
  z-index: 2;
}
@keyframes scanLine {
  0%   { top: 15%; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 85%; opacity: 0; }
}

/* Oscurecer zonas fuera del área de escaneo */
.visor-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

/* Esquinas decorativas */
.visor-esquinas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
.esq {
  position: absolute;
  width: 26px; height: 26px;
  border-color: #22c55e;
  border-style: solid;
  opacity: 0.95;
}
.esq.tl { top: 10px;  left: 10px;  border-width: 3px 0 0 3px; border-radius: 5px 0 0 0; }
.esq.tr { top: 10px;  right: 10px; border-width: 3px 3px 0 0; border-radius: 0 5px 0 0; }
.esq.bl { bottom: 10px; left: 10px;  border-width: 0 0 3px 3px; border-radius: 0 0 0 5px; }
.esq.br { bottom: 10px; right: 10px; border-width: 0 3px 3px 0; border-radius: 0 0 5px 0; }

/* ===== BOTONES MODO ===== */
.botones-modo {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 14px;
}
.btn-modo {
  flex: 1;
  max-width: 160px;
  padding: 11px 0;
  border: 2px solid var(--gris-200);
  border-radius: 10px;
  background: var(--gris-50);
  font-size: 15px;
  font-weight: 600;
  color: var(--gris-600);
  cursor: pointer;
  transition: all 0.18s;
}
.btn-modo.activo {
  border-color: var(--azul);
  background: var(--azul-claro);
  color: var(--azul);
}
.btn-modo:hover:not(.activo) { background: var(--gris-200); }

/* ===== ZONA DNI ===== */
.dni-zona {
  display: flex;
  flex-direction: column;  /* botón debajo del input */
  gap: 10px;
  margin-bottom: 12px;
}
.input-dni {
  width: 100%;
  padding: 13px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 3px;
  text-align: center;
  outline: none;
  transition: border-color 0.18s;
}
.input-dni:focus { border-color: #2563eb; }
.btn-registrar {
  width: 100%;
  padding: 15px 20px;
  background: #16a34a;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s;
}
.btn-registrar:hover { background: #15803d; }
.btn-registrar:active { transform: scale(0.97); }

.instruccion {
  text-align: center;
  color: var(--gris-400);
  font-size: 13px;
  margin-top: 8px;
}

/* ===== OVERLAY DE CONFIRMACIÓN ===== */
.confirmacion-overlay,
.error-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.confirmacion-card {
  background: #fff;
  border-radius: 20px;
  padding: 32px 28px 24px;
  text-align: center;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  animation: slideUp 0.22s ease;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.confirmacion-card.exito { border-top: 5px solid var(--verde); }
.confirmacion-card.error { border-top: 5px solid var(--rojo); }

.confirmacion-icono { font-size: 54px; margin-bottom: 12px; }
.confirmacion-nombre {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--gris-800);
}
.confirmacion-dato { font-size: 15px; color: var(--gris-600); margin-bottom: 4px; }
.confirmacion-hora { font-size: 13px; color: var(--gris-400); margin-bottom: 20px; }

/* Barra de cuenta regresiva */
.confirmacion-contador {
  background: var(--gris-200);
  border-radius: 999px;
  height: 5px;
  overflow: hidden;
  margin-bottom: 10px;
}
.confirmacion-card.exito .contador-barra { background: var(--verde); }
.confirmacion-card.error .contador-barra { background: var(--rojo); }
.contador-barra { height: 100%; border-radius: 999px; width: 100%; }

.confirmacion-espera { font-size: 13px; color: var(--gris-400); }

/* ===== PÁGINA HISTORIAL ===== */
.hist-filtros {
  background: #fff;
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 20px;
  margin-bottom: 16px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.hist-filtros label { font-size: 12px; color: var(--gris-600); font-weight: 600; }
.hist-filtros input,
.hist-filtros select {
  width: 100%;
  margin-top: 4px;
  padding: 9px 12px;
  border: 1.5px solid var(--gris-200);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.18s;
}
.hist-filtros input:focus,
.hist-filtros select:focus { border-color: var(--azul); }

.btn-filtrar {
  align-self: end;
  padding: 10px 20px;
  background: var(--azul);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-filtrar:hover { background: #1d4ed8; }

.hist-tabla-wrap {
  background: #fff;
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  overflow-x: auto;
}
.hist-tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.hist-tabla th {
  background: var(--gris-50);
  padding: 11px 14px;
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gris-400);
  border-bottom: 1px solid var(--gris-200);
}
.hist-tabla td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--gris-100);
  color: var(--gris-800);
}
.hist-tabla tr:last-child td { border-bottom: none; }
.hist-tabla tr:hover td { background: var(--gris-50); }

.badge-qr  { background: var(--azul-claro);  color: var(--azul); padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; }
.badge-dni { background: var(--verde-claro); color: var(--verde-txt); padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; }

.paginacion { display: flex; gap: 8px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.btn-pag {
  padding: 7px 13px;
  border: 1.5px solid var(--gris-200);
  border-radius: 7px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
}
.btn-pag.activo { background: var(--azul); color: #fff; border-color: var(--azul); }
.btn-pag:hover:not(.activo) { background: var(--gris-100); }

/* ===== RESPONSIVE ===== */
@media (max-width: 500px) {
  .cabecera { padding: 12px 14px; }
  .titulo-app { font-size: 17px; }
  .escaner-card { padding: 16px; }
  .confirmacion-card { padding: 24px 18px 18px; }
  .confirmacion-nombre { font-size: 18px; }
  .confirmacion-icono { font-size: 44px; }
  .hist-filtros { grid-template-columns: 1fr; }
}
