/*
   DOCUMENTATION CSS - Tracking v2.0
   Estilos para la vista pública de documentación.
   Importar DESPUÉS de variables.css y common.css
 */

/*
   LAYOUT DOCUMENTACIÓN
 */
.docs-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar de navegación */
.docs-sidebar {
    width: 280px;
    min-width: 280px;
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
    transition: width 0.25s ease, min-width 0.25s ease;
}

.docs-sidebar.collapsed {
    width: 0;
    min-width: 0;
    border-right: none;
}

.docs-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0 16px;
    height: 58px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    overflow: hidden;
    white-space: nowrap;
}

.docs-sidebar-logo {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    object-fit: contain;
}

.docs-sidebar-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--green-primary);
    white-space: nowrap;
}

.docs-sidebar-version {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    font-weight: 400;
    margin-left: 0.35rem;
}

/* Secciones del sidebar */
.docs-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0;
}

.docs-nav::-webkit-scrollbar { width: 4px; }
.docs-nav::-webkit-scrollbar-track { background: transparent; }
.docs-nav::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 2px; }

.docs-nav-section {
    margin-bottom: 0.5rem;
}

.docs-nav-section-title {
    padding: 0.35rem 16px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    user-select: none;
}

.docs-nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 16px 0.4rem 24px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: var(--font-primary);
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    border-radius: 0;
}

.docs-nav-item:hover {
    background: var(--hover-color);
    color: var(--text-primary);
    text-decoration: none;
}

.docs-nav-item.active {
    background: var(--green-bg-soft);
    color: var(--green-primary);
}

.docs-nav-item svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    opacity: 0.6;
}

.docs-nav-item.active svg {
    opacity: 1;
}

/* Footer sidebar */
.docs-sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding: 0.5rem;
    display: flex;
    gap: 0.25rem;
}

.docs-sidebar-footer-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.4rem;
    border-radius: var(--border-radius-md);
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: none;
    font-family: var(--font-primary);
    transition: background 0.15s, color 0.15s;
}

.docs-sidebar-footer-btn:hover {
    background: var(--hover-color);
    color: var(--text-primary);
}

.docs-sidebar-footer-btn svg {
    width: 14px;
    height: 14px;
}

/* ZONA PRINCIPAL */
.docs-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* Header */
.docs-header {
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
    gap: 0.75rem;
}

.docs-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.docs-header-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    cursor: pointer;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: background 0.15s;
}

.docs-header-toggle:hover {
    background: var(--hover-color);
    color: var(--text-primary);
}

.docs-header-toggle svg {
    width: 16px;
    height: 16px;
}

.docs-sidebar.collapsed ~ .docs-body .docs-header-toggle {
    display: flex;
}

.docs-header-breadcrumb {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.docs-header-breadcrumb span {
    color: var(--text-primary);
    font-weight: 600;
}

.docs-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.docs-header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    cursor: pointer;
    color: var(--text-secondary);
    transition: background 0.15s;
    text-decoration: none;
}

.docs-header-btn:hover {
    background: var(--hover-color);
    color: var(--text-primary);
}

.docs-header-btn svg {
    width: 15px;
    height: 15px;
}

/* CONTENIDO MARKDOWN */
.docs-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.docs-content::-webkit-scrollbar { width: 6px; }
.docs-content::-webkit-scrollbar-track { background: var(--scrollbar-track); }
.docs-content::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
.docs-content::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); }

.docs-article {
    max-width: 900px;
    margin: 0 auto;
}

/* --- Headings --- */
.docs-article h1 {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid var(--green-primary);
    letter-spacing: -0.02em;
}

.docs-article h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--green-dark);
    margin-top: 2.75rem;
    margin-bottom: 0.85rem;
    padding: 0.45rem 0.85rem;
    border-left: 4px solid var(--green-primary);
    border-bottom: none;
    background: var(--green-bg-soft);
    border-radius: 0 var(--border-radius-md) var(--border-radius-md) 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dark-theme .docs-article h2 {
    color: #4ade80;
    background: rgba(0, 166, 81, 0.1);
}

.docs-article h2 .h2-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--green-primary);
    opacity: 0.55;
    flex-shrink: 0;
    margin-left: auto;
    line-height: 1;
}

.docs-article h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 1.75rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--hover-color);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.docs-article h3 img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    padding: 3px;
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.docs-article h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 1.1rem;
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.docs-article h4::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 2px;
    background: var(--green-primary);
    border-radius: 1px;
    flex-shrink: 0;
}

/* Paragraphs */
.docs-article p {
    font-size: var(--font-size-base);
    color: var(--text-primary);
    line-height: 1.7;
    margin-bottom: 1rem;
}

/* Links */
.docs-article a {
    color: var(--green-primary);
    text-decoration: none;
    font-weight: 500;
}
.docs-article a:hover { text-decoration: underline; }

/* Lists */
.docs-article ul, .docs-article ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.docs-article li {
    font-size: var(--font-size-base);
    line-height: 1.7;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

/* Tables */
.docs-article table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: var(--font-size-sm);
}

.docs-article thead th {
    background: var(--table-header);
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.docs-article tbody td {
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: top;
}

.docs-article tbody tr:hover {
    background: var(--hover-color);
}

/* Centrar columnas con emoji de check */
.docs-article td:has(img[alt="✅"]),
.docs-article td:has(img[alt="❌"]),
.docs-article td:has(img[alt="⚠️"]) {
    text-align: center;
}

/* Overflows de tablas grandes */
.docs-article .table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    margin-bottom: 1.5rem;
}

.docs-article .table-wrap table {
    margin-bottom: 0;
}

/* Code blocks */
.docs-article code {
    background: var(--hover-color);
    padding: 0.15em 0.4em;
    border-radius: var(--border-radius-sm);
    font-size: 0.85em;
    color: var(--green-primary);
    font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', monospace;
}

.docs-article pre {
    background: #1e1e2e;
    color: #cdd6f4;
    border-radius: var(--border-radius-lg);
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    font-size: 0.8rem;
    line-height: 1.6;
}

.docs-article pre code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: inherit;
}

/* Blockquotes */
.docs-article blockquote {
    border-left: 3px solid var(--green-primary);
    background: var(--green-bg-soft);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 0 var(--border-radius-md) var(--border-radius-md) 0;
}

.docs-article blockquote p {
    margin-bottom: 0;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
}

/* HR */
.docs-article hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem 0;
}

/* Strong / Em */
.docs-article strong {
    font-weight: 600;
    color: var(--text-primary);
}

.docs-article em {
    font-style: italic;
    color: var(--text-secondary);
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .docs-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 1000;
        box-shadow: 4px 0 24px rgba(0,0,0,0.15);
    }

    .docs-sidebar.collapsed {
        width: 0;
        min-width: 0;
    }

    .docs-header-toggle {
        display: flex !important;
    }

    .docs-content {
        padding: 1.25rem;
    }

    .docs-article h1 { font-size: 1.4rem; }
    .docs-article h2 { font-size: 1.1rem; }

    .docs-article table {
        font-size: var(--font-size-xs);
    }

    .docs-article thead th,
    .docs-article tbody td {
        padding: 0.35rem 0.5rem;
    }
}

/* Overlay mobile */
.docs-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
}

@media (max-width: 768px) {
    .docs-overlay.visible {
        display: block;
    }
}
