/* VitePress-Style Theme Variables - Light & Dark */
:root {
    /* Light Theme Colors - VitePress inspired */
    --vp-c-bg: #ffffff;
    --vp-c-bg-soft: #f6f6f7;
    --vp-c-bg-mute: #f6f6f7;
    --vp-c-bg-alt: #f6f6f7;

    --vp-c-divider: rgba(60, 60, 67, 0.12);
    --vp-c-divider-light: rgba(60, 60, 67, 0.06);

    --vp-c-text-1: rgba(60, 60, 67, 1);
    --vp-c-text-2: rgba(60, 60, 67, 0.78);
    --vp-c-text-3: rgba(60, 60, 67, 0.56);

    --vp-c-brand-1: #8b5cf6;
    --vp-c-brand-2: #7c3aed;
    --vp-c-brand-3: #8b5cf6;
    --vp-c-brand-soft: rgba(139, 92, 246, 0.14);

    /* Map to existing variable names for compatibility */
    --ide-bg: var(--vp-c-bg);
    --ide-titlebar-bg: var(--vp-c-bg);
    --ide-tabbar-bg: var(--vp-c-bg);
    --ide-sidebar-bg: var(--vp-c-bg-soft);
    --ide-content-bg: var(--vp-c-bg);
    --ide-statusbar-bg: var(--vp-c-brand-1);

    --ide-border: var(--vp-c-divider);
    --ide-border-light: var(--vp-c-divider-light);

    --ide-text-primary: var(--vp-c-text-1);
    --ide-text-secondary: var(--vp-c-text-2);
    --ide-text-tertiary: var(--vp-c-text-3);
    --ide-text-inverse: #ffffff;

    --ide-accent-primary: var(--vp-c-brand-1);
    --ide-accent-hover: var(--vp-c-brand-2);

    --ide-folder-icon: var(--vp-c-text-3);
    --ide-folder-category: var(--vp-c-brand-1);
    --ide-file-icon: var(--vp-c-text-3);

    --ide-hover-bg: var(--vp-c-bg-soft);
    --ide-active-bg: var(--vp-c-brand-soft);
    --ide-active-text: var(--vp-c-brand-1);

    --ide-scrollbar-track: var(--vp-c-bg-soft);
    --ide-scrollbar-thumb: rgba(60, 60, 67, 0.2);
    --ide-scrollbar-thumb-hover: rgba(60, 60, 67, 0.35);

    --ide-profile-border: var(--vp-c-brand-1);
    --ide-profile-status: #22c55e;

    /* Syntax highlighting for light theme - VitePress style */
    --syntax-bg: var(--vp-c-bg);
    --syntax-pre-bg: var(--vp-c-bg-soft);
    --syntax-text: var(--vp-c-text-1);
    --syntax-border: var(--vp-c-divider);
    --syntax-keyword: #a626a4;
    --syntax-string: #50a14f;
    --syntax-number: #986801;
    --syntax-comment: #a0a1a7;
    --syntax-function: #4078f2;
    --syntax-class: #c18401;
    --syntax-variable: #e45649;
    --syntax-operator: #a626a4;
    --syntax-constant: #0184bc;
    --syntax-tag: #e45649;
    --syntax-attribute: #986801;
    --syntax-escape: #50a14f;
    --syntax-linenumber: var(--vp-c-text-3);
    --syntax-lang-badge: var(--vp-c-text-3);
    --syntax-copy-btn-bg: var(--vp-c-bg);
    --syntax-copy-btn-border: var(--vp-c-divider);
    --syntax-copy-btn-text: var(--vp-c-text-2);
    --syntax-copy-btn-hover-bg: var(--vp-c-bg-mute);

    /* Error and success colors */
    --color-error: #e45649;
    --color-error-bg: rgba(228, 86, 73, 0.1);
    --color-success: #22c55e;
    --color-success-bg: rgba(34, 197, 94, 0.1);

    /* Selection colors */
    --selection-bg: var(--vp-c-brand-soft);
    --selection-text: var(--vp-c-text-1);

    /* VitePress specific */
    --vp-nav-height: 64px;
    --vp-sidebar-width: 272px;
    --vp-content-width: 720px;
    --vp-toc-width: 256px;
}

.dark {
    /* Dark Theme Colors - VitePress inspired */
    --vp-c-bg: #1a1a1a;
    --vp-c-bg-soft: #242424;
    --vp-c-bg-mute: #2c2c2c;
    --vp-c-bg-alt: #161616;

    --vp-c-divider: rgba(82, 82, 89, 0.32);
    --vp-c-divider-light: rgba(82, 82, 89, 0.16);

    --vp-c-text-1: rgba(255, 255, 245, 0.86);
    --vp-c-text-2: rgba(235, 235, 245, 0.6);
    --vp-c-text-3: rgba(235, 235, 245, 0.38);

    --vp-c-brand-1: #a78bfa;
    --vp-c-brand-2: #8b5cf6;
    --vp-c-brand-3: #7c3aed;
    --vp-c-brand-soft: rgba(167, 139, 250, 0.16);

    /* Map to existing variable names for compatibility */
    --ide-bg: var(--vp-c-bg);
    --ide-titlebar-bg: var(--vp-c-bg);
    --ide-tabbar-bg: var(--vp-c-bg);
    --ide-sidebar-bg: var(--vp-c-bg-alt);
    --ide-content-bg: var(--vp-c-bg);
    --ide-statusbar-bg: var(--vp-c-brand-1);

    --ide-border: var(--vp-c-divider);
    --ide-border-light: var(--vp-c-divider-light);

    --ide-text-primary: var(--vp-c-text-1);
    --ide-text-secondary: var(--vp-c-text-2);
    --ide-text-tertiary: var(--vp-c-text-3);
    --ide-text-inverse: #1a1a1a;

    --ide-accent-primary: var(--vp-c-brand-1);
    --ide-accent-hover: var(--vp-c-brand-2);

    --ide-folder-icon: var(--vp-c-text-3);
    --ide-folder-category: var(--vp-c-brand-1);
    --ide-file-icon: var(--vp-c-text-3);

    --ide-hover-bg: var(--vp-c-bg-soft);
    --ide-active-bg: var(--vp-c-brand-soft);
    --ide-active-text: var(--vp-c-brand-1);

    --ide-scrollbar-track: var(--vp-c-bg-soft);
    --ide-scrollbar-thumb: rgba(235, 235, 245, 0.2);
    --ide-scrollbar-thumb-hover: rgba(235, 235, 245, 0.35);

    --ide-profile-border: var(--vp-c-brand-1);
    --ide-profile-status: #22c55e;

    /* Syntax highlighting for dark theme - VitePress style */
    --syntax-bg: var(--vp-c-bg);
    --syntax-pre-bg: var(--vp-c-bg-soft);
    --syntax-text: var(--vp-c-text-1);
    --syntax-border: var(--vp-c-divider);
    --syntax-keyword: #c678dd;
    --syntax-string: #98c379;
    --syntax-number: #d19a66;
    --syntax-comment: #5c6370;
    --syntax-function: #61afef;
    --syntax-class: #e5c07b;
    --syntax-variable: #e06c75;
    --syntax-operator: #c678dd;
    --syntax-constant: #56b6c2;
    --syntax-tag: #e06c75;
    --syntax-attribute: #d19a66;
    --syntax-escape: #98c379;
    --syntax-linenumber: var(--vp-c-text-3);
    --syntax-lang-badge: var(--vp-c-text-3);
    --syntax-copy-btn-bg: var(--vp-c-bg-mute);
    --syntax-copy-btn-border: var(--vp-c-divider);
    --syntax-copy-btn-text: var(--vp-c-text-2);
    --syntax-copy-btn-hover-bg: var(--vp-c-bg-soft);

    /* Error and success colors */
    --color-error: #e06c75;
    --color-error-bg: rgba(224, 108, 117, 0.1);
    --color-success: #42d392;
    --color-success-bg: rgba(66, 211, 146, 0.1);

    /* Selection colors */
    --selection-bg: var(--vp-c-brand-soft);
    --selection-text: var(--vp-c-text-1);
}

/* Apply Theme Variables */
body {
    background-color: var(--ide-bg);
    color: var(--ide-text-primary);
}

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

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

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

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

/* Line clamp utility for multiline text truncation */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Smooth rotation for folder icons */
.rotate-90 {
    transform: rotate(90deg);
}

/* Content area prose/article styling */
.prose {
    color: var(--ide-text-primary) !important;
    max-width: none;
}

.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
    color: var(--ide-text-primary) !important;
}

.prose p, .prose li {
    color: var(--ide-text-primary) !important;
}

.prose strong {
    color: var(--ide-text-primary) !important;
}

.prose a {
    color: var(--ide-accent-primary) !important;
}

.prose a:hover {
    color: var(--ide-accent-hover) !important;
}

.prose code {
    color: var(--ide-text-primary) !important;
    background-color: var(--ide-hover-bg);
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
    font-size: 0.875em;
}

.prose pre {
    background-color: var(--syntax-pre-bg) !important;
    border: 1px solid var(--ide-border);
}

.prose pre code {
    background-color: transparent;
    padding: 0;
}

/* Search Modal */
#modal-search-input {
    background-color: var(--ide-sidebar-bg) !important;
    color: var(--ide-text-primary) !important;
    border-color: var(--ide-border) !important;
}

#modal-search-input::placeholder {
    color: var(--ide-text-tertiary);
}

#modal-search-input:focus {
    outline: 2px solid var(--ide-accent-primary);
    outline-offset: 2px;
}

#search-results::-webkit-scrollbar {
    width: 8px;
}

#search-results::-webkit-scrollbar-track {
    background: var(--ide-scrollbar-track);
}

#search-results::-webkit-scrollbar-thumb {
    background: var(--ide-scrollbar-thumb);
    border-radius: 4px;
}

#search-results::-webkit-scrollbar-thumb:hover {
    background: var(--ide-scrollbar-thumb-hover);
}

kbd {
    font-family: monospace;
    font-size: 0.875em;
}

/* 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;
}

.sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    padding: 0.5rem 1rem;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Transition utilities - more subtle for VitePress feel */
* {
    transition-property: color, background-color, border-color, opacity;
    transition-timing-function: ease;
    transition-duration: 200ms;
}

/* Disable transitions for prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    * {
        transition-duration: 0ms !important;
    }
}

/* Code blocks with syntax highlighting */
.chroma {
    background-color: var(--syntax-pre-bg) !important;
    border: 1px solid var(--ide-border);
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
}

.chroma code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
}

/* Selection */
::selection {
    background: var(--selection-bg);
    color: var(--selection-text);
}

::-moz-selection {
    background: var(--selection-bg);
    color: var(--selection-text);
}
