/* Documentation tab styles - Markdown rendering, TOC, search */

/* Docs panel layout */
.docs-panel {
    max-width: 100%;
    overflow: hidden;
}

.docs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.docs-header h2 {
    margin-bottom: 0;
}

.docs-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.docs-search-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    width: 200px;
}

body.dark-mode .docs-search-input {
    background: #1a1a1a;
    border-color: #444;
    color: #e0e0e0;
}

.docs-search-input:focus {
    outline: none;
    border-color: #3498db;
}

.btn-github {
    padding: 8px 16px;
    background: #333;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-github:hover {
    background: #444;
}

body.dark-mode .btn-github {
    background: #2a2a2a;
    border: 1px solid #444;
}

body.dark-mode .btn-github:hover {
    background: #3a3a3a;
}

/* Layout: TOC sidebar + content */
.docs-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 20px;
    align-items: start;
}

@media (max-width: 900px) {
    .docs-layout {
        grid-template-columns: 1fr;
    }
}

/* Table of Contents */
.docs-toc {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 250px);
    overflow-y: auto;
}

body.dark-mode .docs-toc {
    background: #1a1a1a;
}

.toc-title {
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body.dark-mode .toc-title {
    color: #e0e0e0;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    margin: 6px 0;
}

.toc-list a {
    color: #3498db;
    text-decoration: none;
    font-size: 13px;
    display: block;
    padding: 4px 0;
    border-left: 2px solid transparent;
    padding-left: 10px;
    transition: all 0.2s;
}

.toc-list a:hover {
    color: #2980b9;
    border-left-color: #3498db;
    background: rgba(52, 152, 219, 0.1);
}

.toc-indent {
    padding-left: 15px;
}

.toc-indent a {
    font-size: 12px;
    color: #666;
}

body.dark-mode .toc-indent a {
    color: #999;
}

@media (max-width: 900px) {
    .docs-toc {
        position: static;
        max-height: 200px;
    }
}

/* Docs Content */
.docs-content {
    line-height: 1.7;
    overflow-x: auto;
}

.docs-content h1 {
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
    margin-top: 0;
    margin-bottom: 20px;
}

.docs-content h2 {
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
    margin-top: 40px;
    margin-bottom: 20px;
    color: #2c3e50;
}

body.dark-mode .docs-content h2 {
    border-color: #444;
    color: #e0e0e0;
}

.docs-content h3 {
    margin-top: 30px;
    margin-bottom: 15px;
    color: #34495e;
}

body.dark-mode .docs-content h3 {
    color: #d0d0d0;
}

.docs-content h4 {
    margin-top: 20px;
    margin-bottom: 10px;
}

/* Paragraphs and lists */
.docs-content p {
    margin-bottom: 15px;
}

.docs-content ul,
.docs-content ol {
    margin-bottom: 15px;
    padding-left: 25px;
}

.docs-content li {
    margin-bottom: 5px;
}

/* Links */
.docs-content a {
    color: #3498db;
    text-decoration: none;
}

.docs-content a:hover {
    text-decoration: underline;
}

/* Code blocks */
.docs-content pre {
    background: #f4f4f4;
    border-radius: 5px;
    padding: 15px;
    overflow-x: auto;
    position: relative;
    margin: 15px 0;
    border: 1px solid #e0e0e0;
}

body.dark-mode .docs-content pre {
    background: #0d0d0d;
    border-color: #333;
}

.docs-content code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 13px;
}

.docs-content p > code,
.docs-content li > code,
.docs-content td > code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    border: 1px solid #e0e0e0;
}

body.dark-mode .docs-content p > code,
body.dark-mode .docs-content li > code,
body.dark-mode .docs-content td > code {
    background: #1a1a1a;
    border-color: #333;
}

/* Tables */
.docs-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
}

.docs-content th,
.docs-content td {
    border: 1px solid #ddd;
    padding: 10px 12px;
    text-align: left;
}

body.dark-mode .docs-content th,
body.dark-mode .docs-content td {
    border-color: #444;
}

.docs-content th {
    background: #f8f9fa;
    font-weight: 600;
}

body.dark-mode .docs-content th {
    background: #1a1a1a;
}

.docs-content tr:nth-child(even) {
    background: #fafafa;
}

body.dark-mode .docs-content tr:nth-child(even) {
    background: #151515;
}

.docs-content tr:hover {
    background: #f0f7ff;
}

body.dark-mode .docs-content tr:hover {
    background: #1a2530;
}

/* Blockquotes */
.docs-content blockquote {
    border-left: 4px solid #3498db;
    margin: 15px 0;
    padding: 10px 20px;
    background: #f8f9fa;
    color: #555;
}

body.dark-mode .docs-content blockquote {
    background: #1a1a1a;
    color: #b0b0b0;
}

/* Horizontal rules */
.docs-content hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 30px 0;
}

body.dark-mode .docs-content hr {
    border-color: #444;
}

/* Copy button for code blocks */
.code-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    font-size: 12px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.docs-content pre:hover .code-copy-btn {
    opacity: 1;
}

.code-copy-btn:hover {
    background: #2980b9;
}

.code-copy-btn.copied {
    background: #27ae60;
}

/* Search highlight */
.search-highlight {
    background: #fff59d;
    padding: 1px 2px;
    border-radius: 2px;
}

body.dark-mode .search-highlight {
    background: #5d4e00;
}

/* Loading state */
.docs-loading {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

body.dark-mode .docs-loading {
    color: #999;
}

.docs-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: docs-spin 1s linear infinite;
    margin: 0 auto 15px;
}

body.dark-mode .docs-loading-spinner {
    border-color: #333;
    border-top-color: #3498db;
}

@keyframes docs-spin {
    to { transform: rotate(360deg); }
}

/* Error state */
.docs-error {
    text-align: center;
    padding: 40px;
    color: #e74c3c;
    background: #fdf2f2;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
}

body.dark-mode .docs-error {
    background: #2a1a1a;
    border-color: #5a2a2a;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .docs-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .docs-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .docs-search-input {
        width: 100%;
        flex: 1;
    }

    .docs-content table {
        display: block;
        overflow-x: auto;
    }

    .docs-content pre {
        font-size: 12px;
    }
}
