/* ============================================================
   AulaVirtual MAQPOWER — Estilos Globales
   Mobile-first · Duolingo + Platzi + Coursera inspired
   v2.0 — 6 módulos con contenido real del Plan de Capacitación
   ============================================================ */

/* ── VARIABLES ─────────────────────────────────────────────── */
:root {
  --primary:        #5B21B6;   /* Violeta Platzi       */
  --primary-l:      #7C3AED;   /* Violeta claro        */
  --primary-d:      #4C1D95;   /* Violeta oscuro       */
  --accent:         #F59E0B;   /* Ámbar / Minería      */
  --accent-d:       #D97706;
  --success:        #10B981;
  --success-d:      #059669;
  --danger:         #EF4444;
  --danger-d:       #DC2626;
  --info:           #3B82F6;
  --warning:        #F59E0B;

  --bg:             #F1F5F9;
  --surface:        #FFFFFF;
  --surface-2:      #F8FAFC;
  --border:         #E2E8F0;
  --border-focus:   var(--primary-l);

  --text:           #1E293B;
  --text-muted:     #64748B;
  --text-light:     #94A3B8;

  --shadow-xs:  0 1px 2px rgba(0,0,0,.06);
  --shadow-sm:  0 1px 6px rgba(0,0,0,.08);
  --shadow:     0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.14);
  --shadow-xl:  0 16px 48px rgba(0,0,0,.18);

  --radius-sm:  8px;
  --radius:     12px;
  --radius-lg:  20px;
  --radius-xl:  28px;
  --radius-full:9999px;

  --nav-h:      64px;   /* Altura del bottom nav  */
  --header-h:   56px;   /* Altura del top header  */
  --font:       'Inter', system-ui, sans-serif;
}

/* ── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; -webkit-font-smoothing: antialiased; }
img  { max-width: 100%; display: block; }
a    { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
ul   { list-style: none; }
table { border-collapse: collapse; width: 100%; }

/* ── SPLASH SCREEN ──────────────────────────────────────────── */
.splash-screen {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: linear-gradient(160deg, #4C1D95 0%, #1E1B4B 100%);
  color: #fff; gap: 12px;
}
.splash-logo  { font-size: 4rem; animation: bounce .8s ease-in-out infinite alternate; }
.splash-title { font-size: 2rem; font-weight: 900; letter-spacing: -.02em; }
.splash-sub   { font-size: .9rem; color: #C4B5FD; letter-spacing: .08em; text-transform: uppercase; }
.splash-loader { width: 180px; height: 4px; background: rgba(255,255,255,.2); border-radius: 99px; margin-top: 20px; overflow: hidden; }
.splash-bar   { height: 100%; background: var(--accent); border-radius: 99px; animation: load 1.4s ease-in-out infinite; }

@keyframes bounce { from { transform: translateY(0);  } to { transform: translateY(-12px); } }
@keyframes load   { 0%{width:0;margin-left:0} 50%{width:100%;margin-left:0} 100%{width:0;margin-left:100%} }

/* ── LAYOUT BASE ────────────────────────────────────────────── */
.page {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  padding-bottom: var(--nav-h);  /* espacio para bottom nav */
}
.page--no-nav { padding-bottom: 0; }

/* ── TOP HEADER ─────────────────────────────────────────────── */
.app-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  box-shadow: var(--shadow-sm);
}
.app-header__back {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); border: none;
  background: var(--surface-2); cursor: pointer; font-size: 1.1rem;
  transition: background .15s;
}
.app-header__back:active { background: var(--border); }
.app-header__title { flex: 1; font-size: 1rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-header__logo  { height: 32px; object-fit: contain; }
.app-header__badge { font-size: .75rem; font-weight: 700; background: var(--accent); color: #1a0a00; border-radius: var(--radius-full); padding: 3px 10px; }

/* ── BOTTOM NAVIGATION ──────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--nav-h); z-index: 200;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px rgba(0,0,0,.08);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; border: none; background: none; cursor: pointer;
  color: var(--text-muted); transition: color .15s;
  position: relative; padding: 0;
}
.nav-item.active { color: var(--primary); }
.nav-item.active::after {
  content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 28px; height: 3px; background: var(--primary); border-radius: 99px 99px 0 0;
}
.nav-icon  { font-size: 1.4rem; }
.nav-label { font-size: .65rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* ── SCROLL CONTENT AREA ────────────────────────────────────── */
.scroll-content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.content-pad    { padding: 16px; }
.content-pad-lg { padding: 20px; }

/* ── CARDS ──────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card--bordered { border: 1px solid var(--border); box-shadow: none; }
.card--flat     { box-shadow: none; background: var(--surface-2); }
.card + .card   { margin-top: 12px; }

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 24px; border-radius: var(--radius); border: none;
  font-size: .95rem; font-weight: 700; cursor: pointer; transition: all .18s;
  letter-spacing: .02em; white-space: nowrap; position: relative; overflow: hidden;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-full { width: 100%; }
.btn-primary  { background: var(--primary);   color: #fff; box-shadow: 0 4px 16px rgba(91,33,182,.35); }
.btn-primary:hover  { background: var(--primary-l); box-shadow: 0 6px 20px rgba(91,33,182,.45); }
.btn-accent   { background: var(--accent);    color: #1a0a00; }
.btn-accent:hover   { background: var(--accent-d); }
.btn-success  { background: var(--success);   color: #fff; }
.btn-success:hover  { background: var(--success-d); }
.btn-danger   { background: var(--danger);    color: #fff; }
.btn-outline  { background: transparent; color: var(--primary); border: 2px solid var(--primary); box-shadow: none; }
.btn-outline:hover  { background: var(--primary); color: #fff; }
.btn-ghost    { background: var(--surface-2); color: var(--text); box-shadow: none; }
.btn-ghost:hover    { background: var(--border); }
.btn-sm       { padding: 9px 16px; font-size: .82rem; border-radius: var(--radius-sm); }
.btn-lg       { padding: 18px 32px; font-size: 1.05rem; }
.btn-icon     { padding: 12px; border-radius: var(--radius); }

/* ── FORMS ──────────────────────────────────────────────────── */
.form-group       { margin-bottom: 16px; }
.form-label       { display: block; font-size: .85rem; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.form-hint        { font-size: .75rem; color: var(--text-muted); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 13px 16px;
  border: 2px solid var(--border); border-radius: var(--radius);
  font-size: .95rem; color: var(--text); background: var(--surface);
  transition: border-color .18s, box-shadow .18s; outline: none; font-family: var(--font);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary-l);
  box-shadow: 0 0 0 3px rgba(124,58,237,.15);
}
.form-input.error, .form-select.error { border-color: var(--danger); }
.form-error { display: none; color: var(--danger); font-size: .78rem; margin-top: 4px; }
.form-error.show { display: block; }
.form-textarea { min-height: 100px; resize: vertical; }
.form-divider  { display: flex; align-items: center; gap: 12px; margin: 20px 0; }
.form-divider::before, .form-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.form-divider span { font-size: .78rem; color: var(--text-muted); font-weight: 600; }

/* ── BADGES / TAGS ──────────────────────────────────────────── */
.badge-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: var(--radius-full); font-size: .75rem; font-weight: 700; }
.badge-primary { background: #EDE9FE; color: var(--primary); }
.badge-success { background: #D1FAE5; color: var(--success-d); }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger  { background: #FEE2E2; color: var(--danger-d); }
.badge-info    { background: #DBEAFE; color: #1D4ED8; }
.badge-dark    { background: var(--text); color: #fff; }

/* ── PROGRESS BAR ───────────────────────────────────────────── */
.progress-wrap  { background: var(--border); border-radius: var(--radius-full); overflow: hidden; }
.progress-bar   { height: 100%; border-radius: var(--radius-full); background: var(--primary); transition: width .6s cubic-bezier(.4,0,.2,1); }
.progress-bar--accent   { background: var(--accent); }
.progress-bar--success  { background: var(--success); }
.progress-sm    { height: 6px; }
.progress-md    { height: 10px; }
.progress-lg    { height: 14px; }

/* ── ╔══════════════════════════════════╗
      ║  PANTALLAS ESPECÍFICAS           ║
      ╚══════════════════════════════════╝ */

/* ── LOGIN / REGISTER ───────────────────────────────────────── */
.auth-page {
  min-height: 100dvh; display: flex; flex-direction: column;
  background: linear-gradient(165deg, #4C1D95 0%, #1E1B4B 55%, #0F172A 100%);
}
.auth-hero {
  padding: 40px 24px 24px;
  text-align: center; color: #fff;
}
.auth-hero__icon  { font-size: 3.5rem; margin-bottom: 10px; }
.auth-hero__title { font-size: 1.7rem; font-weight: 900; letter-spacing: -.02em; }
.auth-hero__sub   { font-size: .88rem; color: #C4B5FD; margin-top: 6px; }
.auth-card {
  flex: 1; background: var(--surface); border-radius: 28px 28px 0 0;
  padding: 28px 24px 40px; margin-top: 8px;
}
.auth-card__title { font-size: 1.3rem; font-weight: 800; margin-bottom: 4px; }
.auth-card__sub   { font-size: .85rem; color: var(--text-muted); margin-bottom: 24px; }

/* ── DASHBOARD ──────────────────────────────────────────────── */
.dash-header {
  background: linear-gradient(135deg, var(--primary-d) 0%, var(--primary) 100%);
  padding: 20px 16px 28px;
  color: #fff;
}
.dash-greeting  { font-size: .85rem; color: #C4B5FD; }
.dash-name      { font-size: 1.4rem; font-weight: 800; line-height: 1.2; margin-top: 2px; }
.dash-level     { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px;
                  background: rgba(255,255,255,.15); padding: 5px 12px; border-radius: var(--radius-full);
                  font-size: .8rem; font-weight: 700; }
.dash-points    { margin-left: auto; text-align: right; }
.dash-points__num   { font-size: 1.6rem; font-weight: 900; color: var(--accent); line-height: 1; }
.dash-points__label { font-size: .7rem; color: #C4B5FD; text-transform: uppercase; letter-spacing: .06em; }

/* Progress hero card */
.progress-hero {
  background: var(--surface); border-radius: var(--radius); padding: 16px;
  margin: -14px 16px 0; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 16px;
}
.progress-hero__circle {
  width: 64px; height: 64px; flex-shrink: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; font-weight: 900;
  background: conic-gradient(var(--primary) var(--pct, 0%), var(--border) 0%);
  position: relative;
}
.progress-hero__circle::before {
  content: ''; position: absolute; inset: 6px; background: var(--surface); border-radius: 50%;
}
.progress-hero__circle span { position: relative; z-index: 1; }
.progress-hero__info { flex: 1; min-width: 0; }
.progress-hero__pct   { font-size: 1rem; font-weight: 800; color: var(--primary); }
.progress-hero__label { font-size: .8rem; color: var(--text-muted); }
.progress-hero__bar   { margin-top: 6px; }

/* Roadmap */
.roadmap        { display: flex; align-items: flex-start; gap: 0; padding: 20px 16px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.roadmap::-webkit-scrollbar { display: none; }
.roadmap-step   { display: flex; flex-direction: column; align-items: center; min-width: 100px; scroll-snap-align: center; position: relative; }
.roadmap-step + .roadmap-step::before {
  content: ''; position: absolute; top: 28px; right: 50%; width: 100%;
  height: 3px; background: var(--border); z-index: 0;
}
.roadmap-step.done + .roadmap-step::before  { background: var(--success); }
.roadmap-step.active + .roadmap-step::before { background: linear-gradient(90deg, var(--primary), var(--border)); }
.roadmap-dot {
  width: 56px; height: 56px; border-radius: 50%; border: 3px solid var(--border);
  background: var(--surface); display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; position: relative; z-index: 1; transition: all .2s;
  box-shadow: var(--shadow-sm);
}
.roadmap-step.done   .roadmap-dot { border-color: var(--success); background: #D1FAE5; }
.roadmap-step.active .roadmap-dot { border-color: var(--primary); background: #EDE9FE; box-shadow: 0 0 0 4px rgba(91,33,182,.2); animation: pulse-ring 2s infinite; }
.roadmap-step.locked .roadmap-dot { background: var(--surface-2); }
.roadmap-label { margin-top: 8px; font-size: .72rem; font-weight: 700; text-align: center; color: var(--text-muted); max-width: 88px; }
.roadmap-step.active .roadmap-label { color: var(--primary); }
.roadmap-step.done   .roadmap-label { color: var(--success-d); }

@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 4px rgba(91,33,182,.2); }
  50%  { box-shadow: 0 0 0 8px rgba(91,33,182,.1); }
  100% { box-shadow: 0 0 0 4px rgba(91,33,182,.2); }
}

/* Stats strip */
.stats-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 16px 16px; }
.stat-box    { background: var(--surface); border-radius: var(--radius); padding: 14px 12px; text-align: center; box-shadow: var(--shadow-sm); }
.stat-box__num   { font-size: 1.4rem; font-weight: 900; color: var(--primary); }
.stat-box__label { font-size: .68rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }

/* Module list cards */
.module-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow-sm); margin: 0 16px 10px; cursor: pointer;
  transition: transform .15s, box-shadow .15s; border: 2px solid transparent;
}
.module-card:active { transform: scale(.98); }
.module-card.active  { border-color: var(--primary); }
.module-card.locked  { opacity: .6; cursor: not-allowed; }
.module-card__icon {
  width: 52px; height: 52px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; flex-shrink: 0;
}
.module-card__body { flex: 1; min-width: 0; }
.module-card__title { font-size: .92rem; font-weight: 700; line-height: 1.3; }
.module-card__sub   { font-size: .78rem; color: var(--text-muted); margin-top: 3px; }
.module-card__status { font-size: 1.2rem; flex-shrink: 0; }

/* ── MODULE VIEW ────────────────────────────────────────────── */
.module-hero {
  padding: 20px 16px;
  color: #fff;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  margin-bottom: 16px;
}
.module-hero__badge { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; opacity: .8; margin-bottom: 4px; }
.module-hero__title { font-size: 1.25rem; font-weight: 800; line-height: 1.3; margin-bottom: 10px; }
.module-hero__meta  { display: flex; gap: 12px; font-size: .78rem; opacity: .85; }

/* Tabs */
.tabs       { display: flex; padding: 0 16px; gap: 4px; margin-bottom: 16px; }
.tab-btn    { flex: 1; padding: 10px; border: none; background: var(--border); border-radius: var(--radius); font-size: .85rem; font-weight: 700; cursor: pointer; color: var(--text-muted); transition: all .15s; }
.tab-btn.active { background: var(--primary); color: #fff; }
.tab-panel  { display: none; padding: 0 16px 20px; }
.tab-panel.active { display: block; }

/* Theory content */
.theory-content { font-size: .95rem; line-height: 1.8; }
.theory-content h3 { font-size: 1.05rem; font-weight: 800; margin: 20px 0 8px; color: var(--primary-d); }
.theory-content h4 { font-size: .92rem; font-weight: 700; margin: 16px 0 6px; color: var(--text); }
.theory-content p  { margin-bottom: 12px; }
.theory-content ul, .theory-content ol { padding-left: 20px; margin-bottom: 12px; }
.theory-content li { margin-bottom: 6px; }
.theory-content strong { color: var(--text); }
.theory-content table { margin: 12px 0; font-size: .85rem; }
.theory-content th, .theory-content td { padding: 8px 10px; border: 1px solid var(--border); text-align: left; }
.theory-content th { background: var(--surface-2); font-weight: 700; }

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

/* Activity steps */
.activity-steps { padding-left: 0; }
.activity-step  { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.activity-step:last-child { border-bottom: none; }
.activity-step__num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 900; flex-shrink: 0; margin-top: 2px;
}
.activity-step__text { font-size: .9rem; line-height: 1.5; }

/* ── QUIZ ───────────────────────────────────────────────────── */
.quiz-header    { padding: 16px 16px 8px; }
.quiz-question  { font-size: 1.05rem; font-weight: 700; line-height: 1.5; padding: 0 16px 20px; }
.quiz-options   { padding: 0 16px; display: flex; flex-direction: column; gap: 10px; }
.quiz-option    {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; border: 2px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: all .15s; background: var(--surface);
}
.quiz-option:active { transform: scale(.99); }
.quiz-option.selected    { border-color: var(--primary); background: #EDE9FE; }
.quiz-option.correct     { border-color: var(--success); background: #D1FAE5; }
.quiz-option.incorrect   { border-color: var(--danger);  background: #FEE2E2; }
.quiz-option__radio {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--border); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.quiz-option.selected  .quiz-option__radio { border-color: var(--primary); background: var(--primary); }
.quiz-option.correct   .quiz-option__radio { border-color: var(--success); background: var(--success); }
.quiz-option.incorrect .quiz-option__radio { border-color: var(--danger);  background: var(--danger);  }
.quiz-option__radio::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #fff; opacity: 0; transition: opacity .15s; }
.quiz-option.selected  .quiz-option__radio::after,
.quiz-option.correct   .quiz-option__radio::after,
.quiz-option.incorrect .quiz-option__radio::after { opacity: 1; }
.quiz-option__text { font-size: .92rem; font-weight: 600; line-height: 1.4; flex: 1; }
.quiz-explanation {
  margin: 10px 0 0; padding: 12px 14px;
  background: #F0FDF4; border-left: 3px solid var(--success);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .82rem; color: #065F46;
}
.quiz-nav { display: flex; gap: 10px; padding: 20px 16px; }

/* Counter pill */
.q-counter { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; color: var(--text-muted); }
.q-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); transition: background .2s; }
.q-dot.done    { background: var(--success); }
.q-dot.current { background: var(--primary); }

/* ── RESULT SCREEN ──────────────────────────────────────────── */
.result-page  { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 24px; text-align: center; }
.result-page.pass { background: linear-gradient(160deg, #059669 0%, #065F46 100%); color: #fff; }
.result-page.fail { background: linear-gradient(160deg, #DC2626 0%, #7F1D1D 100%); color: #fff; }
.result-icon  { font-size: 5rem; margin-bottom: 12px; animation: pop .5s cubic-bezier(.34,1.56,.64,1); }
.result-score { font-size: 4.5rem; font-weight: 900; line-height: 1; }
.result-pts   { font-size: 1rem; opacity: .8; margin-bottom: 8px; }
.result-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 6px; }
.result-msg   { font-size: .9rem; opacity: .85; max-width: 320px; margin: 0 auto 28px; }
.result-badge { background: rgba(255,255,255,.15); border-radius: var(--radius-xl); padding: 16px 20px; margin-bottom: 24px; }
.result-badge__icon  { font-size: 2.5rem; }
.result-badge__name  { font-weight: 800; margin-top: 4px; }
.result-badge__desc  { font-size: .78rem; opacity: .8; }
.result-btns  { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 320px; }

@keyframes pop { 0%{transform:scale(0)} 80%{transform:scale(1.2)} 100%{transform:scale(1)} }

/* ── BADGES ─────────────────────────────────────────────────── */
.badges-grid  { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap: 12px; padding: 16px; }
.badge-card   { background: var(--surface); border-radius: var(--radius); padding: 20px 12px; text-align: center; box-shadow: var(--shadow-sm); transition: transform .15s; }
.badge-card.earned { border: 2px solid var(--primary); }
.badge-card.locked { opacity: .45; filter: grayscale(1); }
.badge-card:active { transform: scale(.97); }
.badge-card__icon { font-size: 2.5rem; margin-bottom: 8px; }
.badge-card__name { font-size: .82rem; font-weight: 800; color: var(--text); }
.badge-card__desc { font-size: .72rem; color: var(--text-muted); margin-top: 4px; }
.badge-card__tag  { margin-top: 8px; }

/* ── CERTIFICATE PREVIEW ────────────────────────────────────── */
.cert-preview {
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
  border-radius: var(--radius); padding: 28px 20px; text-align: center;
  color: #fff; border: 3px solid var(--accent); margin: 16px;
  box-shadow: var(--shadow-lg);
}
.cert-preview__badge   { font-size: 2.5rem; margin-bottom: 8px; }
.cert-preview__eyebrow { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin-bottom: 8px; }
.cert-preview__title   { font-size: 1rem; font-weight: 800; color: #fff; margin-bottom: 16px; }
.cert-preview__name    { font-size: 1.6rem; font-weight: 900; color: var(--accent); margin: 8px 0; }
.cert-preview__module  { font-size: .88rem; color: #94A3B8; margin-bottom: 16px; }
.cert-preview__divider { height: 1px; background: rgba(255,255,255,.15); margin: 16px 0; }
.cert-preview__code    { font-size: .72rem; color: #64748B; font-family: monospace; }
.cert-preview__date    { font-size: .8rem; color: #94A3B8; margin-top: 4px; }

/* ── PROFILE ────────────────────────────────────────────────── */
.profile-hero { background: linear-gradient(135deg, var(--primary-d), var(--primary)); padding: 28px 16px; text-align: center; color: #fff; }
.profile-avatar { width: 72px; height: 72px; border-radius: 50%; background: rgba(255,255,255,.2); border: 3px solid rgba(255,255,255,.5); display: flex; align-items: center; justify-content: center; font-size: 2rem; margin: 0 auto 12px; }
.profile-name  { font-size: 1.2rem; font-weight: 800; }
.profile-role  { font-size: .8rem; color: #C4B5FD; margin-top: 4px; }

/* ── ADMIN ──────────────────────────────────────────────────── */
.admin-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 16px; }
.metric-card   { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); }
.metric-card__value { font-size: 1.8rem; font-weight: 900; line-height: 1.1; }
.metric-card__label { font-size: .75rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }
.metric-card__icon  { font-size: 1.4rem; margin-bottom: 8px; }

/* Student table/list */
.student-list { padding: 0 16px 16px; }
.student-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; background: var(--surface); border-radius: var(--radius);
  margin-bottom: 8px; box-shadow: var(--shadow-xs); cursor: pointer;
  transition: transform .15s;
}
.student-item:active { transform: scale(.99); }
.student-avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 1rem; font-weight: 800; color: #fff; flex-shrink: 0; }
.student-info   { flex: 1; min-width: 0; }
.student-name   { font-size: .9rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.student-meta   { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }
.student-progress { text-align: right; font-size: .8rem; font-weight: 700; color: var(--primary); }

/* Section heading */
.section-heading { padding: 16px 16px 8px; }
.section-heading h3 { font-size: 1rem; font-weight: 800; }
.section-heading p  { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }
.section-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; }

/* ── AI TUTOR WIDGET ────────────────────────────────────────── */
/* FAB (floating action button) */
.ai-fab {
  position: fixed; bottom: calc(var(--nav-h) + 16px); right: 16px; z-index: 300;
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-l), var(--primary-d));
  color: #fff; border: none; cursor: pointer; font-size: 1.5rem;
  box-shadow: 0 4px 20px rgba(91,33,182,.45);
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
  display: flex; align-items: center; justify-content: center;
}
.ai-fab:hover  { transform: scale(1.1) rotate(-5deg); box-shadow: 0 6px 24px rgba(91,33,182,.55); }
.ai-fab:active { transform: scale(.96); }
.ai-fab.hidden { display: none; }

/* Panel */
.ai-panel {
  position: fixed; bottom: var(--nav-h); left: 0; right: 0; z-index: 500;
  background: var(--surface); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  max-height: 72dvh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-xl); transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  border-top: 3px solid var(--primary-l);
}
.ai-panel.open { transform: translateY(0); }

/* Panel header — gradient branded */
.ai-panel__header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px 12px;
  background: linear-gradient(135deg, var(--primary-d) 0%, var(--primary) 100%);
  border-radius: calc(var(--radius-xl) - 3px) calc(var(--radius-xl) - 3px) 0 0;
}
.ai-panel__avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,.18);
  border: 2px solid rgba(255,255,255,.35);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.ai-panel__name   { font-weight: 900; font-size: 1rem; color: #fff; line-height: 1.2; letter-spacing: .01em; }
.ai-panel__sub    { font-size: .72rem; color: rgba(255,255,255,.7); margin-top: 1px; }
.ai-panel__title  { flex: 1; }
.ai-panel__status { display: flex; align-items: center; gap: 5px; font-size: .7rem; color: rgba(255,255,255,.75); margin-top: 3px; }
.ai-panel__status::before { content:''; width:7px; height:7px; border-radius:50%; background:#4ADE80; flex-shrink:0; box-shadow:0 0 0 2px rgba(74,222,128,.3); }
.ai-panel__close {
  width: 34px; height: 34px; border-radius: var(--radius-sm); border: none;
  background: rgba(255,255,255,.15); color: #fff;
  cursor: pointer; font-size: 1rem; display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.ai-panel__close:hover { background: rgba(255,255,255,.25); }

/* Suggestions chips */
.ai-suggestions {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 14px 6px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.ai-suggest-btn {
  padding: 6px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text);          /* ← contraste explícito */
  font-size: .76rem; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: all .15s;
}
.ai-suggest-btn:hover  { border-color: var(--primary-l); color: var(--primary); background: var(--surface); }
.ai-suggest-btn:active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Messages area */
.ai-messages {
  flex: 1; overflow-y: auto; padding: 14px 14px 6px;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--bg);
}

/* Message bubbles */
.ai-msg { max-width: 86%; display: flex; flex-direction: column; gap: 2px; }
.ai-msg.user { align-self: flex-end; }
.ai-msg.bot  { align-self: flex-start; }
.ai-msg__bubble {
  padding: 10px 14px; border-radius: 18px;
  font-size: .875rem; line-height: 1.55;
  word-break: break-word;
}
/* User bubble */
.ai-msg.user .ai-msg__bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(91,33,182,.3);
}
/* Bot bubble — high contrast in both modes */
.ai-msg.bot .ai-msg__bubble {
  background: var(--surface);
  color: var(--text);          /* ← siempre usa el color de texto del tema */
  border: 1.5px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-xs);
}
.ai-msg.bot .ai-msg__bubble a { color: var(--accent); font-weight: 700; }

/* Input row */
.ai-input-row {
  display: flex; gap: 8px; padding: 10px 14px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.ai-input {
  flex: 1; padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  font-size: .9rem; outline: none;
  font-family: var(--font);
  background: var(--surface-2);   /* ← visible en dark */
  color: var(--text);             /* ← contraste explícito */
  transition: border-color .18s, box-shadow .18s;
}
.ai-input::placeholder { color: var(--text-muted); }
.ai-input:focus {
  border-color: var(--primary-l);
  box-shadow: 0 0 0 3px rgba(124,58,237,.15);
}
.ai-send {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--primary); border: none; color: #fff;
  font-size: 1.1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .15s;
  box-shadow: 0 2px 8px rgba(91,33,182,.35);
}
.ai-send:hover  { background: var(--primary-l); }
.ai-send:active { transform: scale(.92); }

/* Dark mode overrides for chatbot */
[data-theme="dark"] .ai-msg.bot .ai-msg__bubble {
  background: var(--surface-2);
  border-color: var(--border);
}
[data-theme="dark"] .ai-input    { background: var(--surface-2); }
[data-theme="dark"] .ai-messages { background: #0A0E16; }

/* ── TOAST ──────────────────────────────────────────────────── */
#toast-container { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; width: min(90vw, 360px); }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius);
  font-size: .88rem; font-weight: 600;
  box-shadow: var(--shadow-lg); pointer-events: auto;
  animation: toast-in .3s cubic-bezier(.34,1.56,.64,1);
}
.toast.success { background: #065F46; color: #fff; }
.toast.error   { background: #7F1D1D; color: #fff; }
.toast.info    { background: var(--primary-d); color: #fff; }
.toast.out     { animation: toast-out .3s ease-in forwards; }
@keyframes toast-in  { from { opacity:0; transform:translateY(-16px) scale(.9); } to { opacity:1; transform:none; } }
@keyframes toast-out { from { opacity:1; } to { opacity:0; transform:translateY(-16px) scale(.9); } }

/* ── MODALS / OVERLAYS ──────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 400; display: flex; align-items: flex-end; }
.modal-sheet   { background: var(--surface); border-radius: var(--radius-xl) var(--radius-xl) 0 0; padding: 24px; width: 100%; max-height: 80dvh; overflow-y: auto; animation: slide-up .28s cubic-bezier(.4,0,.2,1); }
@keyframes slide-up { from { transform: translateY(100%); } to { transform: none; } }
.modal-handle  { width: 40px; height: 4px; background: var(--border); border-radius: 99px; margin: 0 auto 20px; }
.modal-title   { font-size: 1.1rem; font-weight: 800; margin-bottom: 16px; }

/* ── UTILITY CLASSES ────────────────────────────────────────── */
.flex          { display: flex; }
.flex-center   { display: flex; align-items: center; justify-content: center; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; }
.flex-gap      { gap: 12px; }
.gap-sm        { gap: 8px; }
.gap-lg        { gap: 20px; }
.mt-8          { margin-top: 8px; }
.mt-12         { margin-top: 12px; }
.mt-16         { margin-top: 16px; }
.mt-24         { margin-top: 24px; }
.mb-16         { margin-bottom: 16px; }
.text-center   { text-align: center; }
.text-muted    { color: var(--text-muted); }
.text-sm       { font-size: .85rem; }
.text-xs       { font-size: .75rem; }
.font-bold     { font-weight: 700; }
.font-black    { font-weight: 900; }
.color-primary { color: var(--primary); }
.color-success { color: var(--success-d); }
.color-accent  { color: var(--accent-d); }
.w-full        { width: 100%; }
.hidden        { display: none !important; }
.divider       { height: 1px; background: var(--border); margin: 12px 0; }
.rounded       { border-radius: var(--radius); }
.p-16          { padding: 16px; }

/* Settings item */
.settings-item { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--surface); border-radius: var(--radius); cursor: pointer; box-shadow: var(--shadow-xs); transition: background .15s; }
.settings-item:active { background: var(--surface-2); }
.settings-item__icon  { font-size: 1.3rem; }
.settings-item__body  { flex: 1; }
.settings-item__title { font-size: .92rem; font-weight: 700; }
.settings-item__sub   { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }
.settings-item__arrow { color: var(--text-light); font-size: .9rem; }

/* Empty state */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state__icon  { font-size: 3rem; margin-bottom: 12px; }
.empty-state__title { font-size: 1rem; font-weight: 700; color: var(--text); }
.empty-state__text  { font-size: .85rem; margin-top: 6px; }

/* Separator with label */
.sep-label { display: flex; align-items: center; gap: 10px; font-size: .75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; padding: 8px 0; }
.sep-label::before, .sep-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── MEDIA QUERIES ──────────────────────────────────────────── */
@media (min-width: 480px) {
  .admin-metrics { grid-template-columns: repeat(4, 1fr); }
  .auth-card { max-width: 440px; margin: 8px auto 0; border-radius: var(--radius-xl); }
  .auth-page { align-items: center; }
  .ai-panel { max-width: 400px; left: auto; right: 0; bottom: var(--nav-h); border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
}

/* ── TRANSITIONS (theme switching) ─────────────────────────── */
body, .app-header, .bottom-nav, .page, .card, .module-card,
.form-input, .form-select, .form-textarea, .auth-card,
.progress-hero, .stat-box, .quiz-option, .settings-item,
.badge-card, .ai-panel, .ai-msg__bubble, .modal-sheet,
.tab-btn, .nav-item, .roadmap-dot, .student-item, .metric-card {
  transition: background-color .25s ease, color .2s ease,
              border-color .2s ease, box-shadow .25s ease;
}

/* ── CSS VAR: banner height ─────────────────────────────────── */
:root { --banner-h: 0px; }
body.is-offline { --banner-h: 36px; }
.app-header { top: var(--banner-h); }

/* ── DARK THEME ─────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:         #0D1117;
  --surface:    #161B22;
  --surface-2:  #1C2333;
  --border:     #30363D;
  --text:       #E6EDF3;
  --text-muted: #7D8590;
  --text-light: #6E7681;
  --shadow-xs:  0 1px 2px rgba(0,0,0,.5);
  --shadow-sm:  0 2px 8px rgba(0,0,0,.55);
  --shadow:     0 4px 16px rgba(0,0,0,.65);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.75);
  --shadow-xl:  0 16px 48px rgba(0,0,0,.85);
}
/* Dark — quiz feedback */
[data-theme="dark"] .quiz-option.selected  { background:#2D1F5E; border-color:var(--primary-l); }
[data-theme="dark"] .quiz-option.correct   { background:#064E3B; }
[data-theme="dark"] .quiz-option.incorrect { background:#450A0A; }
[data-theme="dark"] .quiz-explanation      { background:#064E3B; color:#6EE7B7; border-color:#059669; }
/* Dark — badge chips */
[data-theme="dark"] .badge-primary { background:#2D1F5E; color:#C4B5FD; }
[data-theme="dark"] .badge-success { background:#064E3B; color:#6EE7B7; }
[data-theme="dark"] .badge-warning { background:#451A03; color:#FCD34D; }
[data-theme="dark"] .badge-danger  { background:#450A0A; color:#FCA5A5; }
[data-theme="dark"] .badge-info    { background:#1E3A5F; color:#93C5FD; }
/* Dark — theory content */
[data-theme="dark"] .theory-content h3 { color:#C4B5FD; }
[data-theme="dark"] .theory-content h4 { color:#E2D9F3; }
[data-theme="dark"] .theory-content th { background:var(--surface-2); }
/* Dark — forms */
[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-textarea { background:var(--surface-2); }
/* Dark — donut circle inner */
[data-theme="dark"] .progress-hero__circle::before { background:var(--surface); }
/* Dark — roadmap */
[data-theme="dark"] .roadmap-step.done   .roadmap-dot { background:#064E3B; }
[data-theme="dark"] .roadmap-step.active .roadmap-dot { background:#2D1F5E; }
/* Dark — module card active */
[data-theme="dark"] .module-card.active { background:#1E1B4B; }
/* Dark — ai bubble user msg stays purple */
/* Dark — cert preview already dark */
/* Dark — select option */
[data-theme="dark"] option { background:var(--surface-2); color:var(--text); }

/* ── THEME TOGGLE BUTTON ────────────────────────────────────── */
.btn-theme {
  width: 34px; height: 34px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); border: none;
  background: var(--surface-2); color: var(--text-muted);
  cursor: pointer; font-size: 1rem;
  transition: background .15s, transform .25s;
}
.btn-theme:hover  { background: var(--border); }
.btn-theme:active { transform: rotate(20deg) scale(.9); }
/* On colored headers (dash-header, hero) */
.dash-header .btn-theme,
.module-hero .btn-theme {
  background: rgba(255,255,255,.18); color: #fff;
}
.dash-header .btn-theme:hover { background: rgba(255,255,255,.28); }

/* ── CONNECTION BANNER ──────────────────────────────────────── */
#connection-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9500;
  height: 0; overflow: hidden; opacity: 0;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: .78rem; font-weight: 700; letter-spacing: .02em;
  transition: height .3s ease, opacity .3s ease;
  pointer-events: none;
}
#connection-banner.visible {
  height: 36px; opacity: 1; pointer-events: auto;
}
#connection-banner.offline { background: #7F1D1D; color: #FCA5A5; }
#connection-banner.online  { background: #065F46; color: #6EE7B7; }

/* ── CONNECTION DOT (header) ────────────────────────────────── */
.conn-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  background: #22C55E;
  box-shadow: 0 0 0 3px rgba(34,197,94,.25);
  transition: background .4s, box-shadow .4s;
}
.conn-dot.offline {
  background: #EF4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,.25);
  animation: blink-dot 1.6s ease-in-out infinite;
}
@keyframes blink-dot {
  0%, 100% { opacity: 1; }
  50%      { opacity: .35; }
}

/* ── BETTER CONTRAST REFINEMENTS ────────────────────────────── */
/* Stronger text on cards */
.module-card__title  { font-size: .93rem; font-weight: 800; }
.settings-item__title{ font-weight: 800; }
/* Larger clickable tap targets */
.nav-item { min-height: 64px; }
/* Focus ring for accessibility */
:focus-visible {
  outline: 3px solid var(--primary-l);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
/* Improved button ripple */
.btn::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: rgba(255,255,255,0); transition: background .15s;
}
.btn:active::before { background: rgba(255,255,255,.12); }

/* ── HONOR SYSTEM PREFERENCE if no explicit theme set ────────── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg:         #0D1117;
    --surface:    #161B22;
    --surface-2:  #1C2333;
    --border:     #30363D;
    --text:       #E6EDF3;
    --text-muted: #7D8590;
    --text-light: #6E7681;
  }
}


/* ══════════════════════════════════════════════════════════════
   MEJORAS UX v7 — Chatbot + Upload + Gestión + Certificados
══════════════════════════════════════════════════════════════ */

/* ── CHATBOT: contraste mejorado ────────────────────────────── */
.ai-panel { background: var(--surface); }
.ai-panel__header {
  background: linear-gradient(135deg, var(--primary-d) 0%, var(--primary) 100%);
  border-bottom: none;
}
.ai-panel__name   { font-weight: 900; font-size: 1rem; color: #fff; }
.ai-panel__status { font-size: .72rem; color: #86EFAC; font-weight: 700; letter-spacing:.02em; }
.ai-panel__sub    { font-size: .7rem;  color: #C4B5FD; margin-top:1px; }
.ai-panel__close  { background: rgba(255,255,255,.18); color:#fff; border:none; }
.ai-panel__close:hover { background: rgba(255,255,255,.3); }
.ai-panel__avatar { background: rgba(255,255,255,.2); font-size:1.4rem; }

.ai-messages { background: var(--bg); }

.ai-msg.bot  .ai-msg__bubble {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-bottom-left-radius: 4px;
  line-height: 1.55;
}
.ai-msg.user .ai-msg__bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
[data-theme="dark"] .ai-msg.bot .ai-msg__bubble {
  background: #1C2333;
  color: #E6EDF3;
  border-color: #334155;
}
[data-theme="dark"] .ai-messages { background: #0D1117; }
[data-theme="dark"] .ai-input {
  background: #1C2333; color: #E6EDF3; border-color: #334155;
}
[data-theme="dark"] .ai-input-row { background: #161B22; border-color: #30363D; }
[data-theme="dark"] .ai-suggest-btn {
  background: #1C2333; color: #C4B5FD; border-color: #334155;
}
.ai-input-row { background: var(--surface); }

.ai-typing { display:flex; gap:4px; align-items:center; padding:12px 16px; }
.ai-typing span { width:7px; height:7px; border-radius:50%; background:var(--primary); opacity:.3; animation: typing-dot 1.2s ease-in-out infinite; }
.ai-typing span:nth-child(2){ animation-delay:.2s; }
.ai-typing span:nth-child(3){ animation-delay:.4s; }
@keyframes typing-dot { 0%,100%{opacity:.3;transform:translateY(0)} 50%{opacity:1;transform:translateY(-4px)} }

/* ── ACTIVIDADES: subida de archivos ────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 20px 16px; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.upload-zone:hover { border-color: var(--primary); background: rgba(91,33,182,.04); }
.upload-zone__icon  { font-size: 2rem; margin-bottom:6px; }
.upload-zone__label { font-size: .85rem; font-weight: 700; color: var(--text); }
.upload-zone__hint  { font-size: .75rem; color: var(--text-muted); margin-top:3px; }

.uploaded-file {
  display: flex; align-items: center; gap:10px;
  padding: 10px 12px; background: var(--surface-2);
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  margin-bottom: 6px;
}
.uploaded-file__icon { font-size: 1.3rem; flex-shrink:0; }
.uploaded-file__name { flex:1; font-size:.82rem; font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.uploaded-file__date { font-size:.7rem; color:var(--text-muted); }

/* ── SUSPENDIDO badge ───────────────────────────────────────── */
.badge-suspended { background: #450A0A; color: #FCA5A5; }
[data-theme="light"] .badge-suspended { background: #FEE2E2; color: #991B1B; }

/* ── CERTIFICADO PÚBLICO ────────────────────────────────────── */
.cert-public-page {
  min-height:100dvh; background:linear-gradient(160deg,#1E1B4B 0%,#0F172A 100%);
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  padding: 32px 20px;
}
.cert-valid-badge {
  display:flex; align-items:center; justify-content:center; gap:6px;
  padding:8px 14px; background:rgba(34,197,94,.15);
  border:1px solid rgba(34,197,94,.3); border-radius:var(--radius);
  color:#22C55E; font-size:.82rem; font-weight:700; margin-top:14px;
}
.cert-invalid { color:#FCA5A5; text-align:center; padding:32px 24px; }

/* ── KNOWLEDGE BASE docs ────────────────────────────────────── */
.kb-doc-item {
  display:flex; align-items:center; gap:10px;
  padding:10px 0; border-bottom:1px solid var(--border);
}
.kb-doc-item:last-child { border-bottom:none; }
.kb-source-tag {
  display:inline-block; font-size:.7rem; padding:2px 7px;
  background:rgba(91,33,182,.1); color:var(--primary);
  border-radius:var(--radius-full); margin-top:4px; font-weight:700;
}

/* ── Knowledge base doc list ───────────────────────────────── */
.kb-doc-icon { font-size:1.4rem; flex-shrink:0; }
.kb-doc-info { flex:1; min-width:0; }
.kb-doc-name { font-size:.85rem; font-weight:600; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.kb-doc-date { font-size:.72rem; color:var(--text-muted); margin-top:2px; }

/* ── Cert public page adjustments ──────────────────────────── */
.cert-public-page { max-width:480px; margin:0 auto; padding:24px 16px; }
.cert-valid-badge { display:inline-flex; align-items:center; gap:6px; background:#064E3B; color:#6EE7B7; padding:6px 14px; border-radius:var(--radius-full); font-size:.85rem; font-weight:700; }

/* ── Video player error fallback ───────────────────────────── */
.video-fallback {
  position:absolute; inset:0;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:12px; background:var(--surface-2); border-radius:var(--radius);
  text-align:center; padding:24px;
}
.video-fallback__icon { font-size:3rem; }
.video-fallback__msg  { font-size:.9rem; color:var(--text-muted); font-weight:600; }

/* ── Video card (thumbnail + open YouTube) ─────────────────── */
.video-card {
  position: relative; width: 100%; padding-bottom: 56.25%; height: 0;
  overflow: hidden; border-radius: var(--radius); background: #0F172A;
  margin-bottom: 16px; cursor: pointer;
}
.video-card__thumb {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; transition: transform .3s ease, filter .3s ease;
}
.video-card:hover .video-card__thumb { transform: scale(1.04); filter: brightness(.75); }
.video-card.no-thumb .video-card__thumb { display: none; }
.video-card__overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(to top, rgba(0,0,0,.75) 0%, rgba(0,0,0,.15) 60%, transparent 100%);
  padding: 20px; text-align: center;
}
.video-card:hover .video-card__overlay { background: rgba(0,0,0,.5); }
.video-card__play {
  width: 60px; height: 60px; border-radius: 50%;
  background: rgba(255,255,255,.92); color: var(--primary-d);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; padding-left: 4px;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
  transition: transform .2s cubic-bezier(.34,1.56,.64,1);
}
.video-card:hover .video-card__play { transform: scale(1.12); }
.video-card__label {
  font-size: .82rem; font-weight: 700; color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.8); max-width: 260px;
}
.video-card__hint {
  font-size: .68rem; color: rgba(255,255,255,.75);
  text-shadow: 0 1px 3px rgba(0,0,0,.7);
}
.video-card--placeholder { cursor: default; }
.video-card--placeholder .video-card__overlay {
  background: linear-gradient(135deg, rgba(91,33,182,.25), rgba(15,23,42,.9));
}
