/* =========================================
   VARIABLES Y CONFIGURACIÓN BASE
   ========================================= */
:root {
    --primary-color: #6366f1;
    --primary-light: #e0e7ff;
    --text-color: #000000;
    --text-muted: #4b5563; /* Ajustado de #000 para mejor legibilidad */
    --bg-color: #ffffff;
    --bg-body: #e8e8e8;
    --border-color: #e5e7eb;
    --blue: #2d7ff9;
    --slate: #1f2933;

    --header-height: 60px;
    --side-expanded: 260px;
    --side-collapsed: 50px;
    --transition: all 0.25s ease-out;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-color);
    overflow: hidden;
}

/* =========================================
   CONTENEDOR PRINCIPAL (GRID)
   ========================================= */
.layout-container {
    display: grid;
    grid-template-areas:
        "header header header"
        "left-side main right-side"
        "footer footer footer";
    grid-template-columns: var(--side-expanded) 1fr var(--side-expanded);
    grid-template-rows: var(--header-height) 1fr auto;
    height: 100vh;
    transition: var(--transition);
}

/* Estados de Colapso */
.left-collapsed { grid-template-columns: var(--side-collapsed) 1fr var(--side-expanded); }
.right-collapsed { grid-template-columns: var(--side-expanded) 1fr var(--side-collapsed); }
.left-collapsed.right-collapsed { grid-template-columns: var(--side-collapsed) 1fr var(--side-collapsed); }

/* =========================================
   COMPONENTES ESTRUCTURALES
   ========================================= */
.header {
    grid-area: header;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    z-index: 100;
}
header .links a {
    margin: 0 1rem;
    text-decoration: none;
    color: var(--slate);
    font-size: 0.9rem;
}

header .links a:hover {
    color: var(--blue);
}
.side-panel {
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    transition: var(--transition);
}

.sidebar-left { grid-area: left-side; border-right: 1px solid var(--border-color); }
.sidebar-right { grid-area: right-side; border-left: 1px solid var(--border-color); }

.main-content {
    grid-area: main;
    overflow-y: auto;
    padding: 30px;
    background: var(--bg-body);
}

.footer {
    grid-area: footer;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
    padding: 8px 20px;
    font-size: 12px;
    color: var(--text-muted);
}

.logo {
    font-weight: 800;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =========================================
   MENÚS Y NAVEGACIÓN (Sidebar Left)
   ========================================= */
.menu-list { list-style: none; width: 100%; }

.menu-item {
    display: flex;
    align-items: center;
    height: 50px;
    padding: 0 13px;
    text-decoration: none;
    color: var(--text-muted);
    transition: background 0.2s;
    white-space: nowrap;
    cursor: pointer;
}

.menu-item i {
    font-size: 24px;
    min-width: 24px;
    text-align: center;
}

.menu-text {
    margin-left: 15px;
    font-size: 14px;
    opacity: 1;
    transition: opacity 0.2s;
}

/* Estado activo/hover del item principal */
.menu-item:hover, .menu-group.open > .menu-item {
    background: var(--primary-light);
    color: var(--primary-color);
}

/* Submenú (Acordeón) */
.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: rgba(0, 0, 0, 0.02);
}

.menu-group.open .submenu {
    max-height: max-content; /* Suficiente para varios items */
}

.submenu-item {
    display: block;
    padding: 10px 10px 10px 50px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 2px solid transparent;
    white-space: nowrap;
}

.submenu-item:hover {
    color: var(--primary-color);
    background: var(--primary-light);
}

.submenu-item.active-sub {
    color: var(--primary-color);
    font-weight: 700;
    border-left: 2px solid var(--primary-color);
    background: var(--primary-light);
}

.dropdown-icon {
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.3s;
}

.menu-group.open .dropdown-icon {
    transform: rotate(180deg);
}

/* =========================================
   TOC (Sidebar Right)
   ========================================= */
.toc-number {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 22px;
    padding: 0 6px;
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-radius: 12px;
    font-size: 10px;
    font-weight: 800;
}

.toc-level-1 { padding-left: 25px !important; }
.toc-level-2 { padding-left: 40px !important; }

.btn {
    background: #6366f1;
    border: 1px solid #d2a8ff;
    padding: 7px 20px;
    cursor: pointer;
    border-radius: 14px;
    transition: background 0.2s;
    color:white; ;
    text-align: center;
    margin: 0 5px 5px 5px;
}

.btn:hover {
    background: #764ba2;
}


/* =========================================
   ADAPTABILIDAD AL COLAPSO
   ========================================= */
.left-collapsed .sidebar-left .menu-text,
.left-collapsed .sidebar-left .dropdown-icon,
.left-collapsed .sidebar-left .submenu,
.right-collapsed .sidebar-right .menu-text {
    display: none;
}

.left-collapsed .sidebar-left .menu-item,
.right-collapsed .sidebar-right .menu-item {
    justify-content: center;
    padding-left: 0 !important;
}

/* =========================================
   CONTENIDO (TARJETAS, TABLAS, CÓDIGO)
   ========================================= */
.section-card {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 24px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.section-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
}

.section-header i { color: var(--primary-color); }
.section-body { padding: 20px; }

/* Imágenes Responsivas */
.section-body img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 10px auto;
    border-radius: 4px;
}

.split-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.code-block {
    background: #1e293b;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 6px;
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    overflow-x: auto;
}

/* =========================================
   UTILIDADES Y BOTONES
   ========================================= */
.toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 15px 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
}

.toggle-btn:hover { color: var(--primary-color); }

.placeholder-box {
    background: #f1f5f9;
    border: 2px dashed var(--border-color);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    text-align: center;
    color: var(--text-muted);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border-radius: 10px;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    text-align: center;
}

.table th,
.table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;

    font-size: 14px;
}

.table tr:first-child td {
    background: #f1f5f9;
    font-weight: 700;
    color: #334155;
    border-bottom: 2px solid #cbd5e1;
}

.table tr:nth-child(even) {
    background: #f8fafc;
}

.table tr:hover {
    background: #eef2ff;
}

.table td:first-child {
    font-weight: 600;
    color: #475569;
    width: 120px;
}


/* ======== CONTENEDOR DEL CÓDIGO ======== */
pre {
    background: #0d1117;              /* Fondo oscuro elegante */
    color: #c9d1d9;                   /* Texto gris claro */
    padding: 18px 22px;
    border-radius: 12px;
    overflow-x: auto;
    border: 1px solid #30363d;
    box-shadow: 0 8px 25px rgba(0,0,0,0.25);
    margin: 25px 0;
    font-size: 0.95rem;
}

/* ======== ESTILO DEL TEXTO DEL CÓDIGO ======== */
pre code {
    font-family: "Fira Code", "JetBrains Mono", Consolas, monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    display: block;
    white-space: pre;
}

/* ======== SCROLLBAR PERSONALIZADA ======== */
pre::-webkit-scrollbar {
    height: 8px;
}

pre::-webkit-scrollbar-track {
    background: #161b22;
    border-radius: 10px;
}

pre::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 10px;
}

pre::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}


/* Contenedor general */
.tabs {
    width: 100%;
    margin-top: 1rem;
}

.tab-buttons {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid #ddd;
    padding-bottom: 6px;
}

.tab-btn {
    background: #667eea;
    border: 1px solid #d2a8ff;
    padding: 8px 14px;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    font-weight: 600;
    transition: background 0.2s;
}

.tab-btn:hover {
    background: #764ba2;
}

.tab-btn.active {
    background: #a5d6ff;
    border-bottom: 2px solid white;
    border-color: #d2a8ff;
}

.tab-content {
    display: none;
    padding: 15px 5px;
    border: 1px solid #d2a8ff;
    border-top: none;
    background: white;
    border-radius: 0 6px 6px 6px;
}

.tab-content.active {
    display: block;
}

/* Estilo para la imagen pequeña dentro del proyecto */
.img-thumbnail-clic {
    max-width: 100%;
    height: auto;
    display: block;
    cursor: zoom-in; /* Cambia el cursor a una lupa de + al pasar por encima */
    border-radius: 4px;
    transition: opacity 0.2s;
}

.img-thumbnail-clic:hover {
    opacity: 0.8;
}