:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --secondary-color: #10b981;
    --sidebar-width: 260px;
    --header-height: 70px;
}

/* Light Theme */
[data-theme="light"] {
    --background: #ffffff;
    --surface: #f9fafb;
    --border: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --code-bg: #1f2937;
    --code-text: #f9fafb;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --table-header-bg: #2563eb;
    --table-hover: #f9fafb;
    --info-box-bg: #fef3c7;
    --info-box-border: #f59e0b;
    --info-box-text: #78350f;
    --info-box-title: #92400e;
    --info-box-code-bg: #fde68a;
}

/* Dark Theme (Default) */
[data-theme="dark"] {
    --background: #1a1a1a;
    --surface: #3a3a3a;
    --border: #404040;
    --text-primary: #e5e5e5;
    --text-secondary: #a3a3a3;
    --code-bg: #0a0a0a;
    --code-text: #e5e5e5;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --table-header-bg: #2563eb;
    --table-hover: #383838;
    --info-box-bg: #2d2418;
    --info-box-border: #f59e0b;
    --info-box-text: #fde68a;
    --info-box-title: #fbbf24;
    --info-box-code-bg: #1f1812;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    background: var(--background);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--header-height) 1fr;
    min-height: 100vh;
}

/* Header */
.header {
    grid-column: 1 / -1;
    background: var(--background);
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    height: 100%;
    max-width: 1800px;
    margin: 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.language-switcher {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    margin-right: 1rem;
    padding-right: 1rem;
    border-right: 2px solid var(--border);
}

.theme-toggle-btn {
    background: var(--surface);
    border: 2px solid var(--border);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.theme-toggle-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: rotate(180deg);
}

.lang-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border);
    background: var(--background);
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.lang-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.lang-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Sidebar */
.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 2rem 1rem;
    padding-right: 0.5rem;
    overflow-y: auto;
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.nav-section {
    margin-bottom: 2rem;
    padding-right: 0.5rem;
}

.nav-section h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.nav-section a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s;
    margin-bottom: 0.25rem;
}

.nav-section a:hover {
    background: var(--primary-color);
    color: white;
}

/* Main Content */
.content {
    padding: 3rem;
    max-width: 1200px;
    overflow-y: auto;
}

.doc-section {
    margin-bottom: 4rem;
    scroll-margin-top: calc(var(--header-height) + 2rem);
}

.doc-section h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.doc-section h4 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.doc-section p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

/* Info Box */
.info-box {
    background: var(--info-box-bg);
    border-left: 4px solid var(--info-box-border);
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 6px;
    transition: background-color 0.3s ease;
}

.info-box h4 {
    color: var(--info-box-title);
    margin-bottom: 0.75rem;
}

.info-box ul {
    list-style: none;
    padding-left: 0;
}

.info-box li {
    color: var(--info-box-text);
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
}

.info-box li::before {
    content: "•";
    position: absolute;
    left: 0.5rem;
    font-weight: bold;
}

.info-box code {
    background: var(--info-box-code-bg);
    color: var(--info-box-text);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9em;
}

.info-box p {
    color: var(--info-box-text);
}

/* Endpoint Box */
.endpoint-box {
    background: var(--code-bg);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.method {
    background: var(--success);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.9rem;
}

.endpoint-box .url {
    color: var(--code-text);
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    word-break: break-all;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    background: var(--background);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease;
}

.data-table thead {
    background: var(--table-header-bg);
    color: white;
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    transition: border-color 0.3s ease;
}

.data-table tbody tr:hover {
    background: var(--table-hover);
}

.data-table code {
    background: var(--surface);
    color: var(--primary-color);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

/* Payload Example */
.payload-example {
    margin: 2rem 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.payload-header {
    background: var(--primary-dark);
    color: white;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.payload-header span {
    font-weight: 600;
    font-size: 0.9rem;
}

.payload-actions {
    display: flex;
    gap: 0.5rem;
}

.copy-btn,
.send-btn {
    background: transparent;
    border: none;
    color: white;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-btn:hover,
.send-btn:hover {
    transform: scale(1.2);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.payload-example pre {
    background: var(--code-bg);
    margin: 0;
    padding: 1.5rem;
    overflow-x: auto;
}

.payload-example code {
    color: var(--code-text);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Flow Diagram */
.flow-diagram {
    background: var(--surface);
    padding: 2rem;
    border-radius: 12px;
    margin: 2rem 0;
    border: 1px solid var(--border);
}

.flow-step {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--surface) !important;
    padding: 1.5rem;
    border-radius: 8px;
    border: 2px solid var(--border);
    margin: 1rem 0;
    transition: all 0.2s;
}

.flow-step:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.step-number {
    background: var(--primary-color);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.step-content h4 {
    margin-bottom: 0.25rem;
    color: var(--text-primary) !important;
}

.step-content p {
    margin: 0;
    color: var(--text-secondary) !important;
    font-size: 0.9rem;
}

.flow-arrow {
    text-align: center;
    font-size: 2rem;
    color: var(--primary-color);
    margin: 0.5rem 0;
}

.flow-split {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: center;
    margin: 1rem 0;
}

.flow-branch {
    min-width: 0;
}

.flow-or {
    background: var(--secondary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .content {
        padding: 2rem 1.5rem;
    }

    .flow-split {
        grid-template-columns: 1fr;
    }

    .flow-or {
        text-align: center;
        margin: 0.5rem 0;
    }
}

@media (max-width: 768px) {
    .header-content {
        padding: 0 1rem;
    }

    .logo {
        font-size: 1.2rem;
    }

    .content {
        padding: 1.5rem 1rem;
    }

    .doc-section h2 {
        font-size: 1.5rem;
    }

    .endpoint-box {
        flex-direction: column;
        align-items: flex-start;
    }

    .data-table {
        font-size: 0.85rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

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

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Firefox scrollbar */
.sidebar {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

/* Code inline */
code {
    font-family: 'Courier New', monospace;
}

/* Selection */
::selection {
    background: var(--primary-color);
    color: white;
}
