/* ═══ DOCS LAYOUT ═══ */
.docs-layout {
    display: flex;
    min-height: 100vh;
    padding-top: 80px;
}

/* ═══ SIDEBAR ═══ */
.docs-sidebar {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
    height: calc(100vh - 80px);
    overflow-y: auto;
    background: transparent;
    border-right: 1px solid var(--border-subtle);
    padding: 40px 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-subtle) transparent;
}
.docs-sidebar::-webkit-scrollbar { width: 4px; }
.docs-sidebar::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 4px; }

.docs-search-box {
    position: relative;
    margin-bottom: 28px;
}
.docs-search-box input {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 12px 10px 36px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.docs-search-box input:focus { border-color: var(--accent-orange); }
.docs-search-box input::placeholder { color: var(--text-muted); }
.docs-search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.sidebar-category { margin-bottom: 24px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.05); }
.sidebar-category:first-of-type { padding-top: 0; border-top: none; }
.sidebar-category-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.75);
    margin-bottom: 6px;
    padding: 0 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Subcategory (e.g. Networking inside CloudPúblico) ── */
.sidebar-subcategory { margin-top: 12px; }
.sidebar-subcategory-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 6px 12px 4px;
}
.sidebar-link-indent { padding-left: 20px; }

/* ── Item with children (collapsible submenu) ── */
.sidebar-item-group { margin-bottom: 2px; }
.sidebar-link-parent {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    gap: 8px;
}
.sidebar-chevron {
    font-size: 18px;
    line-height: 1;
    color: var(--text-muted);
    transition: transform 0.2s;
    transform: rotate(0deg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}
.sidebar-chevron.open { transform: rotate(90deg); }

.sidebar-children {
    display: none;
    overflow: hidden;
}
.sidebar-children.expanded { display: block; }
.sidebar-link-child {
    padding-left: 24px;
    font-size: 13px;
    color: var(--text-muted);
}
/* Children inside a subcategory get extra indent */
.sidebar-link-child-deep {
    padding-left: 32px;
}
.sidebar-link-child:hover { color: var(--text-primary); }
.sidebar-link-child.active {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
    border-left-color: rgba(249,174,0,0.5);
    font-weight: 500;
}
.sidebar-link {
    display: block;
    padding: 9px 12px;
    font-size: 14px;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    border-left: 2px solid transparent;
    margin-bottom: 2px;
}
.sidebar-link:hover { background: rgba(255,255,255,0.04); color: var(--text-primary); }
.sidebar-link.active {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
    border-left-color: rgba(249,174,0,0.5);
    font-weight: 500;
}

/* ═══ DOCS MAIN ═══ */
.docs-main {
    flex: 1;
    min-width: 0;
    display: flex;
    gap: 0;
}

.docs-content {
    flex: 1;
    max-width: 800px;
    padding: 48px 60px;
    min-width: 0;
}

/* ═══ DOCS HOME ═══ */
.docs-home { padding-bottom: 80px; }

.docs-home-hero {
    padding: 68px 0 52px;
    position: relative;
}
.docs-home-hero::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(249,174,0,0.35) 0%, transparent 55%);
}
.docs-home-eyebrow {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent-orange);
    margin-bottom: 20px;
}
.docs-home-title {
    font-size: 54px;
    font-weight: 900;
    line-height: 1.04;
    letter-spacing: -1.5px;
    margin-bottom: 18px;
}
.docs-home-subtitle {
    font-size: 17px;
    color: var(--text-secondary);
    line-height: 1.75;
    max-width: 460px;
    margin-bottom: 0;
}

.docs-home-body { padding-top: 48px; }
.docs-home-section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}
.docs-home-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* ── Card ── */
.dhc {
    background: #1f1f1f;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 22px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease,
                border-color 0.18s ease, background 0.18s ease;
}
.dhc-bar {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.dhc:hover { border-color: rgba(255,255,255,0.13); background: #232323; transform: translateY(-3px); box-shadow: 0 16px 48px rgba(0,0,0,0.5); }
.dhc:hover .dhc-bar { opacity: 1; }

.dhc-top { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.dhc-icon {
    width: 38px; height: 38px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.dhc-icon svg { width: 18px; height: 18px; }
.dhc-meta { min-width: 0; }
.dhc-name { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 5px; line-height: 1.3; }
.dhc-desc { font-size: 12.5px; color: var(--text-muted); line-height: 1.55; }

.dhc-links { list-style: none; padding: 16px 0 0; margin: 0; border-top: 1px solid rgba(255,255,255,0.05); }
.dhc-links li { padding: 1px 0; }
.dhc-links a {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex; align-items: center; gap: 7px;
    padding: 5px 0;
    transition: color 0.15s;
    cursor: pointer;
}
.dhc-links a::before {
    content: '→';
    font-size: 11px;
    color: var(--ac, var(--accent-orange));
    flex-shrink: 0;
    opacity: 0.55;
    transition: transform 0.15s, opacity 0.15s;
}
.dhc-links a:hover { color: var(--text-primary); }
.dhc-links a:hover::before { transform: translateX(3px); opacity: 1; }

/* ═══ ARTICLE CONTENT ═══ */
.article-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 0;
}
.article-breadcrumb a { color: var(--text-muted); cursor: pointer; }
.article-breadcrumb a:hover { color: var(--accent-orange); }
.article-breadcrumb span { color: var(--text-muted); }
.breadcrumb-current { color: var(--text-primary) !important; }

/* ═══ ARTICLE HEADER ═══ */
.article-header { margin-bottom: 0; }
.article-title {
    font-size: 36px;
    font-weight: 900;
    color: var(--text-primary);
    margin: 20px 0 12px;
    line-height: 1.15;
    letter-spacing: -0.3px;
}
.article-description {
    font-size: 17px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0;
}
.article-divider {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 28px 0 40px;
}

.article-body { color: var(--text-secondary); line-height: 1.8; }
.article-body > :first-child { margin-top: 0; }
.article-body h1 { font-size: 36px; font-weight: 900; color: var(--text-primary); margin-bottom: 20px; line-height: 1.2; }
.article-body h2 {
    font-size: 22px; font-weight: 700; color: var(--text-primary);
    margin: 40px 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-subtle);
}
.article-body h3 { font-size: 18px; font-weight: 600; color: var(--text-primary); margin: 28px 0 12px; }
.article-body h4 { font-size: 15px; font-weight: 600; color: var(--text-primary); margin: 20px 0 8px; }
.article-body p { margin-bottom: 16px; }
.article-body a { color: var(--accent-orange); }
.article-body a:hover { text-decoration: underline; }
.article-body ul, .article-body ol { margin: 12px 0 16px 20px; }
.article-body li { margin-bottom: 6px; }
/* Inline code only — not inside pre blocks */
.article-body :not(pre) > code {
    background: rgba(249,174,0,0.08);
    color: var(--accent-orange);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'Courier New', monospace;
}
.article-body pre {
    background: #303030;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-sm);
    padding: 20px;
    overflow-x: auto;
    margin: 20px 0;
    position: relative;
}
/* Code blocks — colors handled entirely by highlight.js */
.article-body pre code { background: none; padding: 0; color: inherit; }
.article-body pre .hljs { background: transparent; padding: 0; }

/* ═══ COPY BUTTON ═══ */
.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-muted);
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.3px;
    opacity: 0;
}
.article-body pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.2);
}
.copy-btn.copied {
    color: #4ade80;
    border-color: rgba(74,222,128,0.3);
    background: rgba(74,222,128,0.08);
    opacity: 1;
}
.article-body blockquote {
    border-left: 3px solid var(--accent-orange);
    padding: 12px 20px;
    margin: 20px 0;
    background: rgba(249,174,0,0.04);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
}
.article-body table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 14px; }
.article-body th {
    background: rgba(255,255,255,0.04);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
}
.article-body td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: var(--text-secondary);
}
.article-body tr:hover td { background: rgba(255,255,255,0.02); }
.article-body strong { color: var(--text-primary); font-weight: 600; }
.article-body hr { border: none; border-top: 1px solid var(--border-subtle); margin: 32px 0; }

/* Article footer navigation */
/* ═══ ARTICLE NAV (prev / next) ═══ */
.article-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 72px;
    padding-top: 32px;
    border-top: 1px solid var(--border-subtle);
    gap: 16px;
}
.article-nav-btn {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 20px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.22s ease;
    flex: 1;
    min-width: 0;
    text-align: left;
    position: relative;
    overflow: hidden;
}
.article-nav-prev { border-left: 3px solid transparent; }
.article-nav-next {
    flex-direction: row-reverse;
    text-align: right;
    border-right: 3px solid transparent;
}
.article-nav-btn:hover {
    background: rgba(255,255,255,0.03);
    box-shadow: 0 6px 24px rgba(0,0,0,0.35);
    transform: translateY(-2px);
}
.article-nav-prev:hover { border-left-color: var(--accent-orange); border-color: rgba(249,174,0,0.25); }
.article-nav-next:hover { border-right-color: var(--accent-orange); border-color: rgba(249,174,0,0.25); }

.nav-arrow {
    font-size: 24px;
    color: var(--accent-orange);
    flex-shrink: 0;
    transition: transform 0.22s ease;
    line-height: 1;
}
.article-nav-prev:hover .nav-arrow { transform: translateX(-4px); }
.article-nav-next:hover .nav-arrow { transform: translateX(4px); }

.nav-text {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}
.nav-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.9px;
    color: var(--text-muted);
}
.nav-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ═══ TABLE OF CONTENTS ═══ */
.docs-toc {
    width: 220px;
    flex-shrink: 0;
    position: sticky;
    top: 100px;
    align-self: flex-start;
    padding: 48px 24px 48px 0;
    display: none;
}
@media (min-width: 1200px) { .docs-toc { display: block; } }
.toc-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 12px; }
.toc-list { list-style: none; padding: 0; }
.toc-list li { margin-bottom: 2px; }
.toc-list a { font-size: 13px; color: var(--text-muted); display: block; padding: 5px 0 5px 12px; border-left: 2px solid transparent; transition: 0.2s; }
.toc-list a:hover { color: var(--text-primary); border-left-color: var(--accent-orange); }
.toc-list a.active { color: var(--accent-orange); border-left-color: var(--accent-orange); }

/* ═══ LOADING STATE ═══ */
.docs-loading { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.docs-loading .spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent-orange);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══ NOT FOUND ═══ */
.docs-404 { text-align: center; padding: 80px 20px; }
.docs-404 .icon-404 { font-size: 64px; margin-bottom: 20px; }
.docs-404 h2 { font-size: 28px; font-weight: 800; margin-bottom: 12px; }
.docs-404 p { color: var(--text-muted); margin-bottom: 24px; }

/* ═══ CIDR CALCULATOR WIDGET ═══ */
.cidr-widget {
    background: #232323;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    overflow: hidden;
    margin: 28px 0;
    font-family: inherit;
}
.cidr-widget-header {
    background: rgba(249,174,0,0.07);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding: 13px 20px;
    font-size: 13px;
    font-weight: 700;
    color: #F9AE00;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cidr-widget-controls {
    display: flex;
    gap: 16px;
    padding: 20px;
    flex-wrap: wrap;
}
.cidr-field { flex: 1; min-width: 200px; }
.cidr-field label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 7px;
}
.cidr-field input,
.cidr-field select {
    width: 100%;
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    color: rgba(255,255,255,0.9);
    font-size: 14px;
    padding: 9px 12px;
    font-family: 'SFMono-Regular', Consolas, 'Courier New', monospace;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}
.cidr-field input:focus,
.cidr-field select:focus { border-color: rgba(249,174,0,0.45); }
.cidr-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='rgba(255,255,255,0.4)' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}
.cidr-field select option { background: #1a1a1a; }
.cidr-stats {
    display: flex;
    border-top: 1px solid rgba(255,255,255,0.06);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    min-height: 72px;
    align-items: center;
}
.cidr-stat {
    flex: 1;
    padding: 14px 12px;
    text-align: center;
    border-right: 1px solid rgba(255,255,255,0.05);
}
.cidr-stat:last-child { border-right: none; }
.cidr-stat-value {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: #F9AE00;
    font-family: 'SFMono-Regular', Consolas, 'Courier New', monospace;
    line-height: 1.2;
}
.cidr-stat-label {
    display: block;
    font-size: 10px;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 5px;
}
.cidr-results { overflow-x: auto; }
.cidr-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cidr-table thead tr { background: rgba(255,255,255,0.02); }
.cidr-table th {
    padding: 10px 20px;
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.cidr-table td {
    padding: 8px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-family: 'SFMono-Regular', Consolas, 'Courier New', monospace;
    color: rgba(255,255,255,0.7);
}
.cidr-table tbody tr:hover td { background: rgba(255,255,255,0.02); }
.cidr-table td:first-child { color: #F9AE00; font-weight: 600; }
.cidr-more {
    padding: 10px 20px 12px;
    font-size: 12px;
    color: rgba(255,255,255,0.28);
    text-align: center;
    margin: 0;
}
.cidr-error {
    display: block;
    padding: 14px 20px;
    color: #ff6b6b;
    font-size: 13px;
    width: 100%;
}

/* ═══ DOCS MOBILE TOGGLE ═══ */
.docs-mobile-toggle {
    display: none;
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--accent-orange);
    color: #0f0f14;
    border: none;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(249, 174, 0, 0.4);
    white-space: nowrap;
}

.docs-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 599;
    backdrop-filter: blur(4px);
}
.docs-sidebar-overlay.visible { display: block; }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
    .docs-mobile-toggle { display: flex; }

    .docs-sidebar {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 300px;
        z-index: 600;
        background: #1a1a1a;
        border-right: 1px solid var(--border-subtle);
        padding: 80px 20px 40px;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }
    .docs-sidebar.mobile-open {
        display: block;
        transform: translateX(0);
    }

    .docs-content { padding: 32px 20px 100px; }
    .docs-home-title { font-size: 32px; letter-spacing: -0.5px; }
    .docs-home-grid { grid-template-columns: 1fr; }
    .article-nav { flex-direction: column; }
    .article-nav-next { flex-direction: row; text-align: left; border-right: none; border-left: 3px solid transparent; }
    .article-nav-next:hover { border-left-color: var(--accent-orange); border-color: rgba(249,174,0,0.25); }
}
