/* ==========================================================================
   EduPlatform — identidad: "aula nocturna"
   Fondo profundo tipo pizarra + acento ámbar (el "momento eureka").
   Tipografía: serif editorial para títulos, sans utilitaria para el resto.
   ========================================================================== */

:root {
  --ink: #10151f;
  --panel: #161c29;
  --panel-2: #1d2536;
  --line: #2a3346;
  --paper: #eef1f7;
  --muted: #94a1b8;
  --amber: #f2a93b;
  --amber-dim: #7a5a1f;
  --green: #57b894;
  --red: #e2694f;
  --radius: 10px;
  --serif: Georgia, 'Iowan Old Style', 'Palatino Linotype', ui-serif, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  line-height: 1.5;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 .5em;
}

/* ---------- Topbar ---------- */
.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--ink);
  position: sticky; top: 0; z-index: 10;
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
}
.brand {
  font-family: var(--serif);
  font-size: 1.4rem;
  letter-spacing: .01em;
}
.brand span { color: var(--amber); }
.nav { display: flex; align-items: center; gap: 20px; font-size: .93rem; }
.nav > * { margin-left: 20px; }
.nav > *:first-child { margin-left: 0; }
.nav a:hover { color: var(--amber); }
.nav-user { color: var(--muted); font-size: .85rem; }
.nav-user em { font-style: normal; color: var(--amber); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn-primary { background: var(--amber); color: #23180a; }
.btn-primary:hover { background: #ffbc5c; }
.btn-outline { border-color: var(--line); color: var(--paper); }
.btn-outline:hover { border-color: var(--amber); color: var(--amber); }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-sm { padding: 6px 12px; font-size: .8rem; border-radius: 6px; }
.btn-danger { background: transparent; border: 1px solid var(--red); color: var(--red); }

/* ---------- Flash messages ---------- */
.flash {
  margin: 20px 0; padding: 12px 16px; border-radius: var(--radius);
  font-size: .9rem; border: 1px solid var(--line);
}
.flash-success { border-color: var(--green); color: var(--green); }
.flash-error { border-color: var(--red); color: var(--red); }

/* ---------- Hero ---------- */
.hero { padding: 64px 0 40px; }
.hero .eyebrow {
  color: var(--amber); text-transform: uppercase; letter-spacing: .12em;
  font-size: .75rem; font-weight: 700; margin-bottom: 10px; display: block;
}
.hero h1 { font-size: 2.6rem; max-width: 720px; }
.hero p.lead { color: var(--muted); max-width: 560px; font-size: 1.05rem; }

.search-box { margin-top: 28px; max-width: 480px; }
.search-box input {
  width: 100%; padding: 12px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--paper);
  font-size: .95rem;
}

/* ---------- Course grid & cards ---------- */
.section-title {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 40px 0 18px;
}
.section-title h2 { font-size: 1.4rem; margin: 0; }
.count { color: var(--muted); font-size: .85rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: border-color .15s ease, transform .15s ease;
}
.card:hover { border-color: var(--amber-dim); transform: translateY(-2px); }
.card-cover {
  height: 120px;
  background: linear-gradient(135deg, var(--panel-2), var(--ink));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 1.8rem; color: var(--amber);
  border-bottom: 1px solid var(--line);
}
.card-cover-img { background-size: cover; background-position: center; font-size: 0; }

.course-cover-banner {
  width: 100%; height: 220px; border-radius: var(--radius);
  background-size: cover; background-position: center;
  margin-bottom: 20px; border: 1px solid var(--line);
}
.card-body { padding: 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.card-cat { color: var(--amber); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.card-title { font-family: var(--serif); font-size: 1.1rem; margin: 0; }
.card-meta { color: var(--muted); font-size: .8rem; margin-top: auto; }

/* ---------- Progress ---------- */
.progress-track {
  height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 8px;
}
.progress-fill { height: 100%; background: var(--amber); }
.progress-label { font-size: .78rem; color: var(--muted); margin-top: 4px; }

/* ---------- Forms ---------- */
.form-card {
  max-width: 420px; margin: 48px auto;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 32px;
}
.form-card h1 { font-size: 1.6rem; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--ink); color: var(--paper);
  font-size: .95rem; font-family: var(--sans);
}
.field textarea { resize: vertical; min-height: 100px; }
.form-footer { margin-top: 18px; font-size: .85rem; color: var(--muted); text-align: center; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: .9rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .72rem; font-weight: 700;
}
.badge-admin { background: #3a2140; color: #d18ce8; }
.badge-instructor { background: #1f3a3a; color: #6fd6c8; }
.badge-student { background: #1f2f45; color: #7fb0f0; }
.badge-published { background: #1c3a2a; color: var(--green); }
.badge-draft { background: #3a2a1c; color: var(--amber); }

/* ---------- Course detail / lesson ---------- */
.course-header { padding: 40px 0 24px; border-bottom: 1px solid var(--line); }
.course-header .eyebrow { color: var(--amber); font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; }
.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 32px; margin-top: 32px; align-items: start; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }

.lesson-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.lesson-list li { border-bottom: 1px solid var(--line); }
.lesson-list li:last-child { border-bottom: none; }
.lesson-list a, .lesson-list .lesson-row {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; font-size: .92rem;
}
.lesson-list a:hover { background: var(--panel-2); }
.lesson-check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: .7rem; }
.lesson-check.done { background: var(--green); border-color: var(--green); color: #0a1a12; }

.sidebar-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
}

.video-wrap { position: relative; width: 100%; padding-top: 56.25%; background: #000; border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; }
.video-wrap iframe, .video-wrap video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- Certificate ---------- */
.certificate {
  max-width: 800px; margin: 40px auto; background: #fdfbf5; color: #1c1a14;
  border: 10px solid var(--amber); border-radius: 4px; padding: 60px; text-align: center;
  font-family: var(--serif);
}
.certificate .kicker { letter-spacing: .2em; text-transform: uppercase; font-size: .75rem; color: var(--amber-dim); font-family: var(--sans); font-weight: 700; }
.certificate h1 { font-size: 2rem; margin: 18px 0 6px; }
.certificate .name { font-size: 2.2rem; margin: 20px 0; border-bottom: 2px solid #1c1a14; display: inline-block; padding-bottom: 6px; }
.certificate .code { font-family: var(--sans); font-size: .75rem; color: #8a8060; margin-top: 30px; }
.certificate-actions { text-align: center; margin: 24px 0; }

@media print {
  .topbar, .footer, .certificate-actions { display: none !important; }
  body { background: #fff; }
}

/* ---------- Quizzes ---------- */
.quiz-question {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px;
}
.quiz-question h3 { font-family: var(--sans); font-size: 1rem; margin: 0 0 14px; }
.quiz-option {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 6px; border: 1px solid var(--line);
  margin-bottom: 8px; cursor: pointer; font-size: .92rem;
}
.quiz-option:hover { border-color: var(--amber-dim); }
.quiz-option input { width: auto; margin: 0; }
.quiz-option.correct { border-color: var(--green); background: #12261c; }
.quiz-option.incorrect { border-color: var(--red); background: #2a1712; }

.quiz-result {
  text-align: center; padding: 40px 20px; border-radius: var(--radius);
  border: 1px solid var(--line); margin-bottom: 24px;
}
.quiz-result.passed { border-color: var(--green); }
.quiz-result.failed { border-color: var(--red); }
.quiz-result .score { font-family: var(--serif); font-size: 3rem; margin: 10px 0; }
.quiz-result.passed .score { color: var(--green); }
.quiz-result.failed .score { color: var(--red); }

.quiz-option-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.quiz-option-row input[type="text"] { flex: 1; }
.quiz-option-row input[type="radio"] { width: auto; }

/* ---------- Empty states ---------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state h3 { color: var(--paper); }

.footer { border-top: 1px solid var(--line); margin-top: 60px; padding: 24px 0; color: var(--muted); font-size: .82rem; }
