/* =========================================================
   1. RESETEO BÁSICO / TIPOGRAFÍA
   ========================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f3f4f6;
  color: #111827;
}

/* =========================================================
   2. LAYOUT GENERAL
   ========================================================= */

.page,
.admin-page,
.landing-content {
  max-width: 1100px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

/* Topbar común */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(90deg, #111827, #1f2933);
  color: #f9fafb;
}

.logo {
  font-weight: 700;
  font-size: 1rem;
}

.logo span {
  color: #60a5fa;
}

.inst-label {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Layout 2 columnas para estudiante.php */
.layout-2col {
  display: grid;
  grid-template-columns: 40% 60%;
  gap: 1.5rem;
}

.col-izq,
.col-der {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Responsive */
@media (max-width: 980px) {
  .layout-2col {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   3. TARJETAS (CARDS) Y BLOQUES
   ========================================================= */

.card {
  background: #ffffff;
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
}

.hero-card {
  margin-bottom: 1.5rem;
}

.hero-text h1 {
  margin-top: 0;
  margin-bottom: 0.4rem;
}

.hero-text p {
  margin-top: 0;
  color: #4b5563;
}

.hero-tags {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Header de las tarjetas con número de paso */
.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.card-subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: #6b7280;
}

/* =========================================================
   4. PASTILLAS / PILLS / BADGES
   ========================================================= */

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.pill-primary {
  background: #1d4ed8;
  color: #e5f0ff;
}

.pill-info {
  background: #0ea5e9;
  color: #ecfeff;
}

.pill-neutral {
  background: #e5e7eb;
  color: #374151;
}

.pill-success {
  background: #16a34a;
  color: #ecfdf3;
}

.pill-warning {
  background: #facc15;
  color: #78350f;
}

.inst-name {
  margin-left: 0.25rem;
}

/* Badge de paso (1, 2, 3) */
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  color: #ffffff;
}

.step-1 { background: #1d4ed8; }  /* azul */
.step-2 { background: #0ea5e9; }  /* celeste */
.step-3 { background: #10b981; }  /* verde */

/* Tasa de éxito */
.tasa-exito-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 80px;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  background: #111827;
  color: #f9fafb;
}

/* =========================================================
   5. TIPOGRAFÍA Y TEXTOS
   ========================================================= */

h1, h2, h3 {
  margin-top: 0;
}

.subtle {
  font-size: 0.8rem;
  color: #6b7280;
}

.nota {
  font-size: 0.8rem;
  color: #6b7280;
}

.error {
  color: #b91c1c;
  margin-top: 0.5rem;
}

.warning {
  color: #fbbf24;
}

/* Resumen / contexto en resultados */
.resumen-contexto {
  display: flex;
  gap: 1.5rem;
  font-size: 0.9rem;
  color: #4b5563;
  margin-bottom: 0.75rem;
}

.resumen-analisis {
  margin-bottom: 1rem;
}

/* =========================================================
   6. FORMULARIOS
   ========================================================= */

.form-group {
  margin-bottom: 1rem;
}

.form-row {
  display: flex;
  gap: 0.75rem;
}

.form-row .form-group {
  flex: 1;
}

label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #d1d5db;
  font-size: 0.95rem;
  box-sizing: border-box;
  background-color: #ffffff;
}

textarea {
  font-family: monospace;
}

small {
  font-size: 0.8rem;
  color: #6b7280;
}

.form-actions {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.6rem;
}

/* =========================================================
   7. BOTONES
   ========================================================= */

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition:
    transform 0.05s ease,
    box-shadow 0.1s ease,
    background-color 0.1s ease;
}

.btn:active {
  transform: translateY(1px);
}

/* Botón principal: azul degradado */
.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
}

/* Botón secundario: gris (limpiar) */
.btn-secondary {
  background: #e5e7eb;
  color: #374151;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}

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

/* Feedback botones: verde / rojo */
.btn-feedback-up {
  background: #16a34a;
  color: #ecfdf3;
}

.btn-feedback-up:hover {
  background: #15803d;
}

.btn-feedback-down {
  background: #dc2626;
  color: #fee2e2;
}

.btn-feedback-down:hover {
  background: #b91c1c;
}

/* Pequeño (se usa poco) */
.btn-small {
  border: none;
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  cursor: pointer;
  background: #e5e7eb;
  color: #374151;
}

.btn-small:hover {
  background: #d1d5db;
}

.feedback-reaccion {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.feedback-msg {
  font-size: 0.85rem;
  color: #4b5563;
}

/* =========================================================
   8. SECCIONES DE RESULTADOS (ESTUDIANTE)
   ========================================================= */

.resultado-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.resultado-grid ul {
  padding-left: 1rem;
}

/* Pistas, tasa, feedback */
.pistas-block,
.tasa-block,
.feedback-block {
  margin-top: 1rem;
}

/* Código (para detalle en admin) */
.codigo {
  background: #111827;
  color: #e5e7eb;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  font-size: 0.85rem;
}

/* =========================================================
   9. OVERLAY "PROCESANDO..."
   ========================================================= */

.overlay-procesando {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.overlay-content {
  background: #ffffff;
  padding: 1.5rem 2rem;
  border-radius: 0.75rem;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.4);
  text-align: center;
  max-width: 320px;
}

.overlay-content p {
  margin-top: 1rem;
  font-size: 0.95rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 4px solid #e5e7eb;
  border-top-color: #2563eb;
  animation: spin 0.9s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* =========================================================
   10. ESTILOS PARA PÁGINAS ADMIN
   ========================================================= */

/* Topbar navegación admin */
.admin nav a {
  color: #e5e7eb;
  margin-left: 1rem;
  text-decoration: none;
  font-size: 0.9rem;
}

.admin nav a.active {
  font-weight: 700;
}

/* Login admin centrado */
.admin-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  max-width: 400px;
  width: 100%;
}

/* Métricas en dashboard */
.admin-metrics {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.metric {
  background: #f9fafb;
  border-radius: 0.75rem;
  padding: 1rem;
  flex: 1;
  min-width: 180px;
}

.metric-label {
  font-size: 0.85rem;
  color: #6b7280;
}

.metric-value {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
}

/* Tablas admin */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table th,
.table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 0.4rem 0.5rem;
}

.table th {
  text-align: left;
  background: #f9fafb;
}

/* Filtros admin */
.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

/* Mini QR */
.qr-thumb {
  width: 60px;
  height: 60px;
}

/* =========================================================
   11. VARIOS / LANDING
   ========================================================= */

.landing .landing-content .card {
  text-align: center;
}

/* Asegurar que los enlaces dentro de la app no sean chillones */
a {
  color: #2563eb;
}

a:hover {
  text-decoration: underline;
}
