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

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #f0f9ff;
    --accent: #ec4899;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --surface: #ffffff;
    --surface-glass: rgba(255, 255, 255, 0.7);
    --border-color: #e2e8f0;
    --nav-height: 64px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.16), 0 2px 4px rgba(0,0,0,0.20);
    --shadow-lg: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-accent: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --max-width: 1200px;
    --radius: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --primary-color: #818cf8;
    --primary-dark: #6366f1;
    --secondary-color: #1e293b;
    --accent: #f472b6;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --surface: #0f172a;
    --surface-glass: rgba(15, 23, 42, 0.7);
    --border-color: #334155;
}

/* Smooth page transitions */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(26, 115, 232, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(26, 115, 232, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(26, 115, 232, 0);
    }
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: #ffffff; /* Simple white background */
    transition: all 0.3s ease;
}

[data-theme="dark"] body {
    background: #0f172a; /* Simple dark background */
}

/* Removed animated background for better readability */

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Removed scroll progress bar to reduce visual clutter */

/* Navigation with Glassmorphism */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--surface-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    z-index: 1000;
    transition: all 0.3s ease;
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

/* Sidebar Toggle */
.sidebar-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: transparent;
    border: none;
    cursor: pointer;
    margin-right: 15px;
}

.sidebar-toggle span {
    display: block;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s;
}

.sidebar-toggle:hover span {
    background: var(--primary-color);
}

/* Search Container */
.search-container {
    position: relative;
    flex: 1;
    max-width: 400px;
    min-height: 36px; /* Ensure minimum height */
}

/* Algolia Search Styling */
#searchbox {
    width: 100%;
    min-height: 36px; /* Ensure minimum height */
}

/* Fallback search input */
.fallback-search-input {
    width: 100%;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    font-size: 14px;
    background: white;
    color: var(--text-primary);
}

.ais-SearchBox {
    width: 100%;
}

.ais-SearchBox-form {
    position: relative;
}

.ais-SearchBox-input {
    width: 100%;
    padding: 8px 40px 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    font-size: 14px;
    background: white;
    color: var(--text-primary);
    transition: var(--transition);
}

[data-theme="dark"] .ais-SearchBox-input {
    background: var(--surface);
    color: var(--text-primary);
}

.ais-SearchBox-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.ais-SearchBox-submit {
    display: none;
}

.ais-SearchBox-reset {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

/* Search Results Dropdown */
#search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

#search-results.active {
    display: block;
}

[data-theme="dark"] #search-results {
    background: var(--surface);
}

.ais-Hits-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ais-Hits-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.ais-Hits-item:hover {
    background: var(--secondary-color);
}

.ais-Hits-item:last-child {
    border-bottom: none;
}

.search-hit-title {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.search-hit-content {
    font-size: 0.9rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.search-hit-category {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.search-input {
    width: 100%;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1);
}

.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1001;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.search-result-item:hover {
    background: var(--secondary-color);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.search-result-path {
    font-size: 12px;
    color: var(--text-secondary);
}

.search-result-snippet {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.4;
}

.search-result-snippet mark {
    background: rgba(26, 115, 232, 0.2);
    color: var(--primary-color);
    padding: 1px 2px;
    border-radius: 2px;
}

.search-match-badge {
    display: inline-block;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 12px;
    font-weight: 600;
    margin-left: 8px;
}

.search-match-badge.title {
    background: var(--primary-color);
    color: white;
}

.search-match-badge.content {
    background: var(--secondary-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.nav-brand {
    display: flex;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.25rem;
}

.nav-logo img {
    height: 36px;
    width: auto;
    margin-right: 12px;
    background: white;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

/* Keep logo visible in dark mode */
[data-theme="dark"] .nav-logo img {
    background: white;
}

/* Dark Mode Toggle */
.theme-toggle {
    background: var(--surface);
    border: 2px solid var(--border-color);
    border-radius: 50px;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    margin-left: 1rem;
}

.theme-toggle:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-sm);
}

.theme-icon {
    width: 20px;
    height: 20px;
    transition: all 0.3s ease;
}

.nav-menu {
    display: flex;
    gap: 8px;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: block;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    border-radius: var(--radius);
    transition: background-color 0.2s;
}

.nav-link:hover {
    background-color: var(--secondary-color);
}

/* Dropdown Menu */
.dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 280px;
    background: white;
    box-shadow: var(--shadow-md);
    border-radius: var(--radius);
    padding: 8px 0;
    margin-top: 4px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
}

.dropdown:hover .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    padding: 8px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background-color: var(--secondary-color);
}

.dropdown-submenu {
    padding-left: 24px;
    border-left: 2px solid var(--border-color);
    margin-left: 16px;
}

.dropdown-submenu .dropdown-item {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Mobile Navigation */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: transparent;
    border: none;
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    width: 280px;
    height: calc(100vh - var(--nav-height));
    background: white;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
    transform: translateX(-100%);
    transition: transform 0.3s;
    z-index: 999;
    overflow-y: auto;
}

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

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
}

.sidebar-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

.sidebar-description {
    padding: 8px 16px;
    font-size: 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    background: var(--secondary-color);
    font-style: italic;
}

.sidebar-content {
    padding: 16px;
}

.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-section-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding: 8px;
    background: var(--secondary-color);
    border-radius: 4px;
}

.sidebar-tree {
    list-style: none;
    padding: 0;
}

.sidebar-tree-item {
    margin: 4px 0;
}

.sidebar-tree-link {
    display: block;
    padding: 6px 12px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s;
}

.sidebar-tree-link:hover {
    background: var(--secondary-color);
    color: var(--primary-color);
}

.sidebar-tree-link.active {
    background: var(--primary-color);
    color: white;
}

.sidebar-tree-folder {
    margin: 4px 0;
}

.sidebar-tree-folder-header {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.sidebar-tree-folder-header:hover {
    background: var(--secondary-color);
}

.sidebar-tree-folder-icon {
    margin-right: 8px;
    transition: transform 0.2s;
}

.sidebar-tree-folder.expanded .sidebar-tree-folder-icon {
    transform: rotate(90deg);
}

.sidebar-tree-folder-content {
    padding-left: 20px;
    display: none;
}

.sidebar-tree-folder.expanded .sidebar-tree-folder-content {
    display: block;
}

/* Adjust main content when sidebar is open */
.main-content.sidebar-open {
    margin-left: 280px;
}

/* Breadcrumbs */
.breadcrumbs {
    margin-top: var(--nav-height);
    padding: 12px 0;
    background: var(--secondary-color);
    border-bottom: 1px solid var(--border-color);
}

.breadcrumbs a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.breadcrumb-separator {
    margin: 0 8px;
    color: var(--text-secondary);
}

/* Hero Section with Animated Gradient */
.hero {
    margin-top: var(--nav-height);
    padding: 80px 0 60px;
    background: var(--gradient-primary);
    color: white;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: rotate 30s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.hero h1 {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.8s ease;
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    opacity: 0.95;
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.8s ease 0.2s backwards;
}

/* Hero Stats */
.hero-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 3rem;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.stat-card {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 1.5rem;
    color: white;
    animation: fadeInUp 0.8s ease 0.4s backwards;
    transition: transform 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    display: block;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Main Content */
.main-content {
    padding: 40px 0;
    min-height: calc(100vh - var(--nav-height));
    animation: fadeIn 0.5s ease-out;
    transition: margin-right 0.3s ease;
}

/* Shift content when TOC is visible */
.main-content.toc-visible {
    margin-right: 320px;
}

/* Loading State */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* Skeleton Loading */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* Document Sections */
.document-section {
    margin-bottom: 48px;
}

.document-section h2 {
    font-size: 1.75rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.section-description {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Document Grid */
.document-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.document-card {
    display: block;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.document-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px); /* Subtle lift */
    border-color: var(--primary-color);
}

/* Card Icon */
.card-icon {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.document-card h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 600;
}

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

/* Card Link Arrow */
.card-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: gap 0.3s ease;
}

.card-link:hover {
    gap: 1rem;
}

/* Subsections */
.subsection {
    margin: 32px 0;
}

.subsection h3 {
    font-size: 1.25rem;
    margin-bottom: 16px;
    color: var(--text-primary);
}

/* Expand/Collapse Controls */
.expand-controls {
    max-width: 900px;
    margin: 0 auto 20px;
    padding: 10px 0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.expand-btn {
    padding: 6px 16px;
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* Document Navigation */
.doc-navigation {
    max-width: 900px;
    margin: 0 auto 20px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.doc-nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    min-height: 60px;
}

.doc-nav-btn:hover {
    background: var(--secondary-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.doc-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.doc-nav-btn.prev {
    margin-right: auto;
}

.doc-nav-btn.next {
    margin-left: auto;
}

.doc-nav-label small {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: normal;
    margin-bottom: 2px;
}

/* Related Documents */
.related-docs {
    max-width: 900px;
    margin: 40px auto;
    padding: 24px;
    background: var(--secondary-color);
    border-radius: var(--radius);
}

.related-docs h3 {
    font-size: 1.25rem;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.related-docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.related-doc-card {
    display: block;
    padding: 12px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s;
}

.related-doc-card:hover {
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.related-doc-title {
    font-weight: 500;
    color: var(--primary-color);
    font-size: 14px;
}

/* Document Content */
.document-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-primary);
}

.document-content h1 {
    font-size: 2.5rem;
    margin: 32px 0 24px;
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.2;
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 12px;
}

.document-content h2 {
    font-size: 1.75rem;
    margin: 32px 0 20px;
    color: var(--text-primary);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
    position: relative;
    font-weight: 600;
    line-height: 1.3;
}

/* Removed problematic content sections */

.document-content h3 {
    font-size: 1.4rem;
    margin: 28px 0 16px;
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.4;
}

.document-content h4 {
    font-size: 1.3rem;
    margin: 28px 0 16px;
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.4;
}

.document-content p {
    margin: 20px 0;
    line-height: 1.7;
    text-align: left;
}

.document-content ul,
.document-content ol {
    margin: 20px 0;
    padding-left: 28px;
}

.document-content li {
    margin: 8px 0;
    line-height: 1.7;
}

.document-content a {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.document-content a:hover {
    text-decoration: none;
    border-bottom-color: var(--primary-color);
    color: var(--primary-dark);
}

.document-content code {
    background: var(--secondary-color);
    padding: 3px 8px; /* Increased padding */
    border-radius: 4px; /* Increased from 3px */
    font-family: 'Courier New', 'Monaco', 'Consolas', monospace;
    font-size: 0.9em;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.document-content pre {
    background: var(--secondary-color);
    padding: 20px; /* Increased from 16px */
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 20px 0; /* Increased from 16px */
    border: 1px solid var(--border-color);
}

.document-content pre code {
    background: none;
    padding: 0;
}

.document-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding: 20px 24px; /* Increased padding */
    margin: 24px 0; /* Increased from 16px */
    color: var(--text-secondary);
    background: var(--secondary-color);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
    position: relative;
}

.document-content blockquote::before {
    content: '"';
    font-size: 3rem;
    color: var(--primary-color);
    position: absolute;
    top: -10px;
    left: 10px;
    opacity: 0.3;
}

.document-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0; /* Increased from 16px */
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.document-content th,
.document-content td {
    padding: 12px 16px; /* Increased from 8px 12px */
    border: 1px solid var(--border-color);
    text-align: left;
    vertical-align: top;
}

.document-content th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.document-content tr:nth-child(even) {
    background: var(--secondary-color);
}

.document-content tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

/* Improved content spacing and readability */
.document-content > * + * {
    margin-top: 1.5rem; /* Consistent spacing between elements */
}

.document-content > * + h1,
.document-content > * + h2,
.document-content > * + h3,
.document-content > * + h4 {
    margin-top: 2.5rem; /* Extra space before headings */
}

/* Better list styling */
.document-content ul li::marker {
    color: var(--primary-color);
    font-weight: 600;
}

.document-content ol li::marker {
    color: var(--primary-color);
    font-weight: 600;
}

/* Improved emphasis styling */
.document-content strong {
    font-weight: 700;
    color: var(--text-primary);
}

.document-content em {
    font-style: italic;
    color: var(--text-secondary);
}

/* Better paragraph spacing for readability */
.document-content p + p {
    margin-top: 1.2rem;
}

/* Responsive content width adjustments */
@media (max-width: 1200px) {
    .document-content {
        max-width: 90%;
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .document-content {
        max-width: 95%;
        padding: 15px;
        font-size: 15px; /* Slightly smaller on mobile for better fit */
    }
    
    .document-content h1 {
        font-size: 2rem;
        margin: 24px 0 20px;
    }
    
    .document-content h2 {
        font-size: 1.5rem;
        margin: 24px 0 16px;
    }
    
    .document-content h3 {
        font-size: 1.25rem;
        margin: 20px 0 12px;
    }
    
    .document-content p {
        margin: 16px 0;
        line-height: 1.7;
        text-align: left; /* Disable justify on mobile */
    }
    
    .document-content blockquote {
        padding: 16px 20px;
        margin: 20px 0;
    }
    
    .document-content table {
        font-size: 14px;
    }
    
    .document-content th,
    .document-content td {
        padding: 8px 12px;
    }
}

/* Large screen optimizations */
@media (min-width: 1400px) {
    .document-content {
        max-width: 750px; /* Even narrower on very large screens */
    }
}

/* Table of Contents - Fixed Floating */
.toc-toggle {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
    transition: all 0.3s;
    z-index: 999;
}

.toc-toggle:hover {
    transform: scale(1.05);
    animation: pulse 1s infinite;
}

.toc-icon {
    font-size: 20px;
}

.toc-label {
    font-size: 10px;
}

.toc-panel {
    position: fixed;
    top: calc(var(--nav-height) + 20px);
    right: 20px;
    width: 280px;
    max-height: calc(100vh - var(--nav-height) - 100px);
    background: white;
    box-shadow: var(--shadow-md);
    border-radius: var(--radius);
    z-index: 998;
    display: none;
    overflow: hidden;
}

.toc-panel.visible {
    display: block;
}

/* Only show TOC automatically on very wide screens where it won't overlap */
@media (min-width: 1600px) {
    .toc-panel {
        display: block;
        right: calc((100vw - var(--max-width)) / 2 - 300px);
    }
    
    .toc-toggle {
        display: none;
    }
}

.toc-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toc-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
}

.toc-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

.toc-content {
    padding: 16px;
    overflow-y: auto;
    max-height: calc(100vh - var(--nav-height) - 180px);
}

.toc-content ul {
    list-style: none;
    padding: 0;
}

.toc-content li {
    margin: 8px 0;
}

.toc-content a {
    color: var(--text-primary);
    text-decoration: none;
    display: block;
    padding: 4px 0;
    transition: color 0.2s;
}

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

.toc-content a.active {
    color: var(--primary-color);
    font-weight: 600;
}

.toc-h1 {
    font-weight: 600;
}

.toc-h2 {
    padding-left: 16px;
}

.toc-h3 {
    padding-left: 32px;
    font-size: 0.9rem;
}

/* TOC Progress Bar */
.toc-progress {
    height: 3px;
    background: var(--border-color);
    position: relative;
    overflow: hidden;
}

.toc-progress-bar {
    height: 100%;
    background: var(--primary-color);
    width: 0;
    transition: width 0.3s ease;
}

/* Back to Top */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--text-primary);
    color: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 999;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: scale(1.1);
}

.back-to-top.toc-open {
    right: 340px;
}

/* Featured Section */
.featured-section {
    background: var(--gradient-primary);
    border-radius: 30px;
    padding: 3rem;
    margin: 4rem 0;
    position: relative;
    overflow: hidden;
    color: white;
}

.featured-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    position: relative;
    z-index: 1;
}

.featured-text h2 {
    font-size: 2rem;
    color: white;
    margin-bottom: 1rem;
}

.featured-text p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.btn-primary {
    background: white;
    color: var(--primary-color);
    padding: 0.75rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    display: inline-block;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.featured-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.mini-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 1.5rem;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.mini-card:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
}

.mini-card h4 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

/* Document Footer */
.document-footer {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.last-updated {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Site Footer */
.site-footer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 3rem 0 1.5rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-column h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: white;
    opacity: 0.95;
}

.footer-links {
    list-style: none;
    padding: 0;
}

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

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: white;
    text-decoration: underline;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.footer-bottom p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }
    
    /* Hide search on very small screens */
    .search-container {
        display: none;
    }
    
    .nav-menu {
        position: fixed;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 20px;
        box-shadow: var(--shadow-md);
        transform: translateY(-100%);
        opacity: 0;
        transition: all 0.3s;
        z-index: 1002;
    }
    
    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
    }
    
    .nav-toggle.active span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    
    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .nav-toggle.active span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
    
    .dropdown-content {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        padding: 0;
        margin: 0;
        display: none;
    }
    
    .dropdown.active .dropdown-content {
        display: block;
    }
    
    /* Sidebar mobile adjustments */
    .sidebar {
        width: 85%;
        max-width: 320px;
    }
    
    .main-content.sidebar-open {
        margin-left: 0;
    }
    
    /* Document navigation mobile */
    .doc-navigation {
        flex-direction: column;
        gap: 10px;
    }
    
    .doc-nav-btn {
        width: 100%;
        justify-content: center;
    }
    
    .doc-nav-btn.prev,
    .doc-nav-btn.next {
        margin: 0;
    }
    
    /* TOC mobile */
    .toc-panel {
        width: calc(100% - 40px);
        max-width: 400px;
        right: 50%;
        transform: translateX(50%);
        display: none;
    }
    
    .toc-panel.visible {
        display: block;
    }
    
    /* Related docs mobile */
    .related-docs-grid {
        grid-template-columns: 1fr;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero-stats {
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
        min-width: 120px;
    }
    
    .document-grid {
        grid-template-columns: 1fr;
    }
    
    /* Featured section mobile */
    .featured-content {
        grid-template-columns: 1fr;
    }
    
    .featured-section {
        padding: 2rem;
    }
    
    .featured-cards {
        grid-template-columns: 1fr;
    }
    
    /* Footer mobile */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .footer-column {
        text-align: center;
    }
    
    .back-to-top.toc-open {
        right: 20px;
    }
    
    .main-content.toc-visible {
        margin-right: 0; /* No shift on mobile since TOC takes full width */
    }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1023px) {
    .search-container {
        max-width: 300px;
    }
    
    .sidebar {
        width: 320px;
    }
    
    .toc-panel {
        width: 280px;
    }
    
    .main-content.toc-visible {
        margin-right: 300px; /* Smaller shift on tablets */
    }
    
    /* Footer tablet - 2 columns */
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Additional Mobile Adjustments */
@media (max-width: 480px) {
    .hero {
        padding: 40px 0 30px;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .document-content h1 {
        font-size: 2rem;
    }
    
    .document-content h2 {
        font-size: 1.5rem;
    }
    
    .document-content h3 {
        font-size: 1.15rem;
    }
}

/* Large Screen Adjustments */
@media (min-width: 1024px) {
    .main-content.toc-open {
        margin-right: 320px;
    }
}