/* ============================================
   AVA Database Documentation - Styles
   Modern, clean design inspired by OpenAI Platform
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap');

/* CSS Variables for theming */
:root {
    /* Colors - Light Mode */
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --accent-color: #0ea5e9;

    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-code: #f6f8fa;
    --bg-code-inline: #eff1f3;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --text-inverse: #ffffff;
    --text-code: #24292f;
    --text-code-keyword: #cf222e;
    --text-code-string: #0a3069;
    --text-code-function: #8250df;
    --text-code-comment: #6e7781;

    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --border-code: #d0d7de;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    /* Spacing - Condensed */
    --nav-height: 48px;
    --sidebar-width: 280px;
    --toc-width: 180px;

    /* Typography - Smaller */
    --font-sans: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --font-mono: 'Consolas', 'Monaco', 'Menlo', 'Cascadia Code', 'Courier New', monospace;
    --font-size-base: 14px;
    --font-size-code: 0.8rem;
    --font-size-code-inline: 0.85rem;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-code: #0d1117;
    --bg-code-inline: #161b22;

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-tertiary: #64748b;
    --text-code: #e6edf3;
    --text-code-keyword: #ff7b72;
    --text-code-string: #a5d6ff;
    --text-code-function: #d2a8ff;
    --text-code-comment: #8b949e;

    --border-color: #334155;
    --border-light: #1e293b;
    --border-code: #30363d;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* ============================================
   Base Styles
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Navigation
   ============================================ */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background-color: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
}

[data-theme="dark"] .navbar {
    background-color: rgba(15, 23, 42, 0.9);
}

.navbar.scrolled {
    height: 40px;
    background-color: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .navbar.scrolled {
    background-color: rgba(15, 23, 42, 0.75);
}

.nav-container {
    max-width: 100%;
    margin: 0;
    margin-left: var(--sidebar-width);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
}

.nav-brand a {
    display: flex;
    align-items: baseline;
    text-decoration: none;
    gap: 0.5rem;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--primary-color);
    letter-spacing: -0.02em;
}

.logo-subtext {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Logo Image Styles */
.logo-link {
    display: inline-block;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.logo-link:hover {
    opacity: 0.8;
}

.logo-img {
    height: 40px;
    width: auto;
    display: block;
    transition: opacity 0.3s ease;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 400;
    font-size: 0.95rem;
    transition: color 0.2s ease;
    position: relative;
    text-transform: capitalize;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -0.1rem;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--primary-color);
}

.nav-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-btn,
.theme-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.search-btn:hover,
.theme-toggle:hover {
    background-color: var(--bg-secondary);
    color: var(--primary-color);
}

/* ============================================
   Buttons
   ============================================ */

.btn-primary,
.btn-secondary {
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 400;
    font-size: 0.95rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-tertiary);
    transform: translateY(-1px);
}

.btn-large {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

/* ============================================
   Layout
   ============================================ */

.main-layout {
    margin-top: var(--nav-height);
    display: flex;
    min-height: calc(100vh - var(--nav-height));
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: var(--nav-height);
    bottom: 0;
    overflow-y: auto;
    padding: 1rem 0;
    transition: transform 0.3s ease;
    z-index: 900;
}

.sidebar.collapsed {
    transform: translateX(calc(-1 * var(--sidebar-width)));
}

.sidebar-toggle {
    position: fixed;
    left: var(--sidebar-width);
    top: calc(var(--nav-height) + 1rem);
    width: 32px;
    height: 32px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: none;
    border-radius: 0 0.25rem 0.25rem 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    z-index: 901;
    transition: left 0.3s ease;
}

.sidebar.collapsed + .sidebar-toggle {
    left: 0;
}

.sidebar-toggle:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-toggle i {
    font-size: 0.875rem;
}

.sidebar-content {
    padding: 0 1rem;
}

.sidebar-section {
    margin-bottom: 1rem;
}

.sidebar-title {
    font-size: 0.65rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: 0.35rem;
    padding-left: 0.5rem;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 0.1rem;
}

.sidebar-menu a {
    display: block;
    padding: 0.3rem 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 0.25rem;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    line-height: 1.3;
    text-transform: capitalize;
}

.sidebar-menu a:hover {
    background-color: var(--bg-tertiary);
    color: var(--primary-color);
}

.sidebar-menu a.active {
    background-color: var(--primary-color);
    color: white;
    font-weight: 400;
}

.sidebar-menu a.disabled {
    color: var(--text-tertiary);
    cursor: not-allowed;
    opacity: 0.6;
}

.sidebar-menu a.disabled:hover {
    background-color: transparent;
    color: var(--text-tertiary);
}

/* Expandable Menu Items */
.sidebar-menu-expandable {
    position: relative;
}

.menu-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 0.25rem;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    line-height: 1.3;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
}

.menu-toggle:hover {
    background-color: var(--bg-tertiary);
    color: var(--primary-color);
}

.menu-toggle.active {
    background-color: var(--primary-color);
    color: white;
    font-weight: 400;
}

.menu-toggle::after {
    content: '›';
    font-size: 1.2rem;
    transition: transform 0.2s ease;
    display: inline-block;
}

.menu-toggle.expanded::after {
    transform: rotate(90deg);
}

.sidebar-submenu {
    list-style: none;
    padding-left: 1rem;
    margin-top: 0;
    margin-bottom: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, margin-top 0.3s ease, margin-bottom 0.3s ease;
}

.sidebar-submenu.expanded {
    max-height: 500px;
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
}

.sidebar-submenu li {
    margin-bottom: 0.1rem;
}

.sidebar-submenu a {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    justify-content: center;
    max-width: calc(100% - var(--sidebar-width));
}

.content-wrapper {
    flex: 1;
    max-width: 900px;
    padding: 3rem 4rem;
    margin: 0 auto;
}

/* Table of Contents */
.toc {
    width: var(--toc-width);
    position: sticky;
    top: calc(var(--nav-height) + 2rem);
    height: fit-content;
    padding: 1.5rem;
    border-left: 1px solid var(--border-color);
}

.toc-title {
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
}

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

.toc-list li {
    margin-bottom: 0.5rem;
}

.toc-list a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s ease;
}

.toc-list a:hover {
    color: var(--primary-color);
}

/* ============================================
   Hero Section
   ============================================ */

.hero-section {
    padding: 3rem 0 4rem;
    text-align: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--primary-color);
    margin-bottom: 2rem;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 400;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.hero-description {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto 2.5rem;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* ============================================
   Features Section
   ============================================ */

.features-section {
    padding: 4rem 0;
}

.section-title {
    font-size: 2rem;
    font-weight: 400;
    margin-bottom: 2.5rem;
    color: var(--text-primary);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.feature-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 2rem;
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.feature-icon {
    width: 3rem;
    height: 3rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.25rem;
    font-weight: 400;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.feature-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 400;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: gap 0.2s ease;
}

.feature-link:hover {
    gap: 0.75rem;
}

/* ============================================
   Code Examples
   ============================================ */

.code-example-section {
    padding: 4rem 0;
}

.code-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.code-tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 400;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.code-tab:hover {
    color: var(--primary-color);
}

.code-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.code-panel {
    display: none;
    background-color: var(--bg-code);
    border: 1px solid var(--border-code);
    border-radius: 0.5rem;
    overflow: hidden;
}

.code-panel.active {
    display: block;
}

.code-panel pre {
    margin: 0;
    padding: 1.25rem;
    overflow-x: auto;
}

.code-panel code {
    font-family: var(--font-mono);
    font-size: var(--font-size-code);
    line-height: 1.5;
    color: var(--text-code);
}

/* Inline code styling */
code {
    font-family: var(--font-mono);
    font-size: var(--font-size-code-inline);
    background-color: var(--bg-code-inline);
    color: var(--text-code);
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    border: 1px solid var(--border-code);
    font-weight: 400;
}

pre code {
    background-color: transparent;
    border: none;
    padding: 0;
    font-size: var(--font-size-code);
}

/* Code block (pre) styling for documentation */
article pre {
    background-color: var(--bg-code);
    border: 1px solid var(--border-code);
    border-radius: 0.5rem;
    padding: 1.25rem;
    overflow-x: auto;
    margin: 1rem 0;
    line-height: 1.5;
}

article pre code {
    color: var(--text-code);
    font-size: var(--font-size-code);
}

/* Syntax highlighting for code elements */
.code-keyword {
    color: var(--text-code-keyword);
}

.code-string {
    color: var(--text-code-string);
}

.code-function {
    color: var(--text-code-function);
}

.code-comment {
    color: var(--text-code-comment);
    font-style: italic;
}

/* ============================================
   Tables
   ============================================ */

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.875rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
}

thead {
    background-color: var(--bg-secondary);
}

th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 500;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    font-size: 0.85rem;
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    line-height: 1.5;
}

td code {
    font-size: 0.8rem;
}

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

tbody tr:hover {
    background-color: var(--bg-secondary);
}

/* ============================================
   Search Modal
   ============================================ */

.search-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    padding: 4rem 2rem;
}

.search-modal.active {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.search-modal-content {
    background-color: var(--bg-primary);
    border-radius: 0.75rem;
    max-width: 600px;
    width: 100%;
    box-shadow: var(--shadow-xl);
}

.search-input {
    width: 100%;
    padding: 1.25rem 1.5rem;
    font-size: 1.125rem;
    border: none;
    border-bottom: 1px solid var(--border-color);
    background-color: transparent;
    color: var(--text-primary);
    outline: none;
}

.search-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
}

/* ============================================
   Call to Action
   ============================================ */

.cta-section {
    text-align: center;
    padding: 4rem 0;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    border-radius: 1rem;
    margin: 4rem 0;
}

.cta-section h2 {
    font-size: 2.5rem;
    font-weight: 400;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.cta-section p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.cta-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* ============================================
   Footer
   ============================================ */

.footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 3rem 2rem 2rem;
    margin-top: 4rem;
    margin-left: var(--sidebar-width);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    font-size: 0.875rem;
    font-weight: 400;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.footer-section a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    color: var(--text-tertiary);
    font-size: 1.25rem;
    transition: color 0.2s ease;
}

.social-links a:hover {
    color: var(--primary-color);
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1024px) {
    .toc {
        display: none;
    }

    .content-wrapper {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .nav-container {
        margin-left: 0;
    }

    .nav-links {
        display: none;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        max-width: 100%;
    }

    .content-wrapper {
        padding: 2rem 1.5rem;
    }

    .footer {
        margin-left: 0;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   Utilities
   ============================================ */

.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 2rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ============================================
   Condensed Spacing Overrides
   ============================================ */

/* Reduce heading sizes */
h1 {
    font-size: 2.25rem !important;
    margin-bottom: 0.75rem !important;
    font-weight: 500 !important;
}

h2 {
    font-size: 1.5rem !important;
    margin-bottom: 0.75rem !important;
    font-weight: 500 !important;
}

h3 {
    font-size: 1.25rem !important;
    margin-bottom: 0.5rem !important;
    font-weight: 500 !important;
}

h4 {
    font-size: 1rem !important;
    margin-bottom: 0.5rem !important;
    font-weight: 500 !important;
}

/* Reduce section spacing */
section {
    margin-bottom: 2rem !important;
}

/* Reduce card/block padding */
.feature-card,
.code-panel,
.sidebar-section {
    padding: 1rem !important;
}

/* Reduce list spacing */
ul, ol {
    line-height: 1.4 !important;
}

/* Reduce paragraph spacing */
p {
    margin-bottom: 0.75rem !important;
    line-height: 1.5 !important;
}

/* Reduce code block padding */
pre {
    padding: 1rem !important;
    font-size: var(--font-size-code) !important;
    font-family: var(--font-mono) !important;
}

/* Reduce navigation padding */
.nav-link {
    padding: 0.5rem 0.75rem !important;
    text-transform: capitalize !important;
}

/* Reduce sidebar padding - already set above */
.sidebar-section {
    margin-bottom: 1rem !important;
}

.sidebar-title {
    font-size: 0.65rem !important;
    margin-bottom: 0.35rem !important;
}

.sidebar-menu li {
    margin-bottom: 0.1rem !important;
}

.sidebar-menu a {
    padding: 0.3rem 0.5rem !important;
    font-size: 0.8rem !important;
    line-height: 1.3 !important;
    text-transform: capitalize !important;
}

/* Reduce button sizes */
.btn-primary,
.btn-secondary {
    padding: 0.5rem 1rem !important;
    font-size: 0.875rem !important;
}
