/* ==========================================================================
   SISTEMA DE ASISTENCIA QR - PARTIDO JUSTICIALISTA RÍO GALLEGOS
   Estilos Principales - Responsive, Moderno y Mobile-First
   ========================================================================== */

:root {
  --primary: #0d3875;
  --primary-dark: #07224b;
  --primary-light: #1e40af;
  --accent: #0284c7;
  --accent-light: #e0f2fe;
  --gold: #d97706;
  --gold-light: #fef3c7;
  --success: #15803d;
  --success-light: #dcfce7;
  --warning: #b45309;
  --warning-light: #fef3c7;
  --danger: #b91c1c;
  --danger-light: #fee2e2;
  --bg-main: #f1f5f9;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #cbd5e1;
  --border-focus: #0284c7;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Header y Barra de Navegación
   ========================================================================== */
.main-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #ffffff;
  padding: 12px 20px;
  box-shadow: 0 4px 12px rgba(13, 56, 117, 0.25);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #ffffff;
}

.logo-pj {
  height: 44px;
  width: auto;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.brand-text p {
  font-size: 0.78rem;
  color: #bae6fd;
  font-weight: 500;
}

.nav-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-link {
  color: #e0f2fe;
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-link:hover, .nav-link.active {
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.nav-link.badge-link {
  background: #f59e0b;
  color: #0f172a;
}

/* ==========================================================================
   Contenedor Principal y Layout
   ========================================================================== */
.container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 20px 16px;
  width: 100%;
  flex: 1;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}
.btn-primary:hover {
  background-color: var(--primary-light);
  transform: translateY(-1px);
}

.btn-accent {
  background-color: var(--accent);
  color: #ffffff;
}
.btn-accent:hover {
  background-color: #0369a1;
}

.btn-success {
  background-color: var(--success);
  color: #ffffff;
}
.btn-success:hover {
  background-color: #166534;
}

.btn-warning {
  background-color: var(--warning);
  color: #ffffff;
}

.btn-danger {
  background-color: var(--danger);
  color: #ffffff;
}

.btn-outline {
  background-color: #ffffff;
  color: var(--primary);
  border-color: var(--border);
}
.btn-outline:hover {
  background-color: var(--bg-main);
  border-color: var(--primary);
}

.btn-lg {
  padding: 14px 24px;
  font-size: 1.05rem;
  font-weight: 700;
}

/* Tarjetas */
.card {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--bg-main);
  padding-bottom: 10px;
}

/* ==========================================================================
   KPIs y Métricas en Tiempo Real
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-icon.blue { background: var(--accent-light); color: var(--accent); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.amber { background: var(--warning-light); color: var(--warning); }
.stat-icon.purple { background: #f3e8ff; color: #7e22ce; }

.stat-info .stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.1;
}

.stat-info .stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Barra de Progreso Global */
.progress-container {
  margin-bottom: 24px;
  background: #ffffff;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 0.95rem;
}

.progress-bar-bg {
  height: 16px;
  background-color: #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7 0%, #10b981 100%);
  border-radius: 8px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Grilla de Mesas (1 a 10)
   ========================================================================== */
.mesas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.mesa-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 16px;
  transition: all 0.2s;
}

.mesa-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.mesa-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.mesa-badge {
  background-color: var(--primary);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
}

.mesa-titulo {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-dark);
  line-height: 1.3;
}

.mesa-metricas {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.mesa-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.mesa-bar-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.4s ease;
}

/* ==========================================================================
   Portal Móvil de Asistencia (Auto-servicio en Puerta)
   ========================================================================== */
.portal-asistencia {
  max-width: 480px;
  margin: 30px auto;
  padding: 0 12px;
}

.portal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px 24px;
  border: 1px solid var(--border);
  text-align: center;
}

.portal-header {
  margin-bottom: 24px;
}

.portal-header img {
  height: 64px;
  margin-bottom: 12px;
}

.portal-header h2 {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.portal-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.input-dni-group {
  margin-bottom: 20px;
}

.input-dni-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
  text-align: left;
}

.input-dni {
  width: 100%;
  font-size: 1.85rem;
  font-weight: 800;
  text-align: center;
  padding: 12px 16px;
  letter-spacing: 2px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--primary);
  background: #f8fafc;
  transition: border-color 0.2s;
}

.input-dni:focus {
  outline: none;
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.15);
}

/* Teclado táctil en pantalla */
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.keypad-btn {
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--primary);
  padding: 14px 0;
  cursor: pointer;
  transition: all 0.1s;
}

.keypad-btn:active {
  background: #e2e8f0;
  transform: scale(0.96);
}

.keypad-btn.action {
  font-size: 1.1rem;
  background: #e0f2fe;
  color: #0369a1;
}

/* Resultado de Acreditación (Éxito / Ya Acreditado / No Encontrado) */
.resultado-box {
  border-radius: var(--radius-md);
  padding: 24px;
  margin-top: 20px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.resultado-box.exito {
  background-color: var(--success-light);
  border: 2px solid var(--success);
  color: #14532d;
}

.resultado-box.duplicado {
  background-color: var(--warning-light);
  border: 2px solid var(--warning);
  color: #78350f;
}

.resultado-box.error {
  background-color: var(--danger-light);
  border: 2px solid var(--danger);
  color: #7f1d1d;
}

.badge-mesa-gran {
  background: var(--primary);
  color: #ffffff;
  font-size: 1.35rem;
  font-weight: 800;
  padding: 10px 20px;
  border-radius: 30px;
  display: inline-block;
  margin: 14px 0;
  box-shadow: 0 4px 8px rgba(13, 56, 117, 0.25);
}

/* ==========================================================================
   Panel Operativo de Mesa de Entrada
   ========================================================================== */
.operativo-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-bar-wrap {
  flex: 1;
  min-width: 260px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* Tablas Responsivas */
.table-container {
  overflow-x: auto;
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.92rem;
}

.data-table th {
  background: #f8fafc;
  padding: 12px 16px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
}

.data-table tr:hover {
  background-color: #f8fafc;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 700;
}

.tag-presente {
  background-color: var(--success-light);
  color: var(--success);
}

.tag-ausente {
  background-color: #f1f5f9;
  color: var(--text-muted);
}

/* ==========================================================================
   Cartel A4 Imprimible de Puerta
   ========================================================================== */
.cartel-a4-preview {
  max-width: 800px;
  margin: 20px auto;
  background: #ffffff;
  padding: 40px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
  text-align: center;
}

@media print {
  body {
    background: #ffffff !important;
    padding: 0 !important;
  }
  .main-header, .no-print, .btn, .nav-links {
    display: none !important;
  }
  .cartel-a4-preview {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }
  @page {
    size: A4 portrait;
    margin: 1.5cm;
  }
}
