/* ======== BASE STYLES ======== */
:root {
    --sidebar-width: 280px;
    --bg-color: #ffffff;
    --text-main: #334155;
    /* softer dark for reading */
    --text-heading: #1e1e1e;
    /* charcoal */
    --border-color: #e2e8f0;
    /* clean light gray */
    --sidebar-bg: #fdfdfc;
    /* very subtle warm tint */
    --primary: #8b9a6b;
    /* olive/sage green */
    --code-bg: #fdfdfd;
    --font-sans: 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --border-subtle: #f1f5f9;
    --bg-light: #f8fafc;
    --method-get: #00966b;
    --method-post: #247aff;
    --method-put: #9c3df4;
    --method-delete: #d32f2f;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    color: var(--text-main);
    background: var(--bg-color);
    line-height: 1.6;
    font-size: 15px;
    display: flex;
    min-height: 100vh;
}

/* ======== TYPOGRAPHY ======== */
h1,
h2,
h3,
h4 {
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 24px;
    letter-spacing: -0.02em;
}

h1 {
    font-size: 36px;
    margin-top: 0;
}

h2 {
    font-size: 28px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 24px;
    margin-top: 48px;
}

h3 {
    font-size: 18px;
    margin-top: 32px;
    margin-bottom: 16px;
}

p {
    margin-bottom: 20px;
    color: #475569;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--text-heading);
}

strong {
    color: var(--text-heading);
    font-weight: 600;
}

code {
    font-family: var(--font-mono);
    background: #f1f5f9;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 13px;
    color: #c026d3;
    /* subtle pinkish purple for inline code */
}

/* ======== SIDEBAR ======== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    position: fixed;
    height: 100vh;
    top: 0;
    left: 0;
    overflow-y: auto;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.77, 0, 0.175, 1);
}

.sidebar .logo-wrap {
    display: flex;
    align-items: center;
}

.sidebar-header {
    padding: 32px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header h2 {
    font-size: 20px;
    margin: 0;
    border: none;
    padding: 0;
    color: var(--text-heading);
}

.version-badge {
    background: #e2e8f0;
    color: #475569;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
}

.sidebar-nav {
    padding: 24px;
    flex: 1;
}

.nav-group {
    margin-bottom: 24px;
}

.nav-title {
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: #64748b;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 2px;
    transition: all 0.2s;
}

.nav-link:hover {
    background: #f1f5f9;
    color: var(--text-heading);
}

.nav-link.active {
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    color: var(--primary);
    font-weight: 600;
}

.nav-method {
    font-size: 9px;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 4px;
    text-transform: uppercase;
}

.nav-method.get {
    color: var(--method-get);
}

.nav-method.post {
    color: var(--method-post);
}

.nav-method.put {
    color: var(--method-put);
}

.nav-method.delete {
    color: var(--method-delete);
}

/* ======== GLOBAL LANGUAGE SELECTOR ======== */
.global-lang-selector {
    display: none;
    /* We'll move it to the right pane like Flutterwave */
}

.lang-label {
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-right: 8px;
}

.global-lang-selector .lang-btn {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid var(--border-color);
    padding: 6px 16px;
}

.global-lang-selector .lang-btn:hover {
    background: #e2e8f0;
    color: var(--text-heading);
}

.global-lang-selector .lang-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.lang-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 32px;
}

.lang-btn {
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-btn .icon {
    font-size: 18px;
    opacity: 0.6;
}

.lang-label-text {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
}

.lang-btn:hover {
    border-color: var(--primary);
    background: #fafafa;
}

.lang-btn.active {
    border-color: var(--primary);
    background: #fdfdfd;
    box-shadow: 0 4px 12px rgba(139, 154, 107, 0.1);
}

.lang-btn.active .lang-label-text {
    color: var(--primary);
}

.lang-btn.active .icon {
    opacity: 1;
}

/* ======== MAIN CONTENT LAYOUT ======== */
.content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
}

.doc-section {
    display: flex;
    min-height: 400px;
    border-bottom: 1px solid var(--border-color);
}

.doc-section:last-child {
    border-bottom: none;
}

/* Left Pane: Prose */
.prose {
    flex: 1;
    padding: 64px 60px;
    background: var(--bg-color);
}

.prose ul,
.prose ol {
    margin-bottom: 24px;
    padding-left: 20px;
    color: #475569;
}

.prose li {
    margin-bottom: 8px;
}

/* Right Pane: Code */
.code-area {
    width: 480px;
    flex-shrink: 0;
    background: var(--code-bg);
    padding: 64px 32px;
    border-left: 1px solid var(--border-color);
}

/* Sticky Right Pane Behavior */
@media (min-width: 1024px) {
    .doc-section {
        position: relative;
        align-items: flex-start;
    }

    .code-area {
        position: sticky;
        top: 0;
        height: 100vh;
        overflow-y: auto;
    }
}

/* ======== API ELEMENTS ======== */
.endpoint {
    background: var(--bg-light);
    border: 1px solid var(--border-subtle);
    padding: 8px 12px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 13px;
    margin-bottom: 24px;
}

.method {
    font-size: 10px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: 10px;
}

.method.get {
    background: var(--method-get);
    color: #fff;
}

.method.post {
    background: var(--method-post);
    color: #fff;
}

.method.put {
    background: var(--method-put);
    color: #fff;
}

.method.delete {
    background: var(--method-delete);
    color: #fff;
}

.path {
    color: var(--text-heading);
}

.api-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 32px;
    font-size: 14px;
}

.api-table th {
    text-align: left;
    padding: 12px 0;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-heading);
    font-weight: 600;
}

.api-table td {
    padding: 16px 0;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
    color: #475569;
}

.api-table code {
    background: none;
    padding: 0;
    color: var(--text-heading);
    font-weight: 500;
}

.required {
    font-size: 11px;
    color: #ef4444;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-left: 8px;
}

.syntax-box {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 8px;
    font-family: var(--font-mono);
    color: var(--text-heading);
    margin-bottom: 24px;
    overflow-x: auto;
}

/* ======== CODE BLOCKS (RIGHT PANE) ======== */
.code-block {
    margin-bottom: 24px;
    border-radius: 12px;
    overflow: hidden;
    background: #0f172a;
    /* Back to dark blocks but with better styling */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.code-header {
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    padding: 14px 24px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    letter-spacing: 0.05em;
}

pre {
    margin: 0 !important;
    padding: 24px !important;
    background: transparent !important;
    overflow: auto !important;
    max-height: 500px;
    line-height: 1.6 !important;
}

code[class*="language-"] {
    color: #f8fafc !important;
    font-size: 14px !important;
    white-space: pre !important;
    word-break: normal !important;
    word-wrap: normal !important;
}

code[class*="language-"],
pre[class*="language-"] {
    font-family: var(--font-mono) !important;
    text-shadow: none !important;
}

/* ======== SYNTAX HIGHLIGHTING OVERRIDES (Vibrant on Dark) ======== */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: #6a737d !important;
    font-style: italic;
}

.token.punctuation {
    color: #9cdcfe !important;
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol {
    color: #79c0ff !important;
    /* Sky Blue for Keys */
    font-weight: 500;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
    color: #a5d6ff !important;
    /* Bright Blue for Values/Strings */
}

.token.operator,
.token.entity,
.token.url {
    color: #d1d5db !important;
}

.token.atrule,
.token.attr-value,
.token.keyword {
    color: #ff7b72 !important;
    /* Coral Red for Keywords */
}

.token.function,
.token.class-name {
    color: #d2a8ff !important;
    /* Purple for Functions */
}

.token.regex,
.token.important,
.token.variable {
    color: #ffa657 !important;
}

.token.important,
.token.bold {
    font-weight: bold;
}

.token.italic {
    font-style: italic;
}

/* ======== RESPONSIVE REFINEMENTS (MOBILE DRAWER) ======== */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    z-index: 900;
    padding: 0 20px;
    align-items: center;
    justify-content: space-between;
}

.mobile-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text-heading);
}

.hamburger {
    width: 30px;
    height: 30px;
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-heading);
    border-radius: 2px;
    transition: 0.3s;
}

.hamburger.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 1100px) {
    .doc-section {
        flex-direction: column;
    }

    .prose,
    .code-area {
        width: 100%;
        max-width: none;
        padding: 40px 24px;
    }

    .code-area {
        border-left: none;
        border-top: 1px solid var(--border-color);
        position: relative;
        top: 0;
        height: auto;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .mobile-header {
        display: flex;
    }

    .content {
        margin-left: 0;
        width: 100%;
        padding-top: 64px;
        /* prevent overlap with fixed mobile header */
    }

    body.sidebar-open {
        overflow: hidden;
    }
}