/* ============================================================
   CIBERAULA — Área Python
   Hoja de estilos compartida para todos los artículos
   Archivo: assets/css/estilos_python.css
   Versión: 1.4 — 7 marzo 2026
   Cambios v1.4: Sapientia bg más saturado (visible sobre blanco), SVG ficha fondo diferenciado
   Metodología: BEM (Block__Element--Modifier)
   ============================================================ */

/* ============================================
   CSS PYTHON v1.4 — Metodología BEM
   ============================================ */

:root {
    --color-primary: #306998;
    --color-primary-light: #4B8BBE;
    --color-primary-dark: #1A3A5C;
    --color-accent: #FFD43B;
    --color-accent-hover: #FFE873;
    --bg-page: #ECEEF1;
    --bg-content: #FFFFFF;
    --bg-sidebar: #0F172A;
    --bg-sidebar-hover: #1E293B;
    --bg-code: #0F172A;
    --bg-banner: linear-gradient(135deg, #1A3A5C 0%, #306998 50%, #4B8BBE 100%);
    --text-primary: #1A1A2E;
    --text-secondary: #4A5568;
    --text-muted: #718096;
    --text-sidebar: #CBD5E1;
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'DM Sans', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Consolas', monospace;
    --sidebar-width: 300px;
    --content-max: 1160px;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    --note-info-bg: #E3EFF7; --note-info-border: #306998;
    --note-tip-bg: #FFF8E1; --note-tip-border: #FFD43B;
    --note-warn-bg: #FEF9E7; --note-warn-border: #F39C12;
}
[data-theme="dark"] {
    --bg-page: #0B0F1A;
    --bg-content: #2B3F61;
    --text-primary: #E2E8F0;
    --text-secondary: #A0AEC0;
    --text-muted: #718096;
    --note-info-bg: #1A2744; --note-tip-bg: #1A3328; --note-warn-bg: #2D2A1A;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.4);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    font-size: 15.5px;
    line-height: 1.55;
    color: var(--text-primary);
    background: var(--bg-page);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-light); text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

/* === BANNER === */
.banner {
    background: var(--bg-banner);
    color: white;
    padding: 10px 24px;
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.banner__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
}
.banner__text { font-size: 13.5px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.banner__cta {
    background: var(--color-accent); color: #1A3A5C; padding: 6px 18px;
    border-radius: 20px; font-size: 13px; font-weight: 600; white-space: nowrap; transition: background 0.2s;
}
.banner__cta:hover { background: var(--color-accent-hover); color: white; text-decoration: none; }
.banner__close { background: none; border: none; color: rgba(255,255,255,0.7); font-size: 20px; cursor: pointer; padding: 4px 8px; line-height: 1; }
.banner__close:hover { color: white; }

/* === LAYOUT PRINCIPAL === */
.page-wrapper {
    max-width: var(--content-max);
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    min-height: 100vh;
    background: var(--bg-content);
    box-shadow: 0 0 40px rgba(0,0,0,0.06);
}
.page-wrapper > .banner {
    flex-basis: 100%;
}

/* === SIDEBAR === */
.sidebar {
    width: var(--sidebar-width); min-width: var(--sidebar-width);
    background: var(--bg-sidebar); color: var(--text-sidebar);
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    display: flex; flex-direction: column;
}
.sidebar__logo-block {
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar__logo-img {
    width: 100%;
    max-width: 268px;
    height: auto;
    border-radius: 10px;
    background: white;
    padding: 10px 16px;
    margin: 0 auto;
    display: block;
}
.sidebar__course-info {
    padding: 14px 20px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar__course-title {
    font-size: 20px; font-weight: 800; color: white; line-height: 1.2;
}
.sidebar__course-title span { display: block; font-size: 11px; font-weight: 500; color: var(--text-sidebar); margin-top: 4px; letter-spacing: 1px; text-transform: uppercase; }
.sidebar__progress { padding: 10px 20px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.sidebar__progress-bar { height: 4px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; }
.sidebar__progress-fill { height: 100%; width: 5%; background: linear-gradient(90deg, #4B8BBE, #306998); border-radius: 4px; transition: width 0.4s; }
.sidebar__progress-text { font-size: 11px; color: var(--text-muted); margin-top: 5px; text-align: right; }
.sidebar__nav { flex: 1; overflow-y: auto; padding: 6px 0; }
.sidebar__module { border-bottom: 1px solid rgba(255,255,255,0.04); }
.sidebar__module-header {
    display: flex; align-items: center; gap: 10px; padding: 10px 20px;
    cursor: pointer; transition: background 0.15s; font-size: 13px; font-weight: 600;
    color: var(--text-sidebar); user-select: none; background: none; border: none; width: 100%; text-align: left;
}
.sidebar__module-header:hover { background: var(--bg-sidebar-hover); }
.sidebar__module-icon { width: 26px; height: 26px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.sidebar__module-chevron { margin-left: auto; font-size: 10px; transition: transform 0.2s; color: var(--text-muted); }
.sidebar__module.is-open .sidebar__module-chevron { transform: rotate(90deg); }
.sidebar__lesson-list { display: none; padding: 0 0 6px; }
.sidebar__module.is-open .sidebar__lesson-list { display: block; }
.sidebar__lesson { display: block; padding: 5px 20px 5px 56px; font-size: 12.5px; color: var(--text-sidebar); transition: all 0.15s; line-height: 1.35; }
.sidebar__lesson:hover { background: var(--bg-sidebar-hover); color: white; text-decoration: none; }
.sidebar__lesson.is-active { color: white; font-weight: 600; background: rgba(75, 139, 190, 0.1); border-left: 3px solid #4B8BBE; padding-left: 53px; }
.sidebar__exercises { margin: 10px 16px; padding: 14px; background: linear-gradient(135deg, #1A3A5C, #306998); border-radius: var(--radius); text-align: center; }
.sidebar__exercises-icon { font-size: 24px; margin-bottom: 4px; }
.sidebar__exercises-title { color: white; font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.sidebar__exercises-desc { color: rgba(255,255,255,0.75); font-size: 11.5px; }
.sidebar__separator { border: none; border-top: 1px solid rgba(255,255,255,0.08); margin: 6px 20px; }
.sidebar__links { padding: 6px 20px 16px; }
.sidebar__links-heading { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.sidebar__link { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 12.5px; color: var(--text-sidebar); transition: color 0.15s; }
.sidebar__link:hover { color: white; text-decoration: none; }

/* === CONTENIDO === */
.content { flex: 1; min-width: 0; }
.breadcrumb { background: linear-gradient(135deg, #306998, #4B8BBE); padding: 12px 36px; font-size: 13px; color: rgba(255,255,255,0.7); }
.breadcrumb a { color: rgba(255,255,255,0.85); }
.breadcrumb a:hover { color: white; }
.breadcrumb__sep { margin: 0 8px; color: rgba(255,255,255,0.4); }
.content-header { background: linear-gradient(135deg, #E3EFF7, #C9DFF0); padding: 28px 36px 24px; border-bottom: 1px solid #9CC5E0; }
[data-theme="dark"] .content-header { background: linear-gradient(135deg, #1A2B3D, #1B3650); border-bottom-color: #4B8BBE; }
[data-theme="dark"] .content-header__meta { color: #C6D4E0; }
[data-theme="dark"] .content-header__meta-item { color: #C6D4E0; }
[data-theme="dark"] .content-header .rating-stars .star { color: #5A6B5E; }
[data-theme="dark"] .content-header .rating-stars .star.active { color: #FBBF24; }
[data-theme="dark"] .content-header__rating-text { color: #C6D4E0; }
.content-header__title { font-family: var(--font-display); font-size: 1.9rem; font-weight: 800; color: var(--color-primary-dark); line-height: 1.2; margin-bottom: 12px; }
[data-theme="dark"] .content-header__title { color: #9CC5E0; }
.content-header__meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--text-secondary); align-items: center; }
.content-header__meta-item { display: flex; align-items: center; gap: 4px; }
.content-header__stars { color: #F59E0B; letter-spacing: 1px; }

/* TOC */
.toc { background: var(--bg-content); border: 1px solid #E2E8F0; border-radius: var(--radius-lg); margin: 24px 36px; padding: 20px 24px; box-shadow: var(--shadow); }
[data-theme="dark"] .toc { background: #1E293B; border-color: #334155; }
.toc__title { font-size: 18px; font-weight: 800; color: var(--text-primary); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.toc__list { list-style: none; counter-reset: toc; }
.toc__item { counter-increment: toc; }
.toc__item a {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 0;
    font-size: 13.5px; color: var(--text-secondary); transition: color 0.15s;
    border-bottom: 1px solid rgba(0,0,0,0.03);
}
.toc__item a:hover { color: var(--color-primary); text-decoration: none; }
.toc__item a::before {
    content: counter(toc, decimal-leading-zero); font-size: 11px; font-weight: 700;
    color: var(--color-primary); background: #E3EFF7;
    width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
[data-theme="dark"] .toc__item a::before { background: #1A2B3D; }

/* Artículo */
.article { padding: 0 36px 36px; }
.article h2 { font-family: var(--font-display); font-size: 1.45rem; font-weight: 700; color: var(--color-primary-dark); margin: 32px 0 14px; padding-top: 18px; border-top: 1px solid #E2E8F0; line-height: 1.3; }
[data-theme="dark"] .article h2 { color: #7CB8D4; border-top-color: #334155; }
.article h3 { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); margin: 20px 0 10px; }
.article p { margin-bottom: 12px; color: var(--text-secondary); line-height: 1.5; }
.intro-text { font-size: 1.02rem; line-height: 1.6; color: var(--text-primary); }

/* Código */
.code-block { margin: 18px 0; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.code-block__header { background: #1E293B; padding: 7px 14px; display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: #94A3B8; }
.code-block__dots { display: flex; gap: 5px; }
.code-block__dots span { width: 9px; height: 9px; border-radius: 50%; }
.code-block__dots span:nth-child(1) { background: #EF4444; }
.code-block__dots span:nth-child(2) { background: #F59E0B; }
.code-block__dots span:nth-child(3) { background: #22C55E; }
.code-block__filename { margin-left: 8px; }
.code-block__body { background: var(--bg-code); padding: 16px 18px; overflow-x: auto; font-family: var(--font-mono); font-size: 13px; line-height: 1.55; color: #E2E8F0; }
.code-block__body .kw { color: #C792EA; } .code-block__body .fn { color: #82AAFF; }
.code-block__body .st { color: #C3E88D; } .code-block__body .cm { color: #546E7A; font-style: italic; }
.code-block__body .nb { color: #F78C6C; } .code-block__body .op { color: #89DDFF; } .code-block__body .ty { color: #FFCB6B; }

/* Notas */
.note { padding: 14px 18px; border-radius: var(--radius); margin: 18px 0; border-left: 4px solid; font-size: 13.5px; line-height: 1.45; }
.note--info { background: var(--note-info-bg); border-color: var(--note-info-border); }
.note--tip { background: var(--note-tip-bg); border-color: var(--note-tip-border); }
.note--warn { background: var(--note-warn-bg); border-color: var(--note-warn-border); }
.note__title { font-weight: 700; margin-bottom: 4px; }
/* Alias español para compatibilidad */
.nota { padding: 14px 18px; border-radius: var(--radius); margin: 18px 0; border-left: 4px solid; font-size: 13.5px; line-height: 1.45; }
.nota--tip { background: var(--note-tip-bg); border-color: var(--note-tip-border); }
.nota--warning { background: var(--note-warn-bg); border-color: var(--note-warn-border); }

/* Tablas */
.table-responsive { overflow-x: auto; }
.info-table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 13.5px; }
.info-table thead th { background: #F1F5F9; padding: 9px 12px; text-align: left; font-weight: 600; border-bottom: 2px solid #E2E8F0; color: var(--text-primary); }
[data-theme="dark"] .info-table thead th { background: #1E293B; border-bottom-color: #334155; }
.info-table tbody td { padding: 8px 12px; border-bottom: 1px solid #F1F5F9; color: var(--text-secondary); }
.info-table tbody tr:hover { background: #F8FAFC; }
[data-theme="dark"] .info-table tbody tr:hover { background: #1E293B; }

/* Tablas HTML nativas (sin clase) dentro de .article */
.article table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 13.5px; }
.article table thead th { background: #F1F5F9; padding: 9px 12px; text-align: left; font-weight: 600; border-bottom: 2px solid #E2E8F0; color: var(--text-primary); }
[data-theme="dark"] .article table thead th { background: #1E293B; border-bottom-color: #334155; color: #E2E8F0; }
.article table tbody td { padding: 8px 12px; border-bottom: 1px solid #F1F5F9; color: var(--text-secondary); }
[data-theme="dark"] .article table tbody td { border-bottom-color: #334155; color: #A0AEC0; }
.article table tbody tr:hover { background: #F8FAFC; }
[data-theme="dark"] .article table tbody tr:hover { background: #1E293B; }

/* ============================================================
   FIGURAS E IMÁGENES DE ARTÍCULO
   ============================================================ */
.article-figure {
    margin: 24px 0;
    text-align: left;
    display: inline-block;
    max-width: 100%;
}
.article-figure__img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
    display: block;
}
.article-figure__caption {
    margin-top: 8px;
    font-size: 12.5px;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.4;
    text-align: left;
    max-width: inherit;
}
.article-figure--small {
    max-width: 480px;
}
.article-figure--small .article-figure__img {
    max-width: 480px;
}
.article-figure--medium {
    max-width: 680px;
}
.article-figure--medium .article-figure__img {
    max-width: 680px;
}
[data-theme="dark"] .article-figure__img {
    box-shadow: 0 2px 8px rgba(0,0,0,0.30);
}

/* ─────────────────────────────────────────────────────────────
   D26 — SVG infografías: fondo adaptativo por tema
   ───────────────────────────────────────────────────────────── */
.article-figure--svgblock {
    display: block;
    max-width: 100%;
}
.article-figure--svgblock .article-figure__img {
    background: #FFFFFF;
    border: 1px solid #D1E0EC;
    border-radius: var(--radius-lg);
    padding: 6px;
    box-shadow: 0 2px 12px rgba(48, 105, 152, 0.08);
}
[data-theme="dark"] .article-figure--svgblock .article-figure__img {
    background: #1E293B;
    border: 2px solid #334155;
    padding: 6px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

/* ─────────────────────────────────────────────────────────────
   D25 (v2) — SAPIENTIA con medallón del sabio
   Estructura HTML:
   <div class="sapientia">
     <div class="sapientia__medallon">
       <img src="...retrato/ciceron.svg" alt="Cicerón">
     </div>
     <div class="sapientia__cuerpo">
       <div class="sapientia__cita">Festina lente</div>
       <div class="sapientia__traduccion">«Apresúrate despacio»</div>
       <div class="sapientia__autor">Augusto · s. I a.C.</div>
       <div class="sapientia__consejo">Consejo aplicado...</div>
     </div>
   </div>
   ───────────────────────────────────────────────────────────── */
.sapientia {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    /* v1.4: gradiente más saturado — visible sobre fondo blanco */
    background: linear-gradient(135deg, #FFFBEC 0%, #FEF3C7 55%, #FDE8A0 100%);
    border: 1px solid rgba(201,162,39,0.45);
    border-left: 4px solid #C9A227;
    border-radius: 0 14px 14px 0;
    padding: 22px 26px 20px 22px;
    margin: 32px 0;
    position: relative;
    box-shadow: 0 3px 16px rgba(201,162,39,0.18), inset 0 1px 0 rgba(255,255,255,0.7);
}
[data-theme="dark"] .sapientia {
    background: linear-gradient(135deg, #1E1A08 0%, #231E09 60%, #2A2408 100%);
    border-color: rgba(184,150,12,0.2);
    border-left-color: #B8960C;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
/* Emblema ⚜ flotante sobre el borde */
.sapientia::before {
    content: "⚜";
    position: absolute;
    top: -14px;
    left: 18px;
    font-size: 20px;
    color: #C9A227;
    background: #FFFBEC;
    padding: 0 6px;
    line-height: 1;
}
[data-theme="dark"] .sapientia::before {
    background: #1E1A08;
    color: #D4A827;
}

/* Medallón lateral */
.sapientia__medallon {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow:
        0 0 0 2px rgba(201,162,39,0.4),
        0 0 0 4px rgba(201,162,39,0.15),
        0 3px 10px rgba(0,0,0,0.15);
    background: #C9A227;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 4px;
}
[data-theme="dark"] .sapientia__medallon {
    box-shadow:
        0 0 0 2px rgba(184,150,12,0.5),
        0 0 0 4px rgba(184,150,12,0.2),
        0 3px 10px rgba(0,0,0,0.4);
}
.sapientia__medallon img {
    width: 72px;
    height: 72px;
    display: block;
    border-radius: 50%;
}

/* Cuerpo del texto */
.sapientia__cuerpo {
    flex: 1;
    min-width: 0;
}
.sapientia__cita {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.3rem;
    font-style: italic;
    font-weight: 700;
    color: #7A5B10;
    letter-spacing: 0.3px;
    margin-bottom: 3px;
    line-height: 1.3;
}
[data-theme="dark"] .sapientia__cita {
    color: #E0B020;
}
.sapientia__traduccion {
    font-family: Georgia, serif;
    font-size: 0.9rem;
    font-style: italic;
    color: #5C4A1A;
    margin-bottom: 8px;
}
[data-theme="dark"] .sapientia__traduccion {
    color: #C0A060;
}
.sapientia__autor {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    font-weight: 700;
    color: #8B6914;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    margin-bottom: 12px;
    background: rgba(201,162,39,0.15);
    padding: 3px 10px 3px 8px;
    border-radius: 20px;
    border: 1px solid rgba(201,162,39,0.35);
}
[data-theme="dark"] .sapientia__autor {
    color: #C9A227;
    background: rgba(201,162,39,0.08);
    border-color: rgba(201,162,39,0.2);
}
.sapientia__autor::before {
    content: "𝄖";
    font-size: 14px;
    color: #C9A227;
    opacity: 0.7;
}
.sapientia__consejo {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.55;
    border-top: 1px solid rgba(201,162,39,0.3);
    padding-top: 10px;
}
[data-theme="dark"] .sapientia__consejo {
    color: #A0AEC0;
    border-top-color: rgba(184,150,12,0.25);
}

/* Responsive: medallón encima en móvil */
@media (max-width: 575px) {
    .sapientia {
        flex-direction: column;
        align-items: flex-start;
        padding: 18px 16px 16px;
    }
    .sapientia__medallon {
        width: 56px;
        height: 56px;
        margin-top: 6px;
    }
    .sapientia__medallon img { width: 56px; height: 56px; }
    .sapientia__cita { font-size: 1.1rem; }
}

/* FAQ */
.faq-section { margin: 28px 0; }
.faq-section__title { font-size: 1.25rem; font-weight: 700; margin-bottom: 12px; color: var(--text-primary); }
.faq-item { border: 1px solid #E2E8F0; border-radius: var(--radius); margin-bottom: 6px; overflow: hidden; }
[data-theme="dark"] .faq-item, body.dark-mode .faq-item { border-color: #334155; }
.faq-item__question {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px;
    cursor: pointer; font-weight: 600; font-size: 13.5px;
    background: none; border: none; width: 100%; text-align: left; color: var(--text-primary); transition: background 0.15s;
}
.faq-item__question:hover { background: #F8FAFC; }
[data-theme="dark"] .faq-item__question:hover, body.dark-mode .faq-item__question:hover { background: #1E293B; }
.faq-item__chevron { transition: transform 0.2s; font-size: 11px; color: var(--text-muted); }
.faq-item.is-open .faq-item__chevron { transform: rotate(180deg); }
.faq-item__answer { display: none; padding: 0 16px 12px; font-size: 13px; color: var(--text-secondary); line-height: 1.45; }
.faq-item.is-open .faq-item__answer { display: block; }
body.dark-mode .faq-item__question { background: #1e293b; color: #e2e8f0; }
body.dark-mode .faq-item { border-color: #334155; }
body.dark-mode .faq-item__answer { color: #94a3b8; }


/* === FUNCIONALIDADES INTERACTIVAS: Tabs === */
.interactive-tabs { margin: 28px 0; border: 1px solid #E2E8F0; border-radius: var(--radius-lg); overflow: hidden; }
[data-theme="dark"] .interactive-tabs { border-color: #334155; }
.interactive-tabs__bar { display: flex; background: #F1F5F9; border-bottom: 1px solid #E2E8F0; overflow-x: auto; }
[data-theme="dark"] .interactive-tabs__bar { background: #1E293B; border-bottom-color: #334155; }
.interactive-tabs__btn {
    padding: 10px 16px; font-size: 12.5px; font-weight: 600; color: var(--text-secondary);
    cursor: pointer; border: none; background: none; white-space: nowrap;
    display: flex; align-items: center; gap: 5px; transition: all 0.15s; border-bottom: 2px solid transparent;
}
.interactive-tabs__btn:hover { color: var(--color-primary); background: rgba(48,105,152,0.05); }
.interactive-tabs__btn.is-active { color: var(--color-primary); border-bottom-color: var(--color-primary); background: var(--bg-content); }
.interactive-tabs__panel { display: none; padding: 16px 20px; }
.interactive-tabs__panel.is-active { display: block; }

/* Valoración */
.rating-stars { display: flex; gap: 3px; }
.rating-stars .star { font-size: 26px; cursor: pointer; color: #D1D5DB; transition: color 0.15s; }
.rating-stars .star:hover, .rating-stars .star.active { color: #F59E0B; }

/* === FORO CON REGISTRO === */
.foro-usuario { padding: 10px 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.foro-usuario__btn {
    padding: 6px 14px; border-radius: var(--radius); font-size: 12.5px; font-weight: 600; cursor: pointer; border: 1px solid; transition: all 0.15s;
}
.foro-usuario__btn--login { background: var(--color-primary); color: white; border-color: var(--color-primary); }
.foro-usuario__btn--login:hover { background: var(--color-primary-light); }
.foro-usuario__btn--registro { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.foro-usuario__btn--registro:hover { background: #E8F5E9; }
.foro-usuario__sep { color: var(--text-muted); font-size: 12px; }
.foro-usuario__info { display: flex; align-items: center; gap: 8px; }
.foro-usuario__nombre { font-weight: 600; }
.foro-usuario__logout { background: none; border: none; color: var(--text-muted); font-size: 12px; cursor: pointer; text-decoration: underline; }
.requerido { color: #EF4444; }
.foro-form__row { display: flex; gap: 10px; }
.foro-form__row .foro-form__field { flex: 1; }

/* Paneles login/registro */
.foro-panel { display: none; background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: var(--radius); padding: 16px; margin: 8px 0; }
[data-theme="dark"] .foro-panel { background: #1E293B; border-color: #334155; }
.foro-panel__titulo { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.foro-panel .foro-form__field { margin-bottom: 8px; }
.foro-panel .foro-form__field label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 3px; color: var(--text-secondary); }
.foro-panel .foro-form__field input {
    width: 100%; padding: 7px 10px; border: 1px solid #E2E8F0; border-radius: var(--radius);
    font-family: var(--font-body); font-size: 13px; background: var(--bg-content); color: var(--text-primary);
}
[data-theme="dark"] .foro-panel .foro-form__field input { border-color: #334155; }
.foro-panel__botones { display: flex; gap: 8px; margin-top: 10px; }
.foro-panel__cancelar { background: none; border: 1px solid #E2E8F0; padding: 6px 14px; border-radius: var(--radius); cursor: pointer; font-size: 12.5px; color: var(--text-secondary); }
.foro-panel__link { font-size: 12px; color: var(--color-primary); cursor: pointer; background: none; border: none; text-decoration: underline; margin-top: 6px; display: inline-block; }
.foro-form__feedback { margin-top: 8px; padding: 8px 12px; border-radius: var(--radius); font-size: 12.5px; }
.foro-form__feedback--ok { background: #E3EFF7; color: #306998; }
.foro-form__feedback--error { background: #FEF2F2; color: #B91C1C; }

/* Comentarios del foro */
.forum-comment { padding: 10px 0; border-bottom: 1px solid #F1F5F9; display: flex; gap: 10px; }
[data-theme="dark"] .forum-comment { border-bottom-color: #334155; }
.forum-comment__avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--color-primary-light); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.forum-comment__body { flex: 1; }
.forum-comment__name { font-weight: 600; font-size: 12.5px; color: var(--text-primary); }
.forum-comment__badge { font-size: 10px; background: #E3EFF7; color: #306998; padding: 1px 6px; border-radius: 10px; margin-left: 4px; }
.forum-comment__badge--invitado { background: #FEF3C7; color: #92400E; }
.forum-comment__date { font-size: 11px; color: var(--text-muted); margin-left: 6px; }
.forum-comment__text { font-size: 13px; color: var(--text-secondary); margin-top: 3px; line-height: 1.4; }

.forum-form { margin-top: 12px; }
.forum-form textarea {
    width: 100%; min-height: 70px; padding: 10px; border: 1px solid #E2E8F0; border-radius: var(--radius);
    font-family: var(--font-body); font-size: 13px; resize: vertical; background: var(--bg-content); color: var(--text-primary);
}
[data-theme="dark"] .forum-form textarea { border-color: #334155; }
.forum-form__actions { display: flex; gap: 8px; margin-top: 6px; align-items: center; }
.forum-form__input {
    flex: 1; padding: 7px 10px; border: 1px solid #E2E8F0; border-radius: var(--radius);
    font-family: var(--font-body); font-size: 12.5px; background: var(--bg-content); color: var(--text-primary);
}
[data-theme="dark"] .forum-form__input { border-color: #334155; }
.forum-form__btn {
    background: var(--color-primary); color: white; border: none; padding: 7px 18px;
    border-radius: var(--radius); font-weight: 600; font-size: 12.5px; cursor: pointer; transition: background 0.2s;
}
.forum-form__btn:hover { background: var(--color-primary-light); }

/* CTA Final */
.cta-final { background: linear-gradient(135deg, #0D3B12, #1B5E20); padding: 32px 36px; text-align: center; color: white; }
.cta-final__title { font-size: 1.3rem; font-weight: 700; margin-bottom: 6px; }
.cta-final__text { font-size: 13.5px; color: rgba(255,255,255,0.8); margin-bottom: 16px; }
.cta-final__btn { display: inline-block; background: var(--color-accent); color: #1A3A5C; padding: 11px 30px; border-radius: 30px; font-weight: 700; font-size: 14px; transition: background 0.2s, transform 0.2s; }
.cta-final__btn:hover { background: var(--color-accent-hover); transform: translateY(-1px); text-decoration: none; color: white; }

/* Footer */
.site-footer { background: #0B0F1A; color: #64748B; padding: 18px 36px; display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; }
.site-footer a { color: #94A3B8; }
.site-footer a:hover { color: white; }

/* Barra progreso lectura */
.reading-progress { position: fixed; top: 0; left: 0; width: 0%; height: 3px; background: linear-gradient(90deg, #4B8BBE, #306998); z-index: 9999; transition: width 0.1s; }

/* Tema toggle */
.theme-toggle { display: none; }
.theme-toggle:hover { background: var(--color-primary); }

/* Barra social */
.social-bar { position: fixed; left: 14px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 99; }
.social-bar__btn { width: 34px; height: 34px; border-radius: 50%; background: white; border: 1px solid #E2E8F0; display: flex; align-items: center; justify-content: center; font-size: 15px; cursor: pointer; transition: all 0.2s; box-shadow: var(--shadow); color: var(--text-secondary); }
.social-bar__btn:hover { background: var(--color-primary); color: white; border-color: var(--color-primary); }

/* Responsive */
@media (max-width: 991px) {
    .sidebar { display: none; }
    .page-wrapper { display: block; }
    .social-bar { display: none; }
    .theme-toggle { display: flex !important; z-index: 9999; }
    .article { padding: 0 18px 18px; }
    .toc { margin: 14px 18px; }
    .breadcrumb { padding: 10px 18px; }
    .content-header { padding: 20px 18px; }
    .cta-final { padding: 24px 18px; }
    .site-footer { padding: 14px 18px; flex-direction: column; gap: 6px; text-align: center; }
}
@media (max-width: 575px) {
    .content-header__title { font-size: 1.4rem; }
    .article h2 { font-size: 1.15rem; }
    .foro-form__row { flex-direction: column; }
    .foro-panel__botones { flex-direction: column; }
    .theme-toggle { bottom: 16px; right: 16px; width: 44px; height: 44px; font-size: 20px; z-index: 9999; opacity: 1 !important; display: flex !important; }
}

/* ============================================================
   INCLUDES INTERACTIVOS — ALINEACIÓN CON CONTENIDO
   ============================================================ */
.paa-seccion,
.paa-section,
.valoracion-widget,
.foro-seccion,
.feedback-widget {
    padding-left: 36px !important;
    padding-right: 36px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

@media (max-width: 991px) {
    .paa-seccion,
    .paa-section,
    .valoracion-widget,
    .foro-seccion,
    .feedback-widget {
        padding-left: 18px !important;
        padding-right: 18px !important;
    }
}

/* ============================================================
   TEMA OSCURO — Correcciones para includes interactivos
   ============================================================ */
[data-theme="dark"] .valoracion-compacta { background: #1E293B; border-color: #334155; }
[data-theme="dark"] .valoracion-compacta__info { color: #94A3B8; }
[data-theme="dark"] .valoracion-compacta__sep { background: #475569; }
[data-theme="dark"] .valoracion-compacta__texto-votado { color: #4ADE80; }

[data-theme="dark"] .feedback-util__pregunta { color: #CBD5E1; }
[data-theme="dark"] .feedback-util__btn { background: #1E293B; border-color: #475569; color: #E2E8F0; }
[data-theme="dark"] .feedback-util__btn--si:hover { border-color: #4ADE80; background: #0F2A1D; }
[data-theme="dark"] .feedback-util__btn--no:hover { border-color: #F87171; background: #2A1215; }

[data-theme="dark"] .encuesta-exp__modal { background: #1E293B; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
[data-theme="dark"] .encuesta-exp__titulo { color: #E2E8F0; }
[data-theme="dark"] .encuesta-exp__cerrar { color: #64748B; }
[data-theme="dark"] .encuesta-exp__cerrar:hover { color: #E2E8F0; background: #334155; }
[data-theme="dark"] .encuesta-exp__etiqueta { color: #94A3B8; }
[data-theme="dark"] .encuesta-exp__estrella.is-selected .encuesta-exp__etiqueta { color: #FBBF24; }
[data-theme="dark"] .encuesta-exp__opcion { color: #CBD5E1; border-color: #475569; background: #151B2B; }
[data-theme="dark"] .encuesta-exp__opcion:hover { border-color: #60A5FA; background: #1A2744; }
[data-theme="dark"] .encuesta-exp__opcion.is-selected { border-color: #3B82F6; background: #1E3A5F; }
[data-theme="dark"] .encuesta-exp__label-otro { color: #94A3B8; }
[data-theme="dark"] .encuesta-exp__textarea { background: #151B2B; border-color: #475569; color: #E2E8F0; }
[data-theme="dark"] .encuesta-exp__textarea:focus { border-color: #3B82F6; }
[data-theme="dark"] .encuesta-exp__contador { color: #64748B; }
[data-theme="dark"] .encuesta-exp__saltar { color: #94A3B8; }
[data-theme="dark"] .encuesta-exp__saltar:hover { color: #E2E8F0; }
[data-theme="dark"] .encuesta-exp__gracias p { color: #94A3B8; }

[data-theme="dark"] .social-bar__btn { background: #1E293B; border-color: #334155; color: #94A3B8; }
[data-theme="dark"] .social-bar__btn:hover { background: var(--color-primary); color: white; border-color: var(--color-primary); }

[data-theme="dark"] .foro-form__feedback--ok { background: #0F2A1D; color: #4ADE80; }
[data-theme="dark"] .foro-form__feedback--error { background: #2A1215; color: #F87171; }
[data-theme="dark"] .forum-comment__badge { background: #0F2A1D; color: #4ADE80; }
[data-theme="dark"] .forum-comment__badge--invitado { background: #2A1F0A; color: #FBBF24; }

/* ============================================
   INFOGRAFÍAS SVG DUALES (clara/oscura)
   ============================================ */
.infografia--clara { display: block; margin: 1.5rem 0; }
.infografia--oscura { display: none; }
[data-theme="dark"] .infografia--clara { display: none; }
[data-theme="dark"] .infografia--oscura { display: block; margin: 1.5rem 0; }


/* === BUSCADOR DEL CURSO === */
.search-box {
    padding: 4px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.search-box__form { margin: 0; }
.search-box__wrapper {
    display: flex;
    background: rgba(255,255,255,0.92);
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.95);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.search-box__wrapper:focus-within {
    border-color: #fff;
    box-shadow: 0 1px 8px rgba(0,0,0,0.25);
}
.search-box__input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 14px;
    color: #1a1a2e;
    font-size: 0.85rem;
    outline: none;
    font-family: inherit;
    min-width: 0;
}
.search-box__input::placeholder {
    color: #888;
    font-size: 0.82rem;
}
.search-box__btn {
    background: transparent;
    border: none;
    padding: 8px 12px;
    color: #666;
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    align-items: center;
}
.search-box__btn:hover { color: #333; }