/* ── Identidad corporativa GaeliKA ──────────────────────────────────
   Azul Claro #4FA3D1 · Verde Innovación #6BC46D · Azul profundo #1F4E79
   Gris técnico #4A4A4A · Gris claro #E9EEF2 · Blanco
   Tipografía: Montserrat */
:root {
  --azul: #4FA3D1;
  --verde: #6BC46D;
  --azul-prof: #1F4E79;
  --gris: #4A4A4A;
  --gris-claro: #E9EEF2;
  --blanco: #FFFFFF;
  --rojo: #C0392B;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(31, 78, 121, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Montserrat', 'Segoe UI', Arial, sans-serif;
  color: var(--gris);
  background: var(--blanco);
  font-size: 15.5px;
  line-height: 1.6;
  display: flex; min-height: 100vh; flex-direction: column;
}
main { flex: 1; }
h1, h2, h3, h4 { color: var(--azul-prof); font-weight: 700; line-height: 1.25; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.45rem; } h3 { font-size: 1.15rem; color: var(--azul); }
a { color: var(--azul); text-decoration: none; }
a:hover { text-decoration: underline; }
.accent { color: var(--verde); }

.container { max-width: 1080px; margin: 0 auto; padding: 0 22px; }
.narrow { max-width: 760px; }

/* Header */
header.site {
  background: var(--blanco);
  border-bottom: 3px solid var(--azul);
  box-shadow: var(--shadow);
}
header.site .inner { display: flex; align-items: center; justify-content: space-between; padding: 12px 22px; max-width: 1080px; margin: 0 auto; }
header.site img.logo { height: 46px; display: block; }
nav.main { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
nav.main a { color: var(--azul-prof); font-weight: 600; font-size: .92rem; }
nav.main a.active { color: var(--verde); }
.userchip { font-size: .85rem; color: var(--gris); background: var(--gris-claro); padding: 5px 12px; border-radius: 20px; }

/* Botones */
.btn {
  display: inline-block; padding: 10px 22px; border-radius: var(--radius);
  border: none; cursor: pointer; font-family: inherit; font-weight: 600; font-size: .95rem;
  background: var(--azul); color: #fff; transition: filter .15s;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.green { background: var(--verde); }
.btn.outline { background: transparent; color: var(--azul-prof); border: 2px solid var(--azul); }
.btn.danger { background: var(--rojo); }
.btn.small { padding: 6px 13px; font-size: .82rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Tarjetas */
.card {
  background: #fff; border: 1px solid var(--gris-claro); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 24px; margin: 16px 0;
}
.card.highlight { border-left: 5px solid var(--verde); }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* KPI */
.kpi { text-align: center; padding: 18px 10px; }
.kpi .num { font-size: 2rem; font-weight: 700; color: var(--verde); display: block; }
.kpi .lbl { font-size: .82rem; color: var(--gris); }

/* Formularios */
label { font-weight: 600; font-size: .88rem; color: var(--azul-prof); display: block; margin: 12px 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--gris-claro); border-radius: 8px;
  font-family: inherit; font-size: .95rem; color: var(--gris); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--azul); }
textarea { min-height: 220px; resize: vertical; }

/* Tablas */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { background: var(--azul-prof); color: #fff; text-align: left; padding: 9px 12px; font-weight: 600; }
td { padding: 8px 12px; border-bottom: 1px solid var(--gris-claro); }
tr:nth-child(even) td { background: #F7FAFC; }
td .num-key { color: var(--verde); font-weight: 700; }

/* Alertas */
.alert { padding: 12px 16px; border-radius: 8px; margin: 12px 0; font-size: .92rem; }
.alert.error { background: #FDECEA; color: var(--rojo); border: 1px solid #F5C6C0; }
.alert.ok { background: #EAF7EB; color: #2E7D32; border: 1px solid #C8E6C9; }
.alert.info { background: var(--gris-claro); color: var(--azul-prof); }

/* Insignias y gamificación */
.badge-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 14px; margin: 4px 6px 4px 0;
  border: 1.5px solid var(--verde); border-radius: 20px; font-size: .82rem; color: var(--azul-prof); font-weight: 600;
}
.badge-chip .icon { color: var(--verde); }
.badge-chip.locked { border-color: var(--gris-claro); color: #9AA7B0; }
.badge-chip.locked .icon { color: #C4CED6; }
.level-tag { background: var(--azul-prof); color: #fff; padding: 4px 14px; border-radius: 20px; font-size: .8rem; font-weight: 600; }
.points { color: var(--verde); font-weight: 700; }

/* Barra de progreso */
.progressbar { background: var(--gris-claro); border-radius: 20px; height: 14px; overflow: hidden; }
.progressbar > div { background: linear-gradient(90deg, var(--azul), var(--verde)); height: 100%; border-radius: 20px; transition: width .4s; }

/* Lista de módulos */
.module-row { display: flex; align-items: center; gap: 16px; padding: 14px 4px; border-bottom: 1px solid var(--gris-claro); }
.module-row:last-child { border-bottom: none; }
.module-num {
  width: 40px; height: 40px; min-width: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--gris-claro); color: var(--azul-prof); font-weight: 700;
}
.module-num.done { background: var(--verde); color: #fff; }
.module-row .meta { flex: 1; }
.module-row .meta .title { font-weight: 600; color: var(--azul-prof); }
.module-row .meta .sub { font-size: .82rem; color: #7A8791; }
.mini-status { display: flex; gap: 6px; font-size: .74rem; }
.mini-status span { padding: 2px 9px; border-radius: 12px; background: var(--gris-claro); color: #7A8791; }
.mini-status span.ok { background: #EAF7EB; color: #2E7D32; }

/* Pestañas del módulo */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--gris-claro); margin: 18px 0 0; flex-wrap: wrap; }
.tabs a { padding: 10px 20px; font-weight: 600; font-size: .92rem; color: var(--gris); border-radius: 8px 8px 0 0; }
.tabs a.active { background: var(--azul); color: #fff; }
.tabs a:hover { text-decoration: none; }

/* Contenido teórico */
.theory h3 { margin-top: 26px; }
.theory ul, .theory ol { padding-left: 22px; }
.theory li { margin: 6px 0; }
.theory strong { color: var(--azul-prof); }

/* Quiz */
.question { margin: 20px 0; padding: 16px 20px; background: #F7FAFC; border-radius: var(--radius); border: 1px solid var(--gris-claro); }
.question .qtext { font-weight: 600; color: var(--azul-prof); margin-bottom: 10px; }
.question label { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--gris); margin: 7px 0; cursor: pointer; font-size: .93rem; }
.question input[type=radio] { margin-top: 4px; }
.question.correct { border-color: var(--verde); background: #F2FBF3; }
.question.wrong { border-color: var(--rojo); background: #FDF3F2; }

/* Tutor */
.tutor-box { border: 1.5px solid var(--azul); border-radius: var(--radius); overflow: hidden; margin-top: 20px; }
.tutor-box .head { background: var(--azul); color: #fff; padding: 10px 16px; font-weight: 600; font-size: .9rem; cursor: pointer; }
.tutor-log { max-height: 300px; overflow-y: auto; padding: 14px; }
.tutor-msg { margin: 8px 0; padding: 9px 13px; border-radius: 10px; font-size: .89rem; max-width: 85%; white-space: pre-wrap; }
.tutor-msg.user { background: var(--gris-claro); margin-left: auto; }
.tutor-msg.ai { background: #EAF3F9; border: 1px solid #D3E5F1; }
.tutor-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--gris-claro); }
.tutor-input input { flex: 1; }

/* Landing */
.hero { background: linear-gradient(135deg, #F3F9FC 0%, #FFFFFF 60%); border-bottom: 1px solid var(--gris-claro); padding: 60px 0 50px; }
.hero h1 { font-size: 2.3rem; margin: 0 0 10px; }
.hero .sub { font-size: 1.1rem; max-width: 640px; }
.route-card h3 { margin-top: 4px; }
.pill { display: inline-block; background: var(--gris-claro); color: var(--azul-prof); font-size: .78rem; font-weight: 600; padding: 3px 12px; border-radius: 14px; margin-right: 6px; }
.pill.green { background: #EAF7EB; color: #2E7D32; }

/* Footer */
footer.site { background: var(--azul-prof); color: #CBD9E6; font-size: .84rem; margin-top: 50px; }
footer.site .inner { max-width: 1080px; margin: 0 auto; padding: 26px 22px; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
footer.site a { color: #fff; }

/* Feedback IA */
.feedback-box { background: #F7FAFC; border-left: 4px solid var(--azul); padding: 14px 18px; border-radius: 0 8px 8px 0; margin: 14px 0; white-space: pre-wrap; font-size: .92rem; }
.score-big { font-size: 2.4rem; font-weight: 700; color: var(--verde); }
.score-big.fail { color: var(--rojo); }

/* Certificado en verificación */
.verify-ok { border: 2px solid var(--verde); border-radius: var(--radius); padding: 24px; background: #F6FCF7; }
.verify-fail { border: 2px solid var(--rojo); border-radius: var(--radius); padding: 24px; background: #FDF3F2; }

.mono { font-family: 'Courier New', monospace; letter-spacing: .5px; }
.muted { color: #8A97A0; font-size: .85rem; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 3px solid var(--gris-claro); border-top-color: var(--azul); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  header.site .inner { flex-direction: column; gap: 8px; }
  .hero h1 { font-size: 1.7rem; }
}
