/* ══════════════════════════════════════════════════════
   Estilo corporativo inspirado en ENAP Chile
   Colores institucionales:
     Azul ENAP    → #002B5C
     Rojo ENAP    → #CC092F
     Azul claro   → #E8EDF3
   ══════════════════════════════════════════════════════ */

/* ── Reset & Base ──────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Open Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #f4f6f9;
  color: #2d3436;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: #002B5C;
  text-decoration: none;
  font-weight: 600;
}

a:hover {
  color: #CC092F;
  text-decoration: underline;
}

/* ── Header (barra superior ENAP) ──────────────────── */
header {
  background: linear-gradient(135deg, #002B5C 0%, #003d7a 100%);
  padding: 0.75rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 12px rgba(0, 43, 92, 0.25);
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  font-size: 1.3rem;
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 0.5px;
}

header h1::before {
  content: "";
  display: inline-block;
  width: 28px;
  height: 28px;
  background: #CC092F;
  border-radius: 50%;
  margin-right: 10px;
  vertical-align: middle;
  border: 2px solid rgba(255,255,255,0.3);
}

header nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

header nav a {
  margin-left: 0;
  color: rgba(255,255,255,0.85);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.4rem 1rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

header nav a:hover {
  color: #ffffff;
  background: rgba(255,255,255,0.12);
  text-decoration: none;
}

#user-info {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

#user-info span {
  color: rgba(255,255,255,0.85);
  font-size: 0.85rem;
  font-weight: 500;
}

.btn-logout {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.3);
  color: #ffffff;
  padding: 0.3rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  background: #CC092F;
  border-color: #CC092F;
}

/* ── Main ─────────────────────────────────────────── */
main {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* ── Login (pantalla completa centrada) ───────────── */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #002B5C 0%, #001a3a 50%, #002B5C 100%);
  padding: 1rem;
}

.login-card {
  background: #ffffff;
  padding: 2.5rem;
  border-radius: 12px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-card h2 {
  text-align: center;
  margin-bottom: 0.5rem;
  color: #002B5C;
  font-size: 1.6rem;
  font-weight: 700;
}

.login-card h2::before {
  content: "";
  display: block;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #002B5C, #CC092F);
  border-radius: 50%;
  margin: 0 auto 1rem;
}

.login-card p.subtitle {
  text-align: center;
  color: #636e72;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

/* ── Forms ────────────────────────────────────────── */
.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #002B5C;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.7rem 1rem;
  background: #f8f9fa;
  border: 2px solid #e0e4e8;
  border-radius: 8px;
  color: #2d3436;
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #002B5C;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(0, 43, 92, 0.1);
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

/* ── Buttons ──────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.2s ease;
  letter-spacing: 0.3px;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: #002B5C;
  color: #fff;
  width: 100%;
}

.btn-primary:hover {
  background: #003d7a;
  box-shadow: 0 4px 12px rgba(0, 43, 92, 0.3);
}

.btn-secondary {
  background: #e8edf3;
  color: #002B5C;
  border: 1px solid #d0d8e3;
}

.btn-secondary:hover {
  background: #d0d8e3;
}

.btn-danger {
  background: #CC092F;
  color: #fff;
}

.btn-danger:hover {
  background: #a80726;
  box-shadow: 0 4px 12px rgba(204, 9, 47, 0.3);
}

.btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
}

/* ── Messages ─────────────────────────────────────── */
.error-msg {
  background: #fef2f2;
  border: 1px solid #CC092F;
  color: #a80726;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.success-msg {
  background: #f0fdf4;
  border: 1px solid #22c55e;
  color: #166534;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
}

/* ── Cards ────────────────────────────────────────── */
.card {
  background: #ffffff;
  border: 1px solid #e8edf3;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.card h3 {
  margin-bottom: 1rem;
  color: #002B5C;
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Tables ───────────────────────────────────────── */
.table-container {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #e8edf3;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table th,
table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e8edf3;
}

table th {
  background: #f4f6f9;
  color: #002B5C;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

table tr:last-child td {
  border-bottom: none;
}

table tr:hover {
  background: #f8f9fa;
}

/* ── Streaming ────────────────────────────────────── */
.streaming-wrapper {
  text-align: center;
  background: #ffffff;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.streaming-wrapper h2 {
  margin-bottom: 0.5rem;
  color: #002B5C;
  font-size: 1.5rem;
}

.streaming-wrapper .fecha {
  color: #636e72;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.video-container {
  position: relative;
  width: 100%;
  max-width: 896px;
  margin: 0 auto 1.5rem;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ── Grids ────────────────────────────────────────── */
.admin-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
}

@media (max-width: 768px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }

  header {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
  }

  header h1 {
    font-size: 1.1rem;
  }

  main {
    padding: 1rem;
  }

  .login-card {
    padding: 1.5rem;
  }
}

/* ── Modal ────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: #ffffff;
  border-radius: 12px;
  padding: 2rem;
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal h3 {
  margin-bottom: 1.2rem;
  color: #002B5C;
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-actions {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.5rem;
}

.modal-actions .btn {
  flex: 1;
}

/* ── Badge ────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-admin {
  background: #e8edf3;
  color: #002B5C;
  border: 1px solid #002B5C;
}

.badge-viewer {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #22c55e;
}

.badge-activo {
  background: #f0fdf4;
  color: #166534;
}

.badge-inactivo {
  background: #fef2f2;
  color: #a80726;
}

.badge-confirmado {
  background: #f0fdf4;
  color: #166534;
}

.badge-pendiente {
  background: #fffbeb;
  color: #b45309;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
}

.toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #002B5C;
}

/* ── Footer estilo ENAP ───────────────────────────── */
footer {
  background: #002B5C;
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 1rem;
  font-size: 0.8rem;
  margin-top: auto;
}

footer strong {
  color: #ffffff;
}

/* ── Barra superior decorativa (tricolor) ─────────── */
.top-bar {
  height: 4px;
  background: linear-gradient(90deg, #002B5C 33%, #ffffff 33%, #ffffff 66%, #CC092F 66%);
}

/* ── Separador ENAP ───────────────────────────────── */
hr.separator {
  border: none;
  height: 2px;
  background: linear-gradient(90deg, #002B5C, #CC092F);
  margin: 1rem 0;
  opacity: 0.3;
}

/* ─── Detalle del login demo ──────────────────────── */
.demo-credentials {
  margin-top: 1.5rem;
  padding: 1rem;
  background: #f4f6f9;
  border-radius: 8px;
  text-align: center;
}

.demo-credentials p {
  font-size: 0.8rem;
  color: #636e72;
}

.demo-credentials code {
  display: inline-block;
  background: #e8edf3;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.78rem;
  color: #002B5C;
  font-weight: 600;
  font-family: 'Courier New', monospace;
}
