/* ==========================================================
   Panel de admin · Aula virtual del curso
   Mismo estilo de academia que el aula del estudiante (papel con
   cuadrícula, bordes de tinta, acento verde menta). Todo va colgado
   de .ae / body.modo-aula: el resto del panel no cambia.
   ========================================================== */
.ae, .ae-visor {
  --ae-paper: #f1f5fa;
  --ae-paper-2: #e2eaf4;
  --ae-card: #ffffff;
  --ae-ink: #0c1a2e;
  --ae-muted: #4d6079;
  --ae-rule: #c3d0e1;
  --ae-acento: #5bd580;
  --ae-aviso: #f5c518;
  --ae-rojo: #b3261e;
  --ae-mono: "JetBrains Mono", ui-monospace, monospace;
  --ae-display: "Bricolage Grotesque", system-ui, sans-serif;
}

/* Mientras se edita el aula, toda la página pasa a "papel con cuadrícula" */
body.modo-aula { background-color: #f1f5fa; background-image: linear-gradient(rgba(10,61,114,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(10,61,114,.06) 1px, transparent 1px); background-size: 30px 30px; }
body.modo-aula::before { display: none; }
body.modo-aula .barra-admin { background: #08213d; -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; border-bottom: 1px solid #1b3b61; }

/* ---------- Cabecera ---------- */
.ae-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.ae-migas { font-family: var(--ae-mono); font-size: 12px; color: var(--ae-muted); margin: 0 0 10px; }
.ae-migas b { color: var(--ae-ink); }
.ae-h1 { font-family: var(--ae-display); font-size: clamp(32px, 4vw, 52px); font-weight: 800; letter-spacing: -.05em; line-height: 1; margin: 0; color: var(--ae-ink); }
.ae-subtitulo { margin: 8px 0 0; font-size: 1.05rem; color: var(--ae-muted); font-weight: 600; }
.ae-top-acciones { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ae-estado { font-size: 12px; color: var(--ae-muted); padding: 6px 12px; border: 1.5px dashed var(--ae-rule); border-radius: 999px; background: rgba(255,255,255,.6); }
.ae-estado.ok { color: #14532d; border-color: #14532d; border-style: solid; background: #dcfce7; }

/* ---------- Botones ---------- */
.ae-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; font: 700 14px/1.2 var(--cuerpo, "Inter Tight", sans-serif); color: var(--ae-ink); background: var(--ae-card); border: 1.5px solid var(--ae-ink); border-radius: 6px; box-shadow: 3px 3px 0 var(--ae-ink); cursor: pointer; text-decoration: none; transition: transform .15s, box-shadow .15s, background .2s; }
.ae-btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ae-ink); }
.ae-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ae-ink); }
.ae-btn:disabled { opacity: .55; cursor: wait; transform: none; }
.ae-btn-sm { padding: 7px 12px; font-size: 13px; box-shadow: 2px 2px 0 var(--ae-ink); }
.ae-btn-acento { background: var(--ae-acento); }
.ae-btn-oscuro { background: var(--ae-ink); color: var(--ae-acento); }
.ae-btn-punteado { border-style: dashed; box-shadow: none; background: transparent; margin-top: 14px; }
.ae-btn-punteado:hover { box-shadow: none; background: rgba(255,255,255,.6); }
.ae-btn-bloque { width: 100%; }
.ae-icono { width: 32px; height: 32px; display: inline-grid; place-items: center; flex: none; border: 1.5px solid var(--ae-ink); border-radius: 6px; background: var(--ae-card); color: var(--ae-ink); font-size: 14px; cursor: pointer; }
.ae-icono:hover:not(:disabled) { background: var(--ae-acento); }
.ae-icono.ae-peligro:hover:not(:disabled) { background: #fecaca; }
.ae-icono:disabled { opacity: .3; cursor: default; }

/* ---------- Estructura ---------- */
.ae-estructura { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 28px; align-items: start; }
.ae-lateral { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 16px; }
.ae-principal { min-width: 0; }
.ae-nav { display: flex; flex-direction: column; gap: 8px; }
.ae-nav button { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; padding: 13px 16px; text-align: left; font: 700 15px/1.2 var(--cuerpo, "Inter Tight", sans-serif); color: var(--ae-ink); background: var(--ae-card); border: 1.5px solid var(--ae-ink); border-radius: 8px; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.ae-nav button:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ae-ink); }
.ae-nav button.on { background: var(--ae-acento); box-shadow: 3px 3px 0 var(--ae-ink); }
.ae-nav em { font-style: normal; font-size: 12px; min-width: 26px; text-align: center; padding: 2px 8px; border: 1.5px solid var(--ae-ink); border-radius: 999px; background: var(--ae-card); }
.ae-ayuda { padding: 16px; font-size: 13px; line-height: 1.5; color: var(--ae-muted); background: rgba(255,255,255,.7); border: 1.5px solid var(--ae-ink); border-radius: 8px; }
.ae-ayuda ol { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.ae-ayuda b { color: var(--ae-ink); }
.ae-etiqueta { margin: 0; font-size: 11px; letter-spacing: .16em; font-weight: 700; color: var(--ae-ink); }

/* ---------- Tarjetas de resumen ---------- */
.ae-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 26px; }
.ae-stat { padding: 16px 18px; background: var(--ae-card); border: 1.5px solid var(--ae-ink); border-radius: 10px; display: flex; flex-direction: column; gap: 4px; }
.ae-stat > span { font-size: 11px; letter-spacing: .14em; font-weight: 700; color: var(--ae-muted); }
.ae-stat b { font-family: var(--ae-display); font-size: 38px; letter-spacing: -.05em; line-height: 1; color: var(--ae-ink); }
.ae-stat b small { font-size: 18px; color: var(--ae-muted); letter-spacing: -.02em; }
.ae-stat > small { font-size: 12px; color: var(--ae-muted); }
.ae-stat.alerta { background: #fff8d6; box-shadow: 3px 3px 0 var(--ae-aviso); }
.ae-prog { height: 12px; background: var(--ae-paper-2); border: 1.5px solid var(--ae-ink); border-radius: 999px; overflow: hidden; }
.ae-prog i { display: block; height: 100%; background: var(--ae-acento); border-right: 1.5px solid var(--ae-ink); transition: width .6s cubic-bezier(.2,.8,.2,1); min-width: 0; }
.ae-prog i[style*="width:0%"] { border-right: 0; }

/* ---------- Barra de herramientas de cada sección ---------- */
.ae-herramientas { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.ae-regla { flex: 1 1 200px; display: flex; align-items: center; gap: 14px; margin: 0; font: 700 12px/1 var(--ae-mono); letter-spacing: .16em; color: var(--ae-ink); }
.ae-regla::after { content: ""; flex: 1; border-top: 1.5px dashed var(--ae-rule); }
.ae-ayuda-seccion { margin: 0 0 16px; font-size: 14px; color: var(--ae-muted); max-width: 760px; line-height: 1.55; }
.ae-vacio { margin: 10px 0; font-size: 12.5px; color: var(--ae-muted); }
.ae-vacio-grande { padding: 36px; text-align: center; color: var(--ae-muted); }
.ae-vacio-grande b { display: block; font-family: var(--ae-display); font-size: 22px; color: var(--ae-ink); margin-bottom: 4px; }
.ae-nota { margin: 6px 0 0; font-size: 11.5px; color: var(--ae-muted); }

/* ---------- Tarjetas y listas ---------- */
.ae-card { background: var(--ae-card); border: 1.5px solid var(--ae-ink); border-radius: 10px; }
.ae-lista { display: flex; flex-direction: column; gap: 12px; }
.ae-pill { display: inline-block; flex: none; padding: 3px 9px; font-size: 10px; font-weight: 700; letter-spacing: .06em; border: 1.5px solid var(--ae-ink); border-radius: 999px; background: var(--ae-card); white-space: nowrap; }

/* ---------- Clases (acordeón) ---------- */
.ae-clase header { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 6px; }
.ae-clase.open header { border-bottom: 1.5px dashed var(--ae-rule); }
.ae-clase.bloqueada { background: #f7f9fc; }
.ae-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; text-align: left; padding: 4px 8px; background: none; border: 0; cursor: pointer; color: var(--ae-ink); font: inherit; }
.ae-toggle i { font-style: normal; font-size: 12px; font-weight: 700; display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 7px; background: var(--ae-acento); border: 1.5px solid var(--ae-ink); }
.ae-clase.bloqueada .ae-toggle i { background: var(--ae-paper-2); }
.ae-toggle b { font-family: var(--ae-display); font-size: 17px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ae-chips { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; font-size: 11px; color: var(--ae-muted); }
.ae-chips span { padding: 3px 8px; border: 1px solid var(--ae-rule); border-radius: 999px; background: #fff; white-space: nowrap; }
.ae-chips .warn { color: #7a4a00; background: #fff3c4; border-color: #e0b400; }
.ae-herr { display: flex; gap: 6px; flex: none; }

.ae-interruptor { display: inline-flex; align-items: center; gap: 8px; flex: none; cursor: pointer; padding: 5px 11px 5px 6px; border: 1.5px solid var(--ae-ink); border-radius: 999px; background: #fff; font-size: 13px; font-weight: 700; color: var(--ae-ink); }
.ae-interruptor input { position: absolute; opacity: 0; pointer-events: none; }
.ae-interruptor span { position: relative; width: 36px; height: 20px; border-radius: 999px; border: 1.5px solid var(--ae-ink); background: var(--ae-rule); transition: background .2s; flex: none; }
.ae-interruptor span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: var(--ae-ink); transition: transform .2s; }
.ae-interruptor input:checked + span { background: var(--ae-acento); }
.ae-interruptor input:checked + span::after { transform: translateX(16px); }
.ae-interruptor input:focus-visible + span { outline: 3px solid var(--ae-aviso); outline-offset: 2px; }
.ae-interruptor em { font-style: normal; min-width: 66px; }

.ae-clase-cuerpo { display: none; padding: 18px 20px 14px; }
.ae-clase.open .ae-clase-cuerpo { display: block; }
.ae-fila-titulo { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 0 16px; }
.ae-campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.ae-campo > span { font-size: 13px; font-weight: 700; color: var(--ae-ink); }
.ae-campo small { font-size: 12px; color: var(--ae-muted); line-height: 1.45; }
.ae-in { width: 100%; font: 400 15px/1.4 var(--cuerpo, "Inter Tight", sans-serif); color: var(--ae-ink); background: #fff; border: 1.5px solid var(--ae-ink); border-radius: 7px; padding: 10px 12px; box-shadow: none; }
.ae-in:focus { outline: none; border-color: var(--ae-ink); box-shadow: 0 0 0 3px var(--ae-acento); }
textarea.ae-in { min-height: 0; resize: vertical; line-height: 1.5; }
.ae-in.ae-mono { font-family: var(--ae-mono); font-size: 13px; line-height: 1.6; }
.ae-in-sm { padding: 8px 12px; font-size: 14px; }
.ae-media { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; }
.ae-vista { aspect-ratio: 16 / 9; border: 1.5px solid var(--ae-ink); border-radius: 8px; overflow: hidden; background: #0b1524; margin-bottom: 14px; }
.ae-vista iframe { width: 100%; height: 100%; border: 0; display: block; }
.ae-vista-vacia { height: 100%; display: grid; place-items: center; text-align: center; padding: 16px; font-size: 12px; color: #9db3cd; }
.ae-archivo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ae-archivo-estado { font-size: 12px; }
.ae-archivo-estado.ok { color: #14532d; font-weight: 700; }
.ae-archivo-estado.falta { color: #7a4a00; font-weight: 700; }
.ae-sub { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0 10px; padding-top: 12px; border-top: 1.5px dashed var(--ae-rule); }
.ae-lista-prompts { list-style: none; margin: 0 0 4px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.ae-lista-prompts button { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; font: 600 13px/1.2 var(--cuerpo, "Inter Tight", sans-serif); color: var(--ae-ink); background: var(--ae-paper); border: 1.5px solid var(--ae-ink); border-radius: 6px; cursor: pointer; }
.ae-lista-prompts button:hover { background: var(--ae-acento); }
.ae-progreso { display: flex; align-items: center; gap: 12px; }
.ae-progreso .ae-prog { flex: 1; min-width: 80px; }
.ae-progreso > span { font-size: 12px; color: var(--ae-muted); white-space: nowrap; }

/* ---------- Recursos ---------- */
.ae-zona { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 28px 16px; margin-bottom: 16px; text-align: center; border: 2px dashed var(--ae-ink); border-radius: 10px; background: rgba(255,255,255,.6); cursor: pointer; transition: background .2s, transform .2s; }
.ae-zona b { font-family: var(--ae-display); font-size: 20px; letter-spacing: -.03em; color: var(--ae-ink); }
.ae-zona span { font-size: 13px; color: var(--ae-muted); }
.ae-zona:hover, .ae-zona.encima, .ae-zona:focus-visible { background: #dcfce7; outline: none; }
.ae-zona.encima { transform: scale(1.01); }
.ae-fila { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.ae-fila .ae-in { flex: 1; min-width: 0; }

/* ---------- Prompts ---------- */
.ae-filtros { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.ae-filtros select { flex: 0 1 340px; width: auto; min-width: 200px; }
.ae-filtros input { flex: 1 1 240px; width: auto; }
.ae-prompt { padding: 14px; display: flex; flex-direction: column; gap: 10px; transition: box-shadow .3s; }
.ae-prompt[hidden] { display: none; }
.ae-prompt.destello { box-shadow: 0 0 0 4px var(--ae-acento); }
.ae-prompt-cab { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ae-prompt-cab > input:first-child { flex: 1 1 220px; min-width: 0; }
.ae-in-tipo { width: 130px; flex: none; }
.ae-in-clase { flex: 0 1 240px; width: auto; min-width: 150px; }

/* ---------- Avance ---------- */
.ae-por-clase { padding: 16px 18px; margin-bottom: 18px; display: flex; flex-direction: column; gap: 10px; }
.ae-por-clase-fila { display: grid; grid-template-columns: 30px minmax(0, 1.2fr) minmax(80px, 1fr) 60px; gap: 12px; align-items: center; font-size: 13px; }
.ae-por-clase-fila em { font-style: normal; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ae-por-clase-fila span:last-child { text-align: right; color: var(--ae-muted); }
.ae-tabla-caja { overflow-x: auto; }
.ae-tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.ae-tabla th { text-align: left; padding: 12px 14px; font: 700 11px/1 var(--ae-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ae-muted); background: var(--ae-paper); border-bottom: 1.5px solid var(--ae-ink); white-space: nowrap; }
.ae-tabla td { padding: 11px 14px; border-bottom: 1px solid var(--ae-rule); vertical-align: middle; }
.ae-tabla tr:last-child td { border-bottom: 0; }
.ae-tabla td .ae-progreso { min-width: 220px; }

/* ---------- Vista previa de archivos ---------- */
.ae-visor { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(8,20,36,.65); backdrop-filter: blur(3px); }
.ae-visor[hidden] { display: none; }
.ae-visor-caja { width: min(1100px, 100%); height: min(88vh, 900px); display: flex; flex-direction: column; background: var(--ae-card); border: 1.5px solid var(--ae-ink); border-radius: 12px; box-shadow: 6px 6px 0 var(--ae-acento); overflow: hidden; }
.ae-visor-caja header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1.5px solid var(--ae-ink); }
.ae-visor-caja header b { font-family: var(--ae-display); font-size: 18px; letter-spacing: -.02em; color: var(--ae-ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ae-visor-cuerpo { flex: 1; min-height: 0; position: relative; background: #0b1524; }
.ae-visor-cuerpo iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.ae-cargando, .ae-descarga { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: #e6edf6; text-align: center; padding: 20px; }

/* ---------- Pantallas medianas y celulares ---------- */
@media (max-width: 1100px) {
  .ae-estructura { grid-template-columns: minmax(0, 1fr); }
  .ae-lateral { position: static; min-width: 0; }
  .ae-nav { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .ae-nav button { flex: 0 0 auto; width: auto; }
  .ae-ayuda { display: none; }
  .ae-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ae-chips { display: none; }
}
@media (max-width: 720px) {
  .ae-media, .ae-fila-titulo { grid-template-columns: 1fr; }
  .ae-clase header { flex-wrap: wrap; }
  .ae-toggle { flex: 1 1 100%; }
  .ae-interruptor { margin-left: 8px; }
  .ae-herr { margin-left: auto; }
  .ae-top-acciones .ae-estado { display: none; }
  .ae-por-clase-fila { grid-template-columns: 26px minmax(0, 1fr) 54px; }
  .ae-por-clase-fila .ae-prog { grid-column: 2 / 4; }
  .ae-fila { flex-wrap: wrap; }
  .ae-fila .ae-in { flex: 1 1 100%; order: 3; }
  .ae-visor { padding: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .ae *, .ae-visor * { transition: none !important; }
}
