/* === Mockarty Website — Documentation Page === */

.docs-layout {
    display: grid;
    grid-template-columns: 280px 1fr 220px;
    gap: 0;
    min-height: calc(100vh - 64px);
    margin-top: 64px;
}

/* === Sidebar === */
.docs-sidebar {
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 20px 0;
}
.docs-sidebar::-webkit-scrollbar { width: 4px; }
.docs-sidebar::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

.sidebar-search {
    padding: 0 16px 16px;
}
.sidebar-search input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: var(--font-sm);
}
.sidebar-search .search-icon {
    position: absolute;
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}
.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 16px;
    right: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}
.search-results-dropdown.active { display: block; }
.search-result-item {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    font-size: var(--font-sm);
}
.search-result-item:hover { background: var(--accent-light); }
.search-result-item:last-child { border-bottom: none; }
.search-result-title { font-weight: 600; color: var(--text-primary); }
.search-result-category { font-size: var(--font-xs); color: var(--text-muted); }

.sidebar-category {
    margin-bottom: 4px;
}
.sidebar-category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
}
.sidebar-category-header:hover { color: var(--accent-color); }
.sidebar-category-header i:first-child {
    width: 20px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.sidebar-category-header .chevron {
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.2s;
}
.sidebar-category.open .chevron {
    transform: rotate(90deg);
}

.sidebar-pages {
    display: none;
}
.sidebar-category.open .sidebar-pages { display: block; }
.sidebar-page-link {
    display: block;
    padding: 6px 16px 6px 44px;
    font-size: var(--font-sm);
    color: var(--text-secondary);
    transition: all 0.2s;
    border-left: 2px solid transparent;
}
.sidebar-page-link:hover {
    color: var(--accent-color);
    background: var(--accent-light);
}
.sidebar-page-link.active {
    color: var(--accent-color);
    border-left-color: var(--accent-color);
    background: var(--accent-light);
    font-weight: 600;
}

/* === Content === */
.docs-content {
    padding: 40px 56px;
    max-width: 100%;
    overflow-x: hidden;
}
.docs-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-sm);
    color: var(--text-muted);
    margin-bottom: 28px;
}
.docs-breadcrumb a { color: var(--text-secondary); }
.docs-breadcrumb a:hover { color: var(--accent-color); }

/* ═══════════════════════════════════════════════════
   Markdown Rendered Content — Premium Docs Style
   ═══════════════════════════════════════════════════ */

.docs-body {
    font-size: var(--font-md);
    color: var(--text-primary);
    line-height: 1.75;
}

/* --- Headings --- */
.docs-body h1 {
    font-size: var(--font-3xl);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 12px;
    margin-top: 56px;
    color: var(--text-primary);
}
.docs-body h1:first-child { margin-top: 0; }

.docs-body h2 {
    font-size: var(--font-2xl);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-top: 48px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent-light);
    color: var(--text-primary);
}

.docs-body h3 {
    font-size: var(--font-xl);
    font-weight: 600;
    margin-top: 36px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.docs-body h4 {
    font-size: var(--font-lg);
    font-weight: 600;
    margin-top: 28px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

/* Anchor hover effect on headings */
.docs-body h2:hover::before,
.docs-body h3:hover::before {
    content: "#";
    position: absolute;
    margin-left: -1.2em;
    color: var(--accent-color);
    opacity: 0.5;
    font-weight: 400;
}
.docs-body h2, .docs-body h3 {
    position: relative;
}

/* --- Paragraphs & Text --- */
.docs-body p {
    margin-bottom: 16px;
    line-height: 1.8;
    color: var(--text-primary);
}

.docs-body strong {
    font-weight: 700;
    color: var(--text-primary);
}

.docs-body em {
    color: var(--text-secondary);
}

/* --- Links --- */
.docs-body a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition-fast), color var(--transition-fast);
}
.docs-body a:hover {
    border-bottom-color: var(--accent-color);
}
.docs-body a code {
    color: var(--accent-color);
}

/* --- Lists --- */
.docs-body ul, .docs-body ol {
    margin-bottom: 16px;
    padding-left: 24px;
}
.docs-body ul { list-style: none; }
.docs-body ol { list-style: decimal; }

.docs-body ul > li {
    position: relative;
    padding-left: 8px;
    margin-bottom: 8px;
    line-height: 1.75;
    color: var(--text-primary);
}
.docs-body ul > li::before {
    content: "";
    position: absolute;
    left: -16px;
    top: 0.7em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-color);
    opacity: 0.6;
}
.docs-body ol > li {
    margin-bottom: 8px;
    line-height: 1.75;
    color: var(--text-primary);
    padding-left: 4px;
}
.docs-body ol > li::marker {
    color: var(--accent-color);
    font-weight: 600;
}

/* Nested lists */
.docs-body ul ul, .docs-body ol ul { margin-top: 4px; margin-bottom: 4px; }
.docs-body ul ul > li::before { opacity: 0.35; width: 5px; height: 5px; }

/* Task lists (GFM) */
.docs-body ul > li > input[type="checkbox"] {
    margin-right: 8px;
    accent-color: var(--accent-color);
}

/* --- Inline code --- */
.docs-body code {
    padding: 2px 7px;
    background: var(--bg-code);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--accent-color);
    font-weight: 500;
}

/* --- Code blocks (dark terminal style) --- */
.docs-body pre {
    background: #1e1e2e;
    border: 1px solid #313244;
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    overflow-x: auto;
    margin: 20px 0;
    position: relative;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.docs-body pre code {
    background: none;
    border: none;
    padding: 0;
    color: #cdd6f4;
    font-size: 0.84rem;
    line-height: 1.7;
    font-weight: 400;
}

/* Code block language label (if added via JS) */
.docs-body pre .code-lang {
    position: absolute;
    top: 8px;
    right: 48px;
    font-size: var(--font-xs);
    color: #6c7086;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    user-select: none;
}

/* --- Tables --- */
.docs-body table {
    width: 100%;
    margin: 20px 0;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.docs-body thead {
    background: var(--bg-secondary);
}
.docs-body th {
    padding: 10px 16px;
    font-size: var(--font-sm);
    font-weight: 700;
    text-align: left;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--border-color);
}
.docs-body td {
    padding: 10px 16px;
    font-size: var(--font-sm);
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}
.docs-body tr:last-child td {
    border-bottom: none;
}
.docs-body tbody tr {
    transition: background var(--transition-fast);
}
.docs-body tbody tr:hover {
    background: var(--accent-light);
}
.docs-body td code {
    font-size: 0.8em;
}

/* --- Blockquotes --- */
.docs-body blockquote {
    position: relative;
    border-left: 4px solid var(--accent-color);
    padding: 16px 20px 16px 24px;
    margin: 20px 0;
    background: var(--accent-light);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--text-secondary);
    font-style: italic;
}
.docs-body blockquote p {
    margin-bottom: 8px;
    color: var(--text-secondary);
}
.docs-body blockquote p:last-child {
    margin-bottom: 0;
}
.docs-body blockquote code {
    font-style: normal;
}

/* Callout-style blockquotes: > **Note:** or > **Warning:** */
.docs-body blockquote strong:first-child {
    font-style: normal;
    display: inline-block;
    margin-bottom: 2px;
}

/* --- Horizontal rules --- */
.docs-body hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--border-color) 20%, var(--border-color) 80%, transparent);
    margin: 40px 0;
}

/* --- Images --- */
.docs-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    margin: 24px 0;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

/* --- Definition-style formatting (bold + colon) --- */
.docs-body p > strong:first-child {
    color: var(--text-primary);
}

/* --- "See Also" sections — style as card-like --- */
.docs-body h2 + ul a,
.docs-body h3 + ul a {
    font-weight: 500;
}

/* Code copy button */
.code-copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #313244;
    border: 1px solid #45475a;
    color: #6c7086;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: var(--font-xs);
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition-fast);
    font-family: var(--font-mono);
}
.docs-body pre:hover .code-copy-btn { opacity: 1; }
.code-copy-btn:hover {
    background: #45475a;
    color: #cdd6f4;
    border-color: #585b70;
}
.code-copy-btn.copied {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

/* Prev/Next navigation */
.docs-nav-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 56px;
    padding-top: 32px;
    border-top: 2px solid var(--accent-light);
}
.docs-nav-link {
    padding: 16px 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    background: var(--bg-primary);
}
.docs-nav-link:hover {
    border-color: var(--accent-color);
    background: var(--accent-light);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.docs-nav-link .nav-direction {
    font-size: var(--font-xs);
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}
.docs-nav-link .nav-title {
    font-weight: 600;
    color: var(--accent-color);
}
.docs-nav-link.next { text-align: right; }

/* === Table of Contents === */
.docs-toc {
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
    padding: 24px 16px;
    border-left: 1px solid var(--border-color);
}
.docs-toc::-webkit-scrollbar { width: 4px; }
.docs-toc::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

.toc-title {
    font-size: var(--font-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 14px;
}
.toc-link {
    display: block;
    padding: 5px 0 5px 12px;
    font-size: var(--font-xs);
    color: var(--text-muted);
    border-left: 2px solid transparent;
    transition: all var(--transition-fast);
    line-height: 1.5;
}
.toc-link:hover { color: var(--accent-color); }
.toc-link.active {
    color: var(--accent-color);
    border-left-color: var(--accent-color);
    font-weight: 600;
}
.toc-link.level-3 { padding-left: 24px; }

/* === Responsive === */
@media (max-width: 1200px) {
    .docs-layout { grid-template-columns: 260px 1fr; }
    .docs-toc { display: none; }
    .docs-content { padding: 32px 40px; }
}

@media (max-width: 768px) {
    .docs-layout { grid-template-columns: 1fr; }
    .docs-sidebar {
        position: fixed;
        left: -100%;
        top: 64px;
        width: 280px;
        z-index: 50;
        transition: left 0.3s ease;
    }
    .docs-sidebar.mobile-open { left: 0; box-shadow: var(--shadow-lg); }
    .docs-content { padding: 24px 16px; }
    .docs-nav-footer { grid-template-columns: 1fr; }
    .docs-body h1 { font-size: var(--font-2xl); }
    .docs-body h2 { font-size: var(--font-xl); }
    .docs-body h3 { font-size: var(--font-lg); }
    .docs-body table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .docs-body pre { padding: 14px 16px; border-radius: var(--radius-md); }
    .docs-body pre code { font-size: 0.78rem; }
    .docs-body blockquote { padding: 12px 16px; }
    .docs-body h2:hover::before,
    .docs-body h3:hover::before { display: none; }
}

@media (max-width: 480px) {
    .docs-content { padding: 16px 12px; }
    .docs-body { font-size: var(--font-sm); }
    .docs-body p, .docs-body li { line-height: 1.7; }
    .docs-body pre code { font-size: 0.72rem; }
    .docs-body th, .docs-body td { padding: 6px 10px; font-size: var(--font-xs); }
    .docs-body pre { padding: 12px; }
}

@media print {
    .site-header, .docs-sidebar, .docs-toc, .docs-nav-footer, .code-copy-btn { display: none !important; }
    .docs-layout { display: block; }
    .docs-content { max-width: 100%; margin: 0; padding: 0; }
    .docs-body a[href]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #666; }
    .docs-body pre { border: 1px solid #ccc; padding: 8px; white-space: pre-wrap; word-break: break-all; }
    .docs-body table { border-collapse: collapse; }
    .docs-body th, .docs-body td { border: 1px solid #ccc; }
}
