/* ── Reset y base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:          #F7F8FA;
    --surface:     #FFFFFF;
    --border:      #E4E7ED;
    --text-main:   #1A1D23;
    --text-sub:    #6B7280;
    --accent:      #3B5BDB;
    --accent-dim:  #EEF2FF;
    --green:       #1A7F5A;
    --green-dim:   #E6F4EF;
    --amber:       #b45309;
    --amber-dim:   #fef3c7;
    --locked:      #9CA3AF;
    --locked-dim:  #F3F4F6;
    --red:         #d32f2f;

    --radius-card: 14px;
    --shadow-card: 0 2px 8px rgba(0,0,0,.07), 0 0 0 1px var(--border);
    --shadow-hover: 0 8px 24px rgba(59,91,219,.12), 0 0 0 1px #c7d2fb;

    --font-display: 'Georgia', serif;
    --font-body:    'Arial', sans-serif;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: bold;
    color: var(--accent);
    text-decoration: none;
}
.logo-icon { font-size: 22px; }

.logo-img {
    height: 38px;
    width: auto;
    display: block;
}
.header-right { display: flex; align-items: center; gap: 16px; }
.bienvenida  { font-size: 13px; color: var(--text-sub); }
.btn-salir {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-main);
    font-size: 13px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.btn-salir:hover { background: var(--bg); border-color: var(--locked); }

/* ── Barra superior del curso (tabs de unidad + acciones) ────────────────── */
.curso-topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 60px;
    z-index: 90;
}
.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.topbtn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-main);
    font-size: 13px;
    font-family: var(--font-body);
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    white-space: nowrap;
}
.topbtn:hover { background: var(--bg); border-color: var(--locked); }
.topbtn-icon { font-size: 14px; line-height: 1; }

.topbar-sep {
    width: 1px;
    align-self: stretch;
    background: var(--border);
    margin: 0 4px;
}

/* Contenedor de tabs de unidad: scroll horizontal si hay muchas */
.unidad-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    flex: 1;
    min-width: 0;
    padding-bottom: 2px;
}
.unidad-tab {
    padding: 7px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg);
    color: var(--text-sub);
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
}
.unidad-tab:hover  { background: var(--accent-dim); color: var(--accent); }
.unidad-tab.activa { background: var(--accent); color: #fff; border-color: var(--accent); }
.unidad-tab .tab-check { margin-left: 6px; }

/* ── Main ────────────────────────────────────────────────────────────────── */
.main {
    flex: 1;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    padding: 32px 24px 60px;
}

/* Encabezado del curso */
.curso-encabezado { margin-bottom: 8px; }
.curso-codigo {
    font-size: 11px;
    font-weight: bold;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 3px 10px;
    border-radius: 20px;
}
.curso-titulo-h {
    font-family: var(--font-display);
    font-size: clamp(24px, 3.5vw, 34px);
    font-weight: normal;
    line-height: 1.2;
    margin: 12px 0 6px;
    color: var(--text-main);
}
.curso-sub-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--text-sub); }
.curso-sub-meta .punto::before { content: "·"; margin-right: 10px; }

/* Banner de estado (no matriculado / terminado) */
.estado-banner {
    display: none;
    align-items: center;
    gap: 14px;
    border-radius: 10px;
    padding: 14px 18px;
    margin: 18px 0 8px;
    font-size: 14px;
    line-height: 1.5;
}
.estado-banner.visible { display: flex; }
.estado-banner.aviso   { background: var(--amber-dim);  color: var(--amber);  border: 1px solid #fcd34d; }
.estado-banner.exito   { background: var(--green-dim);  color: var(--green);  border: 1px solid #6ee7b7; }
.estado-banner .banner-texto { flex: 1; }
.estado-banner strong { font-weight: bold; }
.btn-matricular-banner {
    padding: 8px 18px;
    border: none;
    border-radius: 7px;
    background: var(--accent);
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
}
.btn-matricular-banner:hover { background: #2d46b0; }

/* Título + barra de progreso de la unidad activa */
.unidad-activa-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 26px 0 14px;
    flex-wrap: wrap;
}
.unidad-activa-titulo {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: normal;
    color: var(--text-main);
}
.unidad-progreso {
    display: none;
    align-items: center;
    gap: 10px;
    min-width: 220px;
}
.unidad-progreso.visible { display: flex; }
.barra {
    flex: 1;
    height: 8px;
    background: var(--locked-dim);
    border-radius: 6px;
    overflow: hidden;
    min-width: 120px;
}
.barra-fill {
    height: 100%;
    width: 0;
    background: var(--green);
    border-radius: 6px;
    transition: width .4s ease;
}
.barra-pct { font-size: 12px; font-weight: bold; color: var(--green); min-width: 38px; text-align: right; }

/* ── Secciones (acordeón) ────────────────────────────────────────────────── */
.secciones-cont { display: flex; flex-direction: column; gap: 12px; }

.seccion {
    background: var(--surface);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}
.seccion-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
    transition: background .12s;
}
.seccion-head:hover { background: var(--bg); }
.seccion-chevron {
    color: var(--text-sub);
    font-size: 12px;
    transition: transform .2s;
    width: 14px;
}
.seccion.abierta .seccion-chevron { transform: rotate(90deg); }
.seccion-titulo { font-size: 15px; font-weight: bold; color: var(--text-main); flex: 1; }
.seccion-badge {
    font-size: 10px;
    font-weight: bold;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 4px;
    background: var(--accent-dim);
    color: var(--accent);
}
.seccion-badge.eval { background: var(--amber-dim); color: var(--amber); }
.seccion-conteo { font-size: 12px; color: var(--text-sub); }
.seccion-visitada {
    display: none;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: bold;
    color: var(--green);
}
.seccion-visitada.visible { display: inline-flex; }

.seccion-body {
    display: none;
    padding: 4px 20px 20px;
    border-top: 1px solid var(--border);
}
.seccion.abierta .seccion-body { display: block; }

/* ── Contenidos ──────────────────────────────────────────────────────────── */
.contenido {
    padding: 16px 0;
    border-bottom: 1px dashed var(--border);
}
.contenido:last-child { border-bottom: none; }
.contenido-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.contenido-icono { font-size: 16px; }
.contenido-titulo { font-size: 14px; font-weight: bold; color: var(--text-main); }
.contenido-tipo-tag {
    font-size: 10px;
    color: var(--text-sub);
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 1px 7px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

/* Texto */
.contenido-texto {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-main);
    white-space: pre-wrap;
}

/* PDF */
.pdf-visor {
    width: 100%;
    height: 520px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
}
.pdf-link, .archivo-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
    font-weight: bold;
}
.pdf-link:hover, .archivo-link:hover { text-decoration: underline; }

/* Video */
.video-visor {
    width: 100%;
    max-height: 520px;
    border-radius: 8px;
    background: #000;
}

/* Contenido bloqueado */
.contenido-bloqueado {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--locked-dim);
    border: 1px dashed var(--locked);
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 13px;
    color: var(--text-sub);
}
.contenido-bloqueado .candado { font-size: 16px; }

/* Placeholder de evaluación */
.eval-placeholder {
    text-align: center;
    padding: 28px 20px;
    color: var(--text-sub);
}
.eval-placeholder .eval-icono { font-size: 30px; margin-bottom: 8px; }
.eval-placeholder .eval-titulo { font-size: 15px; font-weight: bold; color: var(--text-main); margin-bottom: 4px; }
.eval-placeholder .eval-nota { font-size: 13px; }

/* Estado vacío de la unidad */
.unidad-vacia {
    text-align: center;
    color: var(--text-sub);
    font-size: 14px;
    padding: 40px 20px;
    background: var(--surface);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
}

/* ── Modales ─────────────────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.visible { display: flex; }
.modal {
    background: var(--surface);
    border-radius: 16px;
    padding: 28px 28px 24px;
    max-width: 540px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 24px 60px rgba(0,0,0,.25);
    animation: modal-in .18s ease;
}
@keyframes modal-in {
    from { transform: scale(.95); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}
.modal-titulo {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: normal;
    margin-bottom: 4px;
}
.modal-codigo { font-size: 12px; color: var(--accent); font-weight: bold; letter-spacing: .08em; text-transform: uppercase; }
.modal-fila { display: flex; gap: 18px; flex-wrap: wrap; margin: 16px 0; }
.modal-dato { font-size: 13px; color: var(--text-sub); }
.modal-dato strong { display: block; color: var(--text-main); font-size: 15px; margin-top: 2px; }
.modal-descripcion { font-size: 14px; line-height: 1.7; color: var(--text-main); margin: 14px 0; }
.modal-cerrar-x {
    float: right;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-sub);
    cursor: pointer;
    line-height: 1;
}
.modal-cerrar-x:hover { color: var(--text-main); }
.modal-acciones { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.btn-modal-primario {
    padding: 9px 20px;
    border: none;
    border-radius: 7px;
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background .15s;
}
.btn-modal-primario:hover { background: #2d46b0; }
.btn-modal-secundario {
    padding: 9px 20px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    color: var(--text-sub);
    font-size: 14px;
    cursor: pointer;
}
.btn-modal-secundario:hover { background: var(--bg); color: var(--text-main); }

/* Lista de progreso por unidad en el modal */
.progreso-lista { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.progreso-item .progreso-item-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}
.progreso-item-nombre { font-size: 14px; font-weight: bold; color: var(--text-main); }
.progreso-item-conteo { font-size: 12px; color: var(--text-sub); }
.progreso-global-caja {
    background: var(--green-dim);
    border: 1px solid #6ee7b7;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 18px;
}
.progreso-global-caja .pg-label { font-size: 13px; color: var(--green); font-weight: bold; margin-bottom: 8px; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.footer {
    text-align: center;
    padding: 20px;
    font-size: 12px;
    color: var(--text-sub);
    border-top: 1px solid var(--border);
    background: var(--surface);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
    .header-inner { padding: 10px 16px; height: auto; flex-wrap: wrap; gap: 10px; min-height: 60px; }
    .header-right { gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
    .topbar-inner { padding: 10px 16px; }
    .topbtn { font-size: 12px; padding: 7px 11px; }
    .curso-topbar { position: static; }
}

@media (max-width: 640px) {
    .bienvenida { display: none; }
    .topbar-sep { display: none; }
    .pdf-visor { height: 360px; }
    .main { padding: 24px 16px 40px; }
    .btn-salir { font-size: 12px; padding: 6px 10px; }
    .unidad-activa-head { gap: 10px; }
    .unidad-progreso { min-width: 0; width: 100%; }
    .seccion-head { padding: 14px 16px; gap: 8px; flex-wrap: wrap; }
    .seccion-body { padding: 4px 16px 16px; }
    .eval-lanzador-pie { gap: 8px; }
    .btn-eval-iniciar { width: 100%; justify-content: center; margin-left: 0; }
    .eval-sin-intentos { width: 100%; text-align: center; margin-left: 0; }
}

@media (max-width: 560px) {
    .modal { padding: 22px 18px 20px; }
    .modal-fila { gap: 12px; }
    .modal-acciones { flex-wrap: wrap; }
    .modal-acciones button { flex: 1; min-width: 120px; }
    .btn-modal-peligro-suave { margin-right: 0; }
    .foro-com-nuevo { flex-direction: column; }
    .foro-com-enviar { align-self: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
    .barra-fill, .seccion-chevron, .modal { transition: none; animation: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Ajustes: pestañas de módulo bajo el título, barra global, bloqueo secuencial,
   modal de cancelación de matrícula
   ═══════════════════════════════════════════════════════════════════════════ */

/* Pestañas de módulo ahora viven en el flujo principal (debajo del título) */
.main > .unidad-tabs {
    margin: 6px 0 4px;
    padding-bottom: 4px;
}

/* Barra de progreso global del curso (debajo del título) */
.curso-progreso-global {
    display: none;
    align-items: center;
    gap: 12px;
    margin: 14px 0 4px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-card);
}
.curso-progreso-global.visible { display: flex; }
.progreso-global-label {
    font-size: 13px;
    font-weight: bold;
    color: var(--text-main);
    white-space: nowrap;
}
.curso-progreso-global .barra-pct { color: var(--accent); }
.curso-progreso-global .barra-fill { background: var(--accent); }

/* Etiqueta de la barra del módulo activo */
.unidad-progreso-label {
    font-size: 12px;
    font-weight: bold;
    color: var(--text-sub);
    white-space: nowrap;
}

/* ── Sección bloqueada por la anterior (bloqueo secuencial) ──────────────── */
.seccion.bloqueada { opacity: .85; }
.seccion.bloqueada .seccion-head { cursor: not-allowed; }
.seccion.bloqueada .seccion-titulo { color: var(--text-sub); }
.seccion-candado {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: bold;
    color: var(--locked);
    white-space: nowrap;
}
.seccion-candado::before { content: "🔒"; }

/* Aviso dentro del cuerpo de una sección bloqueada */
.bloqueo-aviso {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--locked-dim);
    border: 1px dashed var(--locked);
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 13px;
    color: var(--text-sub);
}

/* ── Estilos de modal adicionales (cancelar matrícula) ───────────────────── */
.modal-icon      { font-size: 36px; text-align: center; }
.modal-desc-centro { font-size: 14px; color: var(--text-sub); text-align: center; line-height: 1.6; margin: 4px 0; }
.modal-desc-centro strong { color: var(--text-main); }
.modal-instruccion { font-size: 13px; color: var(--text-sub); text-align: center; line-height: 1.7; margin-bottom: 4px; }
.modal-instruccion code {
    display: inline-block;
    background: var(--red-dim, #fdecea);
    color: var(--red);
    border: 1px solid #fca5a5;
    border-radius: 5px;
    padding: 2px 10px;
    font-size: 15px;
    font-weight: bold;
    letter-spacing: .05em;
    margin-top: 4px;
}
.modal-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--font-body);
    color: var(--text-main);
    background: var(--surface);
    margin: 8px 0 4px;
    transition: border-color .15s, box-shadow .15s;
}
.modal-input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(211,47,47,.12); }
.modal-hint { font-size: 12px; min-height: 16px; margin-bottom: 4px; }

/* Botón de peligro sólido (confirmar cancelación) */
.btn-modal-peligro {
    padding: 9px 20px;
    border: none;
    border-radius: 7px;
    background: #9CA3AF;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    cursor: not-allowed;
    transition: background .2s;
}
.btn-modal-peligro:not(:disabled) { background: var(--red); cursor: pointer; }
.btn-modal-peligro:not(:disabled):hover { background: #b71c1c; }

/* Botón de peligro suave (abrir cancelación desde generalidades) */
.btn-modal-peligro-suave {
    padding: 9px 18px;
    border: 1px solid #fca5a5;
    border-radius: 7px;
    background: var(--surface);
    color: var(--red);
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    margin-right: auto;   /* lo empuja a la izquierda en la fila de acciones */
    transition: background .15s;
}
.btn-modal-peligro-suave:hover { background: var(--red-dim, #fdecea); }

/* Sacudida breve al intentar abrir una sección bloqueada */
@keyframes sacudir {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}
.seccion.sacudir { animation: sacudir .4s ease; }
@media (prefers-reduced-motion: reduce) { .seccion.sacudir { animation: none; } }

/* ═══════════════════════════════════════════════════════════════════════════
   Foro de debate (sección tipo 'foro')
   ═══════════════════════════════════════════════════════════════════════════ */
.foro-pregunta {
    background: #f7f3ff;
    border: 1px solid #e7defb;
    border-left: 4px solid #7c3aed;
    border-radius: 8px;
    padding: 14px 16px;
    margin: 14px 0;
}
.foro-pregunta-label { font-size: 12px; font-weight: bold; color: #7c3aed; display: block; margin-bottom: 4px; }
.foro-pregunta-texto { font-size: 15px; color: var(--text-main); line-height: 1.55; white-space: pre-wrap; }

.foro { margin-top: 8px; }
.foro-cargando { color: var(--text-sub); font-size: 13px; padding: 10px 0; }

/* Campo de nueva respuesta */
.foro-nueva { margin-bottom: 14px; }
.foro-input {
    width: 100%;
    min-height: 80px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--font-body);
    color: var(--text-main);
    resize: vertical;
    transition: border-color .15s, box-shadow .15s;
}
.foro-input:focus { outline: none; border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124,58,237,.12); }
.foro-nueva-acciones { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 8px; }
.foro-msg { font-size: 12px; color: var(--text-sub); margin-right: auto; }
.foro-msg.error { color: var(--red); }
.foro-publicar {
    padding: 8px 18px;
    border: none;
    border-radius: 7px;
    background: #7c3aed;
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: background .15s;
}
.foro-publicar:hover:not(:disabled) { background: #6d28d9; }
.foro-publicar:disabled { background: #b9a6e6; cursor: default; }

/* Barra: orden + total */
.foro-barra { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.foro-orden { display: flex; gap: 4px; }
.foro-orden-btn {
    padding: 5px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    color: var(--text-sub);
    font-size: 12px;
    cursor: pointer;
    transition: all .15s;
}
.foro-orden-btn:hover  { background: var(--bg); }
.foro-orden-btn.activo { background: #f0e9ff; color: #7c3aed; border-color: #ddd0fb; font-weight: bold; }
.foro-total { font-size: 12px; color: var(--text-sub); }

/* Lista de respuestas */
.foro-lista { display: flex; flex-direction: column; gap: 10px; }
.foro-vacio { color: var(--text-sub); font-size: 13px; padding: 12px 0; text-align: center; }
.foro-resp {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    background: var(--surface);
}
.foro-resp-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.foro-resp-autor { font-size: 13px; font-weight: bold; color: var(--text-main); }
.foro-yo { font-size: 10px; font-weight: bold; text-transform: uppercase; letter-spacing: .04em; color: #7c3aed; background: #f0e9ff; padding: 1px 6px; border-radius: 10px; margin-left: 4px; }
.foro-resp-fecha { font-size: 11px; color: var(--text-sub); white-space: nowrap; }
.foro-resp-cuerpo { font-size: 14px; color: var(--text-main); line-height: 1.55; white-space: pre-wrap; }
.foro-resp-acciones { display: flex; align-items: center; gap: 10px; margin-top: 10px; }

.foro-estrella {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    color: var(--text-sub);
    font-size: 13px;
    cursor: pointer;
    transition: all .15s;
}
.foro-estrella:hover { background: #fffbeb; border-color: #fcd34d; }
.foro-estrella.activa { background: #fef3c7; border-color: #fbbf24; color: #b45309; font-weight: bold; }
.foro-com-toggle {
    padding: 4px 10px;
    border: none;
    border-radius: 6px;
    background: none;
    color: var(--text-sub);
    font-size: 12px;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.foro-com-toggle:hover { background: var(--bg); color: var(--text-main); }

/* Comentarios */
.foro-comentarios { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.foro-com-lista { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.foro-com { background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.foro-com-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.foro-com-autor { font-size: 12px; font-weight: bold; color: var(--text-main); }
.foro-com-fecha { font-size: 10px; color: var(--text-sub); }
.foro-com-cuerpo { font-size: 13px; color: var(--text-main); line-height: 1.5; margin-top: 2px; white-space: pre-wrap; }
.foro-com-nuevo { display: flex; gap: 8px; }
.foro-com-input {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 13px;
    font-family: var(--font-body);
}
.foro-com-input:focus { outline: none; border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124,58,237,.10); }
.foro-com-enviar {
    padding: 7px 14px;
    border: none;
    border-radius: 7px;
    background: var(--accent);
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
}
.foro-com-enviar:hover:not(:disabled) { background: #2d46b0; }
.foro-com-enviar:disabled { opacity: .6; cursor: default; }

/* Paginación numérica */
.foro-paginacion { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin-top: 14px; }
.foro-pag-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    color: var(--text-sub);
    font-size: 13px;
    cursor: pointer;
    transition: all .15s;
}
.foro-pag-btn:hover:not(:disabled):not(.activo) { background: var(--bg); }
.foro-pag-btn.activo { background: #7c3aed; color: #fff; border-color: #7c3aed; font-weight: bold; }
.foro-pag-btn:disabled { opacity: .4; cursor: default; }

@media (prefers-reduced-motion: reduce) {
    .foro-input, .foro-orden-btn, .foro-estrella, .foro-pag-btn { transition: none; }
}

/* ══════════════════════════════════════════════════════════════════════════
   LANZADOR DE EVALUACIÓN (vista del alumno, dentro del acordeón)
   ══════════════════════════════════════════════════════════════════════════ */
.eval-lanzador {
    border: 1px solid #fcd34d;
    background: #fffdf6;
    border-radius: var(--radius-card);
    padding: 16px 18px;
    margin: 4px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.eval-lanzador.aprobada { border-color: #9ad9bf; background: var(--green-dim); }

.eval-lanzador-cab { display: flex; align-items: center; gap: 12px; }
.eval-lanzador-icono { font-size: 24px; }
.eval-lanzador-titulo {
    font-family: var(--font-display);
    font-size: 17px; font-weight: bold; color: var(--text-main);
    display: flex; align-items: center; gap: 10px;
}
.eval-lanzador-meta { font-size: 13px; color: var(--text-sub); margin-top: 2px; }

.eval-lanzador-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.eval-chip {
    font-size: 12px; font-weight: 600; color: var(--text-sub);
    background: var(--surface); border: 1px solid var(--border);
    padding: 4px 11px; border-radius: 20px;
}
.eval-chip.puntaje { color: var(--amber); border-color: #fcd34d; background: var(--amber-dim); }
.eval-chip.puntaje.ok { color: var(--green); border-color: #9ad9bf; background: var(--green-dim); }

.eval-aprobada-badge {
    font-size: 12px; font-weight: bold; color: var(--green);
    background: var(--surface); border: 1px solid #9ad9bf;
    padding: 2px 10px; border-radius: 20px;
}

.eval-lanzador-pie { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.eval-modo-admin { font-size: 12px; color: var(--text-sub); font-style: italic; }

.btn-eval-iniciar {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 18px; border-radius: 9px;
    background: var(--accent); color: #fff; text-decoration: none;
    font-size: 14px; font-weight: bold; white-space: nowrap;
    transition: background .14s, transform .14s;
    margin-left: auto;
}
.btn-eval-iniciar:hover { background: #2d46b0; transform: translateY(-1px); }
.btn-eval-iniciar.suave { background: var(--surface); color: var(--accent); border: 1px solid #c7d2fb; }
.btn-eval-iniciar.suave:hover { background: var(--accent-dim); }

.eval-sin-intentos {
    font-size: 13px; font-weight: bold; color: var(--text-sub);
    background: var(--locked-dim); border: 1px solid var(--border);
    padding: 9px 16px; border-radius: 9px; margin-left: auto;
}

/* Estado bloqueado del lanzador (intentos agotados) + botón repetir módulo */
.eval-lanzador.bloqueada { border-color: #fcd34d; background: #fffdf6; }
.btn-eval-iniciar.repetir { background: var(--amber); }
.btn-eval-iniciar.repetir:hover { background: #92400e; }

/* ── Confirmación de recursos PDF/video ────────────────────────────────────── */
.recurso-confirmar {
    display: flex; align-items: center; gap: 10px;
    margin-top: 10px; padding: 10px 14px;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--bg); cursor: pointer; user-select: none;
    font-size: 13.5px; color: var(--text-main); transition: background .15s, border-color .15s;
    width: fit-content; max-width: 100%;
}
.recurso-confirmar:hover { border-color: var(--accent); background: var(--accent-dim); }
.recurso-confirmar input { width: 17px; height: 17px; cursor: pointer; accent-color: var(--green); flex-shrink: 0; }
.recurso-confirmar.hecho {
    border-color: #9ad9bf; background: var(--green-dim); color: var(--green); cursor: default; font-weight: bold;
}
.recurso-confirmar.hecho:hover { border-color: #9ad9bf; background: var(--green-dim); }
.recurso-confirmar.hecho input { cursor: default; }
.recurso-confirmar.hecho .recurso-confirmar-txt::after { content: ' ✓'; }

/* ── Botón "Ver a pantalla completa" sobre PDF/video ───────────────────────── */
.recurso-acciones { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.btn-recurso-full {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 7px 14px; border-radius: 8px;
    background: var(--surface); color: var(--accent);
    border: 1px solid #c7d2fb; text-decoration: none;
    font-size: 13px; font-weight: bold; cursor: pointer;
    transition: background .14s, border-color .14s, transform .14s;
}
.btn-recurso-full:hover { background: var(--accent-dim); border-color: var(--accent); transform: translateY(-1px); }
/* ── Botones de certificado en el banner de curso terminado/pagado ────────── */
.btn-cert-pagar,
.btn-cert-descargar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 9px;
    font-size: 14.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s, transform .05s;
}
.btn-cert-pagar:active,
.btn-cert-descargar:active { transform: translateY(1px); }

.btn-cert-pagar {
    background: var(--accent);
    color: #fff;
}
.btn-cert-pagar:hover { background: #2f49b8; }

.btn-cert-descargar {
    background: var(--green);
    color: #fff;
}
.btn-cert-descargar:hover { background: #156647; }

/* Enlace a términos y condiciones en el footer */
.link-terminos {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color .15s;
}
.link-terminos:hover { color: var(--accent); }

/* Botón de aporte voluntario en la barra superior */
.btn-aporte {
    padding: 6px 14px;
    border: 1px solid #ddd6fe;
    border-radius: 6px;
    background: #f3effe;
    color: #6d28d9;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, border-color .15s;
}
.btn-aporte:hover {
    background: #ede9fe;
    border-color: #c4b5fd;
}
@media (max-width: 640px) {
    .btn-aporte { font-size: 0; padding: 6px 10px; }
    .btn-aporte::before { content: "💜"; font-size: 15px; }
}


/* ── WebRTC Peer-to-Server Streaming UI ── */
.webrtc-progreso-wrap {
    margin: 10px 0;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(8px);
    transition: opacity 0.4s ease;
}
.webrtc-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 0.82rem;
}
.webrtc-badge {
    background: #0284c7;
    color: #fff;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}
.webrtc-info-text {
    opacity: 0.85;
}
.webrtc-barra-cont {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    overflow: hidden;
}
.webrtc-barra-fill {
    height: 100%;
    background: #3b82f6;
    transition: width 0.2s ease, background-color 0.3s ease;
}
