/* ═══════════════════════════════════════════════════════════════════════════
   activities.css — Modal de Gestión de Actividades — SPEAKSOFT
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Variables de color por momento ──────────────────────────────────────── */
.act-momento--preparacion { --momento-color: #3b82f6; --momento-light: #eff6ff; --momento-border: #bfdbfe; }
.act-momento--absorcion   { --momento-color: #10b981; --momento-light: #f0fdf4; --momento-border: #a7f3d0; }
.act-momento--practica    { --momento-color: #8b5cf6; --momento-light: #faf5ff; --momento-border: #ddd6fe; }
.act-momento--cierre      { --momento-color: #f59e0b; --momento-light: #fffbeb; --momento-border: #fde68a; }

/* ── Overlay ──────────────────────────────────────────────────────────────── */
.act-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(3px);
    z-index: 9000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: actFadeIn .18s ease;
}
.act-modal-overlay.open { display: flex; }

@keyframes actFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Panel principal ──────────────────────────────────────────────────────── */
.act-modal {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 920px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,.22), 0 4px 16px rgba(0,0,0,.1);
    animation: actSlideUp .22s cubic-bezier(.4,0,.2,1);
}

@keyframes actSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(.98); }
    to   { opacity: 1; transform: translateY(0)    scale(1);   }
}

/* ── Nav header (fijo, no scroll) ────────────────────────────────────────── */
.act-modal-nav {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    flex-shrink: 0;
}

.act-nav-back {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .8rem;
    font-weight: 600;
    color: #64748b;
    background: none;
    border: none;
    cursor: pointer;
    padding: .3rem .55rem;
    border-radius: 6px;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.act-nav-back:hover { background: #e2e8f0; color: #1e293b; }

.act-nav-title {
    flex: 1;
    font-size: .82rem;
    color: #94a3b8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.act-nav-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: #e2e8f0;
    color: #64748b;
    font-size: .9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s, color .15s;
}
.act-nav-close:hover { background: #cbd5e1; color: #1e293b; }

/* ── Hero banner del módulo ───────────────────────────────────────────────── */
.act-module-hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.act-module-hero-icon {
    width: 48px;
    height: 48px;
    background: #e0e7ff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.act-module-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: .2rem;
    line-height: 1.3;
}

.act-module-subtitle {
    font-size: .78rem;
    color: #64748b;
}

/* ── Área scrolleable ─────────────────────────────────────────────────────── */
.act-modal-scroll {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.act-momentos-container {
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ── Loading ──────────────────────────────────────────────────────────────── */
.act-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
    padding: 3rem 1rem;
    color: #64748b;
    font-size: .85rem;
}

/* ── Sección de un momento ────────────────────────────────────────────────── */
.act-momento {
    border: 1.5px solid var(--momento-border);
    border-left: 4px solid var(--momento-color);
    border-radius: 10px;
    background: var(--momento-light);
    overflow: hidden;
}

.act-momento-header {
    display: flex;
    align-items: flex-start;
    gap: .9rem;
    padding: 1rem 1.25rem .8rem;
}

.act-momento-emoji {
    font-size: 1.35rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: .05rem;
}

.act-momento-meta { flex: 1; min-width: 0; }

.act-momento-nombre {
    font-size: .92rem;
    font-weight: 700;
    color: var(--momento-color);
    margin-bottom: .2rem;
}

.act-momento-guia {
    font-size: .76rem;
    color: #64748b;
    line-height: 1.45;
}

.act-momento-tipos {
    margin-top: .35rem;
    display: flex;
    gap: .35rem;
    flex-wrap: wrap;
}

.act-tipo-chip {
    font-size: .68rem;
    font-weight: 600;
    padding: .1rem .45rem;
    border-radius: 20px;
    background: rgba(255,255,255,.7);
    border: 1px solid var(--momento-border);
    color: var(--momento-color);
    letter-spacing: .02em;
}

/* ── Grid de cards de actividades ────────────────────────────────────────── */
.act-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .6rem;
    padding: 0 1.25rem;
}
@media (max-width: 640px) { .act-cards-grid { grid-template-columns: 1fr; } }

/* ── Card de actividad ───────────────────────────────────────────────────── */
.act-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    padding: .7rem .85rem;
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    min-width: 0;
    transition: box-shadow .15s, border-color .15s, transform .1s;
}
.act-card:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,.09);
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.act-card-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: .1rem;
    opacity: .85;
}

.act-card-body {
    flex: 1;
    min-width: 0;
}

.act-card-titulo {
    font-size: .81rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.act-card-meta {
    display: flex;
    align-items: center;
    gap: .35rem;
    margin-top: .25rem;
    flex-wrap: wrap;
}

.act-card-tipo {
    font-size: .67rem;
    font-weight: 600;
    color: #64748b;
    text-transform: capitalize;
    background: #f1f5f9;
    padding: .08rem .35rem;
    border-radius: 4px;
}

.act-card-estado {
    font-size: .64rem;
    font-weight: 700;
    padding: .08rem .38rem;
    border-radius: 20px;
    letter-spacing: .02em;
}
.act-card-estado--activo   { background: #dcfce7; color: #15803d; }
.act-card-estado--inactivo { background: #f1f5f9; color: #64748b; }

.act-card-actions {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    flex-shrink: 0;
    margin-top: .05rem;
}

.act-card-btn {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: transparent;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.act-card-btn:hover { background: #f1f5f9; border-color: #cbd5e1; color: #1e293b; }
.act-card-btn--danger:hover { background: #fef2f2; border-color: #fca5a5; color: #dc2626; }

/* ── Footer del momento con botón agregar ────────────────────────────────── */
.act-momento-footer {
    padding: .75rem 1.25rem 1rem;
}

.act-btn-add {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .78rem;
    font-weight: 600;
    color: var(--momento-color);
    background: rgba(255,255,255,.8);
    border: 1.5px dashed var(--momento-border);
    border-radius: 7px;
    padding: .5rem .9rem;
    cursor: pointer;
    width: 100%;
    justify-content: center;
    transition: background .15s, border-color .15s;
}
.act-btn-add:hover {
    background: #fff;
    border-color: var(--momento-color);
    border-style: solid;
}

/* ── Formulario inline ────────────────────────────────────────────────────── */
.act-form-wrapper {
    margin: 0 1.25rem .85rem;
    background: #fff;
    border: 2px solid var(--momento-color, #4f46e5);
    border-radius: 10px;
    overflow: hidden;
    animation: actSlideDown .18s ease;
}

@keyframes actSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.act-form-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .7rem 1rem;
    background: var(--momento-light, #f1f5f9);
    border-bottom: 1px solid var(--momento-border, #e2e8f0);
}

.act-form-head-title {
    font-size: .82rem;
    font-weight: 700;
    color: var(--momento-color, #1e293b);
}

.act-form-close {
    width: 22px; height: 22px;
    border: none; background: none;
    font-size: .85rem; color: #94a3b8;
    cursor: pointer; border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    transition: background .12s;
}
.act-form-close:hover { background: #e2e8f0; color: #475569; }

.act-form-body { padding: 1rem; }

/* Selector de tipo ─────────────────────────────────── */
.act-form-label {
    display: block;
    font-size: .76rem;
    font-weight: 700;
    color: #475569;
    margin-bottom: .45rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.act-tipo-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: .45rem;
    margin-bottom: .9rem;
}
@media (max-width: 480px) { .act-tipo-selector { grid-template-columns: repeat(2, 1fr); } }

.act-tipo-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .3rem;
    padding: .7rem .5rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: border-color .15s, background .15s, transform .1s;
    background: #f8fafc;
    user-select: none;
}
.act-tipo-card:hover { border-color: #94a3b8; background: #fff; transform: translateY(-1px); }
.act-tipo-card.selected {
    border-color: var(--tipo-color, #4f46e5);
    background: var(--tipo-bg, #eef2ff);
    box-shadow: 0 0 0 3px var(--tipo-ring, rgba(79,70,229,.15));
}

.act-tipo-emoji { font-size: 1.3rem; }
.act-tipo-label { font-size: .73rem; font-weight: 700; color: #374151; }
.act-tipo-desc  { font-size: .67rem; color: #6b7280; line-height: 1.35; }

/* Campos del form ──────────────────────────────────── */
.act-form-group { margin-bottom: .75rem; }
.act-form-group:last-child { margin-bottom: 0; }

.act-form-input,
.act-form-textarea {
    width: 100%;
    padding: .5rem .7rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 7px;
    font-size: .82rem;
    font-family: inherit;
    color: #1e293b;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}
.act-form-input:focus,
.act-form-textarea:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}

.act-form-textarea { resize: vertical; min-height: 70px; }

.act-form-hint {
    font-size: .71rem;
    color: #94a3b8;
    margin-top: .25rem;
}

/* Campos específicos – video ────────────────────────── */
.act-video-preview {
    margin-top: .6rem;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    aspect-ratio: 16/9;
    display: none;
}
.act-video-preview iframe {
    width: 100%; height: 100%;
    border: none; display: block;
}

/* Campos específicos – quiz ─────────────────────────── */
.act-quiz-list { display: flex; flex-direction: column; gap: .75rem; }

.act-quiz-pregunta {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: .75rem;
    position: relative;
}

.act-quiz-pregunta-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .5rem;
}
.act-quiz-num {
    font-size: .7rem;
    font-weight: 700;
    color: #8b5cf6;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.act-quiz-del-btn {
    width: 22px; height: 22px;
    border: none; background: none;
    color: #94a3b8; cursor: pointer;
    border-radius: 4px; display: flex;
    align-items: center; justify-content: center;
    transition: background .12s, color .12s;
}
.act-quiz-del-btn:hover { background: #fee2e2; color: #dc2626; }

.act-quiz-opciones { display: flex; flex-direction: column; gap: .35rem; margin-top: .45rem; }

.act-quiz-opcion {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .55rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    transition: border-color .12s;
}
.act-quiz-opcion:has(input[type="radio"]:checked) {
    border-color: #8b5cf6;
    background: #faf5ff;
}

.act-quiz-opcion-radio { cursor: pointer; accent-color: #8b5cf6; flex-shrink: 0; }
.act-quiz-opcion-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: .78rem;
    background: transparent;
    color: #1e293b;
    font-family: inherit;
}
.act-quiz-opcion-label { font-size: .72rem; font-weight: 700; color: #94a3b8; flex-shrink: 0; }

.act-btn-add-pregunta {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .77rem;
    font-weight: 600;
    color: #8b5cf6;
    background: #faf5ff;
    border: 1.5px dashed #ddd6fe;
    border-radius: 7px;
    padding: .5rem .9rem;
    cursor: pointer;
    width: 100%;
    justify-content: center;
    margin-top: .25rem;
    transition: background .15s, border-color .15s;
}
.act-btn-add-pregunta:hover { background: #f5f3ff; border-color: #8b5cf6; border-style: solid; }

/* Botones del form ─────────────────────────────────── */
.act-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: .6rem;
    margin-top: .9rem;
    padding-top: .75rem;
    border-top: 1px solid #f1f5f9;
}

.act-btn {
    padding: .45rem .9rem;
    border-radius: 7px;
    font-size: .8rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}

.act-btn-ghost {
    background: #fff;
    border-color: #e2e8f0;
    color: #475569;
}
.act-btn-ghost:hover { background: #f1f5f9; border-color: #cbd5e1; }

.act-btn-primary {
    background: #4f46e5;
    color: #fff;
    border-color: #4f46e5;
}
.act-btn-primary:hover { background: #4338ca; border-color: #4338ca; box-shadow: 0 2px 8px rgba(79,70,229,.3); }
.act-btn-primary:disabled { opacity: .55; cursor: not-allowed; }

/* Estado vacío dentro de un momento ─────────────────── */
.act-momento-empty {
    font-size: .78rem;
    color: #94a3b8;
    text-align: center;
    padding: .35rem 0 .1rem;
    font-style: italic;
}

/* Botón de actvidades en fila de módulo ─────────────── */
.modulo-btn-icon.activities { color: #4f46e5; }
.modulo-btn-icon.activities:hover { background: #eef2ff; color: #3730a3; }

/* ── Dark mode ────────────────────────────────────────────────────────────── */
html[data-theme="dark"] .act-modal {
    background: #1e293b;
    color: #e2e8f0;
}

html[data-theme="dark"] .act-modal-nav {
    background: #0f172a;
    border-color: #334155;
}

html[data-theme="dark"] .act-nav-back { color: #94a3b8; }
html[data-theme="dark"] .act-nav-back:hover { background: #334155; color: #e2e8f0; }
html[data-theme="dark"] .act-nav-title { color: #64748b; }
html[data-theme="dark"] .act-nav-close { background: #334155; color: #94a3b8; }
html[data-theme="dark"] .act-nav-close:hover { background: #475569; color: #e2e8f0; }

html[data-theme="dark"] .act-module-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-color: #334155;
}
html[data-theme="dark"] .act-module-hero-icon { background: #312e81; }
html[data-theme="dark"] .act-module-title  { color: #f1f5f9; }
html[data-theme="dark"] .act-module-subtitle { color: #94a3b8; }

html[data-theme="dark"] .act-momento--preparacion { --momento-light: #0f1a2e; --momento-border: #1e3a5f; }
html[data-theme="dark"] .act-momento--absorcion   { --momento-light: #0a1f1a; --momento-border: #14532d; }
html[data-theme="dark"] .act-momento--practica    { --momento-light: #160b2e; --momento-border: #3b1f6e; }
html[data-theme="dark"] .act-momento--cierre      { --momento-light: #1c1306; --momento-border: #713f12; }

html[data-theme="dark"] .act-momento-guia { color: #94a3b8; }
html[data-theme="dark"] .act-tipo-chip { background: rgba(255,255,255,.05); }

html[data-theme="dark"] .act-card {
    background: #1e293b;
    border-color: #334155;
}
html[data-theme="dark"] .act-card:hover { border-color: #475569; box-shadow: 0 3px 10px rgba(0,0,0,.3); }
html[data-theme="dark"] .act-card-titulo { color: #f1f5f9; }
html[data-theme="dark"] .act-card-tipo   { color: #94a3b8; background: rgba(255,255,255,.06); }
html[data-theme="dark"] .act-card-btn {
    background: transparent;
    border-color: #334155;
    color: #64748b;
}
html[data-theme="dark"] .act-card-btn:hover { background: #0f172a; border-color: #475569; color: #e2e8f0; }
html[data-theme="dark"] .act-card-btn--danger:hover { background: #3f0f0f; border-color: #7f1d1d; color: #fca5a5; }

html[data-theme="dark"] .act-form-wrapper {
    background: #1e293b;
    border-color: var(--momento-color, #4f46e5);
}
html[data-theme="dark"] .act-form-head {
    background: rgba(0,0,0,.25);
    border-color: #334155;
}
html[data-theme="dark"] .act-form-head-title { color: var(--momento-color, #a5b4fc); }
html[data-theme="dark"] .act-form-close { color: #64748b; }
html[data-theme="dark"] .act-form-close:hover { background: #334155; color: #cbd5e1; }

html[data-theme="dark"] .act-form-label { color: #94a3b8; }
html[data-theme="dark"] .act-form-input,
html[data-theme="dark"] .act-form-textarea {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}
html[data-theme="dark"] .act-form-input:focus,
html[data-theme="dark"] .act-form-textarea:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
html[data-theme="dark"] .act-form-hint { color: #64748b; }

html[data-theme="dark"] .act-tipo-card {
    background: #0f172a;
    border-color: #334155;
}
html[data-theme="dark"] .act-tipo-card:hover { background: #1e293b; border-color: #475569; }
html[data-theme="dark"] .act-tipo-label { color: #e2e8f0; }
html[data-theme="dark"] .act-tipo-desc  { color: #64748b; }
html[data-theme="dark"] .act-tipo-card.selected {
    background: rgba(99,102,241,.1);
}

html[data-theme="dark"] .act-quiz-pregunta {
    background: #0f172a;
    border-color: #334155;
}
html[data-theme="dark"] .act-quiz-opcion {
    background: #1e293b;
    border-color: #334155;
}
html[data-theme="dark"] .act-quiz-opcion:has(input[type="radio"]:checked) {
    background: #160b2e;
    border-color: #8b5cf6;
}
html[data-theme="dark"] .act-quiz-opcion-input { color: #e2e8f0; }
html[data-theme="dark"] .act-quiz-opcion-label { color: #64748b; }

html[data-theme="dark"] .act-btn-add-pregunta {
    background: rgba(139,92,246,.08);
    border-color: #4c1d95;
    color: #a78bfa;
}
html[data-theme="dark"] .act-btn-add-pregunta:hover {
    background: rgba(139,92,246,.15);
    border-color: #8b5cf6;
}

html[data-theme="dark"] .act-form-actions { border-color: #334155; }
html[data-theme="dark"] .act-btn-ghost {
    background: #0f172a;
    border-color: #334155;
    color: #94a3b8;
}
html[data-theme="dark"] .act-btn-ghost:hover { background: #1e293b; border-color: #475569; }

html[data-theme="dark"] .act-btn-add {
    background: rgba(255,255,255,.04);
    border-color: var(--momento-border);
    color: var(--momento-color);
}
html[data-theme="dark"] .act-btn-add:hover { background: rgba(255,255,255,.08); }

html[data-theme="dark"] .act-momento-empty { color: #64748b; }
html[data-theme="dark"] .act-loading { color: #64748b; }

html[data-theme="dark"] .act-card-estado--activo   { background: #14532d33; color: #86efac; }
html[data-theme="dark"] .act-card-estado--inactivo { background: #1e293b;   color: #64748b; }

@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) .act-modal {
        background: #1e293b; color: #e2e8f0;
    }
}

/* ── Form UI: pares (matching/crossword/sentence_builder) ─────────────────── */
.act-pairs-list, .act-sb-list, .act-cw-list { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .5rem; }
.act-pair-row {
    display: flex;
    align-items: center;
    gap: .4rem;
}
.act-pair-arrow {
    font-size: .9rem;
    color: #94a3b8;
    flex-shrink: 0;
}
.act-cloze-form-preview {
    margin-top: .3rem;
}

/* ── Dark mode additions ──────────────────────────────────────────────────── */
html[data-theme="dark"] .act-pair-arrow { color: #475569; }
