:root {
    --stripe-blue: #635bff;
    --stripe-purple: #8b5cf6;
    --stripe-green: #00d924;
    --stripe-red: #ff6369;
    --sidebar-width: 280px;
}

/* Dark theme (default) */
:root,
[data-theme="dark"] {
    --bg-primary: #0a0e27;
    --bg-secondary: #1a1f3a;
    --bg-tertiary: #1e2642;
    --text-primary: #e3e8ef;
    --text-secondary: #9ba3b4;
    --text-muted: #6e7891;
    --border-color: #2d3552;
    --code-bg: #1a1f3a;
    --inline-code-bg: #1e2642;
    --inline-code-color: #7dd3fc;
}

/* Light theme */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f6f9fc;
    --bg-tertiary: #edf2f7;
    --text-primary: #0a2540;
    --text-secondary: #425466;
    --text-muted: #6e7891;
    --border-color: #cbd5e0;
    --code-bg: #f6f9fc;
    --inline-code-bg: #e3e8ee;
    --inline-code-color: #0066cc;
}

[data-theme="light"] .hljs-string {
    color: #4aa564; /* modern balanced green */
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    z-index: 1000;
    padding: 32px 24px;
}

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

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

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

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #3d4565;
}

.sidebar .logo {
    margin-bottom: 24px;
    max-width: 100%;
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    margin-bottom: 24px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.theme-toggle-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.theme-toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s;
}

.theme-toggle-switch:hover {
    background: var(--text-muted);
}

.theme-toggle-switch::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .theme-toggle-switch {
    background: var(--stripe-blue);
}

[data-theme="dark"] .theme-toggle-switch::before {
    transform: translateX(20px);
}

.theme-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 6px;
    vertical-align: middle;
}

.theme-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.sidebar .search-box {
    margin-bottom: 24px;
}

.sidebar .search-box input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transition: all 0.2s;
}

.sidebar .search-box input::placeholder {
    color: var(--text-muted);
}

.sidebar .search-box input:focus {
    outline: none;
    border-color: var(--stripe-blue);
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.2);
}

.sidebar .nav-group {
    margin-bottom: 8px;
}

.sidebar .nav-item {
    display: block;
    padding: 8px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
}

.sidebar .nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar .nav-item.active {
    background: rgba(99, 91, 255, 0.15);
    color: var(--stripe-blue);
}

.sidebar .nav-subitem {
    padding-left: 28px;
    font-size: 13px;
    font-weight: 400;
}

.sidebar .footer-links {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.sidebar .footer-links a {
    display: block;
    padding: 6px 0;
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
}

.sidebar .footer-links a:hover {
    color: var(--stripe-blue);
}

/* Main Content Area */
.main-container {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.content-column {
    padding: 48px 48px 96px 48px;
    background: var(--bg-primary);
    max-width: 1400px;
    margin: 0 auto;
}

/* Typography */
h1 {
    font-size: 40px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    margin-top: 16px;
    line-height: 1.2;
}

h2 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 48px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 32px;
    margin-bottom: 12px;
}

h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 24px;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 13px;
}

p {
    margin-bottom: 16px;
    color: var(--text-secondary);
}

a {
    color: var(--stripe-blue);
    text-decoration: none;
    transition: color 0.15s;
}

a:hover {
    color: #4f46e5;
}

code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    background: var(--inline-code-bg);
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--inline-code-color);
}

pre {
    background: var(--code-bg);
    border-radius: 8px;
    padding: 16px;
    padding-top: 40px;
    overflow-x: auto;
    margin: 16px 0;
    border: 1px solid var(--border-color);
    position: relative;
}

pre code {
    background: transparent;
    padding: 0;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.6;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 8px;
}

.badge-auth {
    background: #dff5e7;
    color: #00783e;
}

.badge-method {
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 6px;
}

.badge-get {
    background: #dff5e7;
    color: #00783e;
}

.badge-post {
    background: #e6f3ff;
    color: #0066cc;
}

.badge-put {
    background: #fff4e6;
    color: #cc6600;
}

.badge-patch {
    background: #fff4e6;
    color: #cc6600;
}

.badge-delete {
    background: #ffe6e6;
    color: #cc0000;
}

.badge-deprecated {
    background: #ffe6e6;
    color: #cc0000;
}

/* Endpoint Styles */
.endpoint {
    margin-bottom: 64px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
}

.endpoint-content {
    padding-right: 24px;
}

.endpoint-examples {
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.endpoint-examples::-webkit-scrollbar {
    width: 6px;
}

.endpoint-examples::-webkit-scrollbar-track {
    background: transparent;
}

.endpoint-examples::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

@media (max-width: 1200px) {
    .endpoint {
        grid-template-columns: 1fr;
    }

    .endpoint-examples {
        position: relative;
        top: 0;
        max-height: none;
    }
}

.endpoint-header {
    margin-bottom: 24px;
}

.endpoint-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.endpoint-url {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    margin: 16px 0;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 14px;
}

.endpoint-url code {
    background: transparent;
    color: var(--text-primary);
    font-weight: 500;
}

/* Parameters */
.parameter-section {
    margin-top: 24px;
}

.parameter {
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 12px;
    background: var(--bg-secondary);
}

.parameter-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.parameter-name {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.parameter-type {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

.parameter-required {
    font-size: 11px;
    color: var(--stripe-red);
    font-weight: 600;
}

.parameter-description {
    color: var(--text-secondary);
    font-size: 14px;
}

.parameter-example {
    margin-top: 8px;
    padding: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Language Selector - Inline */
.language-selector-inline {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    padding: 16px;
    background: var(--bg-secondary);
}

.example-request-inline {
    padding: 16px;
}

.response-label {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    margin-top: 24px;
}

.example-response {
    margin-top: 24px;
}

.lang-button {
    padding: 6px 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    border-radius: 4px;
    transition: all 0.15s;
}

.lang-button:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.lang-button.active {
    color: var(--stripe-blue);
    background: rgba(99, 91, 255, 0.15);
}

/* Example Requests */
#examples-content {
    padding: 24px 32px;
}

.example-request {
    margin-bottom: 48px;
    scroll-margin-top: 120px;
}

.example-request:target {
    animation: highlight 1s ease-out;
}

@keyframes highlight {
    0% {
        background: rgba(99, 91, 255, 0.15);
    }
    100% {
        background: transparent;
    }
}

.example-title {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

/* Ensure code blocks don't overflow */
.examples-column pre {
    max-width: 100%;
    overflow-x: auto;
}

.examples-column code {
    word-break: break-word;
}

/* Try It Out */
.try-it-out-section {
    margin-top: 32px;
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.try-button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.try-button-primary {
    background: var(--stripe-blue);
    color: white;
}

.try-button-primary:hover {
    background: #7c3aed;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 91, 255, 0.4);
}

.try-button-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.try-button-secondary:hover {
    background: var(--bg-secondary);
}

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

@media (max-width: 1200px) {
    .main-container {
        grid-template-columns: 1fr;
    }

    .examples-column {
        position: relative;
        height: auto;
        max-width: none;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-container {
        margin-left: 0;
    }

    .content-column,
    .examples-column {
        padding: 24px 16px;
    }
}

/* Mobile menu button */
.mobile-menu-button {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: var(--stripe-blue);
    color: var(--stripe-white);
    border: none;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@media (max-width: 768px) {
    .mobile-menu-button {
        display: block;
    }
}

/* Blockquotes */
blockquote {
    border-left: 4px solid var(--stripe-blue);
    padding: 16px 20px;
    margin: 24px 0;
    background: rgba(99, 91, 255, 0.1);
    border-radius: 4px;
}

blockquote p {
    margin: 0;
    color: var(--text-primary);
}

/* Lists */
ul, ol {
    margin-left: 24px;
    margin-bottom: 16px;
}

li {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-secondary);
}

td {
    color: var(--text-secondary);
}

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

.endpoint {
    animation: fadeIn 0.3s ease-in-out;
}

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

/* Better scroll padding for anchors */
:target {
    scroll-margin-top: 80px;
}

/* Focus states */
*:focus {
    outline: 2px solid var(--stripe-blue);
    outline-offset: 2px;
}

button:focus,
a:focus {
    outline: 2px solid var(--stripe-blue);
    outline-offset: 2px;
}

/* Scrollbar for content */
.content-column::-webkit-scrollbar {
    width: 8px;
}

.content-column::-webkit-scrollbar-track {
    background: transparent;
}

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

.content-column::-webkit-scrollbar-thumb:hover {
    background: #3d4565;
}

/* Intro section */
.intro-section {
    margin-bottom: 48px;
}

.intro-section .title {
    font-size: 48px;
    font-weight: 700;
    color: var(--stripe-gray-dark);
    margin-bottom: 16px;
}

.intro-section .description {
    font-size: 18px;
    color: var(--stripe-gray-medium);
    line-height: 1.7;
}

/* Auth section */
.auth-section {
    padding: 24px;
    background: rgba(245, 158, 11, 0.1);
    border-left: 4px solid #f59e0b;
    border-radius: 6px;
    margin: 32px 0;
}

.auth-section h2 {
    margin-top: 0;
    color: #fbbf24;
}

.auth-section p {
    color: var(--text-secondary);
}

/* URL Box Styling */
.url-box-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 32px 0;
}

@media (max-width: 768px) {
    .url-box-container {
        grid-template-columns: 1fr;
    }
}

.url-box {
    padding: 20px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    transition: all 0.2s;
}

.url-box:hover {
    border-color: var(--stripe-blue);
    box-shadow: 0 4px 12px rgba(99, 91, 255, 0.15);
}

.url-box-production {
    border-left: 4px solid var(--stripe-blue);
}

.url-box-sandbox {
    border-left: 4px solid var(--stripe-purple);
}

.url-box-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.url-box-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.url-code {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.url-copy-btn {
    padding: 8px 16px;
    background: var(--stripe-blue);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.url-copy-btn:hover {
    background: #7c3aed;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 91, 255, 0.4);
}

.url-copy-btn:active {
    transform: translateY(0);
}

.url-copy-btn.copied {
    background: var(--stripe-green);
}

[data-theme="light"] .url-copy-btn {
    background: var(--stripe-blue);
}

[data-theme="light"] .url-copy-btn:hover {
    background: #4f46e5;
}

/* Status code colors */
.status-200, .status-201, .status-204 {
    color: var(--stripe-green);
}

.status-400, .status-401, .status-403, .status-404, .status-422 {
    color: #f59e0b;
}

.status-500, .status-503 {
    color: var(--stripe-red);
}

/* Code block improvements */
.hljs {
    background: transparent !important;
}

pre {
    position: relative;
    max-height: 600px;
    overflow-y: auto;
}

pre::-webkit-scrollbar {
    height: 8px;
}

pre::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

pre::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

/* Details/Summary styling */
details {
    margin: 12px 0;
}

details summary {
    cursor: pointer;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 4px;
    font-weight: 500;
    transition: background 0.15s;
    color: var(--text-secondary);
}

details summary:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

details[open] summary {
    margin-bottom: 12px;
}

/* Improved example section spacing */
.example-request {
    margin-bottom: 48px;
}

.example-response {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Loading states */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 8px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

/* Success/Error states */
.success-message {
    padding: 12px 16px;
    background: #d1fae5;
    border-left: 4px solid var(--stripe-green);
    border-radius: 4px;
    color: #065f46;
    margin: 16px 0;
}

.error-message {
    padding: 12px 16px;
    background: #fee2e2;
    border-left: 4px solid var(--stripe-red);
    border-radius: 4px;
    color: #991b1b;
    margin: 16px 0;
}

/* Improved nested parameter styling */
.parameter[style*="margin-left"] {
    border-left: 2px solid var(--border-color);
    padding-left: 16px;
}

/* Copy button styling */
.copy-button {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    padding: 6px 12px !important;
    font-size: 12px !important;
    background: rgba(99, 91, 255, 0.8) !important;
    border: 1px solid rgba(99, 91, 255, 0.3) !important;
    border-radius: 4px !important;
    color: white !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    font-weight: 500 !important;
    z-index: 10 !important;
}

.copy-button:hover {
    background: var(--stripe-blue) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px rgba(99, 91, 255, 0.4) !important;
}

.copy-button:active {
    transform: translateY(0) !important;
}

[data-theme="light"] .copy-button {
    background: var(--stripe-blue) !important;
    border: 1px solid rgba(99, 91, 255, 0.2) !important;
}

[data-theme="light"] .copy-button:hover {
    background: #7c3aed !important;
}

/* Print styles */
@media print {
    .sidebar,
    .mobile-menu-button,
    .try-it-out-section,
    .language-selector {
        display: none !important;
    }

    .main-container {
        margin-left: 0;
        grid-template-columns: 1fr;
    }

    .content-column {
        padding: 0;
    }

    .examples-column {
        position: relative;
        height: auto;
        background: white;
        color: #0a2540;
        page-break-inside: avoid;
    }

    pre {
        border: 1px solid #e3e8ee;
        page-break-inside: avoid;
        background: #f5f5f5;
    }

    .endpoint {
        page-break-inside: avoid;
        margin-bottom: 32px;
    }
}

