/* assets/library.css */
/* Variables de Color Corporativo - Dark Professional */
:root {
    --bg-main: #0f1115; /* Negro profundo */
    --bg-surface: #1a1d24; /* Gris oscuro */
    --bg-card: #232730; /* Gris grafito */
    --text-main: #e2e8f0; /* Blanco apagado para lectura */
    --text-muted: #94a3b8; /* Gris claro */
    --accent: #ff7e67; /* Salmón/coral elegante */
    --accent-hover: #ff6448;
    --border: #334155;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.7;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* HEADER SEMIFIJO */
.top-navbar {
    background-color: var(--bg-surface);
    color: white;
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid var(--border);
}

.top-navbar h1 {
    font-size: 1.25rem;
    font-weight: bold;
    margin: 0;
    letter-spacing: -0.5px;
    color: var(--accent);
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--text-main);
}

.btn-pdf {
    background-color: transparent;
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}
.btn-pdf:hover { background-color: var(--bg-card); }

.btn-logout {
    background-color: var(--accent);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 0.9rem;
}
.btn-logout:hover { background-color: var(--accent-hover); }

/* CONTENIDO PRINCIPAL */
.content-area, .main-container {
    flex: 1;
    padding: 4rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}
.main-container { padding: 0; display: flex; }

/* LAYOUT SIDEBAR */
.sidebar {
    width: 280px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border);
    padding: 2rem 1.5rem;
    position: sticky;
    top: 72px; /* Navbar height */
    height: calc(100vh - 72px);
    overflow-y: auto;
}

.sidebar h3 {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.sidebar ul { list-style: none; display: flex; flex-direction: column; gap: 0.75rem; }
.sidebar a { color: var(--text-muted); text-decoration: none; font-size: 0.95rem; display: block; padding: 0.25rem 0; transition: color 0.2s; }
.sidebar a:hover { color: var(--accent); font-weight: 500; }

.content-area {
    padding: 3rem 4rem;
    background-color: var(--bg-main);
    max-width: 1000px;
}

/* TYPOGRAPHY IN REPORTS */
.content-area h1 { color: var(--text-main); font-size: 2.5rem; margin-bottom: 2rem; border-bottom: 2px solid var(--border); padding-bottom: 1rem; }
.content-area h2 { color: var(--text-main); font-size: 1.8rem; margin-top: 3rem; margin-bottom: 1.5rem; display: flex; align-items: center; }
.content-area h2::before { content: ""; display: inline-block; width: 6px; height: 1.5rem; background-color: var(--accent); margin-right: 0.75rem; border-radius: 4px; }
.content-area h3 { color: var(--accent); font-size: 1.3rem; margin-top: 2rem; margin-bottom: 1rem; }
.content-area p { margin-bottom: 1.25rem; font-size: 1.05rem; color: var(--text-muted); }
.content-area ul, .content-area ol { margin-bottom: 1.5rem; padding-left: 2rem; color: var(--text-muted); }
.content-area li { margin-bottom: 0.5rem; font-size: 1.05rem; }
.content-area strong { color: var(--text-main); }

/* SECCIONES Y PORTADA INDEX */
.hero-section, .complementary-section {
    text-align: center;
    margin-bottom: 4rem;
    background-color: var(--bg-surface);
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    border: 1px solid var(--border);
}
.complementary-section { text-align: left; }

.hero-section h1 { color: var(--text-main); font-size: 2.8rem; margin-bottom: 1rem; letter-spacing: -0.5px; }
.hero-section h2 { color: var(--accent); font-size: 1.4rem; font-weight: 400; margin-bottom: 2rem; }
.hero-section p { font-size: 1.1rem; max-width: 800px; margin: 0 auto 1rem auto; color: var(--text-muted); }
.path-box { background-color: var(--bg-main); color: var(--accent); padding: 1rem; border-radius: 6px; font-family: monospace; font-size: 0.9rem; margin: 2rem auto 0 auto; max-width: 800px; overflow-x: auto; border: 1px solid var(--border); }

/* GRID Y CARDS (3D sutil) */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.card, .qa-card, .speech-box {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2), 0 1px 3px rgba(0,0,0,0.1);
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.4);
    border-color: var(--accent);
}

.card-number { color: var(--accent); font-size: 1.1rem; font-weight: bold; margin-bottom: 0.5rem; }
.card-title { color: var(--text-main); font-size: 1.3rem; margin-bottom: 1rem; line-height: 1.4; }
.card-desc { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1.5rem; flex-grow: 1; }

.btn-card {
    display: inline-block;
    background-color: var(--bg-main);
    color: var(--text-main);
    border: 1px solid var(--border);
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    text-align: center;
    transition: all 0.2s;
    margin-top: auto;
}
.btn-card:hover { background-color: var(--accent); color: white; border-color: var(--accent); }

/* BADGES */
.card-badges { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.5rem; }
.badge { font-size: 0.75rem; font-weight: bold; padding: 0.2rem 0.6rem; border-radius: 9999px; text-transform: uppercase; background-color: var(--bg-main); border: 1px solid var(--border); color: var(--text-muted); }
.badge.inicial { color: #a7f3d0; border-color: #059669; }
.badge.intermedio { color: #fde68a; border-color: #d97706; }
.badge.tecnico { color: #bfdbfe; border-color: #2563eb; }
.badge.seguridad { color: #e9d5ff; border-color: #9333ea; }
.badge.infraestructura { color: #c7d2fe; border-color: #4f46e5; }
.badge.qa-testing { color: #fed7aa; border-color: #ea580c; }
.badge.defensa-oral { color: #fecaca; border-color: #dc2626; }

/* COMPONENTES ESPECÍFICOS DE VOLÚMENES */
.didactic-box { background-color: var(--bg-surface); border-left: 5px solid var(--accent); padding: 1.5rem; border-radius: 0 12px 12px 0; margin: 2rem 0; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.didactic-box h4 { color: var(--accent); margin-top: 0; font-size: 1.1rem; margin-bottom: 0.5rem;}
.didactic-box p { margin: 0; }

.qa-card { margin-bottom: 1.5rem; }
.qa-question { font-weight: bold; color: var(--text-main); font-size: 1.15rem; margin-bottom: 0.5rem; }
.qa-evaluates { font-size: 0.9rem; color: var(--accent); margin-bottom: 1rem; font-style: italic; }
.qa-answer { color: var(--text-muted); margin-bottom: 1rem; }
.qa-keywords span { background: var(--bg-main); padding: 0.2rem 0.5rem; border-radius: 4px; margin-right: 0.5rem; color: var(--text-muted); font-size: 0.85rem; border: 1px solid var(--border); }

.speech-box { font-family: Georgia, serif; font-size: 1.15rem; line-height: 1.8; margin-bottom: 2rem; color: var(--text-main); }
.time-badge { display: inline-block; background-color: var(--accent); color: white; padding: 0.2rem 0.6rem; border-radius: 4px; font-size: 0.9rem; font-weight: bold; margin-bottom: 1rem; font-family: -apple-system, sans-serif;}

/* TABLAS Y RUTAS */
table { width: 100%; border-collapse: collapse; margin: 2rem 0; font-size: 0.95rem; }
th, td { border: 1px solid var(--border); padding: 1rem; text-align: left; vertical-align: top; }
th { background-color: var(--bg-surface); color: var(--accent); font-weight: bold; }
tr:nth-child(even) { background-color: rgba(255,255,255,0.02); }
.code-badge { background-color: var(--bg-main); padding: 2px 6px; border-radius: 4px; font-family: monospace; border: 1px solid var(--border); color: var(--accent);}
code { background-color: var(--bg-surface); padding: 2px 6px; border-radius: 4px; font-family: monospace; color: var(--accent);}
pre code { display: block; padding: 1rem; overflow-x: auto; border: 1px solid var(--border); border-radius: 8px;}

/* RUTA DE ESTUDIO */
.path-steps { display: flex; flex-direction: column; gap: 1.5rem; }
.step { display: flex; background-color: var(--bg-surface); padding: 1.5rem; border-radius: 12px; border-left: 4px solid var(--accent); box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.step-phase { font-weight: bold; color: var(--text-main); width: 250px; font-size: 1.1rem; }
.step-desc { color: var(--text-muted); flex: 1; }
.list-styled { list-style-type: none; padding: 0; }
.list-styled li { position: relative; padding-left: 1.5rem; margin-bottom: 0.5rem; color: var(--text-muted); }
.list-styled li::before { content: "✓"; color: var(--accent); position: absolute; left: 0; font-weight: bold; }

/* BOTÓN MENÚ MÓVIL */
.mobile-menu-btn {
    display: none;
    background-color: var(--bg-card);
    color: var(--accent);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.mobile-menu-btn:hover {
    background-color: var(--bg-surface);
    border-color: var(--accent);
}

/* RESPONSIVE */
@media (max-width: 1024px) {
    .main-container { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; top: 0; border-right: none; border-bottom: 1px solid var(--border); padding: 1rem 2rem; }
    .content-area { padding: 2rem; overflow-x: auto;}
    
    .mobile-menu-btn { display: block; }

    .nav-links {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 72px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 72px);
        background-color: rgba(15, 17, 21, 0.98);
        backdrop-filter: blur(10px);
        padding: 2rem;
        transition: left 0.3s ease;
        z-index: 999;
        overflow-y: auto;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 0;
    }
    
    .nav-links.active {
        left: 0;
    }

    .nav-links a {
        width: 100%;
        padding: 1rem 0;
        border-bottom: 1px solid var(--border);
        font-size: 1.15rem;
    }

    .btn-pdf, .btn-logout {
        width: 100%;
        margin-top: 1rem;
        padding: 1rem;
        font-size: 1.1rem;
        text-align: center;
    }
}

@media (max-width: 768px) {
    .top-navbar { flex-wrap: nowrap; gap: 1rem; justify-content: space-between;}
    .hero-section { padding: 2rem 1rem; }
    .hero-section h1 { font-size: 2rem; }
    .step { flex-direction: column; gap: 0.5rem; }
    .step-phase { width: 100%; }
    .complementary-section { padding: 2rem 1rem; }
    table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* IMPRESIÓN (PDF) */
@media print {
    body { background-color: white !important; color: black !important; }
    .top-navbar, .sidebar, .btn-card, .btn-pdf, .btn-logout { display: none !important; }
    .hero-section, .complementary-section, .content-area { background: transparent !important; box-shadow: none !important; border: none !important; padding: 0 !important; color: black !important; }
    h1, h2, h3, p, li, strong { color: black !important; }
    h2::before { background-color: black !important; }
    .card, .qa-card, .speech-box { border: 1px solid #ccc !important; box-shadow: none !important; break-inside: avoid; background: white !important; }
    .didactic-box { border-left: 5px solid gray !important; background: white !important; }
    th { background-color: #f3f4f6 !important; color: black !important; border: 1px solid #ccc !important; }
    td { border: 1px solid #ccc !important; color: black !important; }
    .badge, .time-badge, .code-badge, code { color: black !important; border: 1px solid #ccc !important; background: white !important; }
    @page { margin: 1.5cm; }
}
