:root {
    --primary: #ff8c42;
    --primary-rgb: 255, 140, 66;
    --bg-dark: #181a1b;
    /* Slightly lighter grey */
    --bg-sidebar: #222527;
    --bg-card: #212425;
    --bg-hover: #21262d;
    --text-main: #e6edf3;
    --text-dim: #7d8590;
    --border: #30363d;

    --sidebar-width: 280px;
    --toc-width: 240px;
    --header-height: 64px;
    --content-max-width: 820px;

    --radius-sm: 3px;
    --radius-md: 6px;
    --radius-lg: 10px;
    --radius-xl: 15px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

.app-container {
    max-width: var(--page-max-width);
    margin: 0 auto;
    display: flex;
    justify-content: center;
    /* Center the columns within the container */
    position: relative;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: transparent;
    /* Seamless background */
    border-right: none;
    /* Remove border */
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.sidebar-header {
    padding: 24px;
}

.logo {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
}

.logo .accent {
    color: var(--primary);
}

.search-container input {
    width: 100%;
    padding: 10px 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    color: white;
    font-size: 0.85rem;
    outline: none;
    transition: all 0.2s;
}

.search-container input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px 40px;
}

.nav-list {
    list-style: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 16px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    margin-bottom: 2px;
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--text-main);
    background-color: var(--bg-hover);
}

.nav-link.active {
    color: var(--primary);
    background-color: rgba(var(--primary-rgb), 0.08);
}

.nav-group {
    margin-top: 24px;
}

.group-title {
    padding: 0 16px 8px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-dim);
    letter-spacing: 1px;
    opacity: 0.5;
}

.sub-nav {
    list-style: none;
}

.sub-nav-link {
    font-size: 0.8rem;
    padding: 3px 16px;
    margin-left: 20px;
}

/* Main Content Area */
.main-content {
    flex: 0 1 auto;
    /* Don't force to fill, fit content */
    width: calc(var(--content-max-width) + var(--toc-width));
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-header {
    height: var(--header-height);
    padding: 0 40px;
    background: var(--bg-dark);
    /* Match body background */
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.breadcrumb {
    font-size: 0.85rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 8px;
}

.breadcrumb a {
    color: var(--text-dim);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--text-main);
}

.breadcrumb .separator {
    opacity: 0.3;
}

.header-actions .github-link {
    color: var(--text-dim);
    transition: color 0.2s;
}

.header-actions .github-link:hover {
    color: var(--text-main);
}

/* Content Layout with TOC */
.content-wrapper {
    display: flex;
    justify-content: center;
    flex: 1;
}

.content-section {
    padding: 48px 40px 80px;
    width: 100%;
    max-width: var(--content-max-width);
}

/* Content Styling */
h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    letter-spacing: -0.5px;
}

h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 3rem 0 1.2rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 1.5rem 0 0.8rem;
}

h4 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

p {
    margin-bottom: 1.2rem;
    color: var(--text-dim);
    line-height: 1.7;
}

p.lead {
    font-size: 1.15rem;
    color: var(--text-main);
    font-weight: 500;
}

code {
    background: var(--bg-hover);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
    color: #f87171;
}

.code-container {
    position: relative;
    margin: 1.5rem 0;
    background: #1b1d1e;
    border: 1px solid #222;
    border-radius: 8px;
    overflow: hidden;
}

.copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #111;
    /* Match container bg to hide text behind */
    border: 1px solid #444;
    color: #888;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
    opacity: 0;
    /* Hidden by default */
    pointer-events: none;
}

.code-container:hover .copy-btn {
    opacity: 1;
    /* Show on container hover */
    pointer-events: auto;
}

.copy-btn:hover {
    color: white;
    border-color: #666;
    background: #222;
}

pre {
    background: transparent !important;
    padding: 20px 0 !important;
    margin: 0 !important;
    border: none !important;
    overflow-x: auto;
}

/* Custom Scrollbar for Code Blocks */
pre::-webkit-scrollbar {
    height: 8px;
    background-color: transparent;
}

pre::-webkit-scrollbar-track {
    background-color: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
}

pre::-webkit-scrollbar-thumb {
    background-color: #333;
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: content-box;
}

pre::-webkit-scrollbar-thumb:hover {
    background-color: #555;
}

pre {
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

pre code {
    color: #ccc !important;
    font-size: 13px !important;
    font-family: 'JetBrains Mono', monospace !important;
    text-shadow: none !important;
    display: block !important;
    white-space: normal !important;
    /* Allow block children to handle lines */
}

.code-line {
    padding: 0 20px;
    min-height: 1.5em;
    display: block;
    transition: background 0.1s;
    white-space: pre;
}

.code-line:hover {
    background: rgba(255, 255, 255, 0.08) !important;
}

.info-card {
    background: rgba(255, 140, 66, 0.03);
    border-left: 4px solid var(--primary);
    padding: 20px 24px;
    border-radius: var(--radius-md);
    margin: 24px 0;
}

.info-card p {
    margin-bottom: 0;
    color: var(--text-main);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 20px;
    margin-top: 2rem;
}

.card {
    background: var(--bg-card);
    padding: 30px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}

.card:hover {
    border-color: rgba(var(--primary-rgb), 0.3);
    background-color: var(--bg-hover);
}

.card-tag {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.card h4 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: white;
}

.api-content {
    overflow-x: auto;
    /* Allow content to scroll if table is wide */
}

.param-table {
    width: 100%;
    min-width: 600px;
    /* Ensure table doesn't get too cramped */
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.5rem 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
}

.param-table th,
.param-table td {
    padding: 14px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.param-table th:nth-child(1) {
    width: 30%;
    min-width: 150px;
}

.param-table th:nth-child(2) {
    width: 20%;
    min-width: 100px;
}

.param-table th:nth-child(3) {
    width: 50%;
    min-width: 250px;
}

.param-table th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 700;
    color: var(--text-main);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.param-table tr:last-child td {
    border-bottom: none;
}

.param-table code {
    background: rgba(52, 152, 219, 0.15);
    color: #3498db;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
}

.required {
    color: #ff4757;
    margin-left: 4px;
    font-weight: bold;
}

.type-badge {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-dim);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* TOC Sidebar */
.toc-sidebar {
    width: var(--toc-width);
    padding-top: 48px;
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
}

.toc-container {
    padding-left: 32px;
    border-left: none;
    /* Remove border */
}

.toc-title {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 16px;
}

.toc-list {
    list-style: none;
}

.toc-item {
    margin-bottom: 5px;
}

.toc-link {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.2s;
    display: block;
}

.toc-link:hover {
    color: var(--text-main);
}

.toc-link.active {
    color: var(--primary);
}

/* Feature List */
.feature-list {
    margin: 2rem 0;
}

.feature-item {
    margin-bottom: 24px;
}

.feature-item h4 {
    margin-bottom: 6px;
    color: var(--text-main);
}

/* API Specific Colors */
.api-content .type-tag {
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 800;
    margin-bottom: 12px;
    display: block;
}

.method-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 800;
    font-size: 0.7rem;
    margin-right: 12px;
}

.get {
    background: rgba(46, 204, 113, 0.15);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.post {
    background: rgba(52, 152, 219, 0.15);
    color: #3498db;
    border: 1px solid rgba(52, 152, 219, 0.3);
}

.put {
    background: rgba(241, 196, 15, 0.15);
    color: #f1c40f;
    border: 1px solid rgba(241, 196, 15, 0.3);
}

.delete {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.nav-method-badge {
    font-size: 0.6rem;
    font-weight: 800;
    padding: 1px 4px;
    border-radius: 3px;
    min-width: 32px;
    text-align: center;
    line-height: 1;
    margin-right: 4px;
    flex-shrink: 0;
}

.nav-method-badge.get {
    color: #2ecc71;
    background: rgba(46, 204, 113, 0.1);
    border: 1px solid rgba(46, 204, 113, 0.2);
}

.nav-method-badge.post {
    color: #3498db;
    background: rgba(52, 152, 219, 0.1);
    border: 1px solid rgba(52, 152, 219, 0.2);
}

.nav-method-badge.put {
    color: #f1c40f;
    background: rgba(241, 196, 15, 0.1);
    border: 1px solid rgba(241, 196, 15, 0.2);
}

.nav-method-badge.delete {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.2);
}

.nav-label-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

footer {
    padding: 60px 40px;
    background-color: transparent;
    /* Seamless background */
}

.footer-content {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 1200px) {
    .toc-sidebar {
        display: none;
    }
}

@media (max-width: 900px) {
    .sidebar {
        display: none;
    }

    .content-section {
        padding: 40px 20px;
    }

    .top-header {
        padding: 0 20px;
    }
}