/* proyecto-examen-vigilancia/profesor/style.css */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* Header — fijo arriba */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #1e2a3a;
  color: #fff;
  padding: 0.85rem 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

header h1 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; }

/* Sesión info — centro del header */
.sesion-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.35rem 1rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
}

.sesion-nombre {
  font-size: 0.88rem;
  font-weight: 600;
  color: #e2e8f0;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sesion-codigo-wrap { display: flex; align-items: center; gap: 0.4rem; }

.sesion-codigo {
  font-family: "Courier New", Courier, monospace;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.06em;
}

.btn-copiar {
  padding: 0.18rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(255,255,255,0.12);
  color: #cbd5e1;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-copiar:hover { background: rgba(255,255,255,0.22); color: #fff; }

.sesion-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.sesion-badge-activo   { background: #166534; color: #bbf7d0; }
.sesion-badge-inactivo { background: rgba(255,255,255,0.1); color: #94a3b8; }

.btn-sesion-accion {
  padding: 0.32rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.btn-sesion-iniciar  { background: #16a34a; color: #fff; }
.btn-sesion-iniciar:hover  { background: #15803d; }
.btn-sesion-finalizar { background: #dc2626; color: #fff; }
.btn-sesion-finalizar:hover { background: #b91c1c; }

.btn-reporte {
  padding: 0.32rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
  background: #475569;
  color: #fff;
}
.btn-reporte:hover { background: #334155; }
.btn-reporte:disabled { background: #94a3b8; cursor: not-allowed; }

.controls { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }

.controls label { font-size: 0.85rem; opacity: 0.75; }

#estudiante-select {
  padding: 0.4rem 0.65rem;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  min-width: 240px;
  background: #fff;
  color: #1a1a2e;
}

/* Main */
main { max-width: 1280px; margin: 1.75rem auto; padding: 0 1.5rem; }

/* Tabs */
.tabs { display: flex; gap: 0.25rem; border-bottom: 2px solid #1e2a3a; }

.tab-btn {
  padding: 0.55rem 1.5rem;
  border: 2px solid #1e2a3a;
  border-bottom: none;
  background: transparent;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e2a3a;
  transition: background 0.15s, color 0.15s;
  position: relative;
  bottom: -2px;
}

.tab-btn:hover { background: #e8edf2; }
.tab-btn.active { background: #1e2a3a; color: #fff; }

/* Tab panels */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Filters */
.filters {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.7rem 1rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-top: none;
  font-size: 0.875rem;
  color: #475569;
}

.filters label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  font-weight: 500;
}

/* Table wrapper */
.table-wrap {
  background: #fff;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
  overflow-x: auto;
}

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

thead { background: #1e2a3a; color: #fff; }
thead th {
  padding: 0.7rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tbody tr { border-bottom: 1px solid #f1f5f9; transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:nth-child(even) { background: #f8fafc; }
tbody tr:hover { background: #eff6ff !important; }
tbody td { padding: 0.6rem 1rem; vertical-align: top; word-break: break-word; }

.empty-msg {
  text-align: center;
  padding: 2.5rem;
  color: #94a3b8;
  font-size: 0.9rem;
  display: none;
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

#logs-table th:nth-child(2),
#logs-table td:nth-child(2) { min-width: 140px; white-space: nowrap; }

.badge-ventana      { background: #dbeafe; color: #1d4ed8; }
.badge-portapapeles { background: #fff7ed; color: #c2410c; border: 1px solid #fdba74; }
.badge-captura      { background: #dcfce7; color: #15803d; }

/* Nivel badges */
.badge-alto  { background: #fee2e2; color: #b91c1c; }
.badge-medio { background: #ffedd5; color: #c2410c; }
.badge-bajo  { background: #fef9c3; color: #854d0e; }

/* --- Portapapeles row highlight --- */
tr.row-portapapeles {
  background: #fff7ed !important;
  border-left: 3px solid #f97316;
}
tr.row-portapapeles:hover { background: #fed7aa !important; }

/* --- Ventana chips --- */
.ventana-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }

.chip {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.chip-normal    { background: #e0f2fe; color: #0369a1; }
.chip-prohibida { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.chip-mas, .chip-ver-menos { background: #e5e7eb; color: #6b7280; cursor: pointer; user-select: none; }
.chip-mas:hover, .chip-ver-menos:hover { background: #d1d5db; }

.ventana-chips .chip-extra              { display: none; }
.ventana-chips.chips-expanded .chip-extra { display: inline-block; }

.ventana-chips .chip-ver-menos             { display: none; }
.ventana-chips.chips-expanded .chip-ver-menos { display: inline-block; }
.ventana-chips.chips-expanded .chip-mas    { display: none; }

/* --- Thumbnail de captura --- */
.thumb {
  height: 80px;
  width: auto;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  display: block;
  transition: box-shadow 0.15s, transform 0.15s;
}
.thumb:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  transform: scale(1.04);
}

/* --- Lightbox --- */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.87);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.lightbox.open { display: flex; }

.lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.lightbox-close {
  position: fixed;
  top: 1.1rem;
  right: 1.4rem;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 1.4rem;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.lightbox-close:hover { background: rgba(255,255,255,0.3); }

/* --- Portapapeles expandible --- */
.clip-completo { display: none; }
.clip-wrap.clip-expanded .clip-corto { display: none; }
.clip-wrap.clip-expanded .clip-completo { display: inline; }
.clip-toggle { margin-left: 0.35rem; vertical-align: middle; }

/* Timestamp */
.ts { white-space: nowrap; color: #64748b; font-size: 0.82rem; }

/* Utility */
.hidden { display: none !important; }

.estudiante-controls { display: flex; align-items: center; gap: 0.5rem; }

/* --- Vista General: grid de tarjetas --- */
.general-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  padding: 1.25rem 0;
}

.student-card {
  background: #fff;
  border-radius: 8px;
  border-left: 4px solid #e2e8f0;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
  padding: 1rem 1.1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: box-shadow 0.15s, transform 0.12s;
}
.student-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.14);
  transform: translateY(-2px);
}

.card-alto  { border-left-color: #ef4444; }
.card-medio { border-left-color: #f97316; }
.card-bajo  { border-left-color: #eab308; }
.card-ok    { border-left-color: #22c55e; }

.card-header-row {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.card-nombre {
  font-weight: 700;
  font-size: 0.95rem;
  color: #1e2a3a;
}
.card-codigo {
  font-size: 0.78rem;
  color: #64748b;
  font-family: monospace;
}

.card-body-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.card-ultima {
  font-size: 0.78rem;
  color: #64748b;
}

.card-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-activo   { background: #22c55e; }
.status-inactivo { background: #94a3b8; }

.badge-ok { background: #dcfce7; color: #15803d; }

/* --- Botón Registrar (header) --- */
.btn-registrar {
  padding: 0.4rem 0.85rem;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.btn-registrar:hover { background: #1d4ed8; }

.btn-importar {
  padding: 0.4rem 0.85rem;
  background: #16a34a;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.btn-importar:hover { background: #15803d; }
.btn-importar:disabled { background: #86efac; cursor: not-allowed; }

/* --- Modal overlay --- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 500;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

/* --- Modal card --- */
.modal-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
  padding: 2rem 2.25rem;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e2a3a;
  margin: 0;
}

/* --- Form groups --- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-group input {
  padding: 0.5rem 0.75rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #1a1a2e;
  outline: none;
  transition: border-color 0.15s;
}
.form-group input:focus { border-color: #2563eb; }

/* --- Modal error --- */
.modal-error {
  font-size: 0.83rem;
  color: #b91c1c;
  min-height: 1.2em;
  margin: 0;
}

/* --- Modal action buttons --- */
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}
.btn-cancelar {
  padding: 0.45rem 1rem;
  background: #e5e7eb;
  color: #374151;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-cancelar:hover { background: #d1d5db; }

.btn-submit {
  padding: 0.45rem 1.1rem;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-submit:hover { background: #1d4ed8; }
.btn-submit:disabled { background: #93c5fd; cursor: not-allowed; }

/* --- Auth screen / Cuenta screen --- */
#auth-screen, #cuenta-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f0f2f5;
  padding: 1.5rem;
}

#auth-screen.hidden, #cuenta-screen.hidden { display: none; }

.auth-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  padding: 2.25rem 2.25rem 2rem;
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.auth-card h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e2a3a;
  text-align: center;
}

/* Tab toggle */
.auth-tabs {
  display: flex;
  border-radius: 8px;
  background: #f1f5f9;
  padding: 3px;
  gap: 3px;
}

.auth-tab-btn, .cuenta-tab-btn {
  flex: 1;
  padding: 0.45rem 0.5rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.auth-tab-btn.active, .cuenta-tab-btn.active {
  background: #fff;
  color: #1e2a3a;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.auth-tab-btn:not(.active):hover, .cuenta-tab-btn:not(.active):hover { color: #1e2a3a; }

/* Sections */
.auth-section, .cuenta-section { display: flex; flex-direction: column; gap: 1rem; }
.auth-section.hidden, .cuenta-section.hidden { display: none; }

.auth-error {
  font-size: 0.83rem;
  color: #b91c1c;
  min-height: 1.2em;
  margin: 0;
}

.btn-auth {
  width: 100%;
  padding: 0.6rem 1rem;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 0.25rem;
}
.btn-auth:hover { background: #1d4ed8; }
.btn-auth:disabled { background: #93c5fd; cursor: not-allowed; }

.cuenta-activa-info {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.82rem;
  color: #64748b;
}

.btn-link {
  background: none;
  border: none;
  color: #2563eb;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.btn-link:hover { color: #1d4ed8; }

.btn-cerrar-cuenta-header {
  background: none;
  border: none;
  color: #cbd5e1;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  text-decoration: underline;
}
.btn-cerrar-cuenta-header:hover { color: #fff; }

/* Resultado: código generado */
.crear-resultado {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  padding: 1.5rem 1rem 0.5rem;
  text-align: center;
}
.crear-resultado.hidden { display: none; }

.codigo-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
}

.codigo-display {
  font-size: 2.75rem;
  font-weight: 800;
  font-family: "Courier New", Courier, monospace;
  letter-spacing: 0.12em;
  color: #1e2a3a;
  background: #f0f4ff;
  border: 2px solid #c7d7fd;
  border-radius: 10px;
  padding: 0.6rem 1.5rem;
  user-select: all;
}

.codigo-hint {
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.5;
  max-width: 320px;
}
