/* Modern API Documentation CSS
   Featuring:
   - Enhanced responsiveness
   - Visual improvements
   - Better mobile support
   - Modern CSS features
*/

:root {
    /* Colors */
    --primary-bg: #ffffff;
    --secondary-bg: #f8fafc;
    --sidebar-bg: #1a202c;
    --sidebar-text-color: #e2e8f0;
    --sidebar-link-hover-bg: #3182ce;
    --sidebar-link-active-bg: #2b6cb0;
    --sidebar-header-color: #63b3ed;
    --text-color: #2d3748;
    --heading-color: #1a202c;
    --link-color: #4299e1;
    --link-hover-color: #2b6cb0;
    --border-color: #e2e8f0;
    --code-bg: #2d3748;
    --code-block-bg: #1a202c;
    --badge-post-bg: #38a169;
    --badge-get-bg: #3182ce;
    --badge-put-bg: #d69e2e;
    --badge-delete-bg: #e53e3e;
    --badge-patch-bg: #805ad5;
    --alert-info-bg: #ebf8ff;
    --alert-info-border: #bee3f8;
    --alert-info-text: #2c5282;
    --alert-warning-bg: #fffaf0;
    --alert-warning-border: #feebc8;
    --alert-warning-text: #744210;
    --copy-button-bg: #4a5568;
    --copy-button-hover-bg: #718096;
    
    /* Typography */
    --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --base-font-size: 16px;
    --line-height: 1.7;
    
    /* Layout */
    --sidebar-width: 250px;
    --header-height-mobile: 66px;
    --container-max-width: 1200px;
    --content-width: calc(100% - var(--sidebar-width));
    
    /* Transitions */
    --transition-speed: 0.3s;
}

/* Reset and Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: var(--base-font-size);
}

body {
    font-family: var(--font-family);
    line-height: var(--line-height);
    background-color: var(--secondary-bg);
    color: var(--text-color);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden; /* Prevent horizontal scrolling */
    margin: 0; /* Ensure no default margins */
}

/* Main Layout Container */
.container {
    display: flex;
    width: 100%;
    max-width: var(--container-max-width);
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden; /* Prevent horizontal scrolling */
    
    padding: 0;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text-color);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform var(--transition-speed) ease-in-out;
    /*box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);*/
    
    overscroll-behavior: contain; /* Prevents scroll chaining */
}

.sidebar-header {
    padding: 1.5rem 1.25rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sidebar-header h2 {
    color: var(--sidebar-header-color);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    padding-bottom: 0 !important; /* Remove space for the line */
}

.sidebar-header h2::after {
    content: none; /* More elegant than display: none */
}

.sidebar-header p {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 0;
}

.sidebar-nav {
    list-style-type: none;
    padding: 1rem 0;
}

.sidebar-nav li a {
    display: block;
    color: var(--sidebar-text-color);
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    font-size: 0.95rem;
    transition: all var(--transition-speed) ease;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
}

.sidebar-nav li a:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-left-color: var(--sidebar-link-hover-bg);
}

.sidebar-nav li a.active {
    background-color: rgba(49, 130, 206, 0.15);
    color: #fff;
    font-weight: 500;
    border-left-color: var(--sidebar-link-hover-bg);
}

.sidebar-nav .nav-icon {
    margin-right: 0.75rem;
    font-size: 1rem;
    opacity: 0.8;
}

.category-title {
    color: #8a9bad;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    margin: 1.5rem 0 0.5rem 1.5rem;
    letter-spacing: 0.5px;
}

/* Content Area */
.content {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    background-color: var(--primary-bg);
    transition: margin-left var(--transition-speed) ease-in-out;
    min-width: 0;
    width: var(--content-width);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
    overflow-x: hidden; /* Prevent horizontal scrolling */
    position: relative; /* Ensure proper positioning context */
   padding: 1.5rem 1.5rem; /* Increased right padding for better balance */
    padding-bottom: 2rem; /* Space before footer */
}

.content-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 2rem; /* Increased padding to keep text away from edges */
}

/* Sticky header and properly fixed sidebar */
.content-header {
    display: none;
    background-color: var(--sidebar-bg);
    color: white;
    padding: 0 1.25rem;
    height: var(--header-height-mobile);
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 900;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    width: 100%;
}

.content-header h1 {
    margin: 0 auto 0 0.625rem;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--sidebar-header-color);
    
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-bottom: 0 !important; /* Remove space for the line */
}

.content-header h1::after {
    content: none; /* More elegant than display: none */
}



.menu-toggle {
    background: none;
    border: none;
    color: var(--sidebar-link-hover-bg);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 0.925rem;
    height: 100%;
    display: flex;
    
    align-items: center;
}

.menu-toggle-text {
    display: none;
}

/* Content Sections & Typography */
section {
    padding: 2rem 0;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

section:last-of-type {
    border-bottom: none;
}

h1, h2, h3, h4 {
    color: var(--heading-color);
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.3;
}

h1 {
    font-size: 2.25rem;
    margin-top: 1rem;
    padding-bottom: 0.75rem;
    position: relative;
}

h1::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 120px;
    height: 4px;
    background: var(--link-color);
    border-radius: 2px;
}

h2 {
    font-size: 1.75rem;
    margin-top: 2.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}

h2::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 60px;
    width: 120px;
    height: 3px;
    background: var(--link-color);
    opacity: 0.6;
    border-radius: 1.5px;
    
}

h3 {
    font-size: 1.4rem;
    margin-top: 2rem;
}

h4 {
    font-size: 1.15rem;
    margin-top: 1.5rem;
    color: var(--link-color);
}

p {
    margin-bottom: 1.25rem;
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color var(--transition-speed) ease;
}

a:hover {
    color: var(--link-hover-color);
}

ul, ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
}

/* Code Blocks and Syntax Highlighting */
.code-block-container {
    position: relative;
    margin: 1.5rem -0.25rem  2rem;
    border-radius: 0.5rem;
    overflow: hidden;
}

pre {
    background-color: var(--code-block-bg) !important;
    border-radius: 0.5rem;
    padding: 1.25rem;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.6;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

pre code, code.path {
    font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

code {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--link-color);
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
    font-size: 0.9em;
}

code.path {
    background-color: #edf2f7;
    color: #2d3748;
    padding: 0.25em 0.5em;
    border-radius: 0.25rem;
    font-weight: 600;
}

/* Copy Button for Code Blocks */
.copy-button {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background-color: var(--copy-button-bg);
    color: white;
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--transition-speed) ease;
    opacity: 0;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.code-block-container:hover .copy-button {
    opacity: 1;
}

.copy-button:hover {
    background-color: var(--copy-button-hover-bg);
    transform: translateY(-1px);
}

.copy-button.copied {
    background-color: var(--badge-post-bg);
}

.copy-button::before {
    content: "Copy";
}

.copy-button.copied::before {
    content: "Copied!";
}

/* Badges (HTTP Methods) */
.badge {
    color: white;
    padding: 0.25em 0.75em;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 600;
    margin-right: 0.5rem;
    display: inline-flex;
    align-items: center;
    height: 1.5rem;
    text-transform: uppercase;
}

.badge.post {
    background-color: var(--badge-post-bg);
}

.badge.get {
    background-color: var(--badge-get-bg);
}

.badge.put {
    background-color: var(--badge-put-bg);
}

.badge.delete {
    background-color: var(--badge-delete-bg);
}

.badge.patch {
    background-color: var(--badge-patch-bg);
}

/* Endpoint header styling */
.endpoint-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.endpoint-url {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    background-color: #f1f5f9;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    margin-left: 0.5rem;
    font-weight: 500;
    flex: 1;
    min-width: 200px;
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin: 1.5rem 0 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    background-color: white;
}

th, td {
    padding: 0.875rem 1rem;
    text-align: left;
    vertical-align: top;
}

th {
    background-color: var(--secondary-bg);
    font-weight: 600;
    color: var(--heading-color);
    position: sticky;
    top: 0;
    box-shadow: 0 1px 0 var(--border-color);
}

tbody tr {
    border-bottom: 1px solid var(--border-color);
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.01);
}

td code {
    background-color: #eef2ff;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.9em;
}

.required {
    color: #e53e3e;
    font-weight: 600;
    margin-left: 0.25rem;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    border-left: 4px solid transparent;
    border-radius: 0.25rem;
    font-size: 0.95rem;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.alert-info {
    color: var(--alert-info-text);
    background-color: var(--alert-info-bg);
    border-color: var(--alert-info-border);
}

.alert-warning {
    color: var(--alert-warning-text);
    background-color: var(--alert-warning-bg);
    border-color: var(--alert-warning-border);
}

/* Footer */
.footer {
    text-align: center;
    padding: 2.5rem 1.5rem;
    background-color: var(--primary-bg);
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: #64748b;
    box-sizing: border-box;
}

.footer p {
    margin-bottom: 0.5rem;
}

.footer a {
    color: var(--link-color);
}

/* Response examples */
.example-response {
    margin: 1.5rem 0;
}

.example-response-header {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--heading-color);
}

/* Search box */
.search-box {
    margin: 1rem 1.25rem;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 0.625rem 1rem 0.625rem 2.25rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.25rem;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--sidebar-text-color);
    font-size: 0.875rem;
    transition: all var(--transition-speed) ease;
}

.search-box input:focus {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: var(--sidebar-link-hover-bg);
    outline: none;
}

.search-box::before {
    content: "🔍";
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--sidebar-text-color);
    opacity: 0.6;
    font-size: 0.875rem;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    :root {
        --container-max-width: 100%;
    }
    
    .content-inner {
        max-width: 100%;
    }
}

/* Animation for menu toggle */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sidebar.active {
    animation: fadeIn 0.3s ease-out;
}

/* Fix for mobile navigation */
@media (max-width: 768px) {
    :root {
        --base-font-size: 15px;
    }
    
    .sidebar {
        transform: translateX(calc(-1 * var(--sidebar-width)));
        box-shadow: none;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    .sidebar.active {
        transform: translateX(0);
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.25);
    }
    
    .content {
        margin-left: 0;
        width: 100%;
        /*Fitting*/
        padding: 1rem 1rem;
        padding-top: var(--header-height-mobile);
    }
    
    
    
    .content-header {
        display: flex;
        padding: 0;
    }
    
    section {
        padding: 1.5rem 0;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .endpoint-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .endpoint-url {
        margin-left: 0;
        width: 100%;
    }
    
    .table-container,
    .code-block-container {
        margin: 1.5rem 0;
        width: 100%;
    }
    
    /* Prevent body scrolling when sidebar is open */
    body.sidebar-active {
        overflow: hidden;
    }
}

@media (max-width: 480px) {
    :root {
        --base-font-size: 14px;
    }
    
    .content-inner {
        padding: 0 1.5rem; /* Increased from 1rem to prevent text touching edges */
    }
    
    .content {
        padding: 1.5rem 1.25rem;
        padding-top: calc(var(--header-height-mobile) + 0.5rem);
    }
    
    section {
        padding: 1.25rem 0;
    }
    
    pre {
        padding: 1rem;
    }
    
    .table-container {
        margin: 1.25rem -1.5rem;
        width: calc(100% + 2rem);
        border-radius: 0;
    }
    
    table {
        border-radius: 0;
    }
    
    h1 {
        font-size: 1.6rem;
    }
    
    h2 {
        font-size: 1.35rem;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-bg: #111827;
        --secondary-bg: #1f2937;
        --text-color: #e5e7eb;
        --heading-color: #f3f4f6;
        --border-color: #374151;
        --link-color: #60a5fa;
        --link-hover-color: #93c5fd;
        --copy-button-bg: #4b5563;
        --copy-button-hover-bg: #6b7280;
    }
    
    code {
        background-color: rgba(255, 255, 255, 0.1);
        color: #93c5fd;
    }
    
    code.path {
        background-color: rgba(255, 255, 255, 0.1);
        color: #e5e7eb;
    }
    
    .endpoint-url {
        background-color: #374151;
    }
    
    td code {
        background-color: #2d3748;
    }
    
    .alert {
        background-color: #1f2937;
    }
}

/* Custom Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Accessibility: Focus Visible */
a:focus-visible, button:focus-visible {
    outline: 2px solid var(--link-color);
    outline-offset: 2px;
}

.copy-button:focus-visible {
    outline: 2px solid var(--copy-button-hover-bg);
    opacity: 1;
}


/************************/
/* Implementation & Additional Resources Sub-Section */
/************************/

.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.resource-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e1e4e8;
    transition: transform 0.2s ease;
}

.resource-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.resource-card h4 {
    margin-top: 0;
    margin-bottom: 10px;
}

.resource-card p {
    margin-bottom: 0;
    color: #555;
}

/************************/
/* Author Section */
/************************/
.author-note {
    padding: 0.5rem;
}

.author-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.author-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-right: 1rem;
    border: 2px solid var(--link-color);
    /* Prevent right-click */
pointer-events: none;
}

.author-title {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 0.2rem;
}

.author-note ul {
    margin: 0.5rem 0 1rem 1.5rem;
}

.author-note li {
    margin-bottom: 0.3rem;
}

/************************/