/* Identidad visual: El Camino del Escritor Fantasma
   Tomado directamente de la web actual: negro/blanco/amarillo, tarjetas
   redondeadas con borde marcado, píldoras en mayúsculas con tracking,
   Playfair Display (títulos) + Lato (texto). Sin emojis. */

:root {
    --black: #000000;
    --white: #ffffff;
    --yellow: #f9ea16;
    --grey: #f2f2f2;
    --mid: #1a1a1a;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--white);
    color: var(--black);
    font-family: 'Lato', Arial, sans-serif;
    font-size: 17px;
    line-height: 1.6;
}

h1, h2, h3, h4 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 0.5em;
}

a { color: var(--black); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── TOPBAR (como el nav de la web principal) ── */
.topbar {
    background: var(--black);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    border-bottom: 3px solid var(--yellow);
}

.topbar .brand {
    color: var(--white);
    font-weight: 700;
    letter-spacing: .12em;
    font-size: .95rem;
    text-transform: uppercase;
}

.topbar nav a {
    color: var(--white);
    margin-left: 20px;
    font-size: 0.9rem;
    text-decoration: none;
}

.topbar nav a:hover { color: var(--yellow); }

.notif-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--yellow);
    color: var(--black);
    font-size: .68rem;
    font-weight: 700;
}

.container {
    max-width: 980px;
    margin: 0 auto;
    padding: 40px 24px;
}

/* ── TARJETAS (como .profile-card / .day-card de la web) ── */
.card {
    background: var(--white);
    border: 2px solid var(--black);
    border-radius: 18px;
    padding: 28px;
    margin-bottom: 24px;
}

.card-dark {
    background: var(--black);
    color: var(--white);
    border-color: var(--black);
}

.card-dark .muted { color: rgba(255,255,255,.65); }

/* ── BOTONES (píldoras, como los CTA de la web) ── */
.btn {
    display: inline-block;
    background: var(--black);
    color: var(--white);
    border: 2px solid var(--black);
    padding: 10px 22px;
    border-radius: 999px;
    font-weight: 700;
    font-size: .9rem;
    cursor: pointer;
    font-family: 'Lato', Arial, sans-serif;
}

.btn:hover { background: var(--white); color: var(--black); text-decoration: none; }

.btn-accent {
    background: var(--yellow);
    color: var(--black);
    border-color: var(--yellow);
}

.btn-accent:hover { background: var(--black); color: var(--yellow); }

.btn-outline { background: transparent; color: var(--black); }

.btn-danger { border-color: #b02a2a; color: #b02a2a; background: transparent; }
.btn-danger:hover { background: #b02a2a; color: var(--white); }

/* ── FORMULARIOS ── */
form label {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
    margin-top: 18px;
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .06em;
}

form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="datetime-local"],
form textarea,
form select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-family: 'Lato', Arial, sans-serif;
    font-size: 1rem;
    background: var(--white);
    color: var(--black);
}

form input:focus, form textarea:focus, form select:focus {
    border-color: var(--black);
    outline: none;
}

form textarea { min-height: 140px; }

/* ── LOGIN (como el .hero + .form-col de la web) ── */
.login-hero {
    background: var(--black);
    min-height: calc(100vh - 66px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--white);
    border-radius: 20px;
    border: 3px solid var(--yellow);
    padding: 2.5rem 2rem;
}

.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: var(--yellow);
    color: var(--black);
    font-weight: 700;
    font-size: .68rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    padding: .35rem .9rem;
    border-radius: 999px;
    margin-bottom: 1.2rem;
}

.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-error { background: #fde8e8; border: 1px solid #b02a2a; color: #b02a2a; }
.alert-success { background: #fffbdd; border: 1px solid var(--yellow); color: #6b6100; }

/* ── ETIQUETAS DE ESTADO (píldoras, como .day-date) ── */
.badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: .06em;
    padding: 4px 12px;
    border-radius: 999px;
    text-transform: uppercase;
}

.badge-draft { background: var(--grey); color: #555; }
.badge-published { background: var(--yellow); color: var(--black); }
.badge-submitted { background: var(--grey); color: #555; }
.badge-reviewed { background: var(--black); color: var(--yellow); }

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid #ececec;
    flex-wrap: wrap;
}

.list-item:last-child { border-bottom: none; }

.muted { color: rgba(0,0,0,.55); font-size: 0.9rem; }

.section-label {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .14em;
    opacity: .45;
    margin-bottom: .4rem;
}

.progress-bar {
    background: var(--grey);
    border-radius: 999px;
    height: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-bar-fill { background: var(--yellow); height: 100%; }

video {
    width: 100%;
    max-width: 100%;
    border-radius: 14px;
    background: var(--black);
}

.deadline-warning { color: #b02a2a; font-weight: 700; }

/* ── EQUIPO (como .team-mini de la web) ── */
.team-mini {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.2rem;
}

.team-mini-card { display: flex; align-items: center; gap: 1rem; }

.team-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--black);
    flex-shrink: 0;
}

.team-mini-name { font-weight: 700; font-size: .95rem; }
.team-mini-role { font-size: .72rem; color: rgba(0,0,0,.5); text-transform: uppercase; letter-spacing: .08em; }

footer {
    text-align: center;
    padding: 28px;
    color: #999;
    font-size: 0.82rem;
    border-top: 4px solid var(--yellow);
    background: var(--black);
}

footer, footer a { color: rgba(255,255,255,.4); }

/* Editor de texto enriquecido (Quill) */
.ql-toolbar { border-radius: 10px 10px 0 0; border-color: #ddd !important; }
.ql-container { border-radius: 0 0 10px 10px; border-color: #ddd !important; min-height: 160px; font-family: 'Lato', Arial, sans-serif; font-size: 1rem; }
.rich-content img { max-width: 100%; border-radius: 8px; }
.rich-content { line-height: 1.7; }

@media (max-width: 600px) {
    .topbar { flex-direction: column; align-items: flex-start; gap: 10px; }
    .topbar nav a { margin-left: 0; margin-right: 16px; }
}

/* ── ORDENAR (flechas subir/bajar en el panel del profesor) ── */
.order-controls { display: flex; align-items: center; gap: 6px; }
.order-controls form { margin: 0; }
.btn-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--black);
    border-radius: 8px;
    background: var(--white);
    color: var(--black);
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.btn-icon:hover:not(:disabled) { background: var(--yellow); }
.btn-icon:disabled { opacity: .25; cursor: default; }

/* ════════════════════════════════════════════════════════════
   MEJORAS VISUALES (nov. 2026)
   ════════════════════════════════════════════════════════════ */

/* Pie de página siempre abajo, aunque la página tenga poco contenido */
body { min-height: 100vh; display: flex; flex-direction: column; }
body > .container, body > .login-hero { flex: 1 0 auto; width: 100%; }
body > footer { flex-shrink: 0; }

/* Enlaces dentro de textos: que se note que son enlaces */
.rich-content a, .link-underline { text-decoration: underline; text-underline-offset: 3px; }
.link-underline:hover { background: var(--yellow); }
.back-link { display: inline-block; margin-bottom: 18px; font-size: .92rem; }

/* Contenido de la lección */
.rich-content h1, .rich-content h2, .rich-content h3 { margin-top: 1.2em; }
.rich-content > :first-child { margin-top: 0; }
.rich-content blockquote {
    margin: 1.4em 0;
    padding: 14px 20px;
    border-left: 5px solid var(--yellow);
    background: #fffde6;
    border-radius: 0 12px 12px 0;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.15rem;
}

/* Botones pequeños (acciones secundarias) */
.btn-small { padding: 6px 14px; font-size: .8rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:hover { background: inherit; color: inherit; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.actions form { margin: 0; display: inline; }

/* Campo de archivo con el mismo aspecto que el resto del formulario */
form input[type="file"] {
    display: block;
    width: 100%;
    padding: 12px;
    border: 2px dashed #ccc;
    border-radius: 10px;
    background: #fafafa;
    font-family: 'Lato', Arial, sans-serif;
    font-size: .9rem;
    cursor: pointer;
}
form input[type="file"]::file-selector-button {
    margin-right: 12px;
    padding: 6px 14px;
    border: 2px solid var(--black);
    border-radius: 999px;
    background: var(--white);
    font-weight: 700;
    cursor: pointer;
}
.hint { color: rgba(0,0,0,.55); font-size: .82rem; margin: 6px 0 0; }

/* ── TARJETAS DE PROFESOR (paneles centrales del curso) ── */
.teacher-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin: 14px 0 32px;
}
.teacher-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px;
    border: 2px solid var(--black);
    border-radius: 18px;
    background: var(--white);
    color: var(--black);
    transition: transform .15s, box-shadow .15s;
}
.teacher-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 6px 6px 0 var(--yellow); }
.teacher-card-top { display: flex; align-items: center; gap: 14px; }
.teacher-card .team-mini-role { margin-top: 2px; }
.teacher-card-stats { font-size: .88rem; color: rgba(0,0,0,.6); }
.teacher-card .progress-bar { margin: 0 0 6px; }
.teacher-card-cta { margin-top: auto; font-weight: 700; font-size: .85rem; }
.teacher-card-dashed { border-style: dashed; border-color: #bbb; justify-content: center; }
.avatar-placeholder {
    width: 56px; height: 56px; border-radius: 50%; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border: 2px solid var(--black); background: var(--grey);
    font-weight: 700; font-size: 1.2rem;
}

/* ── "SIGUE DONDE LO DEJASTE" ── */
.continue-card {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    background: var(--black); color: var(--white);
    border-radius: 18px; padding: 22px 26px; margin: 8px 0 28px;
}
.continue-card .section-label { color: var(--yellow); opacity: 1; }
.continue-card h3 { margin: 4px 0 0; color: var(--white); }
.continue-card .muted { color: rgba(255,255,255,.65); }

/* ── CABECERA DE SECCIÓN DE PROFESOR ── */
.section-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.section-head h2 { margin: 0; }
.section-head-progress { flex: 1 1 220px; max-width: 320px; margin-left: auto; }
.section-head-progress .progress-bar { margin: 4px 0; }

/* ── LISTA DE CLASES DEL ALUMNO ── */
.module-title { display: flex; align-items: baseline; gap: 10px; margin: 0 0 6px; }
.lesson-row {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 10px; margin: 0 -10px;
    border-bottom: 1px solid #ececec; border-radius: 10px;
    color: var(--black);
}
.lesson-row:last-child { border-bottom: none; }
.lesson-row:hover { background: #fffde6; text-decoration: none; }
.lesson-num {
    width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    border: 2px solid var(--black); font-weight: 700; font-size: .85rem;
}
.lesson-row.is-done .lesson-num { background: var(--black); color: var(--yellow); }
.lesson-row-body { flex: 1; min-width: 0; }
.lesson-row-title { font-weight: 700; }

/* ── PÁGINA DE LA LECCIÓN ── */
.breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; font-size: .85rem; color: rgba(0,0,0,.55); margin-bottom: 18px; }
.breadcrumb a { color: rgba(0,0,0,.75); text-decoration: underline; text-underline-offset: 3px; }
.lesson-header { margin-bottom: 20px; }
.lesson-header h2 { font-size: 2rem; margin: 6px 0 10px; }
.lesson-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.deadline-chip {
    display: inline-block; padding: 5px 12px; border-radius: 999px;
    background: #fde8e8; color: #b02a2a; font-weight: 700; font-size: .82rem;
}
.video-embed-wrap {
    position: relative; padding-top: 56.25%; margin-bottom: 24px;
    border-radius: 14px; overflow: hidden; background: var(--black);
}
.video-embed-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.file-row {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 10px; margin: 0 -10px; border-radius: 10px;
    border-bottom: 1px solid #ececec; color: var(--black);
}
.file-row:last-child { border-bottom: none; }
.file-row:hover { background: #fffde6; text-decoration: none; }
.file-row > span:nth-child(2) { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.file-icon {
    width: 44px; height: 44px; flex-shrink: 0; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--yellow); font-weight: 700; font-size: .68rem; letter-spacing: .05em;
}
.file-action { font-weight: 700; font-size: .82rem; text-decoration: underline; text-underline-offset: 3px; }
.lesson-progress-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 8px 0 20px; }
.lesson-progress-bar form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0; }
.lesson-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 28px; }
.lesson-nav-link {
    display: flex; flex-direction: column; gap: 4px;
    padding: 16px 18px; border: 2px solid var(--black); border-radius: 14px; color: var(--black);
}
.lesson-nav-link .section-label { margin: 0; }
.lesson-nav-link:hover { background: var(--yellow); text-decoration: none; }
.lesson-nav-next { text-align: right; }
.submission-box { background: var(--grey); border-radius: 14px; padding: 16px 18px; margin-bottom: 12px; }
.submission-box p:last-child { margin-bottom: 0; }
.feedback-box {
    margin-top: 12px; padding: 14px 16px; border-radius: 12px;
    background: var(--white); border-left: 5px solid var(--yellow);
}
.feedback-box .section-label { opacity: .6; }
.preview-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    background: var(--yellow); border-radius: 14px; padding: 14px 18px; margin-bottom: 20px;
}

/* ── PANEL DEL PROFESOR: módulos y lecciones ── */
.module-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.module-card-head h3 { margin: 0; font-size: 1.25rem; }
.module-teacher-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 6px; font-size: .85rem; }
.module-teacher-form label { margin: 0; }
.module-teacher-form select { width: auto; min-width: 200px; padding: 6px 10px; font-size: .9rem; }
.teacher-lesson {
    display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap;
    padding: 14px 0; border-bottom: 1px solid #ececec;
}
.teacher-lesson:last-of-type { border-bottom: none; }
.teacher-lesson-body { flex: 1 1 260px; min-width: 0; }
.teacher-lesson-title { font-weight: 700; margin-right: 6px; }
.teacher-lesson .actions { flex: 0 0 auto; }

/* ── NOTIFICACIONES ── */
.notif-row {
    display: flex; gap: 14px; align-items: flex-start;
    padding: 14px 12px; margin: 0 -12px; border-radius: 12px;
    border-bottom: 1px solid #ececec; color: var(--black);
}
.notif-row:last-child { border-bottom: none; }
.notif-row:hover { background: var(--grey); text-decoration: none; }
.notif-row.is-unread { background: #fffde6; }
.notif-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 8px; flex-shrink: 0; background: transparent; }
.notif-row.is-unread .notif-dot { background: var(--yellow); box-shadow: 0 0 0 2px var(--black); }
.notif-body { flex: 1; min-width: 0; }
.notif-type { font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; opacity: .5; }

.empty-state { text-align: center; padding: 20px 10px; color: rgba(0,0,0,.55); }

/* ── MÓVIL ── */
@media (max-width: 600px) {
    .container { padding: 24px 16px; }
    .card { padding: 20px 18px; border-radius: 16px; }
    .topbar { padding: 14px 16px; gap: 8px; }
    .topbar .brand { font-size: .8rem; }
    .topbar nav { display: flex; flex-wrap: wrap; gap: 6px 16px; }
    .topbar nav a { margin: 0; font-size: .85rem; }
    .nav-user-name { display: none; }
    .lesson-header h2 { font-size: 1.55rem; }
    .lesson-nav { grid-template-columns: 1fr; }
    .lesson-nav-next { text-align: left; }
    .section-head-progress { max-width: none; margin-left: 0; }
    .module-teacher-form select { min-width: 0; flex: 1; }
    .teacher-lesson .actions { width: 100%; padding-left: 0; }
}
.module-settings { margin: 10px 0 6px; }
.module-settings summary { cursor: pointer; font-size: .85rem; width: fit-content; }
.module-settings summary:hover { text-decoration: underline; }
.module-teacher-form input[type="text"] { padding: 6px 10px; font-size: .9rem; width: auto; }
.btn .notif-count { margin-left: 4px; }
@media (max-width: 600px) {
    .teacher-lesson-body { flex: 1 1 0; }
    .module-card-head h3 { font-size: 1.1rem; }
}

/* ── CAMPANITA DE NOTIFICACIONES (barra superior) ── */
.topbar nav { display: flex; align-items: center; flex-wrap: wrap; }
.nav-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
}
.nav-bell:hover { background: rgba(255,255,255,.1); text-decoration: none; }
.nav-bell.has-unread { color: var(--yellow); }
.nav-bell.has-unread svg { animation: bell-ring 1.2s ease-in-out 1; transform-origin: 50% 10%; }
.nav-bell-count {
    position: absolute;
    top: 1px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--yellow);
    color: var(--black);
    border: 2px solid var(--black);
    font-size: .65rem;
    font-weight: 700;
    line-height: 14px;
    text-align: center;
}
@keyframes bell-ring {
    0%, 100% { transform: rotate(0); }
    15% { transform: rotate(14deg); }
    30% { transform: rotate(-12deg); }
    45% { transform: rotate(8deg); }
    60% { transform: rotate(-6deg); }
    75% { transform: rotate(3deg); }
}
@media (prefers-reduced-motion: reduce) { .nav-bell.has-unread svg { animation: none; } }
@media (max-width: 600px) { .nav-bell { width: 32px; height: 32px; } }

/* ── RECUPERAR CONTRASEÑA ── */
.login-alt { text-align: center; margin: 18px 0 0; font-size: .9rem; }
.temp-password-box {
    background: var(--black); color: var(--white);
    border-radius: 18px; padding: 22px 24px; margin-bottom: 24px;
}
.temp-password-box .section-label { color: var(--yellow); opacity: 1; }
.temp-password {
    display: inline-block; margin: 8px 0 14px; padding: 10px 18px;
    background: var(--yellow); color: var(--black); border-radius: 12px;
    font-family: 'Courier New', monospace; font-size: 1.5rem; font-weight: 700; letter-spacing: .08em;
    user-select: all;
}
.temp-password-box textarea {
    width: 100%; min-height: 160px; border-radius: 10px; border: 0; padding: 12px;
    font-family: 'Lato', Arial, sans-serif; font-size: .95rem; resize: vertical;
}
.temp-password-box .btn-outline { color: var(--white); border-color: var(--white); }
.temp-password-box .btn-outline:hover { background: var(--white); color: var(--black); }
.people-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 0; border-bottom: 1px solid #ececec; }
.people-row:last-child { border-bottom: none; }
.people-row-body { flex: 1 1 220px; min-width: 0; }
.people-search { margin-bottom: 8px; }

/* ── GUARDANDO… (evita dobles envíos) ── */
.btn.is-submitting { opacity: .6; cursor: progress; }
.saving-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,.55);
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.saving-overlay[hidden] { display: none; }
.saving-box {
    background: var(--white); border: 3px solid var(--yellow); border-radius: 18px;
    padding: 26px 28px; max-width: 360px; text-align: center;
}
.saving-box p { margin: 8px 0 0; color: rgba(0,0,0,.6); font-size: .92rem; }
.saving-spinner {
    width: 38px; height: 38px; margin: 0 auto 12px;
    border: 4px solid var(--grey); border-top-color: var(--black); border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .saving-spinner { animation-duration: 2.5s; } }
