/* backend/api/public/docs/css/docs.css */

/* Oliver Chat API Documentation Styles */

:root {
    --oliver-primary: #003366;
    --oliver-secondary: #0066cc;
    --oliver-accent: #66b3ff;
    --oliver-success: #28a745;
    --oliver-warning: #ffc107;
    --oliver-danger: #dc3545;
    --oliver-info: #17a2b8;
    --oliver-light: #f8f9fa;
    --oliver-dark: #343a40;
    --oliver-border: #dee2e6;
    --oliver-text: #333333;
    --oliver-text-muted: #6c757d;
    
    /* Theme variables - light mode defaults */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #333333;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
    --code-bg: #f1f3f5;
    --sidebar-bg: #ffffff;
    --sidebar-border: #e5e7eb;
    --link-color: #0066cc;
    --link-hover: #003366;
}

/* Dark theme overrides */
[data-theme="dark"] {
    --oliver-primary: #4da6ff;
    --oliver-secondary: #66b3ff;
    --oliver-accent: #33adff;
    --oliver-light: #1e293b;
    --oliver-dark: #0f172a;
    --oliver-border: #374151;
    --oliver-text: #e2e8f0;
    --oliver-text-muted: #94a3b8;
    
    --bg-primary: #1e293b;
    --bg-secondary: #0f172a;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --border-color: #374151;
    --code-bg: #374151;
    --sidebar-bg: #0f172a;
    --sidebar-border: #1e293b;
    --link-color: #66b3ff;
    --link-hover: #4da6ff;
}

/* Base styles */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--oliver-primary);
    font-weight: 600;
    line-height: 1.3;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    transition: color 0.3s ease;
}

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: var(--text-primary);
}

.lead {
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* Code blocks */
code {
    background-color: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 0.125rem 0.375rem;
    font-family: 'SFMono-Regular', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.875rem;
    color: var(--oliver-primary);
    transition: all 0.3s ease;
}

pre {
    background-color: #1e293b;
    border-radius: 0.5rem;
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
    position: relative;
    border: 1px solid #374151;
}

[data-theme="dark"] pre {
    background-color: #0f172a;
    border-color: #1e293b;
}

pre code {
    background: transparent;
    border: none;
    padding: 0;
    color: #e2e8f0;
    font-size: 0.875rem;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: var(--bg-primary);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--bg-secondary);
    font-weight: 600;
    color: var(--oliver-primary);
    transition: all 0.3s ease;
}

tr:last-child td {
    border-bottom: none;
}

/* Alerts and callouts */
.alert {
    padding: 1rem;
    border-radius: 0.375rem;
    margin: 1rem 0;
    border-left: 4px solid;
    transition: all 0.3s ease;
}

.alert-info {
    background-color: #e3f2fd;
    border-left-color: var(--oliver-info);
    color: #0277bd;
}

[data-theme="dark"] .alert-info {
    background-color: rgba(23, 162, 184, 0.15);
    color: #5bc0de;
}

.alert-success {
    background-color: #e8f5e8;
    border-left-color: var(--oliver-success);
    color: #2e7d32;
}

[data-theme="dark"] .alert-success {
    background-color: rgba(40, 167, 69, 0.15);
    color: #6abf69;
}

.alert-warning {
    background-color: #fff3cd;
    border-left-color: var(--oliver-warning);
    color: #f57c00;
}

[data-theme="dark"] .alert-warning {
    background-color: rgba(255, 193, 7, 0.15);
    color: #ffc107;
}

.alert-danger {
    background-color: #ffebee;
    border-left-color: var(--oliver-danger);
    color: #c62828;
}

[data-theme="dark"] .alert-danger {
    background-color: rgba(220, 53, 69, 0.15);
    color: #f56565;
}

/* Buttons - FIXED FOR BETTER CONTRAST */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    text-align: center;
    min-width: 80px;
}

.btn-primary {
    background-color: var(--oliver-secondary);
    color: white;
    border-color: var(--oliver-secondary);
}

.btn-primary:hover {
    background-color: var(--oliver-primary);
    border-color: var(--oliver-primary);
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .btn-primary {
    background-color: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

[data-theme="dark"] .btn-primary:hover {
    background-color: #2563eb;
    border-color: #2563eb;
    color: white;
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .btn-secondary {
    background-color: transparent;
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .btn-secondary:hover {
    background-color: var(--code-bg);
    color: var(--text-primary);
    border-color: var(--oliver-accent);
}

/* Layout components */
.documentation-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    overflow-y: auto;
    z-index: 40;
    transition: all 0.3s ease;
    padding: 1rem;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-secondary);
}

.sidebar-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-header h1 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--oliver-primary);
}

.sidebar-header p {
    margin: 0.25rem 0 0 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.sidebar-logo-link {
    color: inherit;
    text-decoration: none;
}

.sidebar-logo-link:hover {
    text-decoration: none;
}

.sidebar-logo-link:hover h1 {
    color: var(--oliver-accent);
}

.version-selector {
    margin-bottom: 1rem;
}

.version-selector select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.version-selector select:focus {
    outline: none;
    border-color: var(--oliver-secondary);
    box-shadow: 0 0 0 3px rgba(102, 179, 255, 0.1);
}

.sidebar-search {
    margin-bottom: 1.5rem;
    position: relative;
}

.sidebar-search-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.sidebar-search-input:focus {
    outline: none;
    border-color: var(--oliver-secondary);
    box-shadow: 0 0 0 3px rgba(102, 179, 255, 0.1);
}

.sidebar-search-input::placeholder {
    color: var(--text-secondary);
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li {
    margin-bottom: 0.25rem;
}

.sidebar-nav a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background-color: var(--bg-secondary);
    color: var(--oliver-primary);
    text-decoration: none;
    border-left-color: var(--oliver-accent);
}

.sidebar-nav a.active {
    background-color: rgba(102, 179, 255, 0.1);
    color: var(--oliver-primary);
    font-weight: 600;
    border-left-color: var(--oliver-secondary);
}

[data-theme="dark"] .sidebar-nav a.active {
    background-color: rgba(59, 130, 246, 0.15);
    color: var(--oliver-accent);
    border-left-color: var(--oliver-accent);
}

.content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem;
    min-height: 100vh;
    background-color: var(--bg-primary);
    transition: all 0.3s ease;
}

/* Theme toggle - FIXED */
.theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background-color: var(--oliver-primary);
    color: white;
    border: none;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.theme-toggle:hover {
    transform: scale(1.1);
    background-color: var(--oliver-secondary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.theme-toggle:focus {
    outline: 2px solid var(--oliver-accent);
    outline-offset: 2px;
}

[data-theme="dark"] .theme-toggle {
    background-color: #3b82f6;
}

[data-theme="dark"] .theme-toggle:hover {
    background-color: #2563eb;
}

.theme-toggle .light-icon,
.theme-toggle .dark-icon {
    transition: opacity 0.2s ease;
}

/* Endpoint styling */
.endpoint {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    margin: 1.5rem 0;
    overflow: hidden;
    background-color: var(--bg-primary);
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.endpoint:hover {
    border-color: var(--oliver-accent);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.endpoint-header {
    background-color: var(--bg-secondary);
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
}

.endpoint-body {
    padding: 1.5rem;
}

.http-method {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    font-family: monospace;
    min-width: 60px;
    text-align: center;
}

.http-method.get { 
    background-color: #dcfce7; 
    color: #166534; 
}

.http-method.post { 
    background-color: #dbeafe; 
    color: #1e40af; 
}

.http-method.put { 
    background-color: #fef3c7; 
    color: #92400e; 
}

.http-method.delete { 
    background-color: #fee2e2; 
    color: #991b1b; 
}

.http-method.patch { 
    background-color: #f3e8ff; 
    color: #6b21a8; 
}

[data-theme="dark"] .http-method.get { 
    background-color: rgba(22, 101, 52, 0.3); 
    color: #86efac; 
}

[data-theme="dark"] .http-method.post { 
    background-color: rgba(30, 64, 175, 0.3); 
    color: #93c5fd; 
}

[data-theme="dark"] .http-method.put { 
    background-color: rgba(146, 64, 14, 0.3); 
    color: #fbbf24; 
}

[data-theme="dark"] .http-method.delete { 
    background-color: rgba(153, 27, 27, 0.3); 
    color: #fca5a5; 
}

[data-theme="dark"] .http-method.patch { 
    background-color: rgba(107, 33, 168, 0.3); 
    color: #c084fc; 
}

.endpoint-url {
    font-family: 'SFMono-Regular', monospace;
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
}

.params-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.875rem;
}

.params-table th {
    background-color: var(--bg-secondary);
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-primary);
}

.params-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
    color: var(--text-primary);
}

/* Copy buttons - IMPROVED */
.copy-button {
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e2e8f0;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.copy-button:hover {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    transform: translateY(-1px);
}

.copy-button:focus {
    outline: 2px solid var(--oliver-accent);
    outline-offset: 2px;
}

[data-theme="dark"] .copy-button {
    background: rgba(15, 23, 42, 0.8);
    border-color: rgba(148, 163, 184, 0.2);
}

[data-theme="dark"] .copy-button:hover {
    background: rgba(15, 23, 42, 0.95);
    border-color: rgba(148, 163, 184, 0.4);
}

/* Footer */
.footer {
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.footer-content p {
    margin: 0.25rem 0;
}

.footer a {
    color: var(--link-color);
}

.footer a:hover {
    color: var(--link-hover);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 4px 0 6px -1px rgba(0, 0, 0, 0.1);
        width: 280px;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .content {
        margin-left: 0;
        padding: 1rem;
    }
    
    .theme-toggle {
        top: 0.5rem;
        right: 0.5rem;
        width: 2rem;
        height: 2rem;
        font-size: 1rem;
    }
    
    .endpoint-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .params-table {
        font-size: 0.75rem;
    }
    
    .params-table th,
    .params-table td {
        padding: 0.5rem;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
}

/* Sidebar backdrop for mobile */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 30;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-backdrop.visible {
    opacity: 1;
    visibility: visible;
}

@media (min-width: 769px) {
    .sidebar-backdrop {
        display: none;
    }
}

/* Search results - IMPROVED */
.search-results {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-top: none;
    background-color: var(--bg-primary);
    border-radius: 0 0 0.375rem 0.375rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 50;
}

.search-results a {
    display: block;
    padding: 0.75rem;
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.search-results a:hover {
    background-color: var(--bg-secondary);
    text-decoration: none;
    color: var(--oliver-primary);
}

.search-results a:last-child {
    border-bottom: none;
}

.search-results mark {
    background-color: #fef08a;
    color: #92400e;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
}

[data-theme="dark"] .search-results mark {
    background-color: #451a03;
    color: #fbbf24;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles - IMPROVED */
*:focus {
    outline: 2px solid var(--oliver-secondary);
    outline-offset: 2px;
}

button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--oliver-secondary);
    outline-offset: 2px;
}

[data-theme="dark"] *:focus,
[data-theme="dark"] button:focus,
[data-theme="dark"] a:focus,
[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
    outline-color: var(--oliver-accent);
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Environment selector */
.environment-selector {
    margin: 1rem 0;
    padding: 1rem;
    background-color: var(--bg-secondary);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.environment-selector label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.environment-selector select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.environment-selector select:focus {
    outline: none;
    border-color: var(--oliver-secondary);
    box-shadow: 0 0 0 3px rgba(102, 179, 255, 0.1);
}

/* API Key manager */
.api-key-manager {
    background-color: var(--bg-secondary);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    margin: 1rem 0;
    transition: all 0.3s ease;
}

.api-key-manager h5 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
}

.api-key-manager input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.api-key-manager input:focus {
    outline: none;
    border-color: var(--oliver-secondary);
    box-shadow: 0 0 0 3px rgba(102, 179, 255, 0.1);
}

.api-key-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.current-key {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-family: monospace;
}

.no-key {
    font-style: italic;
    font-family: inherit;
}

/* Grid layout utilities */
.grid {
    display: grid;
}

.grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 768px) {
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.gap-6 {
    gap: 1.5rem;
}

.my-8 {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

/* Feature cards */
.feature-card {
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--bg-primary);
    transition: all 0.3s ease;
}

.feature-card:hover {
    border-color: var(--oliver-secondary);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.feature-card h3 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    color: var(--oliver-primary);
}

.feature-card p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

/* Notification styles */
.notification {
    font-weight: 500;
    line-height: 1.4;
}

/* Print styles */
@media print {
    .sidebar,
    .sidebar-container,
    .theme-toggle,
    .copy-button,
    .sidebar-backdrop,
    #mobile-sidebar-toggle {
        display: none !important;
    }
    
    .content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    
    .documentation-container {
        display: block;
    }
    
    a {
        color: inherit;
        text-decoration: none;
    }
    
    pre {
        background: white;
        border: 1px solid #ccc;
        color: black;
    }
    
    pre code {
        color: black;
    }
    
    .endpoint {
        border: 1px solid #ccc;
        break-inside: avoid;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-secondary: #000000;
    }
    
    [data-theme="dark"] {
        --border-color: #ffffff;
        --text-secondary: #ffffff;
    }
    
    .btn {
        border-width: 2px;
    }
    
    .endpoint {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .theme-toggle:hover {
        transform: none;
    }
    
    .feature-card:hover {
        transform: none;
    }
    
    .btn:hover {
        transform: none;
    }
}