/* Documentation page styles */
.docs-container {
    display: flex;
    min-height: calc(100vh - 60px);
    gap: 0;
}

/* Sidebar */
.docs-sidebar {
    width: 280px;
    min-width: 280px;
    background: #f8f9fa;
    border-right: 1px solid #e0e0e0;
    padding: 1rem;
    overflow-y: auto;
    position: sticky;
    top: 0;
    height: calc(100vh - 60px);
}

/* Search */
.docs-search {
    position: relative;
    margin-bottom: 1rem;
}

.docs-search input {
    width: 100%;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
}

.docs-search input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.docs-search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 0 4px;
}

/* Search results */
.docs-search-results-header {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #6b7280;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 0.5rem;
}

.docs-search-result {
    display: block;
    padding: 0.5rem;
    margin-bottom: 0.25rem;
    border-radius: 4px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background 0.15s;
}

.docs-search-result:hover {
    background: #e5e7eb;
}

.docs-search-result-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: #1f2937;
}

.docs-search-result-snippet {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
    line-height: 1.4;
}

.docs-no-results {
    text-align: center;
    color: #9ca3af;
    padding: 1rem;
    font-size: 0.875rem;
}

/* TOC */
.docs-toc-title {
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    color: #374151;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 0.5rem;
}

.docs-toc-section {
    margin-bottom: 0.25rem;
}

.docs-toc-link {
    display: block;
    padding: 0.375rem 0.5rem;
    color: #4b5563;
    text-decoration: none;
    font-size: 0.875rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.docs-toc-link:hover {
    background: #e5e7eb;
    color: #1f2937;
}

.docs-toc-link.active {
    background: #dbeafe;
    color: #1d4ed8;
    font-weight: 600;
}

.docs-toc-child {
    padding-left: 1.5rem;
    font-size: 0.8125rem;
}

.docs-toc-children {
    margin-left: 0;
}

/* Content area */
.docs-content {
    flex: 1;
    padding: 2rem 3rem;
    max-width: 900px;
    overflow-y: auto;
}

.docs-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3rem;
    color: #6b7280;
}

.docs-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: docs-spin 0.8s linear infinite;
}

@keyframes docs-spin {
    to { transform: rotate(360deg); }
}

.docs-error {
    text-align: center;
    color: #dc2626;
    padding: 3rem;
}

.docs-welcome {
    text-align: center;
    padding: 3rem;
    color: #4b5563;
}

.docs-welcome h1 {
    color: #1f2937;
    margin-bottom: 1rem;
}

/* Article markdown content styling */
.docs-article {
    line-height: 1.7;
    color: #1f2937;
}

.docs-article h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
    color: #111827;
}

.docs-article h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 2rem 0 1rem;
    color: #1f2937;
}

.docs-article h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem;
    color: #374151;
}

.docs-article p {
    margin: 0 0 1rem;
}

.docs-article img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin: 1rem 0;
}

.docs-article code {
    background: #f3f4f6;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.875em;
    color: #dc2626;
}

.docs-article pre {
    background: #1f2937;
    color: #e5e7eb;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1rem 0;
}

.docs-article pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.docs-article table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.docs-article th,
.docs-article td {
    border: 1px solid #e5e7eb;
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.docs-article th {
    background: #f9fafb;
    font-weight: 600;
}

.docs-article blockquote {
    border-left: 4px solid #3b82f6;
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    background: #eff6ff;
    color: #1e40af;
    border-radius: 0 6px 6px 0;
}

.docs-article blockquote p:last-child {
    margin-bottom: 0;
}

.docs-article ul,
.docs-article ol {
    margin: 0.5rem 0 1rem;
    padding-left: 1.5rem;
}

.docs-article li {
    margin-bottom: 0.375rem;
}

.docs-article a {
    color: #2563eb;
    text-decoration: none;
}

.docs-article a:hover {
    text-decoration: underline;
}

/* YouTube iframe responsive */
.docs-article iframe {
    max-width: 100%;
    border-radius: 8px;
    margin: 1rem 0;
}

.docs-video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    margin: 1rem 0;
}

.docs-video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* YouTube thumbnail with play button overlay */
.docs-article .video-link {
    position: relative;
    display: inline-block;
    max-width: 560px;
    margin: 1rem 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.docs-article .video-link img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
}

.docs-article .video-link::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 68px;
    height: 48px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 14px;
    pointer-events: none;
}

.docs-article .video-link::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-42%, -50%);
    z-index: 1;
    border-style: solid;
    border-width: 11px 0 11px 19px;
    border-color: transparent transparent transparent #fff;
    pointer-events: none;
}

.docs-article .video-link:hover::after {
    background: rgba(255, 0, 0, 0.85);
}

/* Print-friendly */
@media print {
    .docs-sidebar {
        display: none;
    }
    .docs-content {
        max-width: 100%;
        padding: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .docs-container {
        flex-direction: column;
    }
    .docs-sidebar {
        width: 100%;
        min-width: 100%;
        height: auto;
        position: relative;
        max-height: 300px;
    }
    .docs-content {
        padding: 1rem;
    }
}
