/* ──────────── DESIGN TOKENS ──────────── */
:root {
    --bg: #F8FAFC;
    --surface: #FFFFFF;
    --surface-2: #F1F5F9;
    --border: rgba(0, 0, 0, .07);
    --border-h: rgba(0, 0, 0, .12);

    --tx-1: #0F172A;
    --tx-2: #475569;
    --tx-3: #94A3B8;

    --brand: #0EA5E9;
    --brand-dim: rgba(14, 165, 233, .10);
    --brand-border: rgba(14, 165, 233, .25);

    --green: #22C55E;
    --green-dim: rgba(34, 197, 94, .12);
    --orange: #F59E0B;
    --red: #EF4444;
    --red-dim: rgba(239, 68, 68, .12);
    --purple: #8B5CF6;
    --purple-dim: rgba(139, 92, 246, .12);

    --code-bg: #0D1117;
    --code-border: #21262D;
    --code-tx: #E6EDF3;

    --sh-sm: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
    --sh-md: 0 4px 16px rgba(0, 0, 0, .06), 0 2px 6px rgba(0, 0, 0, .04);
}

[data-theme="dark"] {
    --bg: #060A14;
    --surface: #0D1117;
    --surface-2: #161B22;
    --border: rgba(255, 255, 255, .07);
    --border-h: rgba(255, 255, 255, .13);

    --tx-1: #F1F5F9;
    --tx-2: #94A3B8;
    --tx-3: #475569;

    --brand-dim: rgba(14, 165, 233, .15);
    --brand-border: rgba(14, 165, 233, .30);

    --green-dim: rgba(34, 197, 94, .15);
    --red-dim: rgba(239, 68, 68, .15);
    --purple-dim: rgba(139, 92, 246, .15);

    --code-bg: #010409;
    --code-border: #21262D;
    --code-tx: #E6EDF3;

    --sh-sm: 0 1px 3px rgba(0, 0, 0, .4), 0 1px 2px rgba(0, 0, 0, .3);
    --sh-md: 0 4px 16px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .3);
}

/* ──────────── RESET & BASE ──────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--tx-2);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    transition: background .3s, color .3s;
}

h1,
h2,
h3,
h4 {
    font-family: 'Outfit', sans-serif;
    color: var(--tx-1);
    letter-spacing: -.02em;
    line-height: 1.2;
}

p {
    color: var(--tx-2);
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

code {
    font-family: 'JetBrains Mono', monospace;
    font-size: .85em;
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 5px;
    color: var(--brand);
}

/* ──────────── SIDEBAR ──────────── */
aside {
    width: 280px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    height: 100vh;
    position: sticky;
    top: 0;
    padding: 32px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
    transition: background .3s, border-color .3s;
}

.logo {
    font-family: 'Outfit';
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--tx-1);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.logo svg {
    color: var(--brand);
    flex-shrink: 0;
}

/* Prominent back-home link just below logo */
.home-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 100px;
    border: 1px solid var(--border);
    color: var(--tx-3);
    font-size: .78rem;
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 28px;
    transition: all .2s;
    background: var(--surface-2);
    width: fit-content;
}

.home-pill:hover {
    color: var(--tx-1);
    border-color: var(--border-h);
    text-decoration: none;
}

.nav-group {
    margin-bottom: 28px;
}

.nav-group-label {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    font-weight: 700;
    color: var(--tx-3);
    padding: 0 10px;
    margin-bottom: 6px;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-links a {
    display: block;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 500;
    color: var(--tx-2);
    transition: all .15s;
}

.nav-links a:hover {
    background: var(--surface-2);
    color: var(--tx-1);
    text-decoration: none;
}

.nav-links a.active {
    background: var(--brand-dim);
    color: var(--brand);
    font-weight: 600;
}

.sidebar-cta {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-cta a {
    display: block;
    text-align: center;
    padding: 10px;
    border-radius: 10px;
    font-weight: 600;
    font-size: .875rem;
    transition: all .2s;
}

.sidebar-cta .cta-lab {
    background: var(--tx-1);
    color: var(--bg);
}

[data-theme="dark"] .sidebar-cta .cta-lab {
    background: var(--tx-1);
    color: var(--bg);
}

.sidebar-cta .cta-lab:hover {
    opacity: .85;
    text-decoration: none;
}

/* WhatsApp floating button */
.wa-float {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 60px;
    height: 60px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(37, 211, 102, .4);
    z-index: 9999;
    text-decoration: none;
    transition: all .3s cubic-bezier(.16, 1, .3, 1);
    animation: waPulse 3s ease-in-out infinite;
}

.wa-float:hover {
    transform: scale(1.1);
    box-shadow: 0 16px 32px rgba(37, 211, 102, .5);
}

@keyframes waPulse {

    0%,
    100% {
        box-shadow: 0 8px 24px rgba(37, 211, 102, .4);
    }

    50% {
        box-shadow: 0 8px 36px rgba(37, 211, 102, .7);
    }
}

/* ──────────── MAIN CONTENT ──────────── */
main {
    flex-grow: 1;
    min-width: 0;
    padding: 64px 72px;
    max-width: 900px;
    position: relative;
}

/* Theme Toggle */
.theme-btn {
    position: absolute;
    right: 40px;
    top: 40px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--tx-2);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--sh-sm);
    transition: all .2s;
}

.theme-btn:hover {
    border-color: var(--border-h);
    color: var(--tx-1);
}

.sun-icon {
    display: block;
}

.moon-icon {
    display: none;
}

[data-theme="dark"] .sun-icon {
    display: none;
}

[data-theme="dark"] .moon-icon {
    display: block;
}

/* Page Header */
.page-header {
    margin-bottom: 64px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--border);
}

.page-tag {
    display: inline-block;
    background: var(--brand-dim);
    color: var(--brand);
    border: 1px solid var(--brand-border);
    padding: 4px 12px;
    border-radius: 100px;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.page-title {
    font-size: 3rem;
    font-weight: 900;
    color: var(--tx-1);
    letter-spacing: -.04em;
    margin-bottom: 12px;
}

.page-subtitle {
    font-size: 1.1rem;
    color: var(--tx-2);
    max-width: 560px;
}

/* Sections */
section {
    margin-bottom: 72px;
    scroll-margin-top: 32px;
}

.section-number {
    font-family: 'JetBrains Mono';
    font-size: .75rem;
    color: var(--brand);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    margin-bottom: 8px;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--tx-1);
    margin-bottom: 16px;
}

.section-desc {
    color: var(--tx-2);
    margin-bottom: 28px;
    line-height: 1.7;
}

/* Method + Endpoint Row */
.endpoint-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: var(--sh-sm);
}

.method-badge {
    font-family: 'JetBrains Mono';
    font-size: .75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    letter-spacing: .05em;
}

.method-post {
    background: var(--green-dim);
    color: var(--green);
    border: 1px solid rgba(34, 197, 94, .2);
}

.endpoint-path {
    font-family: 'JetBrains Mono';
    font-size: .95rem;
    color: var(--tx-1);
    font-weight: 500;
}

/* Tables */
.table-wrap {
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    margin: 20px 0;
    box-shadow: var(--sh-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--surface-2);
}

th {
    padding: 12px 18px;
    text-align: left;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    font-weight: 700;
    color: var(--tx-3);
    border-bottom: 1px solid var(--border);
}

td {
    padding: 14px 18px;
    font-size: .9rem;
    color: var(--tx-2);
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    transition: background .2s;
}

tr:last-child td {
    border-bottom: 0;
}

tbody tr:hover td {
    background: var(--surface-2);
}

td code {
    font-size: .82rem;
    white-space: nowrap;
}

.req-badge {
    font-size: .65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--red-dim);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, .2);
    margin-left: 6px;
    vertical-align: middle;
}

.opt-badge {
    font-size: .65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--purple-dim);
    color: var(--purple);
    border: 1px solid rgba(139, 92, 246, .2);
    margin-left: 6px;
    vertical-align: middle;
}

/* Code Blocks */
.code-block {
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 14px;
    overflow: hidden;
    margin: 20px 0;
    box-shadow: var(--sh-md);
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--code-border);
    background: rgba(255, 255, 255, .02);
}

.code-dots {
    display: flex;
    gap: 6px;
}

.code-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.code-label {
    font-family: 'JetBrains Mono';
    font-size: .75rem;
    color: #6E7681;
}

.copy-btn {
    background: transparent;
    border: 1px solid #30363D;
    color: #6E7681;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: .75rem;
    cursor: pointer;
    font-family: 'Inter';
    transition: all .2s;
}

.copy-btn:hover {
    border-color: #6E7681;
    color: #E6EDF3;
}

pre {
    padding: 22px;
    overflow-x: auto;
    color: var(--code-tx);
    font-family: 'JetBrains Mono', monospace;
    font-size: .85rem;
    line-height: 1.7;
    margin: 0;
}

.hl-k {
    color: #79C0FF;
}

/* key   – blue  */
.hl-s {
    color: #A5D6FF;
}

/* str   – light blue */
.hl-v {
    color: #79C0FF;
}

/* value string */
.hl-n {
    color: #F47067;
}

/* num   – red   */
.hl-c {
    color: #6E7681;
}

/* comment – gray */

/* Status Codes Grid */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.status-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--sh-sm);
}

.status-code {
    font-family: 'JetBrains Mono';
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--tx-1);
    margin-bottom: 4px;
}

.status-desc {
    font-size: .875rem;
    color: var(--tx-2);
}

.status-action {
    font-size: .8rem;
    color: var(--tx-3);
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
}

/* Channel pills */
.channel-table-wrap {
    overflow-x: auto;
}

/* Callout box */
.callout {
    background: var(--brand-dim);
    border: 1px solid var(--brand-border);
    border-radius: 12px;
    padding: 18px 22px;
    margin: 20px 0;
    display: flex;
    gap: 14px;
}

.callout-icon {
    flex-shrink: 0;
    color: var(--brand);
    margin-top: 2px;
}

.callout p {
    color: var(--tx-2);
    font-size: .9rem;
    margin: 0;
}

.callout strong {
    color: var(--tx-1);
}

/* Responsive */
@media(max-width:1024px) {
    body {
        flex-direction: column;
    }

    aside {
        width: 100%;
        height: 100vh;
        position: fixed;
        top: 0;
        left: -100%;
        z-index: 10000;
        transition: left 0.3s ease;
        border-right: 1px solid var(--border);
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.1);
    }

    aside.open {
        left: 0;
    }

    main {
        padding: 80px 20px 40px;
        max-width: 100%;
    }

    .theme-btn {
        position: fixed;
        bottom: 24px;
        right: 24px;
        z-index: 999;
    }

    /* Mobile Menu Toggle */
    .menu-toggle {
        display: flex;
        position: fixed;
        top: 20px;
        left: 20px;
        width: 44px;
        height: 44px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 12px;
        align-items: center;
        justify-content: center;
        z-index: 1000;
        color: var(--tx-1);
        box-shadow: var(--sh-sm);
        cursor: pointer;
    }

    /* Overlay when menu is open */
    .overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        z-index: 9999;
    }

    .overlay.active {
        display: block;
    }

    .page-title {
        font-size: 2.2rem;
    }
}

@media(min-width:1025px) {

    .menu-toggle,
    .overlay {
        display: none !important;
    }
}

/* Improved Table Scrollers */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    min-width: 600px;
    /* Ensure tables have enough space then scroll */
}