/* Wiki Styles - MediaWiki-inspired modern design */

:root {
    --wiki-bg: #0a0a0f;
    --wiki-sidebar-bg: #0f0f1a;
    --wiki-content-bg: #12121f;
    --wiki-card-bg: #1a1a2e;
    --wiki-border: rgba(0, 212, 255, 0.1);
    --wiki-text: #e0e0e8;
    --wiki-text-muted: #a0a0b8;
    --wiki-link: #00d4ff;
    --wiki-link-hover: #00a8cc;
    --wiki-accent: #00d4ff;
    --wiki-success: #00ff88;
    --wiki-warning: #ffaa00;
    --wiki-danger: #ff4444;
    --wiki-code-bg: #0d0d15;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--wiki-bg);
    color: var(--wiki-text);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Navigation */
.wiki-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--wiki-border);
    z-index: 1000;
}

.wiki-nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wiki-logo a {
    color: var(--wiki-accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.3s;
}

.wiki-logo a:hover {
    opacity: 0.8;
}

.wiki-search {
    position: relative;
    width: 300px;
}

.wiki-search input {
    width: 100%;
    padding: 8px 40px 8px 16px;
    background: var(--wiki-card-bg);
    border: 1px solid var(--wiki-border);
    border-radius: 8px;
    color: var(--wiki-text);
    font-size: 14px;
    transition: all 0.3s;
}

.wiki-search input:focus {
    outline: none;
    border-color: var(--wiki-accent);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--wiki-text-muted);
    pointer-events: none;
}

/* Container */
.wiki-container {
    display: flex;
    max-width: 1400px;
    margin: 60px auto 0;
    min-height: calc(100vh - 60px);
}

/* Sidebar */
.wiki-sidebar {
    width: 280px;
    background: var(--wiki-sidebar-bg);
    border-right: 1px solid var(--wiki-border);
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--wiki-accent) transparent;
}

.wiki-sidebar::-webkit-scrollbar {
    width: 6px;
}

.wiki-sidebar::-webkit-scrollbar-thumb {
    background: var(--wiki-accent);
    border-radius: 3px;
}

.wiki-toc {
    padding: 20px;
}

.wiki-toc h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--wiki-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.toc-list {
    list-style: none;
}

.toc-list ul {
    list-style: none;
    margin-left: 16px;
    margin-top: 4px;
}

.toc-link {
    display: block;
    padding: 8px 12px;
    color: var(--wiki-text-muted);
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s;
    margin-bottom: 2px;
}

.toc-link:hover {
    color: var(--wiki-text);
    background: rgba(0, 212, 255, 0.05);
}

.toc-link.active {
    color: var(--wiki-accent);
    background: rgba(0, 212, 255, 0.1);
    font-weight: 500;
}

/* Main Content */
.wiki-content {
    flex: 1;
    padding: 40px;
    max-width: 900px;
}

.wiki-section {
    margin-bottom: 60px;
    scroll-margin-top: 80px;
}

.wiki-section h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--wiki-text);
    border-bottom: 2px solid var(--wiki-border);
    padding-bottom: 12px;
}

.wiki-section h2 {
    font-size: 28px;
    font-weight: 600;
    margin: 32px 0 16px;
    color: var(--wiki-text);
}

.wiki-section h3 {
    font-size: 20px;
    font-weight: 600;
    margin: 24px 0 12px;
    color: var(--wiki-text);
}

.wiki-section h4 {
    font-size: 16px;
    font-weight: 600;
    margin: 16px 0 8px;
    color: var(--wiki-text);
}

.wiki-section p {
    margin-bottom: 16px;
    color: var(--wiki-text-muted);
    line-height: 1.8;
}

.wiki-lead {
    font-size: 18px;
    line-height: 1.8;
    color: var(--wiki-text);
    margin-bottom: 24px;
}

/* Links */
.wiki-content a {
    color: var(--wiki-link);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s;
}

.wiki-content a:hover {
    border-bottom-color: var(--wiki-link);
}

/* Info Boxes */
.wiki-info-box {
    background: var(--wiki-card-bg);
    border: 1px solid var(--wiki-border);
    border-radius: 8px;
    padding: 16px;
    margin: 24px 0;
}

.wiki-highlight {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.05), rgba(0, 212, 255, 0.02));
    border-left: 3px solid var(--wiki-accent);
    padding: 20px;
    margin: 24px 0;
    border-radius: 0 8px 8px 0;
}

.wiki-warning {
    background: linear-gradient(135deg, rgba(255, 170, 0, 0.1), rgba(255, 170, 0, 0.05));
    border-left: 3px solid var(--wiki-warning);
    padding: 20px;
    margin: 24px 0;
    border-radius: 0 8px 8px 0;
}

.wiki-danger {
    background: linear-gradient(135deg, rgba(255, 68, 68, 0.1), rgba(255, 68, 68, 0.05));
    border-left: 3px solid var(--wiki-danger);
    padding: 20px;
    margin: 24px 0;
    border-radius: 0 8px 8px 0;
}

.wiki-success {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.1), rgba(0, 255, 136, 0.05));
    border-left: 3px solid var(--wiki-success);
    padding: 20px;
    margin: 24px 0;
    border-radius: 0 8px 8px 0;
}

/* Code Blocks */
code {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    background: var(--wiki-code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
    color: var(--wiki-accent);
}

.wiki-code, pre {
    background: var(--wiki-code-bg);
    border: 1px solid var(--wiki-border);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: var(--wiki-text);
    margin: 16px 0;
}

/* Tables */
.wiki-table-container {
    overflow-x: auto;
    margin: 24px 0;
}

.wiki-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--wiki-card-bg);
    border-radius: 8px;
    overflow: hidden;
}

.wiki-table th {
    background: var(--wiki-sidebar-bg);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--wiki-text);
    border-bottom: 2px solid var(--wiki-border);
}

.wiki-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--wiki-border);
    color: var(--wiki-text-muted);
}

.wiki-table tr:last-child td {
    border-bottom: none;
}

.wiki-table tr:hover {
    background: rgba(0, 212, 255, 0.02);
}

/* Lists */
.wiki-content ul, .wiki-content ol {
    margin: 16px 0;
    padding-left: 24px;
    color: var(--wiki-text-muted);
}

.wiki-content li {
    margin-bottom: 8px;
}

.wiki-steps {
    counter-reset: step;
    list-style: none;
    padding-left: 0;
}

.wiki-steps li {
    counter-increment: step;
    position: relative;
    padding-left: 48px;
    margin-bottom: 24px;
}

.wiki-steps li:before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 32px;
    height: 32px;
    background: var(--wiki-accent);
    color: var(--wiki-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* Tabs */
.wiki-tabs {
    display: flex;
    gap: 8px;
    margin: 24px 0 16px;
    border-bottom: 2px solid var(--wiki-border);
}

.wiki-tab-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    color: var(--wiki-text-muted);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.wiki-tab-btn:hover {
    color: var(--wiki-text);
}

.wiki-tab-btn.active {
    color: var(--wiki-accent);
    border-bottom-color: var(--wiki-accent);
}

.wiki-tab-content {
    display: none;
    padding: 24px 0;
}

.wiki-tab-content.active {
    display: block;
}

/* Cards and Grids */
.wiki-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 24px 0;
}

.wiki-card {
    background: var(--wiki-card-bg);
    border: 1px solid var(--wiki-border);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s;
}

.wiki-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 212, 255, 0.1);
}

/* Flow Diagram */
.wiki-flow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 32px 0;
    padding: 24px;
    background: var(--wiki-card-bg);
    border-radius: 12px;
    overflow-x: auto;
}

.flow-step {
    flex: 1;
    text-align: center;
    position: relative;
}

.step-number {
    display: inline-block;
    width: 40px;
    height: 40px;
    line-height: 40px;
    background: var(--wiki-accent);
    color: var(--wiki-bg);
    border-radius: 50%;
    font-weight: 700;
    margin-bottom: 12px;
}

.flow-arrow {
    color: var(--wiki-accent);
    font-size: 24px;
    margin: 0 16px;
}

/* Commands */
.wiki-commands {
    display: grid;
    gap: 16px;
    margin: 24px 0;
}

.command-item {
    background: var(--wiki-card-bg);
    border: 1px solid var(--wiki-border);
    border-radius: 8px;
    padding: 16px;
}

.command-item code {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 16px;
    color: var(--wiki-accent);
    background: var(--wiki-code-bg);
    padding: 4px 8px;
    border-radius: 4px;
}

.command-item p {
    margin-bottom: 8px;
}

.command-item .example {
    font-size: 13px;
    color: var(--wiki-text-muted);
    font-style: italic;
}

/* API Docs */
.wiki-api {
    margin: 24px 0;
}

.api-endpoint {
    background: var(--wiki-card-bg);
    border: 1px solid var(--wiki-border);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.api-endpoint h4 {
    font-size: 18px;
    margin-bottom: 12px;
}

.method {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
    margin-right: 8px;
}

.method.get {
    background: rgba(0, 255, 136, 0.2);
    color: var(--wiki-success);
}

.method.post {
    background: rgba(0, 212, 255, 0.2);
    color: var(--wiki-accent);
}

/* FAQ */
.wiki-faq details {
    background: var(--wiki-card-bg);
    border: 1px solid var(--wiki-border);
    border-radius: 8px;
    margin: 16px 0;
    padding: 16px;
}

.wiki-faq summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--wiki-text);
    list-style: none;
    position: relative;
    padding-right: 24px;
}

.wiki-faq summary::-webkit-details-marker {
    display: none;
}

.wiki-faq summary::after {
    content: '+';
    position: absolute;
    right: 0;
    top: 0;
    color: var(--wiki-accent);
    font-size: 20px;
    transition: transform 0.3s;
}

.wiki-faq details[open] summary::after {
    transform: rotate(45deg);
}

.wiki-faq details p {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--wiki-border);
}

/* Glossary */
.wiki-glossary dl {
    margin: 24px 0;
}

.wiki-glossary dt {
    font-weight: 600;
    color: var(--wiki-accent);
    margin-top: 16px;
    margin-bottom: 4px;
}

.wiki-glossary dd {
    color: var(--wiki-text-muted);
    margin-left: 0;
    padding-left: 20px;
    margin-bottom: 8px;
}

/* Back to Top */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    background: var(--wiki-accent);
    color: var(--wiki-bg);
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 999;
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.4);
}

/* Mobile Sidebar Toggle Button - Hidden by default on all screens */
.wiki-sidebar-toggle {
    display: none;
    position: fixed;
    top: 80px;
    left: 20px;
    width: 48px;
    height: 48px;
    background: var(--wiki-accent);
    color: var(--wiki-bg);
    border: none;
    border-radius: 12px;
    font-size: 24px;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.4);
    align-items: center;
    justify-content: center;
}

.wiki-sidebar-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.4);
}

.wiki-sidebar-toggle.active {
    transform: rotate(90deg);
}

/* Responsive Design - Tablet and Mobile */
@media (max-width: 1024px) {
    .wiki-sidebar-toggle {
        display: flex; /* Show toggle button only on tablet/mobile */
    }

    .wiki-sidebar {
        position: fixed;
        top: 60px;
        left: -280px;
        width: 280px;
        height: calc(100vh - 60px);
        transition: left 0.3s ease;
        z-index: 1000;
        background: var(--wiki-sidebar-bg);
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.5);
    }

    .wiki-sidebar.open {
        left: 0;
    }

    .wiki-content {
        margin-left: 0;
        width: 100%;
        padding: 40px 20px;
    }

    .wiki-container {
        flex-direction: row;
        min-height: calc(100vh - 60px);
    }

    /* Overlay when sidebar is open */
    .wiki-sidebar-overlay {
        display: none;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .wiki-sidebar-overlay.active {
        display: block;
    }
}

@media (max-width: 768px) {
    .wiki-nav-container {
        flex-direction: column;
        height: auto;
        padding: 12px 20px;
        gap: 12px;
    }

    .wiki-nav {
        height: auto;
        min-height: 60px;
        padding: 10px 0;
    }

    .wiki-search {
        width: 100%;
        margin: 0;
    }

    .wiki-container {
        margin-top: 80px;
    }

    .wiki-sidebar-toggle {
        top: auto;
        bottom: 30px;
        right: 20px;
        left: auto;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        font-size: 28px;
        box-shadow: 0 6px 16px rgba(0, 212, 255, 0.5);
    }

    .wiki-content {
        padding: 20px;
        padding-bottom: 100px;
    }

    .wiki-section h1 {
        font-size: 28px;
    }

    .wiki-section h2 {
        font-size: 22px;
    }

    .wiki-grid {
        grid-template-columns: 1fr;
    }

    .wiki-flow {
        flex-direction: column;
        gap: 20px;
    }

    .flow-arrow {
        transform: rotate(90deg);
        margin: 8px 0;
    }

    .wiki-table {
        font-size: 13px;
    }

    .wiki-table th,
    .wiki-table td {
        padding: 8px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wiki-section {
    animation: fadeIn 0.6s ease-out;
}

/* Utility Classes */
.wiki-math {
    background: var(--wiki-code-bg);
    border: 1px solid var(--wiki-border);
    border-radius: 8px;
    padding: 20px;
    margin: 24px 0;
}

.wiki-tip {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(0, 212, 255, 0.05);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 8px;
    padding: 12px;
    margin: 16px 0;
}

.wiki-checklist {
    list-style: none;
    padding-left: 0;
}

.wiki-checklist li {
    position: relative;
    padding-left: 28px;
}

.wiki-checklist li:before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--wiki-success);
    font-weight: 700;
}

/* Timeline */
.wiki-timeline {
    position: relative;
    padding-left: 40px;
    margin: 32px 0;
}

.wiki-timeline:before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--wiki-border);
}

.timeline-item {
    position: relative;
    margin-bottom: 32px;
}

.timeline-marker {
    position: absolute;
    left: -35px;
    top: 0;
    width: 32px;
    height: 32px;
    background: var(--wiki-accent);
    color: var(--wiki-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: 0 0 0 4px var(--wiki-bg);
}

.timeline-content {
    background: var(--wiki-card-bg);
    padding: 16px;
    border-radius: 8px;
}

/* Stats Grid */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.stat-card {
    background: var(--wiki-card-bg);
    border: 1px solid var(--wiki-border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--wiki-accent);
    margin-bottom: 8px;
}

.stat-label {
    display: block;
    font-size: 13px;
    color: var(--wiki-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Search Highlighting */
.search-highlight {
    background: rgba(255, 212, 0, 0.3);
    padding: 2px 4px;
    border-radius: 3px;
}

/* Print Styles */
@media print {
    .wiki-nav,
    .wiki-sidebar,
    .back-to-top {
        display: none;
    }

    .wiki-content {
        max-width: 100%;
        padding: 0;
    }

    .wiki-section {
        page-break-inside: avoid;
    }
}