
* { box-sizing: border-box; }

:root {
  --primary: #00A5A2;
  --primary-light: #4CE1E1;
  --primary-dark: #007C82;
  --accent: #00C48C;
  --bg-soft: #f4f4f7;
  --text-main: #0f172a;
  --text-muted: #6b7280;
  --card-radius: 14px;
}

html, body { height: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-soft);
  color: var(--text-main);
}

/* Fondo general */
.bg {
  background:
    radial-gradient(circle at top left, rgba(76, 225, 225, 0.22), transparent 55%),
    radial-gradient(circle at bottom right, rgba(0, 124, 130, 0.25), #020617);
}

/* LOGIN CENTRADO */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.center-card {
  width: 100%;
  max-width: 420px;
  padding: 16px;
}

.auth-card {
  width: 100%;
}

.login-shell { text-align: center; }

.login-logo { margin-bottom: 10px; }
.login-logo img { max-width: 90px; }

/* TOPBAR */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: linear-gradient(90deg, #00141f, var(--primary-dark));
  color: #f9fafb;
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-img-wrapper {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  overflow: hidden;
  background: radial-gradient(circle at 30% 20%, var(--primary-light), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* CONTENEDORES Y TARJETAS */

.container {
  max-width: 1200px;
  margin: 20px auto 40px;
  padding: 0 16px;
}

.card {
  background: #ffffff;
  border-radius: var(--card-radius);
  padding: 18px 20px;
}

.shadow { box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18); }

.title { margin-top: 0; margin-bottom: 4px; text-align: center; }
.brand { letter-spacing: 0.04em; margin: 0; }
.subtitle { margin: 0 0 16px; text-align: center; color: var(--text-muted); }

/* FORMULARIOS */

form label {
  display: block;
  margin-top: 8px;
  margin-bottom: 4px;
  font-size: 0.9rem;
}

input, textarea, select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font: inherit;
  background: #ffffff;
}

textarea { min-height: 60px; resize: vertical; }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 1px rgba(76, 225, 225, 0.45);
}

/* BOTONES */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: none;
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.12s ease, background 0.12s ease, opacity 0.12s ease;
}

.btn.full { width: 100%; margin-top: 10px; }

.btn.primary {
  background: linear-gradient(90deg, var(--primary-light), var(--primary-dark));
  color: #0b1120;
  box-shadow: 0 14px 32px rgba(0, 124, 130, 0.55);
  font-weight: 600;
}

.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(0, 124, 130, 0.65);
}

.btn.secondary {
  background: #e5e7eb;
  color: var(--text-main);
}

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

.btn.ghost {
  background: transparent;
  color: #e5e7eb;
  border: 1px solid rgba(148, 163, 184, 0.7);
}

.btn.ghost:hover {
  background: rgba(15, 23, 42, 0.6);
}

/* Botones pequeños y de peligro */
.btn-small {
  padding: 4px 10px;
  font-size: 0.8rem;
}

.btn.danger {
  background: #ef4444;
  color: #f9fafb;
}

.btn.danger:hover {
  background: #b91c1c;
}

.error {
  color: #fca5a5;
  margin-top: 8px;
  font-size: 0.88rem;
}

.hint { margin: 4px 0 10px; font-size: 0.85rem; color: var(--text-muted); }

/* LAYOUTS */

.two-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  text-align: left;
  border-left: 4px solid var(--primary);
  background: radial-gradient(circle at top left, #e0f2fe, #ecfdf5);
}

.stat-card h4 { margin: 0 0 4px; font-size: 0.9rem; color: var(--text-muted); }
stat-card p { margin: 0; font-size: 1.6rem; font-weight: 600; }

.list {
  list-style: none;
  padding-left: 0;
}

/* LISTAS */

.list li {
  padding: 6px 4px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
}

.list li:last-child { border-bottom: none; }

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

table th, table td {
  border: 1px solid #e5e7eb;
  padding: 6px 8px;
}

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

/* QUIZ BUILDER */

.question-block {
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  padding: 10px 10px 10px;
  margin-bottom: 10px;
  background: #fdfdfd;
}

.qb-header {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 0.9fr);
  gap: 8px;
  margin-bottom: 8px;
}

.options-area, .gapfill-area, .tf-area { margin-bottom: 6px; }

/* Fila de opción (admin): radio | texto | borrar */
.option-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.option-row .opt-radio {
  flex: 0 0 auto;
}

.option-row .opt-input {
  flex: 1 1 auto;
}

.option-row .opt-input input.option-text {
  width: 100%;
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #ffffff;
}

.option-row .opt-remove {
  flex: 0 0 auto;
  background: transparent;
  border: none;
  color: #b91c1c;
  font-size: 0.9rem;
  cursor: pointer;
}

.gapfill-area input.gapfill-correct {
  width: 100%;
}

/* Verdadero/Falso */
.tf-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 10px;
  font-size: 0.9rem;
}

/* CHIPS DE GRUPOS */

.chips label {
  display: inline-flex;
  align-items: center;
  margin: 3px 4px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  font-size: 0.85rem;
  background: #f9fafb;
}

.chips input { margin-right: 4px; }

/* CONTENEDOR QUIZ (ALUMNO) */

#quizContainer {
  background: radial-gradient(circle at top left, rgba(76, 225, 225, 0.14), #020617);
  color: #e5e7eb;
  border-radius: 18px;
  border: 1px solid rgba(76, 225, 225, 0.45);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.9);
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.quiz-form fieldset {
  border: none;
  border-top: 1px solid #1f2937;
  margin: 0;
  padding: 10px 0;
}

.quiz-form legend {
  font-weight: 600;
  margin-bottom: 6px;
}

.quiz-form input[type="radio"] {
  accent-color: var(--primary-light);
}

.quiz-form .text-answer {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #020617;
  color: #f9fafb;
}

/* Opciones tipo tarjeta (alumno) */

.quiz-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin: 6px 0;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.quiz-option input[type="radio"] {
  margin-right: 6px;
}

.quiz-option-badge {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #e0f2fe;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: #0f172a;
}

.quiz-option-text { flex: 1; }

.quiz-option.selected {
  background: rgba(76, 225, 225, 0.14);
  border-color: #4CE1E1;
  box-shadow: 0 0 0 1px rgba(76, 225, 225, 0.5);
}

/* TABS ADMIN */

.tabs-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.tab-btn {
  border-radius: 999px;
  border: 1px solid #cbd5f5;
  padding: 6px 14px;
  background: #e5e7eb;
  font-size: 0.9rem;
  cursor: pointer;
}

.tab-btn.active {
  background: linear-gradient(90deg, var(--primary-light), var(--primary-dark));
  color: #020617;
  border-color: transparent;
  font-weight: 600;
}

.tabs-panel { margin-top: 4px; }

.tab-section { display: none; }
.tab-section.active { display: block; }

/* FOOTER */

.site-footer {
  margin-top: 24px;
  background: #020617;
  color: #e5e7eb;
  padding: 10px 18px;
  font-size: 0.85rem;
}

.site-footer.dark {
  position: fixed;
  left: 0; right: 0; bottom: 0;
}

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

.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-logo-circle {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 20%, var(--primary-light), var(--primary-dark));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #020617;
}

.footer-brand { font-weight: 500; }

.footer-right {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.footer-right a {
  color: #e5e7eb;
  text-decoration: none;
  opacity: 0.9;
}

.footer-right a:hover {
  opacity: 1;
  text-decoration: underline;
}

@media (max-width: 640px) {
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

/* UTILIDADES */
.hidden { display: none; }
