/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #1a1a1a;
    background-color: #f8fafc;
    overflow-x: hidden;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
    color: #4a5568;
}

a {
    color: #3182ce;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #2c5aa0;
}

code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Consolas', monospace;
    background-color: #f1f5f9;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    color: #dc2626;
}

/* ===== LAYOUT ===== */
.main-container {
    display: flex;
    min-height: 100vh;
}

/* ===== HEADER ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px;
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: white;
}

.logo-text span {
    font-size: 0.875rem;
    opacity: 0.9;
    font-weight: 400;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.version-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s ease;
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 320px;
    background: white;
    border-right: 1px solid #e2e8f0;
    position: fixed;
    top: 80px;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s ease;
}

/* Search Container */
.search-container {
    padding: 0 1.5rem 1.5rem;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: #f8fafc;
    color: #1e293b;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: #059669;
    background: white;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.search-input::placeholder {
    color: #94a3b8;
}

.sidebar-content {
    padding: 2rem 0;
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    padding: 0 1.5rem;
}

.sidebar-title i {
    font-size: 1rem;
    color: #059669;
}

/* Info Cards */
.info-cards {
    padding: 0 1.5rem;
}

.info-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.info-card:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.info-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #059669, #047857);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
}

.info-content {
    flex: 1;
}

.info-label {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.info-value {
    display: block;
    font-size: 0.875rem;
    color: #1e293b;
    font-weight: 600;
}

/* Navigation */
.sidebar-nav {
    padding: 0 1.5rem;
}

.nav-list {
    list-style: none;
}

.nav-item {
    margin-bottom: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #64748b;
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-link:hover {
    background: #f1f5f9;
    color: #475569;
}

.nav-link.active {
    background: linear-gradient(135deg, #059669, #047857);
    color: white;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.nav-link i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid #e2e8f0;
    margin-top: auto;
}

.powered-by {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #64748b;
    font-size: 0.875rem;
    transition: color 0.2s ease;
}

.powered-by:hover {
    color: #059669;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    margin-left: 320px;
    margin-top: 80px;
    padding: 2rem;
    max-width: calc(100vw - 320px);
    /* Ensure content is visible */
    visibility: visible !important;
    display: block !important;
}

.content-wrapper {
    max-width: 900px;
    margin: 0 auto;
    /* Ensure content wrapper is visible */
    visibility: visible !important;
    display: block !important;
}

.content-section {
    margin-bottom: 4rem;
    scroll-margin-top: 100px;
    opacity: 1 !important; /* Ensure content is always visible */
    visibility: visible !important;
    display: block !important;
}

.section-header {
    margin-bottom: 2rem;
    text-align: center;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: #1e293b;
    margin-bottom: 1rem;
}

.section-title i {
    color: #059669;
    font-size: 1.5rem;
}

.section-description {
    font-size: 1.125rem;
    color: #64748b;
    max-width: 600px;
    margin: 0 auto;
}

/* ===== CONTENT CARDS ===== */
.content-card {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

.content-card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.content-card:last-child {
    margin-bottom: 0;
}

.content-card h3 {
    color: #1e293b;
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

.content-card h4 {
    color: #374151;
    margin: 2rem 0 1rem 0;
    font-size: 1.125rem;
}

/* ===== ALERTS ===== */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    margin: 1.5rem 0;
    border-left: 4px solid;
}

.alert-info {
    background: #eff6ff;
    border-left-color: #3b82f6;
    color: #1e40af;
}

.alert i {
    font-size: 1.25rem;
    margin-top: 0.125rem;
}

.alert strong {
    font-weight: 600;
}

/* ===== ENDPOINT DETAILS ===== */
.endpoint-details {
    background: #f8fafc;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid #e2e8f0;
}

.endpoint-method {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.method {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-width: 80px;
    text-align: center;
}

.method.get {
    background: #dcfce7;
    color: #166534;
}

.method.post {
    background: #dbeafe;
    color: #1e40af;
}

.method.test {
    background: #fef3c7;
    color: #92400e;
}

.endpoint-url {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    color: #1e293b;
    font-weight: 500;
}

.endpoint-description {
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ===== PARAMETERS SECTION ===== */
.parameters-section {
    margin: 2rem 0;
}

.table-container {
    overflow-x: auto;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
}

.parameters-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.parameters-table th {
    background: #f8fafc;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.875rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.parameters-table th:first-child {
    border-top-left-radius: 0.75rem;
}

.parameters-table th:last-child {
    border-top-right-radius: 0.75rem;
}

.parameters-table td {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: #4a5568;
    font-size: 0.875rem;
}

.parameters-table tr:last-child td {
    border-bottom: none;
}

.type {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.type.string {
    background: #dbeafe;
    color: #1e40af;
}

.type.number {
    background: #dcfce7;
    color: #166534;
}

.type.boolean {
    background: #fef3c7;
    color: #92400e;
}

.required {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #fecaca;
    color: #dc2626;
}

/* ===== REQUEST/RESPONSE SECTIONS ===== */
.request-response {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.request-section,
.response-section {
    flex: 1;
}

.request-section h4,
.response-section h4 {
    color: #374151;
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 600;
}

/* ===== CODE BLOCKS ===== */
.code-block {
    background: #1e293b;
    border-radius: 0.75rem;
    overflow: hidden;
    margin-bottom: 1.5rem;
    border: 1px solid #334155;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #334155;
    border-bottom: 1px solid #475569;
}

.code-header span {
    color: #e2e8f0;
    font-size: 0.875rem;
    font-weight: 500;
}

.copy-btn {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.copy-btn:hover {
    background: #475569;
    color: #e2e8f0;
}

.code-block pre {
    margin: 0;
    padding: 1rem;
    overflow-x: auto;
}

.code-block code {
    background: none;
    padding: 0;
    color: #e2e8f0;
    font-size: 0.875rem;
    line-height: 1.6;
    white-space: pre;
    word-wrap: break-word;
}

/* Code wrapper for line numbers */
.code-wrapper {
    display: flex;
    position: relative;
}

.line-numbers {
    display: flex;
    flex-direction: column;
    padding: 1rem 0.5rem 1rem 1rem;
    background: #334155;
    border-right: 1px solid #475569;
    color: #94a3b8;
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    user-select: none;
    min-width: 3rem;
}

.line-numbers span {
    line-height: 1.6;
    text-align: right;
}

.code-wrapper pre {
    flex: 1;
    margin: 0;
}

/* Ensure JSON formatting is preserved */
.code-block pre code.language-json {
    white-space: pre !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Additional JSON formatting fixes */
.code-block pre code.language-json,
.code-block pre code[class*="language-json"] {
    white-space: pre !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: block;
    white-space: pre-wrap;
}

/* Force line breaks in JSON */
.code-block pre code.language-json br {
    display: block;
    content: "";
    margin-top: 0.5em;
}

/* Override any Prism.js styles that might interfere */
.code-block pre code.language-json,
.code-block pre code[class*="language-json"],
pre code.language-json,
pre code[class*="language-json"] {
    white-space: pre !important;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    display: block !important;
}

/* Ensure pre elements preserve formatting */
.code-block pre,
pre {
    white-space: pre !important;
    white-space: pre-wrap !important;
}

/* ===== ENDPOINT EXAMPLES ===== */
.endpoint-example {
    margin: 1.5rem 0;
}

.endpoint-example h4 {
    color: #374151;
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 600;
}

/* ===== MOBILE RESPONSIVENESS ===== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        max-width: 100vw;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .request-response {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    /* Mobile menu overlay */
    .mobile-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

@media (max-width: 768px) {
    .header-container {
        padding: 1rem;
    }
    
    .logo-text h1 {
        font-size: 1.25rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .content-card {
        padding: 1.5rem;
    }
    
    .section-title {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .endpoint-method {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .header-container {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .header-actions {
        width: 100%;
        justify-content: center;
    }
    
    .content-card {
        padding: 1rem;
    }
    
    .parameters-table {
        font-size: 0.75rem;
    }
    
    .parameters-table th,
    .parameters-table td {
        padding: 0.75rem 0.5rem;
    }
}

/* ===== MOBILE OVERLAY ===== */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ===== SCROLLBAR STYLING ===== */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.content-section {
    animation: fadeInUp 0.6s ease-out;
}

/* Loading state */
body:not(.loaded) .content-section {
    opacity: 1; /* Changed from 0 to 1 to ensure content is visible */
}

body.loaded .content-section {
    opacity: 1;
}

/* Intersection Observer animations */
.content-section.visible {
    animation: fadeInUp 0.6s ease-out;
}

/* Sidebar animations */
.sidebar-nav .nav-item {
    animation: slideInLeft 0.4s ease-out;
    animation-fill-mode: both;
}

.sidebar-nav .nav-item:nth-child(1) { animation-delay: 0.1s; }
.sidebar-nav .nav-item:nth-child(2) { animation-delay: 0.2s; }
.sidebar-nav .nav-item:nth-child(3) { animation-delay: 0.3s; }
.sidebar-nav .nav-item:nth-child(4) { animation-delay: 0.4s; }
.sidebar-nav .nav-item:nth-child(5) { animation-delay: 0.5s; }
.sidebar-nav .nav-item:nth-child(6) { animation-delay: 0.6s; }
.sidebar-nav .nav-item:nth-child(7) { animation-delay: 0.7s; }
.sidebar-nav .nav-item:nth-child(8) { animation-delay: 0.8s; }
.sidebar-nav .nav-item:nth-child(9) { animation-delay: 0.9s; }
.sidebar-nav .nav-item:nth-child(10) { animation-delay: 1.0s; }
.sidebar-nav .nav-item:nth-child(11) { animation-delay: 1.1s; }
.sidebar-nav .nav-item:nth-child(12) { animation-delay: 1.2s; }

/* ===== UTILITY CLASSES ===== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* ===== ACCESSIBILITY & FOCUS STATES ===== */
.nav-link:focus,
.copy-btn:focus,
.mobile-menu-toggle:focus {
    outline: 2px solid #059669;
    outline-offset: 2px;
}

.search-input:focus {
    outline: 2px solid #059669;
    outline-offset: 2px;
}

/* Skip to content link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #059669;
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1001;
}

.skip-link:focus {
    top: 6px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .content-card {
        border: 2px solid #000;
    }
    
    .method {
        border: 1px solid currentColor;
    }
    
    .nav-link.active {
        border: 2px solid #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }
