/* Aula integraIA — experiencia tipo ChatGPT con la línea gráfica violeta de integraIA. Celular primero; claro y oscuro. */
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 500; font-display: swap; src: url("/fonts/PlusJakartaSans-500.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 600; font-display: swap; src: url("/fonts/PlusJakartaSans-600.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 700; font-display: swap; src: url("/fonts/PlusJakartaSans-700.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 800; font-display: swap; src: url("/fonts/PlusJakartaSans-800.woff2") format("woff2"); }

:root {
  --violeta: #5b2be0; --violeta-osc: #3d1fa8; --magenta: #a63de8;
  --fondo: #ffffff; --lateral: #f7f6fb; --texto: #0f1b3d; --suave: #5d6580; --borde: #e8e9f1;
  --burbuja: #f1eefc; --compositor: #f4f3f9; --hover: #ebe8f6; --codigo: #0f1b3d; --codigo-txt: #eef0ff;
  --lavanda: #ece8fc; --rojo: #c8283c; --verde: #1a9a55; --ambar: #b7791f;
  --sombra: 0 8px 30px rgba(60, 50, 120, .12);
  --ancho: 760px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #17161f; --lateral: #100f16; --texto: #ececf4; --suave: #a2a6bd; --borde: #2c2b3a;
    --burbuja: #2b2745; --compositor: #25232f; --hover: #2a2838; --codigo: #0b0a10; --codigo-txt: #eef0ff;
    --lavanda: #2f2a52; --rojo: #ff7080; --verde: #4cd18a; --ambar: #f0b653;
    --sombra: 0 8px 30px rgba(0, 0, 0, .4);
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--texto); background: var(--fondo); font-size: 16px; line-height: 1.55; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--magenta); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
.suave { color: var(--suave); }
.error { color: var(--rojo); font-weight: 600; margin: 8px 0 0; }
.espacio { flex: 1; }
svg { flex: none; }

button { cursor: pointer; border: 0; border-radius: 12px; padding: 10px 16px; font-weight: 700; background: transparent; }
button:disabled { cursor: not-allowed; }
.primario { background: var(--violeta); color: #fff; }
.primario:hover:not(:disabled) { background: var(--violeta-osc); }
.secundario { background: var(--lavanda); color: var(--violeta-osc); }
@media (prefers-color-scheme: dark) { .secundario { color: #d9d0ff; } }
.secundario:hover:not(:disabled) { filter: brightness(.96); }
.peligro { background: rgba(200, 40, 60, .12); color: var(--rojo); }
.chico { padding: 6px 12px; font-size: 13px; }
.ancho { width: 100%; }
.icono { color: var(--suave); padding: 8px; border-radius: 10px; display: inline-grid; place-items: center; }
.icono:hover { background: var(--hover); color: var(--texto); }
.icono.redondo { border-radius: 50%; width: 38px; height: 38px; padding: 0; }
.solo-movil { display: none; }

/* ───────── Pantallas de entrada ───────── */
.centro { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(60% 50% at 0% 0%, rgba(253,238,238,.5) 0%, transparent 70%), radial-gradient(60% 50% at 100% 100%, rgba(241,234,252,.7) 0%, transparent 70%), var(--fondo); }
.tarjeta-entrada { width: min(440px, 100%); background: var(--fondo); border: 1px solid var(--borde); border-radius: 22px; padding: 32px 24px 28px; box-shadow: var(--sombra); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; }
.tarjeta-entrada form, .tarjeta-entrada .guardados { width: 100%; text-align: left; }
.tarjeta-entrada h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.tarjeta-entrada h1.marca { font-size: 32px; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; color: #000; margin-top: -2px; }
.titulo-top { color: #000; }
@media (prefers-color-scheme: dark) { .tarjeta-entrada h1.marca, .titulo-top { color: #fff; } }
.bienvenida-txt { margin: 0; font-size: 18px; font-weight: 700; }
.logo { height: 84px; width: auto; max-width: 80%; align-self: center; mix-blend-mode: multiply; margin-bottom: 4px; }
@media (prefers-color-scheme: dark) { .logo, .logo-mini { background: #fff; border-radius: 14px; padding: 6px 12px; mix-blend-mode: normal; } }
label { font-weight: 700; font-size: 14px; display: block; margin-bottom: 6px; }
input[type="text"], input[type="password"], .panel-profesor textarea { width: 100%; border: 1.5px solid var(--borde); border-radius: 12px; padding: 12px 14px; background: var(--fondo); }
input:focus, .panel-profesor textarea:focus { border-color: var(--violeta); outline: none; box-shadow: 0 0 0 3px rgba(91, 43, 224, .18); }
.fila-form { display: flex; gap: 8px; }
.fila-form input { flex: 1; min-width: 0; }
#form-nombre { display: flex; flex-direction: column; gap: 6px; }
#form-nombre button { margin-top: 10px; }
.guardados { border-top: 1px solid var(--borde); padding-top: 14px; }
.guardados h2 { font-size: 16px; }
.guardados ul { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

/* ───────── Estructura de la clase ───────── */
.app { height: 100dvh; display: grid; grid-template-columns: 268px minmax(0, 1fr); position: relative; overflow: hidden; }
.lateral { background: var(--lateral); border-right: 1px solid var(--borde); display: flex; flex-direction: column; padding: 12px; gap: 8px; min-height: 0; }
.lat-cab { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 8px; }
.logo-mini { height: 38px; width: auto; mix-blend-mode: multiply; }
.nuevo { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 12px; color: var(--texto); font-weight: 700; text-align: left; border: 1px solid var(--borde); background: var(--fondo); }
.nuevo:hover { background: var(--hover); }
.lat-titulo { margin: 10px 8px 2px; font-size: 12px; font-weight: 700; color: var(--suave); text-transform: uppercase; letter-spacing: .04em; }
.lista-chats { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.chat-item { display: flex; align-items: center; gap: 4px; border-radius: 10px; padding: 0 4px 0 12px; }
.chat-item:hover, .chat-item.activo { background: var(--hover); }
.chat-item .ti { flex: 1; min-width: 0; text-align: left; padding: 9px 0; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: transparent; border-radius: 0; color: var(--texto); }
.chat-item .borrar { opacity: 0; padding: 6px; color: var(--suave); }
.chat-item:hover .borrar, .chat-item .borrar:focus-visible { opacity: 1; }
.vacia { color: var(--suave); font-size: 14px; padding: 6px 12px; margin: 0; }
.lat-pie { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--borde); padding: 10px 4px 2px; }
.yo { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--violeta), var(--magenta)); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 14px; flex: none; }
.quien { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cortina { position: fixed; inset: 0; background: rgba(10, 8, 24, .45); z-index: 30; }

.principal { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; background: var(--fondo); }
.top { display: flex; align-items: center; gap: 8px; padding: 10px 16px; min-height: 52px; }
.titulo-top { font-weight: 800; letter-spacing: -.01em; }
.reloj { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--violeta-osc); background: var(--lavanda); padding: 4px 11px; border-radius: 999px; white-space: nowrap; }
@media (prefers-color-scheme: dark) { .reloj { color: #d9d0ff; } }
.reloj.pronto { background: rgba(183, 121, 31, .18); color: var(--ambar); }

.hilo { flex: 1; overflow-y: auto; min-height: 0; scroll-behavior: smooth; }
.mensajes { width: min(var(--ancho), 100%); margin: 0 auto; padding: 8px 16px 24px; display: flex; flex-direction: column; gap: 22px; }
.inicio { display: none; }
.inicio h1 { font-size: clamp(26px, 5vw, 34px); font-weight: 800; letter-spacing: -.02em; text-align: center; }

/* Estado «chat vacío»: saludo, caja y sugerencias al centro, como ChatGPT */
.principal.vacio { justify-content: center; }
.principal.vacio .top { position: absolute; top: 0; left: 0; right: 0; }
.principal.vacio .hilo { flex: 0 0 auto; overflow: visible; }
.principal.vacio .inicio { display: block; padding: 0 16px 22px; }
.principal.vacio .mensajes { display: none; }
.principal:not(.vacio) .sugerencias { display: none; }

.msg { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.msg.persona { align-items: flex-end; }
.msg.persona .cuerpo { background: var(--burbuja); border-radius: 22px; padding: 10px 18px; max-width: 85%; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.ia { flex-direction: row; gap: 14px; align-items: flex-start; }
.ia-avatar { width: 30px; height: 30px; border-radius: 50%; flex: none; margin-top: 2px; background: linear-gradient(135deg, var(--violeta), var(--magenta)); color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 800; letter-spacing: -.02em; }
.ia-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.contenido { overflow-wrap: anywhere; }
.contenido > :first-child { margin-top: 0; } .contenido > :last-child { margin-bottom: 0; }
.contenido p { margin: 0 0 12px; }
.contenido ul, .contenido ol { margin: 0 0 12px; padding-left: 24px; } .contenido li { margin: 3px 0; }
.contenido h3 { font-size: 17px; margin: 16px 0 8px; }
.contenido a { color: var(--violeta); font-weight: 600; } @media (prefers-color-scheme: dark) { .contenido a { color: #b9a6ff; } }
.contenido blockquote { margin: 0 0 12px; padding: 2px 14px; border-left: 3px solid var(--violeta); color: var(--suave); }
.contenido hr { border: 0; border-top: 1px solid var(--borde); margin: 16px 0; }
.contenido code { background: var(--lavanda); padding: 1px 6px; border-radius: 6px; font-size: .92em; }
.bloque-codigo { background: var(--codigo); border-radius: 14px; overflow: hidden; margin: 0 0 12px; }
.bloque-codigo .cab { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 14px; background: rgba(255,255,255,.07); color: #aeb3d1; font-size: 12px; font-weight: 700; }
.bloque-codigo .cab button { color: #c9cdea; padding: 4px 8px; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; border-radius: 8px; }
.bloque-codigo .cab button:hover { background: rgba(255,255,255,.1); }
.bloque-codigo pre { margin: 0; padding: 12px 14px; overflow-x: auto; color: var(--codigo-txt); font-size: 14px; }
.bloque-codigo pre code { background: transparent; padding: 0; color: inherit; font-size: inherit; }
.tabla-md { border: 1px solid var(--borde); border-radius: 12px; overflow: hidden; margin: 0 0 12px; }
.tabla-md .cab { display: flex; justify-content: flex-end; padding: 4px 6px; background: var(--compositor); border-bottom: 1px solid var(--borde); }
.tabla-md .cab button { color: var(--suave); font-size: 12px; padding: 4px 8px; display: inline-flex; gap: 6px; align-items: center; border-radius: 8px; }
.tabla-md .cab button:hover { background: var(--hover); color: var(--texto); }
.tabla-md .desliza { overflow-x: auto; }
.tabla-md table { border-collapse: collapse; font-size: 14px; width: 100%; }
.tabla-md th, .tabla-md td { padding: 7px 12px; text-align: left; border-bottom: 1px solid var(--borde); white-space: nowrap; }
.tabla-md tr:last-child td { border-bottom: 0; }
.tabla-md th { background: var(--compositor); font-weight: 700; }
.cursor { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--texto); margin-left: 3px; vertical-align: middle; animation: late 1s infinite ease-in-out; }
@keyframes late { 0%, 100% { transform: scale(.7); opacity: .5; } 50% { transform: scale(1.1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } .hilo { scroll-behavior: auto; } }
.falla { color: var(--rojo); font-weight: 600; }

.herramienta { display: inline-flex; align-items: center; gap: 10px; color: var(--suave); font-weight: 600; font-size: 14px; }
.rueda { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--lavanda); border-top-color: var(--violeta); animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .rueda { animation: none; border-top-color: var(--violeta); } }

.acciones-msg { display: flex; gap: 2px; margin-left: -8px; }
.acciones-msg .icono { padding: 6px; }
.acciones-msg .icono.listo { color: var(--verde); }

.archivo { display: flex; align-items: center; gap: 12px; background: var(--fondo); border: 1.5px solid var(--borde); border-radius: 16px; padding: 10px 12px; max-width: 520px; }
.archivo .ico { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; font-size: 12px; color: #fff; flex: none; }
.ico.excel { background: #1a9a55; } .ico.dashboard { background: var(--violeta); } .ico.word { background: #2b6cd9; }
.archivo .info { flex: 1 1 130px; min-width: 0; }
.archivo .nombre { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archivo .detalle { font-size: 13px; color: var(--suave); }
.archivo .acciones { display: flex; gap: 6px; flex-wrap: wrap; }
.archivo .acciones button { padding: 7px 12px; font-size: 14px; }
.archivo.perdido { opacity: .7; }

/* ───────── Caja para escribir ───────── */
.zona { width: min(var(--ancho), 100%); margin: 0 auto; padding: 4px 16px calc(10px + env(safe-area-inset-bottom)); position: relative; }
.bajar { position: absolute; top: -46px; left: 50%; transform: translateX(-50%); width: 36px; height: 36px; border-radius: 50%; padding: 0; background: var(--fondo); border: 1px solid var(--borde); box-shadow: var(--sombra); color: var(--texto); display: grid; place-items: center; }
.compositor { background: var(--compositor); border-radius: 28px; padding: 10px 12px 8px 16px; display: flex; flex-direction: column; gap: 4px; border: 1.5px solid transparent; }
.compositor:focus-within { border-color: rgba(91, 43, 224, .45); }
.compositor textarea { width: 100%; border: 0; background: transparent; resize: none; outline: none; padding: 6px 2px; max-height: 200px; min-height: 38px; line-height: 1.5; overflow-y: auto; font-size: 16px; }
.compositor textarea::placeholder { color: var(--suave); }
.fila-comp { display: flex; align-items: center; gap: 6px; }
.enviar { width: 38px; height: 38px; border-radius: 50%; padding: 0; background: var(--violeta); color: #fff; display: grid; place-items: center; }
.enviar:hover:not(:disabled) { background: var(--violeta-osc); }
.enviar:disabled { background: var(--hover); color: var(--suave); }
.enviar.parar { background: var(--texto); color: var(--fondo); }
.adjuntos { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 2px; }
.adj { display: inline-flex; align-items: center; gap: 8px; background: var(--fondo); border: 1px solid var(--borde); border-radius: 12px; padding: 5px 6px 5px 10px; font-size: 13px; font-weight: 600; max-width: 100%; }
.adj .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adj .ic { width: 24px; height: 24px; border-radius: 7px; background: var(--violeta); color: #fff; font-size: 9px; font-weight: 800; display: grid; place-items: center; flex: none; }
.adj button { padding: 2px; color: var(--suave); border-radius: 50%; display: grid; place-items: center; }
.adj button:hover { color: var(--texto); }
.sugerencias { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.sug { text-align: left; border: 1px solid var(--borde); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; color: var(--texto); font-weight: 400; }
.sug b { font-weight: 700; font-size: 15px; } .sug span { color: var(--suave); font-size: 13px; }
.sug:hover { background: var(--hover); }
.pie { margin: 8px 0 0; font-size: 12px; color: var(--suave); text-align: center; }

/* ───────── Panel del profesor, visor, avisos ───────── */
.panel-profesor { position: absolute; top: 0; right: 0; bottom: 0; width: min(380px, 100%); background: var(--fondo); border-left: 1px solid var(--borde); box-shadow: -10px 0 30px rgba(60,50,120,.18); padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; z-index: 40; }
.panel-cab { display: flex; justify-content: space-between; align-items: center; }
.prof-tiempo { margin: 0; font-weight: 700; color: var(--violeta); }
.prof-botones { display: flex; gap: 8px; flex-wrap: wrap; }
.prof-alumnos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.prof-alumnos li { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; border-bottom: 1px solid var(--borde); padding-bottom: 5px; }
.prof-alumnos .det { color: var(--suave); font-size: 12px; white-space: nowrap; }
.panel-profesor h3 { font-size: 15px; margin-top: 6px; }
.visor { position: fixed; inset: 0; z-index: 60; background: var(--fondo); display: flex; flex-direction: column; }
.visor-cab { display: flex; gap: 8px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--borde); }
.visor iframe { flex: 1; border: 0; width: 100%; background: #fff; }
.aviso { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); background: var(--texto); color: var(--fondo); padding: 10px 16px; border-radius: 12px; font-weight: 600; max-width: 90vw; z-index: 70; box-shadow: var(--sombra); }
.soltar { position: fixed; inset: 0; z-index: 80; background: rgba(91, 43, 224, .16); display: grid; place-items: center; backdrop-filter: blur(2px); }
.soltar div { background: var(--fondo); border: 2px dashed var(--violeta); border-radius: 24px; padding: 40px 48px; font-weight: 800; font-size: 22px; color: var(--violeta); }

/* ───────── Celular ───────── */
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .lateral { position: fixed; z-index: 35; top: 0; bottom: 0; left: 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--sombra); }
  .app.menu-abierto .lateral { transform: none; }
  .solo-movil { display: inline-grid; }
  .titulo-top { font-size: 15px; }
  .sugerencias { grid-template-columns: 1fr; margin-top: 14px; }
  .sug span { display: none; }
  .msg.persona .cuerpo { max-width: 92%; }
  .msg.ia { gap: 10px; }
  .panel-profesor { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .lateral { transition: none; } }

/* ───────── Resistencia: aviso de conexión y salud de la clase ───────── */
.falla + .chico { align-self: flex-start; }
.salud { border: 1px solid var(--borde); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.salud h3 { margin: 0; }
.salud-estado { margin: 0; font-weight: 800; }
.salud-estado.bien { color: var(--verde); } .salud-estado.atencion { color: var(--ambar); } .salud-estado.mal { color: var(--rojo); }
.salud-detalle { margin: 0; font-size: 13px; color: var(--suave); white-space: pre-line; }

/* Nombre del docente en la barra superior */
.docente { color: #8a91a8; font-size: 12px; font-weight: 400; white-space: nowrap; }
@media (max-width: 560px) { .docente { font-size: 10.5px; white-space: normal; line-height: 1.2; } }

/* Pantalla de nombre: el cuadro se remarca en violeta para que se vea de inmediato dónde escribir */
#nombre { border: 2px solid var(--violeta); box-shadow: 0 0 0 4px rgba(91, 43, 224, .14); font-size: 17px; padding: 14px 16px; }
#nombre:focus { box-shadow: 0 0 0 5px rgba(91, 43, 224, .28); }

/* «Soy el profesor»: discreto, para no distraer a los alumnos */
.enlace { background: none; color: var(--suave); font-size: 13px; font-weight: 600; text-decoration: underline; padding: 4px 8px; border-radius: 8px; }
.enlace:hover { color: var(--violeta); }
.form-profesor { border-top: 1px solid var(--borde); padding-top: 12px; }

/* Interruptor BÚSQUEDA WEB del panel del profesor */
.interruptor { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 12px 14px; border: 1.5px solid var(--borde); border-radius: 14px; background: var(--fondo); color: var(--texto); }
.interruptor-nombre { font-weight: 800; letter-spacing: .02em; }
.interruptor-estado { font-weight: 800; font-size: 13px; padding: 4px 12px; border-radius: 999px; background: var(--hover); color: var(--suave); }
.interruptor.encendido { border-color: var(--violeta); }
.interruptor.encendido .interruptor-estado { background: var(--violeta); color: #fff; }
