/* ============================================================
   Aurabox API Documentation Theme
   Brand: Indigo primary, Work Sans typography (matching app)
   ============================================================ */

/* --- CSS Variable Overrides (Stoplight Elements) --- */
:root {
    /* Fonts — match the app's font stack exactly */
    --font-prose: "Work Sans", ui-sans-serif, system-ui, sans-serif,
        "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
        "Noto Color Emoji";
    --font-ui: "Work Sans", ui-sans-serif, system-ui, sans-serif,
        "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
        "Noto Color Emoji";
    --font-mono: "SF Mono", ui-monospace, Menlo, Monaco, Consolas,
        "Liberation Mono", "Courier New", monospace;
    --font-code: var(--font-mono);

    /* Bump base font sizes for readability */
    --fs-paragraph: 15px;
    --fs-paragraph-leading: 18px;
    --fs-paragraph-small: 14px;
    --fs-paragraph-tiny: 13px;
    --fs-code: 13px;

    /* Primary = Aurabox Indigo */
    --primary-h: 244;
    --primary-s: 76%;
    --primary-l: 58%;
    --color-primary: #4f46e5;
    --color-primary-dark: #4338ca;
    --color-primary-darker: #3730a3;
    --color-primary-light: #6366f1;
    --color-primary-tint: rgba(79, 70, 229, 0.1);
    --color-text-primary: #4338ca;
    --color-on-primary: #fff;

    /* Canvas (slightly warm off-white) */
    --canvas-h: 230;
    --canvas-s: 100%;
    --canvas-l: 99%;
    --color-canvas: #fafbff;
    --color-canvas-pure: #ffffff;
    --color-canvas-tint: rgba(245, 247, 255, 0.5);
    --color-canvas-50: #f5f7ff;
    --color-canvas-100: #eef0fa;
    --color-canvas-200: #e4e7f5;
    --color-canvas-300: #d8dcee;
    --color-canvas-400: #c8cde5;
    --color-canvas-500: #b8bfdc;
    --color-canvas-dialog: #fff;

    /* Borders */
    --color-border: rgba(79, 70, 229, 0.12);
    --color-border-light: rgba(79, 70, 229, 0.08);
    --color-border-dark: rgba(79, 70, 229, 0.18);
    --color-border-input: rgba(79, 70, 229, 0.25);

    /* Success */
    --color-success: #059669;
    --color-success-dark: #047857;
    --color-success-darker: #065f46;
    --color-success-light: #10b981;
    --color-success-tint: rgba(16, 185, 129, 0.15);

    /* Danger */
    --color-danger: #dc2626;
    --color-danger-dark: #b91c1c;
    --color-danger-darker: #991b1b;
    --color-danger-light: #ef4444;
    --color-danger-tint: rgba(239, 68, 68, 0.15);

    /* Warning */
    --color-warning: #d97706;
    --color-warning-dark: #b45309;
    --color-warning-darker: #92400e;
    --color-warning-light: #f59e0b;
    --color-warning-tint: rgba(245, 158, 11, 0.15);

    /* Text */
    --text-h: 230;
    --text-s: 25%;
    --text-l: 18%;
    --color-text-heading: #1e1f5c;
    --color-code: rgba(79, 70, 229, 0.06);
    --color-on-code: #3730a3;
}

/* Inverted (dark panels for Try It Out) — use app indigo-700/800 */
:root .sl-inverted,
[data-theme="light"] .sl-inverted,
[data-theme="light"] .sl-inverted .sl-inverted .sl-inverted {
    --color-primary: #818cf8;
    --color-primary-dark: #6366f1;
    --color-primary-darker: #4f46e5;
    --color-on-primary: #fff;
    --color-canvas: #312e81; /* indigo-900 */
    --color-canvas-100: #3730a3; /* indigo-800 */
    --color-canvas-200: #4338ca; /* indigo-700 */
    --color-canvas-300: #4f46e5; /* indigo-600 */
    --color-border: rgba(255, 255, 255, 0.15);
    --color-border-input: rgba(255, 255, 255, 0.3);
}

/* --- Global Resets --- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    font-family: var(--font-ui);
    background: var(--color-canvas);
    color: var(--color-text);
    line-height: 1.6;
}

/* --- Layout --- */
.aurabox-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.aurabox-body {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* --- Header — uses app's indigo-700 (#4338CA) --- */
.aurabox-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #4338ca;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.aurabox-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 100%;
    height: 56px;
    padding: 0 24px;
}

.aurabox-header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.aurabox-logo {
    height: 28px;
    width: auto;
}

.aurabox-header-title {
    color: #fff;
    font-family: var(--font-prose);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.aurabox-header-links {
    display: flex;
    align-items: center;
    gap: 16px;
}

.aurabox-header-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.aurabox-header-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    margin-right: 12px;
    transition: background 0.15s ease;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* --- Sidebar --- */
.aurabox-sidebar {
    position: sticky;
    top: 56px;
    width: 280px;
    min-width: 280px;
    height: calc(100vh - 56px);
    overflow-y: auto;
    background: #fff;
    border-right: 1px solid rgba(79, 70, 229, 0.08);
    scrollbar-width: thin;
    scrollbar-color: rgba(79, 70, 229, 0.15) transparent;
}

.aurabox-sidebar::-webkit-scrollbar {
    width: 4px;
}

.aurabox-sidebar::-webkit-scrollbar-thumb {
    background: rgba(79, 70, 229, 0.15);
    border-radius: 4px;
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Search */
.sidebar-search {
    padding: 16px 16px 12px;
    border-bottom: 1px solid rgba(79, 70, 229, 0.06);
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 10px;
    color: #9ca3af;
    pointer-events: none;
}

.search-input-wrapper input {
    width: 100%;
    height: 36px;
    padding: 0 12px 0 34px;
    font-family: var(--font-ui);
    font-size: 13px;
    background: var(--color-canvas-50);
    border: 1px solid rgba(79, 70, 229, 0.12);
    border-radius: 8px;
    color: var(--color-text);
    outline: none;
    transition: all 0.15s ease;
}

.search-input-wrapper input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
    background: #fff;
}

.search-input-wrapper input::placeholder {
    color: #9ca3af;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

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

.nav-group-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    cursor: pointer;
    user-select: none;
    transition: background 0.1s ease;
}

.nav-group-heading:hover {
    background: rgba(79, 70, 229, 0.04);
}

.nav-group-heading.active {
    background: rgba(79, 70, 229, 0.08);
}

.nav-group-link {
    font-family: var(--font-prose);
    font-size: 14px;
    font-weight: 600;
    color: #1e1f5c;
    text-decoration: none;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-group-heading .expansion-chevrons {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: 8px;
}

.nav-group-heading .expansion-chevrons svg {
    width: 10px;
    height: 10px;
    color: #9ca3af;
    transition: transform 0.2s ease;
}

.nav-item {
    transition: background 0.1s ease;
}

.nav-item-link {
    display: block;
    padding: 6px 16px 6px 28px;
    font-size: 14px;
    font-weight: 400;
    color: #4b5563;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: all 0.1s ease;
}

.nav-item-link:hover {
    color: #4f46e5;
    background: rgba(79, 70, 229, 0.04);
}

.nav-item.active .nav-item-link,
.nav-item.active > .nav-item-link {
    color: #4f46e5;
    background: rgba(79, 70, 229, 0.08);
    font-weight: 500;
}

.nav-item-nested .nav-item-link {
    padding-left: 40px;
    font-size: 13px;
}

/* --- Main Content --- */
.aurabox-content {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    height: calc(100vh - 56px);
    background: var(--color-canvas);
}

.aurabox-content-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 48px;
}

/* --- Intro Section --- */
.aurabox-intro {
    max-width: 720px;
}

.aurabox-intro > h1:first-child {
    margin-top: 0;
}

.aurabox-intro h1 {
    font-family: var(--font-prose);
    font-size: 32px;
    font-weight: 700;
    color: #1e1f5c;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    line-height: 1.2;
}

.aurabox-intro h2 {
    font-family: var(--font-prose);
    font-size: 22px;
    font-weight: 600;
    color: #1e1f5c;
    margin-top: 32px;
    margin-bottom: 12px;
}

.aurabox-intro p {
    font-size: 15px;
    line-height: 1.7;
    color: #374151;
    margin-bottom: 12px;
}

.aurabox-intro aside {
    background: rgba(79, 70, 229, 0.06);
    border-left: 3px solid #4f46e5;
    border-radius: 0 8px 8px 0;
    padding: 16px 20px;
    font-size: 14px;
    color: #374151;
    margin: 16px 0;
}

.aurabox-intro code {
    font-family: var(--font-mono);
    font-size: 13px;
    background: rgba(79, 70, 229, 0.06);
    color: #3730a3;
    padding: 2px 6px;
    border-radius: 4px;
}

/* --- Typography for Content --- */
.aurabox-content h1 {
    font-family: var(--font-prose);
    font-size: 28px;
    font-weight: 700;
    color: #1e1f5c;
    letter-spacing: -0.02em;
    margin-top: 48px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(79, 70, 229, 0.08);
}

/* First heading in content: no extra top margin — parent padding handles it */
.aurabox-content-inner > :first-child h1:first-child {
    margin-top: 0;
}

.aurabox-content h2 {
    font-family: var(--font-prose);
    font-size: 20px;
    font-weight: 600;
    color: #1e1f5c;
    margin-top: 36px;
    margin-bottom: 12px;
}

.aurabox-content h3 {
    font-family: var(--font-prose);
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    margin-top: 24px;
    margin-bottom: 8px;
}

/* --- Endpoint Cards --- */
.HttpOperation {
    background: #fff;
    border: 1px solid rgba(79, 70, 229, 0.08);
    border-radius: 12px;
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s ease;
}

.HttpOperation:hover {
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.08);
}

/* Method badges */
.HttpOperation .sl-text-lg.sl-font-semibold.sl-px-2\.5.sl-py-1 {
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* URL path display */
.HttpOperation .sl-font-mono {
    font-family: var(--font-mono);
    font-size: 14px;
}

/* Auth and deprecated badges */
.HttpOperation .sl-font-prose.sl-font-semibold.sl-px-1\.5.sl-py-0\.5 {
    font-size: 11px;
    border-radius: 4px;
    letter-spacing: 0.02em;
}

/* --- Parameters Section --- */
.HttpOperation h3 {
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 20px;
    margin-bottom: 12px;
}

/* --- FIX #1,2,3: Increase text sizes in field details --- */

/* Field descriptions — vendor hardcodes 12px, override to 14px */
.HttpOperation .sl-prose.sl-markdown-viewer[style*="font-size: 12px"],
.HttpOperation .sl-prose.sl-markdown-viewer[style] {
    font-size: 14px !important;
}

/* Also catch any 12px set via style attribute */
.HttpOperation div[style*="font-size: 12px"] {
    font-size: 14px !important;
}

/* Example labels and values */
.HttpOperation .sl-text-muted {
    font-size: 14px;
}

/* Field name + type row */
.HttpOperation .sl-text-base {
    font-size: 15px;
}

/* Enum lists — "Must be one of:" and the items */
.HttpOperation ul {
    font-size: 14px;
    margin: 6px 0;
}

.HttpOperation ul li {
    font-size: 14px;
    padding: 2px 0;
}

.HttpOperation ul li code {
    font-size: 13px;
    padding: 2px 8px;
}

/* Example value badges */
.HttpOperation .sl-bg-canvas-tint {
    font-size: 13px;
    padding: 2px 8px;
}

/* "required" / "deprecated" labels */
.HttpOperation .sl-text-warning {
    font-size: 13px;
    font-weight: 600;
}

/* sl-text-sm overrides — bump to 14px throughout endpoint cards */
.HttpOperation .sl-text-sm {
    font-size: 14px;
}

/* --- Code Blocks — use app indigo-800 (#3730a3) --- */
pre {
    background: #312e81;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
}

pre code {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    color: #e0e7ff;
    padding: 16px;
    display: block;
}

code {
    font-family: var(--font-mono);
    font-size: 13px;
}

/* Inline code */
p code,
li code,
td code {
    background: rgba(79, 70, 229, 0.06);
    color: #3730a3;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

/* --- Panels (Example Request/Response) --- */
.sl-panel {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(79, 70, 229, 0.08);
    margin-bottom: 12px;
}

/* FIX #6: Padding on example request/response panel title bar */
.sl-panel__titlebar {
    font-size: 14px;
    font-weight: 600;
    padding-top: 8px;
    padding-bottom: 8px;
}

.sl-panel__titlebar .sl--ml-2 {
    margin-left: 0;
}

.sl-panel__titlebar .sl-h-lg {
    height: auto;
    min-height: 36px;
}

/* Fix the content padding inside panels */
.sl-panel__content-wrapper pre {
    margin: 0;
    border-radius: 0;
}

/* --- FIX #4,5: Try It Out dark panels — use app indigo colours --- */
.TryItPanel {
    border-radius: 10px;
    overflow: hidden;
}

.TryItPanel .sl-panel {
    border: none;
    border-radius: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Override inverted panel background colors */
.sl-inverted .sl-bg-canvas-100 {
    background-color: #3730a3;
}

.sl-inverted .sl-bg-canvas-200 {
    background-color: #4338ca;
}

.sl-inverted .sl-rounded-lg {
    border-radius: 10px;
}

.SendButtonHolder .tryItOut-btn {
    background: #4f46e5;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    padding: 8px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.SendButtonHolder .tryItOut-btn:hover:not(:disabled) {
    background: #4338ca;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.SendButtonHolder .tryItOut-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* --- Select Dropdowns --- */
select {
    font-family: var(--font-ui);
    font-size: 14px;
    border: 1px solid rgba(79, 70, 229, 0.15);
    border-radius: 6px;
    padding: 4px 8px;
    background: #fff;
    color: #374151;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s ease;
}

select:focus {
    border-color: #4f46e5;
}

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

th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    padding: 8px 12px;
    border-bottom: 2px solid rgba(79, 70, 229, 0.1);
}

td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(79, 70, 229, 0.06);
    font-size: 14px;
}

/* --- Footer --- */
.aurabox-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    margin-top: 48px;
    border-top: 1px solid rgba(79, 70, 229, 0.08);
    font-size: 13px;
    color: #9ca3af;
}

.aurabox-footer a {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 500;
}

.aurabox-footer a:hover {
    text-decoration: underline;
}

.aurabox-footer-sep {
    color: #d1d5db;
}

/* --- Markdown Prose --- */
.sl-markdown-viewer h1 {
    font-family: var(--font-prose);
    color: #1e1f5c;
}
.sl-markdown-viewer h2 {
    font-family: var(--font-prose);
    color: #1e1f5c;
}
.sl-markdown-viewer h3 {
    font-family: var(--font-prose);
    color: #374151;
}

.sl-markdown-viewer p {
    font-size: 15px;
    line-height: 1.7;
    color: #374151;
}

.sl-markdown-viewer a {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 500;
}

.sl-markdown-viewer a:hover {
    text-decoration: underline;
}

.sl-markdown-viewer ul,
.sl-markdown-viewer ol {
    padding-left: 24px;
    margin: 8px 0;
}

.sl-markdown-viewer li {
    font-size: 15px;
    line-height: 1.7;
    color: #374151;
    margin-bottom: 4px;
}

/* --- Scrollbar for main content --- */
.aurabox-content::-webkit-scrollbar {
    width: 6px;
}

.aurabox-content::-webkit-scrollbar-thumb {
    background: rgba(79, 70, 229, 0.12);
    border-radius: 4px;
}

.aurabox-content::-webkit-scrollbar-thumb:hover {
    background: rgba(79, 70, 229, 0.25);
}

/* --- Mobile Overlay --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(49, 46, 129, 0.5);
    backdrop-filter: blur(2px);
}

.sidebar-overlay.open {
    display: block;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .aurabox-content-inner {
        padding: 32px 24px;
    }

    .HttpOperation {
        padding: 20px;
    }

    /* Stack two-column layout */
    .HttpOperation [data-testid="two-column-right"] {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-top: 24px;
    }

    .HttpOperation [data-testid="two-column-left"] {
        width: 100% !important;
    }

    .HttpOperation
        .sl-flex[data-testid="two-column-left"]
        + [data-testid="two-column-right"] {
        margin-left: 0 !important;
    }
}

@media (max-width: 768px) {
    .sidebar-toggle {
        display: flex;
    }

    .aurabox-sidebar {
        position: fixed;
        top: 56px;
        left: 0;
        bottom: 0;
        z-index: 95;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: none;
    }

    .aurabox-sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 16px rgba(0, 0, 0, 0.1);
    }

    .aurabox-header-links {
        display: none;
    }

    .aurabox-content-inner {
        padding: 24px 16px;
    }

    .aurabox-content h1 {
        font-size: 22px;
    }

    .HttpOperation {
        padding: 16px;
        border-radius: 8px;
    }
}

/* --- Print --- */
@media print {
    .aurabox-header,
    .aurabox-sidebar,
    .sidebar-toggle,
    .sidebar-overlay,
    .tryItOut-btn,
    .SendButtonHolder,
    .TryItPanel {
        display: none !important;
    }

    .aurabox-content {
        height: auto;
        overflow: visible;
    }

    .HttpOperation {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* --- Animations --- */
@media (prefers-reduced-motion: no-preference) {
    .aurabox-sidebar {
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .nav-group-heading,
    .nav-item-link,
    .aurabox-header-link,
    select,
    .HttpOperation {
        transition: all 0.15s ease;
    }
}

/* --- Accessibility --- */
:focus-visible {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

/* Skip focus ring for mouse clicks */
:focus:not(:focus-visible) {
    outline: none;
}
