/* ===== PyData Academy — estilos ===== */
:root {
  --green: #58cc02;
  --green-dark: #58a700;
  --green-hover: #61e002;
  --blue: #1cb0f6;
  --purple: #ce82ff;
  --gold: #ffc800;
  --red: #ff4b4b;
  --orange: #ff9600;

  --bg: #f7f9fb;
  --card: #ffffff;
  --card-2: #f1f4f8;
  --text: #2b2b3a;
  --text-soft: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 2px 0 rgba(0,0,0,.12);
  --radius: 16px;
  --maxw: 900px;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Nunito", sans-serif;
}
[data-theme="dark"] {
  --bg: #131f24;
  --card: #1b2b33;
  --card-2: #22343d;
  --text: #eaf2f5;
  --text-soft: #9fb3bd;
  --border: #2d434d;
  --shadow: 0 2px 0 rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }

#app { min-height: 100vh; display: flex; flex-direction: column; }

/* ===== Topbar ===== */
#topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px;
  background: var(--card);
  border-bottom: 2px solid var(--border);
}
.logo {
  border: none; background: none; font-size: 20px; font-weight: 800;
  color: var(--green); display: flex; align-items: center; gap: 8px;
}
.logo span { color: var(--text); }
.tb-right { display: flex; align-items: center; gap: 10px; }
.stat {
  font-weight: 800; font-size: 15px; background: var(--card-2);
  padding: 6px 12px; border-radius: 999px; display: flex; align-items: center; gap: 5px;
}
.stat.hearts { color: var(--red); }
#lang-select, #theme-toggle {
  border: 2px solid var(--border); background: var(--card-2); color: var(--text);
  border-radius: 12px; padding: 6px 8px; font-weight: 700; font-size: 14px;
}
#theme-toggle { width: 40px; }

/* ===== Layout ===== */
#screen { flex: 1; width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 24px 18px 60px; }
#footer { text-align: center; color: var(--text-soft); font-size: 13px; padding: 14px; }

/* ===== Home / Path ===== */
.hero {
  background: linear-gradient(135deg, var(--green), var(--blue));
  color: #fff; border-radius: 20px; padding: 28px 26px; margin-bottom: 26px;
  box-shadow: var(--shadow);
}
.hero h1 { margin: 0 0 8px; font-size: 28px; }
.hero p { margin: 0; opacity: .95; font-size: 16px; max-width: 640px; line-height: 1.5; }
.hero .cta {
  margin-top: 16px; background: #fff; color: var(--green-dark); border: none;
  font-weight: 800; padding: 12px 22px; border-radius: 14px; font-size: 15px;
  box-shadow: 0 3px 0 rgba(0,0,0,.15);
}

.track-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-soft); font-weight: 800; margin: 26px 0 12px; }

.unit {
  background: var(--card); border: 2px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 16px; transition: transform .08s;
}
.unit.locked { opacity: .55; }
.unit .u-icon {
  width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center;
  font-size: 26px; flex-shrink: 0; color: #fff;
}
.unit .u-body { flex: 1; min-width: 0; }
.unit .u-title { font-weight: 800; font-size: 17px; margin: 0 0 3px; }
.unit .u-desc { color: var(--text-soft); font-size: 14px; margin: 0; }
.unit .u-meta { font-size: 12px; color: var(--text-soft); margin-top: 6px; font-weight: 700; }
.unit .u-actions { display: flex; flex-direction: column; gap: 6px; }
.progress-bar { height: 10px; background: var(--card-2); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.progress-bar > div { height: 100%; background: var(--green); border-radius: 999px; transition: width .3s; }

.btn {
  border: none; border-radius: 14px; font-weight: 800; font-size: 14px; padding: 10px 16px;
  color: #fff; background: var(--green); box-shadow: 0 3px 0 var(--green-dark);
  transition: transform .05s;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--green-dark); }
.btn.blue { background: var(--blue); box-shadow: 0 3px 0 #1391cc; }
.btn.gray { background: var(--card-2); color: var(--text); box-shadow: 0 3px 0 var(--border); }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== Lista de lecciones ===== */
.lessons { display: grid; gap: 12px; }
.lesson-row {
  background: var(--card); border: 2px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow);
}
.lesson-row.done { border-color: var(--green); }
.lesson-row .l-num {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; background: var(--card-2); flex-shrink: 0;
}
.lesson-row.done .l-num { background: var(--green); color: #fff; }
.lesson-row .l-body { flex: 1; }
.lesson-row .l-title { font-weight: 800; }
.lesson-row .l-sub { color: var(--text-soft); font-size: 13px; }

.back-link { background: none; border: none; color: var(--blue); font-weight: 800; font-size: 15px; padding: 0; margin-bottom: 14px; }

/* ===== Lección / ejercicios ===== */
.lesson-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.lesson-head .lp { flex: 1; height: 14px; background: var(--card-2); border-radius: 999px; overflow: hidden; }
.lesson-head .lp > div { height: 100%; background: var(--green); transition: width .3s; }
.lesson-head .hh { font-weight: 800; color: var(--red); }

.card {
  background: var(--card); border: 2px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.theory h2 { margin-top: 0; }
.theory h3 { margin: 20px 0 8px; }
.theory p, .theory li { line-height: 1.65; font-size: 16px; }
.theory code {
  background: var(--card-2); padding: 2px 6px; border-radius: 6px; font-family: var(--mono); font-size: 14px;
}
.theory pre {
  background: #0f1c22; color: #e6edf3; padding: 16px; border-radius: 12px; overflow-x: auto;
  font-family: var(--mono); font-size: 14px; line-height: 1.5;
}
.theory pre code { background: none; padding: 0; color: inherit; }
.theory .tip { background: rgba(28,176,246,.12); border-left: 4px solid var(--blue); padding: 12px 14px; border-radius: 8px; margin: 14px 0; }
.theory .warn { background: rgba(255,150,0,.12); border-left: 4px solid var(--orange); padding: 12px 14px; border-radius: 8px; margin: 14px 0; }
.theory table { border-collapse: collapse; width: 100%; margin: 14px 0; font-size: 14px; }
.theory th, .theory td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.theory th { background: var(--card-2); }

.ex-prompt { font-size: 18px; font-weight: 700; margin: 0 0 16px; line-height: 1.5; }
.ex-sub { color: var(--text-soft); font-size: 14px; margin: -8px 0 14px; }

/* Opciones (MCQ) */
.options { display: grid; gap: 10px; }
.opt {
  text-align: left; border: 2px solid var(--border); background: var(--card); color: var(--text);
  border-radius: 14px; padding: 14px 16px; font-size: 16px; box-shadow: 0 2px 0 var(--border);
  display: flex; align-items: center; gap: 12px;
}
.opt .k { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--border); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex-shrink: 0; }
.opt.sel { border-color: var(--blue); background: rgba(28,176,246,.10); }
.opt.correct { border-color: var(--green); background: rgba(88,204,2,.12); }
.opt.wrong { border-color: var(--red); background: rgba(255,75,75,.12); }
.opt code { font-family: var(--mono); }

/* Predict / fill inputs */
.answer-input {
  width: 100%; border: 2px solid var(--border); border-radius: 12px; padding: 12px 14px;
  font-family: var(--mono); font-size: 15px; background: var(--card-2); color: var(--text);
}
.blank-input {
  border: 2px solid var(--blue); border-radius: 8px; padding: 3px 8px; font-family: var(--mono);
  font-size: 15px; background: var(--card); color: var(--text); min-width: 60px; text-align: center;
}
.code-block {
  background: #0f1c22; color: #e6edf3; padding: 16px; border-radius: 12px; overflow-x: auto;
  font-family: var(--mono); font-size: 14px; line-height: 1.55; white-space: pre; margin: 0 0 14px;
}

/* Parsons */
.parsons { display: grid; gap: 8px; }
.parsons .p-line {
  background: var(--card-2); border: 2px solid var(--border); border-radius: 10px; padding: 10px 12px;
  font-family: var(--mono); font-size: 14px; cursor: grab; display: flex; align-items: center; gap: 8px;
}
.parsons .p-line .grip { color: var(--text-soft); }
.parsons .p-line.dragging { opacity: .4; }

/* Editor de código */
.CodeMirror { border: 2px solid var(--border); border-radius: 12px; height: auto; font-family: var(--mono); font-size: 14px; }
.CodeMirror-scroll { min-height: 140px; }
.run-out {
  margin-top: 12px; background: #0f1c22; color: #d1f7c4; padding: 12px 14px; border-radius: 12px;
  font-family: var(--mono); font-size: 13px; white-space: pre-wrap; max-height: 240px; overflow: auto;
}
.run-out.err { color: #ffb4b4; }

/* Barra inferior de feedback */
.feedback-bar {
  position: sticky; bottom: 0; margin-top: 20px; padding: 18px; border-radius: 16px 16px 0 0;
}
.feedback-bar.ok { background: rgba(88,204,2,.15); }
.feedback-bar.no { background: rgba(255,75,75,.15); }
.feedback-bar .fb-title { font-weight: 800; font-size: 17px; margin-bottom: 4px; }
.feedback-bar.ok .fb-title { color: var(--green-dark); }
.feedback-bar.no .fb-title { color: var(--red); }
.feedback-bar .fb-body { font-size: 14px; line-height: 1.5; }
.feedback-bar .fb-body code { background: rgba(0,0,0,.08); padding: 2px 6px; border-radius: 6px; font-family: var(--mono); }

.action-row { display: flex; gap: 10px; margin-top: 16px; align-items: center; justify-content: space-between; }
.action-row .left { display: flex; gap: 10px; }

/* Pantalla de fin de lección */
.finish { text-align: center; padding: 40px 20px; }
.finish .big { font-size: 64px; }
.finish h2 { margin: 10px 0; }
.finish .rewards { display: flex; gap: 14px; justify-content: center; margin: 20px 0; flex-wrap: wrap; }
.finish .reward { background: var(--card-2); border-radius: 14px; padding: 14px 22px; font-weight: 800; }
.finish .reward .r-num { font-size: 26px; }

/* Toast Python */
.py-toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--card); border: 2px solid var(--border); box-shadow: 0 6px 24px rgba(0,0,0,.2);
  border-radius: 14px; padding: 12px 18px; display: flex; align-items: center; gap: 12px;
  z-index: 50; font-weight: 700; font-size: 14px;
}
.py-toast.hidden { display: none; }
.spinner { width: 18px; height: 18px; border: 3px solid var(--border); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

/* Chips info */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 0; }
.chip { background: var(--card-2); border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 700; color: var(--text-soft); }

@media (max-width: 620px) {
  .tb-left .logo span { display: none; }
  .hero h1 { font-size: 22px; }
  .unit { flex-wrap: wrap; }
}
