/* =============================================================================
   styles.css — Plataforma de Capacitación IA · BancoSol
   Paleta: blanco 70% / morado institucional 20% / naranja institucional 10%
   Tipografía: Poppins (encabezados) + Inter (cuerpo)
============================================================================= */

:root {
  --purple: #4C2E84;
  --purple-dark: #382263;
  --purple-soft: #EFE9F7;
  --orange: #F28C28;
  --orange2: #F39B34;
  --gray-dark: #2C2C2C;
  --gray-mid: #6B6B76;
  --gray-light: #F4F5F7;
  --gray-line: #E3E3EA;
  --white: #FFFFFF;
  --green: #2FAE60;
  --red: #E5484D;
  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 6px 20px rgba(76, 46, 132, 0.08);
  --font-display: 'Poppins', 'Montserrat', sans-serif;
  --font-body: 'Inter', 'Montserrat', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--white);
  color: var(--gray-dark);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); margin: 0 0 8px; color: var(--purple); }
p { line-height: 1.5; margin: 0 0 10px; }

button { font-family: var(--font-body); cursor: pointer; }

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

/* --------------------------------- BOTONES --------------------------------- */

.btn {
  border: none;
  border-radius: 999px;
  padding: 13px 26px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .2px;
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--orange); color: var(--white); box-shadow: 0 4px 0 #C96F14; }
.btn-primary:hover { opacity: .95; }
.btn-secondary { background: var(--purple-soft); color: var(--purple); }
.btn-ghost { background: transparent; color: var(--gray-mid); text-decoration: underline; padding: 8px 4px; box-shadow: none; }
.btn-danger { background: #FDEBEC; color: var(--red); }
.btn-block { width: 100%; margin-top: 6px; }
.btn:disabled { opacity: .5; cursor: default; }

/* --------------------------------- LOGIN --------------------------------- */

.login-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--purple) 0%, var(--purple-dark) 55%, #2a1a4d 100%);
  padding: 24px;
}
.login-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
  text-align: center;
}
.brand-mark {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--white);
  background: var(--purple);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 14px;
  margin-bottom: 18px;
}
.brand-mark.small { padding: 4px 12px; font-size: 12px; }
.login-card h1 { font-size: 22px; margin-bottom: 6px; }
.login-sub { color: var(--gray-mid); font-size: 14px; margin-bottom: 22px; }
.login-card form { text-align: left; }
.login-card label { font-size: 13px; font-weight: 600; color: var(--gray-mid); display: block; margin: 12px 0 6px; }
.login-card input {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 2px solid var(--gray-line); font-size: 15px; outline: none;
}
.login-card input:focus { border-color: var(--orange); }
.login-error { color: var(--red); font-size: 13px; margin-top: 12px; text-align: center; }

/* --------------------------------- HEADER --------------------------------- */

.app-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 28px; background: var(--white);
  border-bottom: 1px solid var(--gray-line); position: sticky; top: 0; z-index: 10;
  flex-wrap: wrap;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-title { font-family: var(--font-display); font-weight: 700; color: var(--gray-dark); }
.header-stats { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.stat { display: flex; align-items: center; gap: 5px; font-weight: 700; font-size: 14px; color: var(--purple); background: var(--purple-soft); padding: 6px 12px; border-radius: 999px; }
.stat-icon { font-size: 14px; }
.progress-pill { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--gray-mid); }
.progress-track { width: 100px; height: 8px; background: var(--gray-line); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--orange), var(--orange2)); }
.header-nav { display: flex; gap: 8px; }
.nav-btn { background: transparent; border: none; padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 13px; color: var(--gray-mid); }
.nav-btn.active { background: var(--purple); color: var(--white); }
.nav-logout { color: var(--red); }

/* --------------------------------- MAPA DE MÓDULOS --------------------------------- */

main { flex: 1; width: 100%; max-width: 900px; margin: 0 auto; padding: 28px 20px 60px; }

.map-intro { text-align: center; margin-bottom: 30px; }
.map-intro p { color: var(--gray-mid); }

.module-path { display: flex; flex-direction: column; align-items: center; gap: 26px; position: relative; }
.module-path::before {
  content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 4px;
  background: repeating-linear-gradient(to bottom, var(--gray-line) 0 10px, transparent 10px 20px);
  transform: translateX(-50%); z-index: 0;
}
.module-node {
  position: relative; z-index: 1;
  transform: translateX(var(--offset, 0px));
  display: flex; align-items: center; gap: 12px;
  background: var(--white); border: 3px solid var(--purple); border-radius: 999px;
  padding: 14px 24px 14px 14px; min-width: 260px;
  box-shadow: var(--shadow);
}
.module-node .node-icon {
  width: 46px; height: 46px; border-radius: 50%; background: var(--purple-soft);
  display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0;
}
.module-node .node-label { font-weight: 700; font-size: 14px; text-align: left; color: var(--gray-dark); }
.module-node.completed { border-color: var(--green); }
.module-node.completed .node-icon { background: #E4F7EC; }
.module-node.locked { border-color: var(--gray-line); opacity: .55; }
.module-node.locked .node-icon { background: var(--gray-light); }
.node-check { margin-left: auto; color: var(--green); font-weight: 900; }

/* --------------------------------- TARJETAS / CARD --------------------------------- */

.card {
  background: var(--white); border: 1px solid var(--gray-line); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow); margin-bottom: 20px;
}
.card-icon { font-size: 34px; margin-bottom: 8px; }
.explicacion { font-size: 16px; color: var(--gray-dark); }
.ejemplo-box { background: var(--gray-light); border-radius: var(--radius-sm); padding: 14px 16px; margin: 14px 0 20px; }
.ejemplo-label { font-size: 11px; font-weight: 800; letter-spacing: .5px; color: var(--orange); text-transform: uppercase; }
.ejemplo-box p, .ejemplo-inline { margin: 6px 0 0; font-size: 14px; color: var(--gray-dark); }

.module-steps { display: flex; gap: 6px; justify-content: center; margin-bottom: 18px; }
.step-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--gray-line); }
.step-dot.active { background: var(--orange); }

.activity-tag { display: inline-block; background: var(--purple); color: var(--white); font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; padding: 5px 12px; border-radius: 999px; margin-bottom: 14px; }
.prompt { font-size: 17px; font-weight: 700; color: var(--gray-dark); margin-bottom: 14px; }
.sentence { font-style: italic; color: var(--gray-mid); background: var(--gray-light); padding: 10px 14px; border-radius: var(--radius-sm); }

.options { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.options-row { flex-direction: row; }
.option-btn {
  text-align: left; background: var(--white); border: 2px solid var(--gray-line); border-radius: var(--radius-sm);
  padding: 13px 16px; font-size: 15px; font-weight: 600; color: var(--gray-dark); transition: all .15s ease;
}
.option-btn:hover:not(:disabled) { border-color: var(--purple); background: var(--purple-soft); }
.option-btn.correct { border-color: var(--green); background: #E4F7EC; color: #1D7A42; }
.option-btn.incorrect { border-color: var(--red); background: #FDEBEC; color: #B5262B; }
.option-btn:disabled { cursor: default; }

.feedback { margin-top: 14px; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; }
.feedback-correct { background: #E4F7EC; color: #1D7A42; }
.feedback-incorrect { background: #FDEBEC; color: #B5262B; }

.reteach-box { margin-top: 16px; background: #FFF4E6; border: 1px dashed var(--orange); border-radius: var(--radius-sm); padding: 16px; }
.reteach-box p { font-size: 14px; }
.reteach-box .btn { margin-top: 10px; }

/* Flashcards */
.flashcard { perspective: 1200px; height: 160px; cursor: pointer; margin: 10px 0; }
.flashcard-inner { position: relative; width: 100%; height: 100%; transition: transform .5s; transform-style: preserve-3d; }
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute; inset: 0; backface-visibility: hidden; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 18px;
  font-weight: 700; font-size: 16px;
}
.flashcard-front { background: var(--purple); color: var(--white); }
.flashcard-back { background: var(--orange); color: var(--white); transform: rotateY(180deg); flex-direction: column; gap: 6px; }
.flashcard-note { font-size: 12px; font-weight: 500; opacity: .9; }
.hint { text-align: center; font-size: 12px; color: var(--gray-mid); }

/* Drag & drop (por selección) */
.dragdrop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 14px 0; }
.dragdrop-col { display: flex; flex-direction: column; gap: 10px; }
.match-btn { border: 2px solid var(--gray-line); border-radius: var(--radius-sm); padding: 12px; font-size: 13px; font-weight: 600; background: var(--white); }
.match-btn.selected { border-color: var(--purple); background: var(--purple-soft); }
.match-btn.matched { border-color: var(--green); background: #E4F7EC; opacity: .8; }
.match-btn.shake { animation: shake .4s; border-color: var(--red); }
@keyframes shake { 0%,100%{transform:translateX(0);} 25%{transform:translateX(-6px);} 75%{transform:translateX(6px);} }

/* Ordenar pasos */
.order-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.order-row { display: flex; align-items: center; gap: 12px; background: var(--gray-light); border-radius: var(--radius-sm); padding: 10px 14px; }
.order-index { width: 26px; height: 26px; border-radius: 50%; background: var(--purple); color: var(--white); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; flex-shrink: 0; }
.order-text { flex: 1; font-size: 14px; }
.order-controls { display: flex; gap: 4px; }
.icon-btn { border: 1px solid var(--gray-line); background: var(--white); border-radius: 8px; width: 30px; height: 30px; font-weight: 800; color: var(--purple); }

/* Escenarios (árbol de decisión / caso práctico / simulación) */
.scenario-box { background: var(--purple-soft); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 14px; }
.scenario-label { font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--purple); }
.scenario-box p { margin: 6px 0 0; font-weight: 600; color: var(--gray-dark); }

/* Resumen de módulo */
.summary-stats { display: flex; gap: 22px; margin: 18px 0; }
.summary-stats div { text-align: center; }
.summary-stats strong { display: block; font-size: 24px; color: var(--orange); font-family: var(--font-display); }
.summary-stats span { font-size: 12px; color: var(--gray-mid); }
.perfect-note { color: var(--orange); font-weight: 700; }

/* --------------------------------- RESULTADOS --------------------------------- */

.badges-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 16px; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 6px; background: var(--purple-soft); border-radius: var(--radius-sm); padding: 14px; width: 96px; text-align: center; }
.badge-icon { font-size: 26px; }
.badge.badge-locked { opacity: .35; filter: grayscale(1); }
.results-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
.results-table th, .results-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--gray-line); }
.results-table th { color: var(--gray-mid); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.export-row { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* --------------------------------- ADMIN --------------------------------- */

.view-admin .card input[type="file"] { display: block; margin: 14px 0; }
.upload-status { font-size: 13px; margin: 10px 0; padding: 10px 12px; border-radius: var(--radius-sm); }
.upload-success { background: #E4F7EC; color: #1D7A42; }
.upload-warning { background: #FFF4E6; color: #9A5B0A; }
.upload-error { background: #FDEBEC; color: #B5262B; }

/* --------------------------------- FOOTER --------------------------------- */

.app-footer { text-align: center; font-size: 12px; color: var(--gray-mid); padding: 20px; border-top: 1px solid var(--gray-line); }

/* --------------------------------- RESPONSIVE --------------------------------- */

@media (max-width: 720px) {
  .app-header { padding: 12px 16px; }
  .header-stats { order: 3; width: 100%; justify-content: space-between; }
  .header-nav { gap: 4px; }
  .nav-btn { padding: 7px 10px; font-size: 12px; }
  main { padding: 20px 14px 50px; }
  .module-node { min-width: 0; width: 100%; transform: none !important; }
  .dragdrop-grid { grid-template-columns: 1fr; }
  .login-card { padding: 30px 22px; }
}
