/* css/style.css v0.10.13 */

/* === Estilos Base === */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    margin: 0;
    padding: 0;
    overflow: hidden;
    padding-bottom: 30px; /* Espacio para el footer fijo */
    background-color: #fff;
    color: #333;
}

/* === Barra Superior (Header) === */
.top-bar {
    background-color: #f8f9fa;
    padding: 5px 40px; /* Padding lateral para que los botones no queden pegados */
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    height: 45px;
    box-sizing: border-box;
    border-bottom: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.top-bar button {
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    padding: 6px 2px;
    font-size: 1em;
    margin: 0 3px;
    transition: background-color 0.2s ease, color 0.2s ease;
    color: #333;
}
.top-bar button:hover {
    background-color: #007bff;
    color: #fff;
    border-color: #0056b3;
}
.top-bar button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #e9ecef;
    color: #6c757d;
}
.top-bar button i { pointer-events: none; }
.top-bar .navigation { display: flex; margin-left: auto; }

/* === Contenedor Principal === */
.container { display: flex; margin-top: 45px; height: calc(100vh - 45px - 30px); }

/* === Panel Lateral (Sidebar) === */
.sidebar { width: 300px; background-color: #f8f9fa; padding: 20px; overflow-y: auto; transition: width 0.3s ease, padding 0.3s ease, transform 0.3s ease; border-right: 1px solid #dee2e6; box-sizing: border-box; flex-shrink: 0; display: flex; flex-direction: column; z-index: 90; transform: translateX(0); }
.sidebar.collapsed { width: 0; padding: 0; border-right: none; overflow: hidden; transform: translateX(-100%); }
.sidebar-branding { text-align: center; margin-bottom: 10px; border-bottom: 1px solid #ccc; padding-bottom: 15px; }
.sidebar-title { font-size: 1.0em; color: navy; margin: 0; font-weight: 600; }
.glossary-button { display: block; width: 100%; padding: 5px 5px; margin-bottom: 5px; background-color: #5a6268; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 1em; text-align: center; transition: background-color 0.2s ease; }
.glossary-button:hover { background-color: #495057; }
.glossary-button i { margin-right: 8px; }
.sidebar-header { color: #333; font-weight: 600; margin-bottom: 5px; text-align: center; font-size: 1.0em; }
.sidebar-footer { color: #888; font-size: 0.8em; font-style: italic; margin-top: 20px; text-align: center; border-top: 1px solid #eee; padding-top: 15px; flex-shrink: 0; }

/* === Índice (ToC) === */
#toc { list-style-type: none; padding: 0; margin: 0; flex-grow: 1; }
#toc li { margin-bottom: 3px; }
#toc .unit-item > a { font-weight:bold; color: #0056b3; padding: 4px 2px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; border-radius: 3px; transition: background-color 0.2s ease; text-decoration: none; }
#toc .theme-item a { text-decoration: none; color: #333; display: block; padding: 6px 5px 6px 20px; border-radius: 3px; transition: background-color 0.2s ease, color 0.2s ease; position: relative; }
#toc .theme-item a::before { content: '\2022'; position: absolute; left: 8px; top: 50%; transform: translateY(-50%); color: #888; font-size: 1.0em; }
#toc .theme-item.active a::before { color: white; }
#toc .theme-item a:hover, #toc .unit-item > a:hover { background-color: #e9e9e9; }
#toc .theme-item.active a { background-color: #007bff; color: white; font-weight:normal; }
#toc ul { list-style: none; padding: 0; margin-left: 6px; display: none; margin-top: 1px; background-color: #fff; }
#toc .unit-item.open > ul { display: block; }
.toc-arrow { font-size: 0.8em; margin-left: 8px; transition: transform 0.2s ease; }
.unit-item.open > a > .toc-arrow { transform: rotate(90deg); }

/* === Área de Contenido === */
.content { flex: 1; display: flex; flex-direction: column; overflow: hidden; background-color: #fff; }
.content-header { background-color: #f8f9fa; padding: 10px 25px; border-bottom: 1px solid #dee2e6; text-align: center; font-size: 1.1em; color: #333; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content-body { padding: 15px 25px; overflow-y: auto; flex: 1; line-height: 1.7; }
.content-body p { margin-bottom: 1.2em; margin-top: 0; }
.content-body table { border-collapse: collapse; width: 100%; margin: 20px 0; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.content-body th, .content-body td { border: 1px solid #ddd; padding: 10px 12px; text-align: left; }
.content-body th { background-color: #f2f2f2; font-weight: 600; }
.content-body pre { background-color: #2d2d2d; color: #f8f8f2; padding: 15px; border-radius: 5px; overflow-x: auto; margin: 15px 0; }
.content-body code, .content-body span.code { background-color: #eef; color: #d63384; padding: 0.2em 0.4em; border-radius: 3px; font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 0.9em; }
.content-body pre code { background-color: transparent; padding: 0; }
.content-body ul, .content-body ol { margin-left: 20px; margin-bottom: 1em; }
.content-body li { margin-bottom: 0.5em; }
#content-display::after { content: ""; display: table; clear: both; } /* Clearfix */
.content-footer { background-color: #f8f9fa; padding: 10px; text-align: center; border-top: 1px solid #dee2e6; font-size: 0.9em; color: #555; }

/* === Contenido Multimedia === */
.content-media { display: block; margin-bottom: 15px; max-width: 100%; height: auto; border: 1px solid #eee; padding: 5px; border-radius: 4px; box-shadow: 2px 2px 5px rgba(0,0,0,0.1); background-color: #f9f9f9; }
.img-left, .video-left { float: left; margin-right: 20px; margin-bottom: 10px; max-width: 48%; }
.img-right, .video-right { float: right; margin-left: 20px; margin-bottom: 10px; max-width: 48%; }
.img-top, .video-top { margin: 15px auto; }
.img-bottom, .video-bottom { margin: 15px auto; }

/* === Estilos para Buscador Principal en Content Body === */
.main-search-container {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}
#main-search-input {
    width: 100%;
    padding: 10px 15px;
    font-size: 1em;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

/* === Estilos para el Recuadro de Resultados de Búsqueda === */
.search-results-box {
    display: none; /* Oculto por defecto */
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-top: 10px; /* Espacio desde el input de búsqueda */
    margin-bottom: 20px;
    max-height: 300px; /* Altura máxima, luego scroll */
    overflow-y: auto;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.search-result-item {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.search-result-item:last-child {
    border-bottom: none;
}
.search-result-item:hover {
    background-color: #e9ecef;
}
.search-result-item .unit-name { /* Para la primera línea - Nombre de Unidad */
    display: block;
    font-size: 0.9em; /* Más pequeño para la unidad */
    color: #555;
    margin-bottom: 3px;
}
.search-result-item .theme-name { /* Para la segunda línea - Nombre del Tema */
    display: block;
    font-weight: bold;
    color: #0056b3;
    font-size: 1em;
}

/* === Estilos para Resaltado de Búsqueda en Contenido === */
.search-highlight {
    background-color: yellow;
    color: #333; /* Asegura legibilidad */
    font-weight: bold;
}

/* === Modal Glosario === */
.modal { display: none; position: fixed; z-index: 1050; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.7); align-items: center; justify-content: center; }
/* JS controla 'display: flex' en el elemento modal directamente, no con .active */
.modal-content { background-color: #fefefe; padding: 25px; border: 1px solid #888; width: 90vw; height: 90vh; max-width: 1300px; border-radius: 8px; position: relative; display: flex; flex-direction: column; box-shadow: 0 5px 15px rgba(0,0,0,0.5); box-sizing: border-box; }
.modal-content h2 { margin-top: 0; padding-bottom: 10px; border-bottom: 1px solid #eee; color: #0056b3; }
#glosario-frame { flex-grow: 1; overflow-y: auto; border: none; }
.close-button { position: absolute; top: 15px; right: 20px; color: #aaa; font-size: 32px; font-weight: bold; cursor: pointer; line-height: 1; padding: 5px; }
.close-button:hover, .close-button:focus { color: #333; text-decoration: none; }

/* === Footer Fijo === */
.sticky-footer { position: fixed; left: 0; bottom: 0; width: 100%; background-color: #343a40; color: white; text-align: center; padding: 6px 0; font-size: 0.8em; z-index: 101; }

/* === Media Queries === */
@media (max-width: 768px) {
    .sidebar { position: fixed; left: 0; top: 45px; height: calc(100vh - 45px); z-index: 95; transform: translateX(-100%); transition: transform 0.3s ease; border-right: 1px solid #ddd; }
    .sidebar:not(.collapsed) { transform: translateX(0); width: 250px; }
    .top-bar .navigation { display: none; }
    .img-left, .video-left, .img-right, .video-right { float: none; max-width: 100%; margin-left: auto; margin-right: auto; }
    .modal-content { width: 95vw; height: 95vh; padding: 15px; }
    .content-body { padding: 15px; }
    .main-search-container { margin-bottom: 15px; }
    .search-results-box { max-height: 200px; }
}