/* =================================================================
   Escuela PIB 2 — Sistema de diseño
   Paleta: madera cálida del templo (roble/nogal + dorado + crema).
   Mobile-first. Contraste WCAG AA.
   Inspirada en la foto del santuario: paneles de roble medio,
   púlpito de madera oscura, asientos crema, acentos dorados.
   ================================================================= */

:root {
    /* Marca — familia madera del templo */
    --brand-primary:        #8B5A2B;   /* roble medio cálido */
    --brand-primary-dark:   #5C3A1E;   /* nogal oscuro (púlpito) */
    --brand-primary-light:  #B5824A;   /* madera clara miel */
    --brand-accent:         #B68A3E;   /* dorado envejecido */
    --brand-accent-dark:    #8B6914;   /* dorado profundo */
    --brand-accent-light:   #D9B85C;   /* dorado claro */
    --brand-gold:           #C9A24A;
    --brand-cream:          #F5EFE0;   /* crema cálida (asientos) */
    --brand-vino:           #6B1F1F;   /* granate austero (acento serio) */

    /* Superficies */
    --surface:              #FDFAF2;   /* crema muy suave (papel viejo) */
    --surface-alt:          #F0E6D0;   /* crema más oscuro */
    --surface-edge:         #D9C8A8;   /* borde madera suave */
    --surface-elevated:     #FFFDF7;

    /* Texto */
    --text:                 #2B1A0E;   /* marrón muy oscuro (casi negro cálido) */
    --text-muted:           #6B4F2E;   /* marrón medio */
    --text-soft:            #9C7E58;   /* marrón claro */
    --text-inverse:         #FDFAF2;   /* crema sobre madera oscura */

    /* Estados (se mantienen, ya son estándar) */
    --success:              #4F7A3F;   /* verde olivo (coherente con templo) */
    --success-soft:         #E8EFD9;
    --warning:              #B5811A;
    --warning-soft:         #F8ECCB;
    --danger:               #8B2C2C;   /* vino (en vez de rojo brillante) */
    --danger-soft:          #F1D8D8;
    --info:                 #5A6B7A;   /* azul grisáceo sobrio */
    --info-soft:            #DEE3E8;

    /* Sombra (tinte madera en vez de azul) */
    --shadow-sm:  0 1px 2px 0 rgba(60, 36, 16, 0.08);
    --shadow:     0 4px 14px -2px rgba(60, 36, 16, 0.12), 0 2px 4px -2px rgba(60, 36, 16, 0.06);
    --shadow-lg:  0 20px 40px -12px rgba(60, 36, 16, 0.22);

    /* Radios */
    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 16px;
    --radius-xl: 22px;
    --radius-full: 9999px;

    /* Tipografía */
    --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-display: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;

    /* Espaciado */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Transiciones */
    --t-fast: 150ms cubic-bezier(.4, 0, .2, 1);
    --t-base: 250ms cubic-bezier(.4, 0, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { margin: 0; font-family: var(--font-sans); color: var(--text); background: var(--surface-alt); line-height: 1.55; }
img, svg, video { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
a { color: var(--brand-primary); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--brand-accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 3px solid var(--brand-accent-light);
    outline-offset: 2px;
    border-radius: 4px;
}

.container { width: min(1200px, 100% - 32px); margin-inline: auto; }
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }
.app-main  { flex: 1; padding-block: var(--space-8); }

/* Topbar */
.topbar {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-accent) 100%);
    color: var(--text-inverse);
    padding-block: var(--space-3);
    box-shadow: var(--shadow);
    position: sticky; top: 0; z-index: 50;
}
.topbar .container { display: flex; align-items: center; gap: var(--space-6); flex-wrap: wrap; }
.topbar-brand { display: flex; align-items: center; gap: var(--space-3); color: var(--text-inverse); font-weight: 700; font-family: var(--font-display); font-size: 1.1rem; }
.topbar-brand:hover { color: var(--text-inverse); opacity: 0.9; }
.topbar-brand .logo {
    width: 36px; height: 36px; border-radius: var(--radius);
    background: rgba(255,255,255,0.15);
    display: grid; place-items: center; font-size: 18px;
    border: 1px solid rgba(255,255,255,0.20);
}
.topbar-nav { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; flex-wrap: wrap; }
.topbar-nav a {
    color: rgba(255,255,255,0.85);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.95rem;
    transition: background var(--t-fast), color var(--t-fast);
}
.topbar-nav a:hover { background: rgba(255,255,255,0.10); color: var(--text-inverse); }
.topbar-nav a.active { background: rgba(255,255,255,0.18); color: var(--text-inverse); }
.topbar-cta { background: var(--brand-gold); color: var(--text); padding: 8px 16px; border-radius: var(--radius); font-weight: 600; border: 0; }
.topbar-cta:hover { background: #e6c14a; color: var(--text); }

/* Botones */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    background: var(--brand-primary);
    color: var(--text-inverse);
    transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { background: var(--brand-primary-dark); color: var(--text-inverse); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn[disabled], .btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-secondary { background: var(--surface-elevated); color: var(--brand-primary); border-color: var(--brand-primary); }
.btn-secondary:hover { background: var(--brand-primary); color: var(--text-inverse); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--surface-alt); color: var(--text); }
.btn-accent { background: var(--brand-accent); }
.btn-accent:hover { background: var(--brand-accent-dark); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-lg { padding: 14px 24px; font-size: 1.05rem; }
.btn-block { display: flex; width: 100%; }

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--surface-edge);
    overflow: hidden;
}
.card:hover { box-shadow: var(--shadow); }
.card-body { padding: var(--space-6); }
.card-header { padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--surface-edge); background: var(--surface-alt); }
.card-footer { padding: var(--space-4) var(--space-6); border-top: 1px solid var(--surface-edge); background: var(--surface-alt); }

/* Formularios */
.form-grid { display: grid; gap: var(--space-4); }
.form-row { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width: 720px) {
    .form-row.cols-2 { grid-template-columns: 1fr 1fr; }
    .form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
}
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.form-field .help { font-size: 0.8rem; color: var(--text-muted); }
.form-field .error { font-size: 0.85rem; color: var(--danger); }
.form-field .req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
    width: 100%;
    padding: 10px 14px;
    font: inherit;
    background: var(--surface-elevated);
    border: 1px solid var(--surface-edge);
    border-radius: var(--radius);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input:focus, .select:focus, .textarea:focus {
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
    outline: none;
}
.textarea { min-height: 110px; resize: vertical; }

/* Badges */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--info-soft);
    color: var(--info);
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-accent  { background: var(--brand-cream); color: var(--brand-accent-dark); }

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--surface-edge);
    background: var(--info-soft);
    color: var(--info);
    margin-bottom: var(--space-4);
    display: flex; align-items: flex-start; gap: 10px;
}
.alert-success { background: var(--success-soft); color: var(--success); border-color: #bbf7d0; }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: #fde68a; }
.alert-danger  { background: var(--danger-soft);  color: var(--danger);  border-color: #fecaca; }
.alert .ico { font-size: 18px; line-height: 1; }

/* Tooltip CSS-only fallback */
[data-bs-tooltip] { position: relative; }
[data-bs-tooltip]:focus::after,
[data-bs-tooltip]:hover::after {
    content: attr(data-bs-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: var(--text-inverse);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    max-width: 280px;
    width: max-content;
    text-align: left;
    line-height: 1.4;
    z-index: 1000;
    box-shadow: var(--shadow);
    pointer-events: none;
    white-space: pre-wrap;
}
[data-bs-tooltip]:focus::before,
[data-bs-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--text);
    z-index: 1000;
}
[data-bs-tooltip-placement="bottom"]:focus::after,
[data-bs-tooltip-placement="bottom"]:hover::after {
    bottom: auto; top: calc(100% + 8px);
}
[data-bs-tooltip-placement="bottom"]:focus::before,
[data-bs-tooltip-placement="bottom"]:hover::before {
    bottom: auto; top: calc(100% + 2px);
    border-top-color: transparent; border-bottom-color: var(--text);
}

/* Tablas */
.table { width: 100%; border-collapse: collapse; background: var(--surface-elevated); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: 12px 16px; text-align: left; }
.table thead th { background: var(--surface-alt); color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.table tbody tr { border-top: 1px solid var(--surface-edge); }
.table tbody tr:hover { background: #fafbff; }

/* Stats grid */
.stat-grid { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width: 720px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card { background: var(--surface-elevated); border-radius: var(--radius-lg); padding: var(--space-5); border: 1px solid var(--surface-edge); position: relative; overflow: hidden; }
.stat-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(180deg, var(--brand-primary), var(--brand-accent)); }
.stat-card .label { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card .value { font-size: 2rem; font-weight: 700; font-family: var(--font-display); margin-top: 4px; }
.stat-card .delta { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

/* Resource cards */
.resource-grid { display: grid; gap: var(--space-5); grid-template-columns: 1fr; }
@media (min-width: 720px) { .resource-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .resource-grid { grid-template-columns: repeat(3, 1fr); } }
.resource-card { display: flex; flex-direction: column; background: var(--surface-elevated); border-radius: var(--radius-lg); border: 1px solid var(--surface-edge); overflow: hidden; transition: transform var(--t-base), box-shadow var(--t-base); }
.resource-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.resource-card .icon-bar { padding: var(--space-5); background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-accent) 100%); color: var(--text-inverse); display: flex; align-items: center; gap: 10px; }
.resource-card .icon-bar .ico { font-size: 22px; }
.resource-card .icon-bar .type { font-weight: 600; }
.resource-card .body { padding: var(--space-5); flex: 1; display: flex; flex-direction: column; gap: var(--space-2); }
.resource-card .body h3 { margin: 0; font-size: 1.05rem; font-family: var(--font-display); }
.resource-card .body p { color: var(--text-muted); font-size: 0.9rem; margin: 0; }
.resource-card .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.resource-card .footer { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--surface-edge); display: flex; gap: 8px; justify-content: space-between; align-items: center; }

/* Modal bíblico */
.dialog-backdrop {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center; justify-content: center;
    z-index: 200;
    padding: var(--space-4);
}
.dialog-backdrop.is-open { display: flex; }
.dialog {
    background: var(--surface-elevated);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    max-width: 640px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: dialog-in 200ms cubic-bezier(.4, 0, .2, 1);
}
@keyframes dialog-in {
    from { transform: translateY(8px) scale(0.98); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}
.dialog header { padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--surface-edge); display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.dialog header h2 { margin: 0; font-size: 1.1rem; font-family: var(--font-display); }
.dialog .body { padding: var(--space-6); overflow-y: auto; }
.dialog .body p { margin: 0 0 var(--space-3) 0; line-height: 1.7; }
.dialog .body .verse-num { font-weight: 700; color: var(--brand-accent); font-size: 0.75em; vertical-align: super; margin-right: 2px; }
.dialog .body .ref-title { font-weight: 700; color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: var(--space-3); }
.dialog .dialog-footer { padding: var(--space-3) var(--space-6); border-top: 1px solid var(--surface-edge); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-alt); }
.dialog .close-x { background: transparent; border: 0; font-size: 24px; line-height: 1; color: var(--text-muted); padding: 4px 8px; border-radius: 6px; cursor: pointer; }
.dialog .close-x:hover { background: var(--surface-edge); color: var(--text); }

/* Empty / loading states */
.state { padding: var(--space-12); text-align: center; color: var(--text-muted); background: var(--surface-elevated); border: 1px dashed var(--surface-edge); border-radius: var(--radius-lg); }
.state .ico { font-size: 36px; margin-bottom: var(--space-3); }
.state h3 { margin: 0 0 6px 0; font-size: 1.1rem; color: var(--text); }
.state p { margin: 0 0 var(--space-3) 0; }
.spinner { width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--surface-edge); border-top-color: var(--brand-accent); animation: spin 700ms linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Hero */
.hero {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-accent) 100%);
    color: var(--text-inverse);
    padding: var(--space-16) 0;
    position: relative;
    overflow: hidden;
}
.hero::after {
    content: '';
    position: absolute; inset: 0;
    background-image: radial-gradient(circle at 20% 30%, rgba(255,255,255,0.10) 0, transparent 40%),
                      radial-gradient(circle at 80% 70%, rgba(255,255,255,0.10) 0, transparent 40%);
    pointer-events: none;
}
.hero h1 { font-family: var(--font-display); font-size: clamp(1.8rem, 4vw, 3rem); line-height: 1.1; margin: 0 0 var(--space-4) 0; }
.hero p { font-size: 1.1rem; max-width: 640px; margin: 0 0 var(--space-6) 0; opacity: 0.92; }
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* Footer */
.footer { background: var(--brand-primary-dark); color: rgba(255,255,255,0.85); padding: var(--space-8) 0; margin-top: var(--space-16); }
.footer a { color: rgba(255,255,255,0.95); }
.footer a:hover { color: var(--brand-gold); }
.footer .container { display: flex; flex-wrap: wrap; gap: var(--space-6); justify-content: space-between; }
.footer .meta { font-size: 0.85rem; opacity: 0.7; }

/* Utilidades */
.muted { color: var(--text-muted); }
.text-center { text-align: center; }
.flex { display: flex; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ===========================================================
   EDITOR DE BLOQUES (Módulo C9)
   =========================================================== */
.editor-bloques {
    background: var(--surface);
    border: 1px solid var(--surface-edge);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    display: flex; flex-direction: column; gap: var(--space-4);
}
.editor-bloques-header { display: flex; flex-direction: column; gap: 4px; padding-bottom: var(--space-3); border-bottom: 1px dashed var(--surface-edge); }
.editor-bloques-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.editor-bloques-vacio { padding: var(--space-6); text-align: center; background: var(--surface-alt); border-radius: var(--radius); }
.editor-bloques-add { display: flex; flex-wrap: wrap; gap: 8px; padding-top: var(--space-3); border-top: 1px dashed var(--surface-edge); align-items: center; }
.editor-bloques-add .muted { margin-right: 8px; }

.btn-chip {
    background: var(--surface-alt);
    color: var(--text);
    border: 1px solid var(--surface-edge);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.btn-chip:hover { background: var(--brand-primary); color: var(--text-inverse); border-color: var(--brand-primary); transform: translateY(-1px); }
.btn-chip:active { transform: translateY(0); }

.editor-bloque {
    background: var(--surface-alt);
    border: 1px solid var(--surface-edge);
    border-radius: var(--radius);
    padding: var(--space-3);
    display: flex; flex-direction: column; gap: var(--space-3);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.editor-bloque.dragging { opacity: 0.5; border-style: dashed; }
.editor-bloque.drag-over { border-color: var(--brand-accent); box-shadow: 0 0 0 3px rgba(124,58,237,0.15); }
.editor-bloque-header { display: flex; align-items: center; gap: var(--space-3); }
.editor-bloque-handle { cursor: grab; color: var(--text-muted); font-size: 1.1rem; user-select: none; padding: 0 4px; }
.editor-bloque-handle:active { cursor: grabbing; }
.editor-bloque-tipo { font-weight: 600; flex: 1; }
.editor-bloque-acciones { display: flex; gap: 4px; }
.iconbtn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    width: 28px; height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background var(--t-fast), color var(--t-fast);
}
.iconbtn:hover { background: var(--surface); color: var(--text); }
.iconbtn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.editor-bloque-body { display: flex; flex-direction: column; gap: var(--space-2); }
.editor-bloque-body label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
.editor-bloque-body .input.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; }

/* Render de bloques (vista alumno) */
.bloque-texto { line-height: 1.7; }
.bloque-texto p { margin: 0 0 var(--space-3) 0; }
.bloque-texto p:last-child { margin-bottom: 0; }
.bloque-texto strong { font-weight: 700; }
.bloque-texto em { font-style: italic; }
.bloque-texto a[data-bible-ref] { color: var(--brand-accent); border-bottom: 1px dotted var(--brand-accent); }
.bloque-texto a[data-bible-ref]:hover { color: var(--brand-accent-dark); border-bottom-style: solid; }

.bloque-imagen { margin: var(--space-4) 0; text-align: center; }
.bloque-imagen.align-left { text-align: left; }
.bloque-imagen.align-right { text-align: right; }
.bloque-imagen img { max-width: 100%; height: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
.bloque-imagen figcaption { font-size: 0.85rem; color: var(--text-muted); margin-top: 8px; font-style: italic; }

.bloque-video { margin: var(--space-4) 0; }
.bloque-video video { max-width: 100%; border-radius: var(--radius); }
.bloque-video figcaption { font-size: 0.85rem; color: var(--text-muted); margin-top: 8px; text-align: center; }

.bloque-cita {
    margin: var(--space-4) 0;
    padding: var(--space-3) var(--space-5);
    border-left: 4px solid var(--brand-accent);
    background: linear-gradient(90deg, rgba(124,58,237,0.05) 0%, transparent 100%);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
}
.bloque-cita p { margin: 0 0 var(--space-2) 0; font-size: 1.05rem; }
.bloque-cita cite { font-size: 0.85rem; color: var(--text-muted); font-style: normal; font-weight: 600; }

.bloque-codigo {
    margin: var(--space-3) 0;
    background: var(--brand-primary-dark);
    color: var(--brand-cream);
    padding: var(--space-4);
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.5;
}
.bloque-codigo code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.bloque-biblia {
    margin: var(--space-4) 0;
    border: 1px solid var(--brand-accent-light);
    background: linear-gradient(135deg, rgba(124,58,237,0.03) 0%, rgba(99,102,241,0.05) 100%);
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-4);
}
.bloque-biblia header { margin-bottom: var(--space-2); padding-bottom: var(--space-2); border-bottom: 1px dashed var(--brand-accent-light); }
.bloque-biblia-texto p { margin: 0 0 var(--space-2) 0; line-height: 1.6; }
.bloque-biblia-texto .verse-num { font-weight: 700; color: var(--brand-accent); font-size: 0.75em; vertical-align: super; margin-right: 2px; }

.bloque-lista { margin: var(--space-3) 0; padding-left: var(--space-6); }
.bloque-lista li { margin-bottom: 4px; line-height: 1.6; }

.bloque-separador { border: 0; border-top: 1px dashed var(--surface-edge); margin: var(--space-6) auto; max-width: 200px; }

/* ===========================================================
   HILO DE COMENTARIOS (Módulo C10)
   =========================================================== */
.comentarios-hilo-header { padding-bottom: var(--space-3); border-bottom: 1px dashed var(--surface-edge); }
.comentarios-form textarea { min-height: 90px; resize: vertical; }
.comentarios-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.comentarios-vacio { padding: var(--space-6); text-align: center; background: var(--surface-alt); border-radius: var(--radius); }
.comentario {
    background: var(--surface);
    border: 1px solid var(--surface-edge);
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-4);
    transition: border-color var(--t-fast);
}
.comentario:hover { border-color: var(--brand-accent-light); }
.comentario-header { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.comentario-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-accent) 100%);
    color: var(--text-inverse);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    flex-shrink: 0;
}
.comentario-autor { display: inline-flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.comentario-autor strong { color: var(--text); }
.comentario-fecha { font-size: 0.8rem; }
.comentario-editado { font-size: 0.75rem; font-style: italic; margin-left: 4px; }
.comentario-cuerpo { margin: var(--space-2) 0 0 40px; line-height: 1.55; color: var(--text); word-wrap: break-word; }
.comentario-cuerpo a { color: var(--brand-accent); text-decoration: underline; }
.comentario-cuerpo a:hover { color: var(--brand-accent-dark); }
.comentario-acciones { margin: var(--space-2) 0 0 40px; display: flex; gap: var(--space-3); align-items: center; }
.comentario-acciones summary { cursor: pointer; font-size: 0.85rem; }
.comentario-acciones summary:hover { color: var(--brand-accent); }
.comentario-editar-form textarea { min-height: 70px; }
.comentario-eliminar {
    background: transparent; border: 0; color: var(--text-muted);
    font-size: 0.85rem; cursor: pointer; padding: 0;
    text-decoration: underline;
    transition: color var(--t-fast);
}
.comentario-eliminar:hover { color: var(--danger); }
.badge-muted { background: var(--surface-alt); color: var(--text-muted); }

/* ===========================================================
   NOTIFICACIONES (Módulo C11)
   =========================================================== */
.topbar-notif { position: relative; padding: 8px 10px !important; font-size: 1.1rem; }
.notif-badge {
    position: absolute;
    top: 0; right: -4px;
    background: var(--danger);
    color: var(--text-inverse);
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    line-height: 1;
    box-shadow: 0 0 0 2px var(--brand-primary);
}
.btn-chip-active { background: var(--brand-primary); color: var(--text-inverse); border-color: var(--brand-primary); }

.notifs-header { padding-bottom: var(--space-3); border-bottom: 1px dashed var(--surface-edge); }
.notifs-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.notifs-vacio { padding: var(--space-8) 0; }
.notif {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    gap: var(--space-3);
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--surface-edge);
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-4);
    transition: border-color var(--t-fast), background var(--t-fast);
}
.notif:hover { border-color: var(--brand-accent-light); }
.notif-nueva { background: linear-gradient(90deg, rgba(124,58,237,0.05) 0%, transparent 50%); border-left: 3px solid var(--brand-accent); }
.notif-leida { opacity: 0.7; }
.notif-ico { font-size: 1.4rem; text-align: center; }
.notif-titulo { display: block; color: var(--text); }
.notif-contenido { font-size: 0.85rem; margin-top: 4px; }
.notif-fecha { display: block; font-size: 0.75rem; margin-top: 4px; }
.notif-acciones { display: flex; gap: 6px; flex-wrap: wrap; }

/* ===========================================================
   TAREAS / EVALUACIONES (Módulo C12)
   =========================================================== */
.tareas-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.tarea {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--space-3);
    align-items: center;
    background: var(--surface-elevated);
    border: 1px solid var(--surface-edge);
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-4);
    transition: border-color var(--t-fast);
}
.tarea:hover { border-color: var(--brand-accent-light); }
.tarea-info h3 a { color: var(--text); }
.tarea-info h3 a:hover { color: var(--brand-primary); }
.tarea-meta { font-size: 0.85rem; margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tarea-stats { display: flex; align-items: center; gap: var(--space-2); }

.entregas-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.entrega {
    background: var(--surface-elevated);
    border: 1px solid var(--surface-edge);
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-4);
    transition: border-color var(--t-fast);
}
.entrega-pendiente { border-left: 3px solid var(--warning); }
.entrega-calificada { border-left: 3px solid var(--success); }
.entrega-header { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.entrega-header time { font-size: 0.8rem; }
.entrega-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-accent) 100%);
    color: var(--text-inverse);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    flex-shrink: 0;
}
.entrega-contenido {
    margin: var(--space-2) 0 0 36px;
    line-height: 1.55;
    color: var(--text);
    white-space: pre-wrap;
}
.entrega-retro {
    margin: var(--space-2) 0 0 36px;
    padding: var(--space-2) var(--space-3);
    background: var(--brand-cream);
    border-left: 3px solid var(--brand-accent);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 0.9rem;
}
.entrega-calificar summary { cursor: pointer; font-size: 0.85rem; display: inline-block; }

@media (max-width: 640px) {
    .topbar .container { gap: var(--space-3); }
    .topbar-nav { gap: 0; }
    .topbar-nav a { padding: 6px 8px; font-size: 0.85rem; }
}
