/* ============================================================
   ASEAC - CSS CATÁLOGO ACADÉMICO & BIBLIOTECA CIENTÍFICA
   Paleta: Zafiro Real (#1565c0 / #1353a0), Fondos Ónice y Carbón
   SIN COLORES NEÓN · SIN EMOJIS (Iconografía Font Awesome 6)
   ============================================================ */

:root {
    --cat-bg: #090d16;
    --cat-surface: #0f1523;
    --cat-card: #151d30;
    --cat-card-hover: #1c2740;
    --cat-border: rgba(255, 255, 255, 0.08);
    --cat-border-active: rgba(37, 99, 235, 0.4);

    --cat-primary: #2563eb;
    --cat-primary-hover: #1d4ed8;
    --cat-primary-light: #60a5fa;

    --cat-text: #f8fafc;
    --cat-text-muted: #94a3b8;
    --cat-text-dim: #64748b;

    --cat-font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --cat-font-mono: 'JetBrains Mono', monospace;

    --cat-radius-sm: 6px;
    --cat-radius-md: 12px;
    --cat-radius-lg: 18px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.catalogo-body {
    background-color: var(--cat-bg);
    color: var(--cat-text);
    font-family: var(--cat-font-sans);
    line-height: 1.55;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.cat-header {
    background: rgba(15, 21, 35, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--cat-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.cat-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    gap: 16px;
}

.cat-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--cat-text);
}

.cat-brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.cat-brand-name {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    font-family: var(--cat-font-mono);
}

.cat-brand-badge {
    font-size: 0.68rem;
    font-weight: 700;
    background: rgba(37, 99, 235, 0.2);
    color: #93c5fd;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
}

.cat-nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--cat-radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.16s ease;
    text-decoration: none;
    font-family: inherit;
    color: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--cat-border);
    color: var(--cat-text);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.78rem;
}

/* Hero Search Banner */
.cat-hero {
    padding: 48px 0 32px;
    text-align: center;
    background: radial-gradient(circle at 50% 20%, rgba(37, 99, 235, 0.12) 0%, transparent 60%);
    border-bottom: 1px solid var(--cat-border);
}

.cat-hero-title {
    font-size: clamp(1.8rem, 3.5vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
    color: var(--cat-text);
}

.cat-hero-desc {
    font-size: 0.95rem;
    color: var(--cat-text-muted);
    max-width: 680px;
    margin: 0 auto 28px;
    line-height: 1.6;
}

/* Search Box */
.cat-search-box {
    max-width: 650px;
    margin: 0 auto;
    position: relative;
}

.cat-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--cat-text-dim);
    font-size: 1rem;
}

.cat-search-input {
    width: 100%;
    padding: 14px 16px 14px 46px;
    border-radius: var(--cat-radius-md);
    background: var(--cat-surface);
    border: 1px solid var(--cat-border);
    color: var(--cat-text);
    font-size: 0.92rem;
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.cat-search-input:focus {
    border-color: var(--cat-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

/* Filter Pills */
.cat-filters-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 20px;
}

.cat-pill {
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--cat-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--cat-text-muted);
    transition: all 0.15s ease;
}

.cat-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--cat-text);
}

.cat-pill.active {
    background: var(--cat-primary);
    border-color: var(--cat-primary);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

/* Grid & Cards */
.cat-grid-section {
    padding: 40px 0 80px;
}

.cat-stats-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    font-size: 0.85rem;
    color: var(--cat-text-muted);
}

.cat-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 24px;
}

.cat-card {
    background: var(--cat-surface);
    border: 1px solid var(--cat-border);
    border-radius: var(--cat-radius-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    position: relative;
}

.cat-card:hover {
    transform: translateY(-3px);
    border-color: var(--cat-border-active);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.cat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
}

.badge-blue { background: rgba(37, 99, 235, 0.2); color: #93c5fd; }
.badge-green { background: rgba(5, 150, 105, 0.2); color: #34d399; }
.badge-amber { background: rgba(217, 119, 6, 0.2); color: #fbbf24; }
.badge-purple { background: rgba(147, 51, 234, 0.2); color: #c084fc; }

.cat-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--cat-text);
    margin-bottom: 10px;
    line-height: 1.35;
}

.cat-card-desc {
    font-size: 0.86rem;
    color: var(--cat-text-muted);
    line-height: 1.55;
    margin-bottom: 18px;
}

.cat-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
}

.cat-tag {
    font-size: 0.72rem;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--cat-text-dim);
    font-family: var(--cat-font-mono);
}

.cat-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    border-top: 1px solid var(--cat-border);
    font-size: 0.8rem;
    color: var(--cat-text-dim);
}

.cat-author {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Reader Modal (KaTeX Math) */
.reader-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 7, 12, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.reader-overlay.activo {
    display: flex;
}

.reader-modal {
    background: var(--cat-surface);
    border: 1px solid var(--cat-border);
    border-radius: var(--cat-radius-lg);
    width: 100%;
/* ============================================================
   LAYOUT DE BIBLIOTECA DE DOCUMENTACIÓN CON BARRA LATERAL
   ============================================================ */
.cat-docs-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 28px;
    align-items: start;
    margin-top: 24px;
}

.cat-sidebar {
    background: var(--cat-surface);
    border: 1px solid var(--cat-border);
    border-radius: var(--cat-radius-md);
    padding: 20px;
    position: sticky;
    top: 76px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.cat-sidebar-section-title {
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--cat-primary-light);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cat-routes-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cat-route-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--cat-radius-sm);
    background: transparent;
    border: 1px solid transparent;
    color: var(--cat-text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: all 0.16s ease;
}

.cat-route-btn:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--cat-text);
}

.cat-route-btn.active {
    background: rgba(37, 99, 235, 0.16);
    border-color: rgba(59, 130, 246, 0.35);
    color: #93c5fd;
}

.cat-tree-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cat-tree-item {
    font-size: 0.82rem;
    color: var(--cat-text-muted);
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.15s ease;
}

.cat-tree-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--cat-text);
}

.cat-tree-item.active {
    background: rgba(37, 99, 235, 0.15);
    color: #60a5fa;
    font-weight: 600;
}

.cat-tree-count {
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.08);
    padding: 1px 6px;
    border-radius: 9999px;
    color: var(--cat-text-dim);
}

/* Atajo de teclado en el buscador */
.cat-search-shortcut {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    font-family: var(--cat-font-mono);
    color: var(--cat-text-dim);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--cat-border);
    padding: 3px 7px;
    border-radius: 4px;
    pointer-events: none;
}

/* Lector con Índice Lateral (TOC) y Ancho Óptimo de Lectura */
.reader-modal {
    background: var(--cat-surface);
    border: 1px solid var(--cat-border);
    border-radius: var(--cat-radius-lg);
    width: 100%;
    max-width: 1080px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85);
}

.reader-header {
    padding: 14px 24px;
    border-bottom: 1px solid var(--cat-border);
    background: var(--cat-card);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.reader-two-col {
    display: grid;
    grid-template-columns: 240px 1fr;
    flex: 1;
    overflow: hidden;
}

.reader-toc-sidebar {
    background: rgba(9, 13, 22, 0.7);
    border-right: 1px solid var(--cat-border);
    padding: 20px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.reader-toc-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--cat-primary-light);
    letter-spacing: 1.2px;
    margin-bottom: 6px;
}

.reader-toc-link {
    font-size: 0.8rem;
    color: var(--cat-text-muted);
    text-decoration: none;
    padding: 5px 8px;
    border-radius: 4px;
    line-height: 1.4;
    transition: all 0.15s ease;
    cursor: pointer;
}

.reader-toc-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.reader-content-wrap {
    overflow-y: auto;
    padding: 36px 40px;
    scroll-behavior: smooth;
}

.reader-article-content {
    max-width: 72ch;
    margin: 0 auto;
    line-height: 1.78;
    color: #cbd5e1;
    font-size: var(--cat-reading-font-size, 1rem);
}

.reader-article-content h1, 
.reader-article-content h2, 
.reader-article-content h3 {
    color: var(--cat-text);
    margin: 28px 0 12px;
    font-weight: 700;
    line-height: 1.25;
}

.reader-article-content h3 {
    font-size: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 8px;
}

.reader-article-content p {
    margin-bottom: 16px;
}

.reader-article-content .nota-teorica {
    background: rgba(37, 99, 235, 0.1);
    border-left: 3px solid #3b82f6;
    padding: 14px 18px;
    border-radius: 0 8px 8px 0;
    margin: 20px 0;
    font-size: 0.94rem;
}

/* Barra de Acciones Catálogo -> App */
.reader-actions-bar {
    padding: 12px 24px;
    border-top: 1px solid var(--cat-border);
    background: #090d16;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.reader-action-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-reader-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--cat-border);
    color: #cbd5e1;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: var(--cat-radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.btn-reader-action:hover {
    background: rgba(37, 99, 235, 0.2);
    border-color: rgba(59, 130, 246, 0.4);
    color: #ffffff;
}

.font-size-ctrls {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--cat-border);
    border-radius: 6px;
    padding: 2px 6px;
}

.font-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}

.font-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

/* Bottom Sheet / Cajón móvil para filtros */
.cat-mobile-filter-trigger {
    display: none;
    margin-bottom: 16px;
    width: 100%;
}

@media (max-width: 900px) {
    .cat-docs-layout {
        grid-template-columns: 1fr;
    }
    .cat-sidebar {
        display: none;
    }
    .cat-sidebar.mobile-open {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        max-height: 80vh;
        z-index: 2000;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.9);
    }
    .cat-mobile-filter-trigger {
        display: inline-flex;
    }
    .reader-two-col {
        grid-template-columns: 1fr;
    }
    .reader-toc-sidebar {
        display: none;
    }
    .reader-content-wrap {
        padding: 24px 18px;
    }
}

/* Impresión Limpia PDF */
@media print {
    .cat-header, .cat-hero, .reader-header, .reader-actions-bar, .reader-toc-sidebar {
        display: none !important;
    }
    .reader-modal {
        border: none !important;
        box-shadow: none !important;
        max-width: 100% !important;
    }
    .reader-article-content {
        color: #000000 !important;
        max-width: 100% !important;
    }
}
