/* =============================================
   ESTILOS PRINCIPALES - style.css
   Fecha: 28.05.2026-18:09 (modificado - paleta gris)
   Tema oscuro/claro + Sidebar + Sistema de colapsables (manual con .hidden)
   ============================================= */

/* =====================
   VARIABLES DE COLOR - PALETA GRIS 
   ===================== */
:root {
    /* Fondo principal: gris muy oscuro */
    --bg: #121212;
    --text: #f0f0f0;
    --primary: #9ca3af;      /* gris medio */
    --secondary: #d1d5db;    /* gris claro */
    --sidebar-bg: #1f1f1f;
    --border: #3f3f46;
    --link: #cbd5e1;         /* gris azulado claro */
    --summary-bg: #2a2a2a;
    --active-bg: #3a3a3a;
    --active-border: #9ca3af;
    --accent: #6b7280;        /* gris medio-oscuro como acento */
    --accent-hover: #4b5563;
    --danger: #e11d48;
    --danger-hover: #be123c;
    --code-bg: #1e1e1e;
    --code-text: #e2e8f0;

    /* Variables neutras */
    --white: #ffffff;
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.4);
    --link-hover-bg: rgba(156, 163, 175, 0.2);
    --code-inline-bg: rgba(128, 128, 128, 0.2);
    --error-color: #ef4444;
    --btn-hover-text: #ffffff;
    --home-text: #ffffff;
}

/* Modo claro - tonos grises claros */
.light {
    --bg: #f9fafb;
    --text: #1f2937;
    --primary: #4b5563;
    --secondary: #9ca3af;
    --sidebar-bg: #e5e7eb;
    --border: #cbd5e1;
    --link: #374151;
    --summary-bg: #d1d5db;
    --active-bg: #cbd5e1;
    --active-border: #4b5563;
    --accent: #4b5563;
    --accent-hover: #374151;
    --danger: #e11d48;
    --danger-hover: #be123c;
    --code-bg: #f3f4f6;
    --code-text: #1f2937;

    /* Variables neutras para modo claro */
    --white: #ffffff;
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.15);
    --link-hover-bg: rgba(75, 85, 99, 0.1);
    --code-inline-bg: rgba(0, 0, 0, 0.05);
    --error-color: #dc2626;
    --btn-hover-text: #ffffff;
    --home-text: #ffffff;
}

/* =========================
   RESET
   ========================= */
* {
    box-sizing: border-box;
}

/* =====================
   CONFIGURACIÓN GLOBAL
   ===================== */
html {
    scroll-behavior: smooth;
}
body {
    font-family: "Nunito", sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    display: flex;
    margin: 0;
    height: 100dvh;
    overflow: hidden;
    transition: background-color 0.3s ease;
}

/* =====================
   HEADER FIJO
   ===================== */
#header {
    position: fixed;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    top: 0;
    left: 0;
    right: 0;
    height: 65px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    gap: 10px;
    padding: 0 0px 0 20px;
}

#header-title {
    margin-right: auto;
    margin-left: 20px;
    font-size: clamp(0.9rem, 0.3667rem + 2.3704vw, 1.7rem);
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

#header-icon {
    height: 70%;
    width: auto;
    max-height: 50px;
    margin-right: 24px;
    flex-shrink: 0;
}

h1, #header-title {
    font-weight: 700;
}

#logLink {
    color: var(--bg);
    text-decoration: none;
    font-size: 1.5rem;
    margin-left: auto;
    padding: 0 8px;
    transition: opacity 0.2s;
}

#logLink:hover {
    opacity: 0.8;
}

/* =====================
   BOTÓN TOGGLE MENU ☰
   ===================== */
#toggle-menu-btn {
    background: var(--border);
    border: none;
    border-radius: 20px;
    height: 40px;
    width: 40px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text);
}

#toggle-menu-btn:hover {
    transform: scale(1.2);
}

.light #toggle-menu-btn {
    background: var(--active-bg);
}

/***********************************
   LOGO
***********************************/
.logo-svg {
    flex-shrink: 1;
}

.logo-bg {
    fill: var(--summary-bg);
}
.logo-box {
    width: 100%;
    height: 100%;
    fill: none;
    stroke-width: 1px;
    stroke: none;
}

.favicon-parts {
    color: var(--primary);
}
.logo-title2 {
    font-size: 200px;
    font-weight: 800;
    letter-spacing: 8px;
    fill: var(--primary);
}

.logo-subtitle2 {
    font-family: Nunito, sans-serif;
    font-size: 150px;
    font-weight: 700;
    letter-spacing: 2px;
    fill: var(--secondary);
    text-anchor: middle;
    dominant-baseline: middle;
}
.logo-title {
    font-size: 35px;
    font-weight: 800;
    letter-spacing: 8px;
    fill: var(--primary);
}

.logo-subtitle {
    font-family: Nunito, sans-serif;
    font-size: 25px;
    font-weight: 500;
    letter-spacing: 2px;
    fill: var(--secondary);
    text-anchor: middle;
    dominant-baseline: middle;
}

/*****************/
.smallCaps {
    font-variant: small-caps;
}
.upperCase {
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* =====================
   SIDEBAR
   ===================== */
#sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 65px);
    overflow: hidden;
    padding: 0;
    margin-top: 65px;
    transition: margin-left 0.3s ease;
    box-sizing: border-box;
}

body.collapsed #sidebar {
    margin-left: -260px;
}

.sidebar-controls {
    padding: 3px 3px 3px 7px;
    background: var(--sidebar-bg);
    flex-shrink: 0;
    z-index: 10;
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: flex-start;
    margin-bottom: 7px;
}

/* =====================
   BOTONES DE CONTROL
   ===================== */
#home-btn,
#collapse-all-btn,
#lupa-btn,
#theme-btn {
    cursor: pointer;
    padding: 5px 10px 0;
    background: var(--summary-bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.light #home-btn,
.light #collapse-all-btn,
.light #lupa-btn,
.light #theme-btn {
    color: var(--link);
    background: var(--summary-bg);
}

#home-btn:hover,
#home-btn:focus,
#collapse-all-btn:hover,
#collapse-all-btn:focus,
#lupa-btn:hover,
#lupa-btn:focus,
#theme-btn:hover,
#theme-btn:focus {
    background: var(--accent);
    color: var(--btn-hover-text);
    outline: none;
}

/* =====================
   ICONOS
   ===================== */
#icon-collapse line {
    stroke: currentColor;
    stroke-width: 14;
    stroke-linecap: round;
}

#icon-luna {
    fill: currentColor;
}
#icon-sol line, #icon-sol circle {
    stroke: currentColor;
    stroke-width: 10;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

#icon-lupa line, #icon-lupa circle {
    stroke: currentColor;
    stroke-width: 14;
    stroke-linecap: round;
    fill: none;
}

/* cuerpo de la carpeta */
.folder-body {
    fill: var(--link);
    stroke: var(--text);
    stroke-width: 2;
    stroke-linejoin: round;
}

/* =====================
   BUSCADOR
   ===================== */
#search {
    width: 95%;
    margin: 0 0 10px 5px;
    padding: 8px;
    box-sizing: border-box;
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: 6px;
    flex-shrink: 0;
    transition: border-color 0.2s ease;
}

#search:hover,
#search:focus {
    border-color: var(--link);
}

/* Ocultar barra de búsqueda (toggle) */
#search.search-collapsed {
    display: none;
}

/* =====================
   MENU LINKS (FOLDERS & FILE)
   <nav id="menu-links"></nav>
   ===================== */
#menu-links {
    flex: 1;
    overflow-y: auto;
    padding: 10px 5px 5px 0px;
    scrollbar-width: thin;
    border-top: 1px solid var(--border);
}

#menu-links::-webkit-scrollbar-track {
    background: transparent;
}
#menu-links::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* =====================
   Enlaces dentro del <nav id="menu-links"></nav>
   DETAILS = Carpetas box
   SUMMARY = Nombre de la carpeta
   LINKS = Enlace a archivo <a class=link...
   ===================== */
/* Enlace especial (🏠 INICIO) */
#home {
    display: block;
    padding: 10px;
    background: var(--accent);
    color: var(--home-text);
    text-decoration: none;
    text-align: left;
    border-radius: 5px;
    margin-bottom: 15px;
}

details {
    margin-top: 5px;
    margin-left: 10px;
}

summary {
    cursor: pointer;
    font-weight: bold;
    background: var(--summary-bg);
    padding: 5px;
    border-radius: 4px;
    list-style: none;
    color: var(--text);
    transition: all 0.2s ease;
}

summary:hover,
summary:focus {
    background: var(--active-bg);
    outline: none;
}

.link {
    display: block;
    padding: 8px;
    color: var(--link);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    font-size: 0.9em;
    font-weight: 400;
    margin-left: 5px;
    line-height: 1.2;
    transition: all 0.2s ease;
}

.link:hover,
.link:focus {
    background: var(--link-hover-bg);
    padding-left: 12px;
    outline: none;
}

.link.active {
    background: var(--active-bg);
    border-left: 4px solid var(--active-border);
    font-weight: bold;
}

/* =====================
   BÚSQUEDA FLOTANTE
   ===================== */
#floating-search {
    position: fixed;
    top: 0px;
    left: 50px;
    width: 70%;
    max-width: 300px;
    background: var(--sidebar-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    gap: 8px;
    z-index: 2000;
    box-shadow: var(--shadow-sm);
}

#floating-search-input {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-size: 1rem;
}

#close-floating-search {
    background: var(--danger);
    border: none;
    color: var(--btn-hover-text);
    border-radius: 6px;
    cursor: pointer;
    padding: 0 12px;
    font-weight: bold;
}

#close-floating-search:hover {
    background: var(--danger-hover);
}

/* =====================
   CONTENIDO PRINCIPAL
   ===================== */
main {
    font-size: clamp(1rem, 0.95rem + 0.2667vw, 1.1rem);
    flex: 1;
    margin-top: 65px;
    padding: 0px 0px 0px 10px;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg);
    height: calc(100dvh - 65px);
    transition: background-color 0.3s ease;
}

#render-area {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

#render-area a,
#render-area a:visited {
    color: var(--link);
    text-decoration: none;
}

#render-area a:hover,
#render-area a:focus {
    color: var(--danger);
    text-decoration: underline;
}

.container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

/* =====================
   SISTEMA DE COLAPSABLES MANUALES
   ===================== */
.to1 {
    color: var(--link);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    padding: 10px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.to1:hover {
    color: var(--danger);
}

.to1::before {
    content: "▼";
    display: inline-block;
    margin-right: 10px;
    transition: transform 0.3s ease;
}

.to1.active::before {
    transform: rotate(-180deg);
}

/* Contenedor oculto (clase .hidden) */
.hidden {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.hidden.active {
    max-height: none;
    opacity: 1;
}

.hidden-content {
    padding: 0 10px 10px 20px;
}

/* =====================
   TABLA DE CONTENIDOS (TOC)
   ===================== */
.table-of-contents {
    background: var(--summary-bg);
    padding: 5px 5px 5px 10px;
    border-radius: 6px;
    margin: 20px 0;
    border-left: 4px solid var(--active-border);
}

.table-of-contents ul {
    list-style: none;
    padding-left: 5px;
    margin: 10px 0;
}

.table-of-contents li {
    margin: 5px 0;
}

.table-of-contents a {
    color: var(--link);
    text-decoration: none;
    font-size: 0.95em;
    transition: all 0.2s ease;
}

.table-of-contents a:hover,
.table-of-contents a:focus {
    text-decoration: underline;
    color: var(--danger);
    outline: none;
}

/* =====================
   BOTÓN SCROLL TO TOP
   ===================== */
#scroll-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--link);
    color: var(--home-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: all 0.3s ease;
}

#scroll-top-btn.visible {
    opacity: .7;
    transform: translateY(0);
    pointer-events: auto;
}

#scroll-top-btn:hover,
#scroll-top-btn:focus {
    background: var(--active-border);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
    outline: none;
}

/* =====================
   PRE, CÓDIGO, IMG
   ===================== */
pre {
    background: var(--code-bg);
    color: var(--code-text);
    padding: 0px;
    margin: 0px;
    border-radius: 6px;
    overflow-x: auto;
    border-left: 4px solid var(--accent);
}

code {
    background: var(--code-inline-bg);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

img {
    max-width: 100%;
    border-radius: 8px;
    display: block;
}

/* =====================
   UTILIDADES
   ===================== */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text);
    opacity: 0.7;
}

.error {
    text-align: center;
    padding: 40px;
    color: var(--error-color);
}

/* Ajuste de scroll para anclas internas (headings) */
h1 {
    color: var(--primary);
}
h1, h2, h3, h4, h5, h6, [id] {
    scroll-margin-top: 70px;
}

/* Estilos para visor de imágenes */
.img-viewer {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}
.img-viewer-img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

/* Bloque genérico para código y texto plano */
.code-block {
    white-space: pre-wrap;
    word-wrap: break-word;
    background: var(--code-bg);
    padding: 1rem;
    border-radius: 8px;
    font-family: monospace;
}

.txt-block,
.js-block,
.css-block {
    /* específicos si se requieren */
}

/* Contenedor de mensajes de error */
.error-container {
    text-align: center;
    padding: 3rem;
}
.error-home-btn {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
}