/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Theme Variables */
:root {
    /* Enhanced Light theme (default) */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-accent: #495057;
    --text-muted: #868e96;
    --border-color: #dee2e6;
    --border-light: #e9ecef;
    --shadow-light: rgba(0,0,0,0.08);
    --shadow-medium: rgba(0,0,0,0.12);
    --card-bg: #ffffff;
    --highlight-bg: #f8f9fa;
    --code-bg: #f8f9fa;
    --blockquote-bg: #f8f9fa;
    --blockquote-border: #007bff;
    --link-color: #007bff;
    --link-hover: #0056b3;
    --success-color: #28a745;
    --success-hover: #218838;
    --danger-color: #dc3545;
    --danger-hover: #c82333;
    --warning-color: #ffc107;
    --warning-hover: #e0a800;
    --info-color: #17a2b8;
    --info-hover: #138496;
    
    /* Additional colors for VSCode editor - root theme */
    --accent-color: #007acc;
    --accent-hover-color: #005a9e;
    --accent-color-rgb: 0, 122, 204;
    --accent-bg: rgba(0, 122, 204, 0.1);
    --error-color: #f44336;
    --error-bg: rgba(244, 67, 54, 0.1);
    --success-bg: rgba(40, 167, 69, 0.1);
    
    /* Typography */
    --font-mono: 'Consolas', 'Monaco', 'Courier New', monospace;
    
    /* Light theme gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-card: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    --gradient-button: linear-gradient(145deg, #ffffff 0%, #f1f3f4 100%);
}

/* Dark theme */
[data-theme="dark"] {
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --bg-tertiary: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-accent: #ffffff;
    --text-muted: #888888;
    --border-color: #333333;
    --border-light: #444444;
    --shadow-light: rgba(255,255,255,0.1);
    --shadow-medium: rgba(255,255,255,0.15);
    --card-bg: #2d2d2d;
    --highlight-bg: #2d2d2d;
    --code-bg: #2d2d2d;
    --blockquote-bg: #2d2d2d;
    --blockquote-border: #4a9eff;
    --link-color: #4a9eff;
    --link-hover: #6bb6ff;
    --success-color: #4caf50;
    --success-hover: #45a049;
    --danger-color: #f44336;
    --danger-hover: #da190b;
    --warning-color: #ff9800;
    --warning-hover: #e68900;
    --info-color: #29b6f6;
    --info-hover: #0288d1;
    
    /* Additional colors for VSCode editor - dark theme */
    --accent-color: #4a9eff;
    --accent-hover-color: #6bb6ff;
    --accent-color-rgb: 74, 158, 255;
    --accent-bg: rgba(74, 158, 255, 0.1);
    --error-color: #f44336;
    --error-bg: rgba(244, 67, 54, 0.1);
    --success-bg: rgba(76, 175, 80, 0.1);
    
    /* Typography */
    --font-mono: 'Consolas', 'Monaco', 'Courier New', monospace;
    
    /* Dark theme gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-card: linear-gradient(145deg, #2d2d2d 0%, #1e1e1e 100%);
    --gradient-button: linear-gradient(145deg, #333333 0%, #2d2d2d 100%);
}

/* Enhanced Light Mode Specific Styles */
[data-theme="light"] {
    /* Light mode specific enhancements */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-accent: #495057;
    --border-color: #dee2e6;
    --card-bg: #ffffff;
    --shadow-light: rgba(0,0,0,0.08);
    --shadow-medium: rgba(0,0,0,0.15);
    
    /* Beautiful light mode colors */
    --link-color: #0066cc;
    --link-hover: #004499;
    --success-color: #22c55e;
    --success-hover: #16a34a;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --warning-color: #f59e0b;
    --warning-hover: #d97706;
    --info-color: #3b82f6;
    --info-hover: #2563eb;
    
    /* Additional colors for VSCode editor - light theme */
    --accent-color: #0066cc;
    --accent-hover-color: #004499;
    --accent-color-rgb: 0, 102, 204;
    --accent-bg: rgba(0, 102, 204, 0.1);
    --error-color: #dc3545;
    --error-bg: rgba(220, 53, 69, 0.1);
    --success-bg: rgba(34, 197, 94, 0.1);
    
    /* Typography */
    --font-mono: 'Consolas', 'Monaco', 'Courier New', monospace;
}

/* Auto theme detection */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --bg-primary: #121212;
        --bg-secondary: #1e1e1e;
        --bg-tertiary: #2d2d2d;
        --text-primary: #e0e0e0;
        --text-secondary: #a0a0a0;
        --text-accent: #ffffff;
        --border-color: #333333;
        --border-light: #444444;
        --shadow-light: rgba(255,255,255,0.1);
        --shadow-medium: rgba(255,255,255,0.15);
        --card-bg: #2d2d2d;
        --highlight-bg: #2d2d2d;
        --code-bg: #2d2d2d;
        --blockquote-bg: #2d2d2d;
        --blockquote-border: #4a9eff;
        --link-color: #4a9eff;
        --link-hover: #6bb6ff;
        --success-color: #4caf50;
        --success-hover: #45a049;
        --danger-color: #f44336;
        --danger-hover: #da190b;
        --warning-color: #ff9800;
        --warning-hover: #e68900;
        --info-color: #29b6f6;
        --info-hover: #0288d1;
        
        /* Additional colors for VSCode editor - auto dark theme */
        --accent-color: #4a9eff;
        --accent-hover-color: #6bb6ff;
        --accent-color-rgb: 74, 158, 255;
        --accent-bg: rgba(74, 158, 255, 0.1);
        --error-color: #f44336;
        --error-bg: rgba(244, 67, 54, 0.1);
        --success-bg: rgba(76, 175, 80, 0.1);
        
        /* Typography */
        --font-mono: 'Consolas', 'Monaco', 'Courier New', monospace;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Light mode overrides - Remove dark hardcoded styles when in light mode */
[data-theme="light"] html,
[data-theme="light"] body {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
}

[data-theme="light"] .sidebar {
    background: var(--bg-secondary) !important;
    border-right: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    box-shadow: 2px 0 8px var(--shadow-light) !important;
}

[data-theme="light"] .sidebar-header h1 {
    color: var(--text-accent) !important;
}

[data-theme="light"] .nav-category-header {
    color: var(--text-secondary) !important;
}

[data-theme="light"] .nav-item {
    color: var(--text-primary) !important;
    background: transparent !important;
}

[data-theme="light"] .nav-item:hover {
    background: var(--highlight-bg) !important;
    color: var(--link-color) !important;
}

[data-theme="light"] .nav-item.active {
    background: var(--link-color) !important;
    color: #ffffff !important;
}

[data-theme="light"] .main-content {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
}

[data-theme="light"] .content-header {
    background: var(--bg-secondary) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

[data-theme="light"] .content-body {
    background: var(--bg-primary) !important;
}

[data-theme="light"] .btn {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 2px 4px var(--shadow-light) !important;
}

[data-theme="light"] .btn:hover {
    background: var(--bg-tertiary) !important;
    box-shadow: 0 4px 8px var(--shadow-medium) !important;
    transform: translateY(-1px) !important;
}

[data-theme="light"] .btn-primary {
    background: var(--link-color) !important;
    color: #ffffff !important;
    border-color: var(--link-color) !important;
}

[data-theme="light"] .btn-primary:hover {
    background: var(--link-hover) !important;
    border-color: var(--link-hover) !important;
}

[data-theme="light"] .btn-secondary {
    background: var(--text-secondary) !important;
    color: #ffffff !important;
    border-color: var(--text-secondary) !important;
}

[data-theme="light"] .btn-secondary:hover {
    background: var(--text-accent) !important;
    border-color: var(--text-accent) !important;
}

[data-theme="light"] .btn-danger {
    background: var(--danger-color) !important;
    color: #ffffff !important;
    border-color: var(--danger-color) !important;
}

[data-theme="light"] .btn-danger:hover {
    background: var(--danger-hover) !important;
    border-color: var(--danger-hover) !important;
}

[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: inset 0 1px 3px var(--shadow-light) !important;
}

[data-theme="light"] input:focus,
[data-theme="light"] select:focus,
[data-theme="light"] textarea:focus {
    border-color: var(--link-color) !important;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1) !important;
}

[data-theme="light"] .search-container input {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
}

[data-theme="light"] .add-page-btn {
    background: var(--success-color) !important;
    color: #ffffff !important;
    border: none !important;
}

[data-theme="light"] .add-page-btn:hover {
    background: var(--success-hover) !important;
}

[data-theme="light"] .modal {
    background: rgba(0, 0, 0, 0.5) !important;
}

[data-theme="light"] .modal-content {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15) !important;
}

[data-theme="light"] .modal-header {
    border-bottom: 1px solid var(--border-color) !important;
}

[data-theme="light"] .close {
    color: var(--text-secondary) !important;
}

[data-theme="light"] .close:hover {
    color: var(--text-primary) !important;
}

/* Enhanced Light Mode Markdown Content - Consistent with preview */
[data-theme="light"] .markdown-content {
    color: var(--text-primary) !important;
}

[data-theme="light"] .markdown-content h1,
[data-theme="light"] .markdown-content h2,
[data-theme="light"] .markdown-content h3,
[data-theme="light"] .markdown-content h4,
[data-theme="light"] .markdown-content h5,
[data-theme="light"] .markdown-content h6 {
    color: var(--text-accent) !important;
}

[data-theme="light"] .markdown-content code {
    background: var(--code-bg) !important;
    color: var(--text-accent) !important;
    border: none !important;
}

[data-theme="light"] .markdown-content pre {
    background: var(--code-bg) !important;
    border: none !important;
}

[data-theme="light"] .markdown-content pre code {
    background: transparent !important;
    color: var(--text-primary) !important;
}

[data-theme="light"] .markdown-content blockquote {
    background: var(--highlight-bg) !important;
    border-left: 4px solid var(--accent-color) !important;
    color: var(--text-secondary) !important;
}

[data-theme="light"] .markdown-content table {
    border: 1px solid var(--border-color) !important;
}

[data-theme="light"] .markdown-content th {
    background: var(--bg-secondary) !important;
    color: var(--text-accent) !important;
    border-bottom: 2px solid var(--border-color) !important;
}

[data-theme="light"] .markdown-content td {
    border-bottom: 1px solid var(--border-light) !important;
}

/* Enhanced Light Mode Editor */
[data-theme="light"] .editor-toolbar {
    background: var(--bg-secondary) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

[data-theme="light"] .toolbar-btn {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-light) !important;
}

[data-theme="light"] .toolbar-btn:hover {
    background: var(--link-color) !important;
    color: #ffffff !important;
}

[data-theme="light"] .markdown-editor-enhanced {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
}

[data-theme="light"] .editor-pane,
[data-theme="light"] .preview-pane {
    background: var(--bg-primary) !important;
    border-right: 1px solid var(--border-color) !important;
}

[data-theme="light"] .line-numbers {
    background: var(--bg-secondary) !important;
    color: var(--text-muted) !important;
    border-right: 1px solid var(--border-light) !important;
}

/* Light Mode Back to Top Button */
[data-theme="light"] .back-to-top {
    background: rgba(255, 255, 255, 0.9) !important;
    color: var(--text-primary) !important;
    border: 2px solid var(--border-color) !important;
    box-shadow: 0 4px 12px var(--shadow-medium) !important;
}

[data-theme="light"] .back-to-top:hover {
    background: var(--link-color) !important;
    color: #ffffff !important;
    border-color: var(--link-color) !important;
}

/* Custom Light Mode Overrides - Removed conflicting code block styles */

/* Make h2 headers white in light mode */
[data-theme="light"] .markdown-content h2 {
    color: #ffffff !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    padding: 1rem 1.5rem !important;
    border-radius: 8px !important;
    margin: 2rem 0 1rem 0 !important;
    border-bottom: none !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
}

/* Also apply to any section content h2s */
[data-theme="light"] .section-content h2 {
    color: #ffffff !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    padding: 1rem 1.5rem !important;
    border-radius: 8px !important;
    margin: 2rem 0 1rem 0 !important;
    border-bottom: none !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
}

/* Ensure all code elements stay black in light mode */
[data-theme="light"] .cheat-item code {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
    border: 1px solid #4a5568 !important;
}

[data-theme="light"] .preview-content pre {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

[data-theme="light"] .preview-content pre code {
    background: transparent !important;
    color: #e2e8f0 !important;
}

[data-theme="light"] .preview-content code {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
    border: 1px solid #4a5568 !important;
}

/* Code syntax highlighting overrides for light mode */
[data-theme="light"] .syntax-code {
    color: #e2e8f0 !important;
    background: #2d3748 !important;
}

[data-theme="light"] .basic-highlighted {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

/* Container and layout */
.container {
    display: flex;
    height: 100vh;
    max-width: 100%;
}

/* Sidebar styles */
.sidebar {
    width: 300px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 4px var(--shadow-light);
    animation: slideInLeft 0.5s ease-out;
    color: var(--text-primary);
}

.sidebar-header {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
    animation: fadeInUp 0.6s ease-out;
}

.sidebar-header h1 {
    font-size: 1.5rem;
    color: var(--text-accent);
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
}

.sidebar-header h1::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--link-color), transparent);
    animation: expandWidth 2s ease-out 0.5s forwards;
}

@keyframes expandWidth {
    to { width: 100%; }
}

.search-container {
    position: relative;
}

.search-container input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.search-container input:focus {
    outline: none;
    border-color: var(--link-color);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
    transform: translateY(-1px);
}

.search-container input:hover {
    border-color: var(--text-secondary);
    transform: translateY(-1px);
}

/* Navigation menu */
.nav-menu {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.nav-category {
    margin-bottom: 1rem;
    animation: fadeInUp 0.4s ease-out;
    animation-fill-mode: both;
}

.nav-category:nth-child(1) { animation-delay: 0.1s; }
.nav-category:nth-child(2) { animation-delay: 0.2s; }
.nav-category:nth-child(3) { animation-delay: 0.3s; }
.nav-category:nth-child(4) { animation-delay: 0.4s; }
.nav-category:nth-child(5) { animation-delay: 0.5s; }

.nav-category-header {
    padding: 0.5rem 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.nav-category-header::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 1px;
    background: var(--link-color);
    transition: width 0.3s ease;
}

.nav-category:hover .nav-category-header::before {
    width: 100%;
}

.nav-item {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--text-primary);
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: -100%;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(74, 158, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.nav-item:hover::before {
    left: 100%;
}

.nav-item:hover {
    background-color: var(--highlight-bg);
    color: var(--link-color);
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(74, 158, 255, 0.15);
}

.nav-item.active {
    background-color: var(--link-color);
    color: white;
    border-right: 3px solid var(--link-hover);
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(74, 158, 255, 0.3);
    animation: pulse 2s infinite;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.add-page-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    animation: float 3s ease-in-out infinite;
}

.add-page-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.add-page-btn:hover::before {
    left: 100%;
}

.add-page-btn:hover {
    background: var(--success-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.add-page-btn:active {
    transform: translateY(0);
}

/* Main content area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideInRight 0.5s ease-out;
}

.content-header {
    background: var(--bg-secondary);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: fadeInUp 0.6s ease-out;
}

.breadcrumb {
    font-size: 0.9rem;
    color: var(--text-secondary);
    animation: slideInRight 0.7s ease-out;
}

.breadcrumb span {
    margin: 0 0.5rem;
    transition: color 0.2s ease;
}

.breadcrumb span:hover {
    color: var(--link-color);
}

.page-actions {
    display: flex;
    gap: 0.5rem;
    animation: fadeIn 0.8s ease-out;
}

.page-actions .btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.page-actions .btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.page-actions .btn:hover::before {
    left: 100%;
}

.page-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.content-body {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background-color: #000000;
    opacity: 0.8;
    background: radial-gradient(circle, transparent 20%, #000000 20%, #000000 80%, transparent 80%, transparent), radial-gradient(circle, transparent 20%, #000000 20%, #000000 80%, transparent 80%, transparent) 15px 15px, linear-gradient(#0c0c0c 1.2000000000000002px, transparent 1.2000000000000002px) 0 -0.6000000000000001px, linear-gradient(90deg, #0c0c0c 1.2000000000000002px, #000000 1.2000000000000002px) -0.6000000000000001px 0;
    background-size: 30px 30px, 30px 30px, 15px 15px, 15px 15px;
    animation: fadeInUp 0.8s ease-out;
}

/* Markdown content styles - Using preview styling for consistency */
.markdown-content {
    max-width: none;
    margin: 0;
    animation: fadeInUp 0.6s ease-out;
    padding: 20px;
    color: var(--text-primary);
    line-height: 1.6;
}

.markdown-content h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-accent);
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.markdown-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.5rem 0 1rem 0;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-light);
}

.markdown-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.25rem 0 0.75rem 0;
}

.markdown-content h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1rem 0 0.5rem 0;
}

.markdown-content p {
    margin: 0 0 1rem 0;
    line-height: 1.7;
}

/* Ensure proper spacing for text content within sections */
.section-content p,
.toc-container p,
.markdown-content .section-container p {
    margin: 0 0 1rem 0;
    line-height: 1.7;
}

/* Fix spacing for lists within sections */
.section-content ul,
.section-content ol,
.markdown-content .section-container ul,
.markdown-content .section-container ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.section-content li,
.markdown-content .section-container li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.markdown-content ul, .markdown-content ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.markdown-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.markdown-content blockquote {
    margin: 1rem 0;
    padding: 1rem 1.5rem;
    background: var(--highlight-bg);
    border-left: 4px solid var(--accent-color);
    border-radius: 0 6px 6px 0;
    font-style: italic;
    color: var(--text-secondary);
}

.markdown-content code {
    background: var(--code-bg);
    color: var(--text-accent);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.9em;
}

.markdown-content pre {
    background: var(--code-bg);
    border-radius: 6px;
    padding: 1rem;
    margin: 1rem 0;
    overflow-x: auto;
}

.markdown-content pre code {
    background: none;
    padding: 0;
    color: var(--text-primary);
    font-size: 0.9rem;
}

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

.markdown-content a:hover {
    border-bottom-color: var(--link-color);
}

.markdown-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
}

.markdown-content th, .markdown-content td {
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    text-align: left;
}

.markdown-content th {
    background: var(--bg-secondary);
    font-weight: 600;
}

/* Editor styles */
.edit-content {
    max-width: none;
    margin: 0;
}

#markdown-editor {
    width: 100%;
    height: 500px;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
}

#markdown-editor:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.25);
}

.editor-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

/* Button styles */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    font-size: 0.9rem;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

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

.btn-primary:hover {
    background: var(--link-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 158, 255, 0.4);
}

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

.btn-secondary:hover {
    background: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

.btn-danger:hover {
    background: var(--danger-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
    animation: pulse 0.5s ease-in-out;
}

.btn:active {
    transform: translateY(0) !important;
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-secondary);
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    animation: scaleIn 0.4s ease-out;
    transform-origin: center;
    position: relative;
    overflow: hidden;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--link-color), transparent);
    animation: slideInModalTop 1s ease-out 0.3s forwards;
}

@keyframes slideInModalTop {
    to { left: 100%; }
}

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

.modal-header h2 {
    margin: 0;
    color: var(--text-accent);
}

.close {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input, .form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 0.9rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.3s ease;
    position: relative;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--link-color);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.25), 0 4px 12px rgba(74, 158, 255, 0.15);
    transform: translateY(-1px);
}

.form-group input:hover, .form-group select:hover {
    border-color: var(--link-color);
    box-shadow: 0 2px 8px rgba(74, 158, 255, 0.1);
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Enhanced VSCode Editor Features */

/* Loading State Styles - Hidden for cleaner UX */
.vscode-loading {
    display: none !important;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--accent-color);
    border-radius: 50%;
    animation: loadingSpin 1s linear infinite;
    margin-bottom: 16px;
}

.loading-text {
    color: var(--text-secondary);
    font-size: 14px;
    font-family: var(--font-mono);
}

@keyframes loadingSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast Notifications */
.vscode-error-toast,
.vscode-status-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    max-width: 400px;
    animation: slideInRightToast 0.3s ease-out;
}

.vscode-error-toast {
    border-color: #ff4444;
    background: rgba(255, 68, 68, 0.1);
}

.vscode-status-toast.success {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.1);
}

.error-content,
.status-content {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 8px;
}

.error-icon,
.status-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.error-text,
.status-text {
    color: var(--text-primary);
    font-size: 14px;
    flex: 1;
    font-family: var(--font-mono);
}

.error-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.error-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Drag and Drop Styles */
.vscode-editor-textarea.drag-over {
    border-color: var(--accent-color);
    background-color: rgba(var(--accent-color-rgb), 0.1);
}

.vscode-editor-textarea.drag-over::after {
    content: '📁 Drop files here to insert';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-primary);
    padding: 16px 24px;
    border-radius: 6px;
    border: 2px dashed var(--accent-color);
    color: var(--accent-color);
    font-family: var(--font-mono);
    font-size: 14px;
    z-index: 10;
    pointer-events: none;
}

/* Enhanced Animations */
@keyframes slideInRightToast {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInSmooth {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUpSmooth {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Apply smooth animations to panels */
.vscode-command-palette,
.vscode-search-panel,
.vscode-cheat-sheet {
    animation: slideUpSmooth 0.2s ease-out;
}

/* Multiple stacked toasts support */
.vscode-error-toast + .vscode-error-toast,
.vscode-status-toast + .vscode-status-toast,
.vscode-error-toast + .vscode-status-toast,
.vscode-status-toast + .vscode-error-toast {
    top: 80px;
}

.vscode-error-toast + .vscode-error-toast + .vscode-error-toast,
.vscode-status-toast + .vscode-status-toast + .vscode-status-toast {
    top: 140px;
}

/* High Contrast Theme Support */
@media (prefers-contrast: high) {
    .vscode-markdown-editor {
        --border-color: #ffffff;
        --text-primary: #ffffff;
        --text-secondary: #cccccc;
        --bg-primary: #000000;
        --bg-secondary: #1a1a1a;
    }
    
    .vscode-toolbar-btn {
        border: 2px solid var(--border-color);
    }
}

/* 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;
    }
    
    .loading-spinner {
        animation: none;
        border-top-color: var(--accent-color);
    }
    
    .vscode-command-palette,
    .vscode-search-panel,
    .vscode-cheat-sheet,
    .vscode-error-toast,
    .vscode-status-toast {
        animation: none;
    }
}

/* Focus Management */
.vscode-markdown-editor:focus-within .vscode-line-numbers {
    opacity: 1;
}

.vscode-editor:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: -2px;
}

/* Statistics Modal */
.vscode-stats-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeInSmooth 0.3s ease-out;
}

.stats-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
    min-width: 400px;
    max-width: 500px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: slideUpSmooth 0.3s ease-out;
}

.stats-modal h3 {
    margin: 0 0 20px 0;
    color: var(--text-primary);
    font-size: 18px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-primary);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.stat-value {
    color: var(--text-primary);
    font-weight: 500;
    font-family: var(--font-mono);
}

.stats-close {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: block;
    margin: 0 auto;
    transition: background-color 0.2s;
}

.stats-close:hover {
    background: var(--accent-hover-color);
}

/* Better Mobile Touch Targets */
@media (hover: none) and (pointer: coarse) {
    .vscode-toolbar-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 12px;
    }
    
    .command-suggestion,
    .cheat-item {
        min-height: 44px;
        padding: 12px;
    }
    
    .error-close {
        min-width: 32px;
        min-height: 32px;
    }
    
    .stats-modal {
        min-width: 90vw;
        margin: 0 5vw;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 300px;
    }
    
    .content-body {
        padding: 1rem;
    }
    
    .content-header {
        padding: 1rem;
    }
}

/* Loading animation */
.loading {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 200px;
    font-size: 1.1rem;
    color: var(--text-secondary);
    animation: fadeInUp 0.5s ease-out;
}

.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    margin-top: 1rem;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--link-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Highlight search results */
.search-highlight {
    background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 0, 0.8) 50%, transparent 100%);
    padding: 0.1rem 0.2rem;
    border-radius: 3px;
    animation: highlightPulse 0.8s ease-out;
}

@keyframes highlightPulse {
    0% { background-size: 0% 100%; }
    100% { background-size: 100% 100%; }
}

/* Settings sections */
.settings-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.settings-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.settings-section h3 {
    margin: 0 0 1rem 0;
    color: var(--text-accent);
    font-size: 1.1rem;
}

.theme-selector-container {
    position: relative;
}

.theme-selector-container select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'><path fill='%23666' d='M2 0L0 2h4zm0 5L0 3h4z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 0.5rem;
    padding-right: 2.5rem;
}

/* Delete modal styles */
.delete-info {
    margin: 1rem 0;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: 6px;
    border-left: 4px solid var(--link-color);
}

.warning-text {
    margin: 1rem 0;
    padding: 1rem;
    background: var(--warning-color);
    color: #000;
    border-radius: 6px;
    font-weight: 500;
}

/* Enhanced transitions for all elements */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

/* Page content animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRightToast {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px var(--link-color); }
    50% { box-shadow: 0 0 20px var(--link-color), 0 0 30px var(--link-color); }
}

@keyframes ripple {
    to {
        transform: scale(2);
        opacity: 0;
    }
}

/* Additional markdown content styles - Dark theme consistency */
.markdown-content blockquote {
    background: var(--highlight-bg);
    border-left: 4px solid var(--accent-color);
    margin: 1rem 0;
    padding: 1rem 1.5rem;
    border-radius: 0 6px 6px 0;
    font-style: italic;
    color: var(--text-secondary);
}

.markdown-content code {
    background: var(--code-bg);
    color: var(--text-accent);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.9em;
}

.markdown-content pre {
    background: var(--code-bg);
    border-radius: 6px;
    padding: 1rem;
    margin: 1rem 0;
    overflow-x: auto;
}

.markdown-content pre code {
    background: none;
    padding: 0;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.markdown-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
}

.markdown-content th, .markdown-content td {
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    text-align: left;
}

.markdown-content th {
    background: var(--bg-secondary);
    font-weight: 600;
}

/* Editor styles updates */
#markdown-editor {
    width: 100%;
    height: 500px;
    padding: 1rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.3s ease;
    animation: fadeInUp 0.6s ease-out;
}

#markdown-editor:focus {
    outline: none;
    border-color: var(--link-color);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.25), 0 8px 20px rgba(74, 158, 255, 0.1);
    transform: translateY(-2px);
}

#markdown-editor:hover {
    border-color: var(--link-color);
    box-shadow: 0 4px 12px rgba(74, 158, 255, 0.1);
}

/* Utility animation classes */
.animate-on-load {
    animation: fadeInUp 0.6s ease-out;
}

.hover-lift:hover {
    transform: translateY(-3px);
    transition: transform 0.2s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(74, 158, 255, 0.3);
    transition: box-shadow 0.3s ease;
}

/* Enhanced scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

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

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

::-webkit-scrollbar-thumb:hover {
    background: #888;
}

/* ===============================================
   🚀 ENHANCED MARKDOWN EDITOR STYLES
   =============================================== */

/* Editor Toolbar */
.editor-toolbar {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    box-shadow: 0 2px 4px var(--shadow-light);
    animation: slideInDown 0.4s ease-out;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0 0.5rem;
    position: relative;
}

.toolbar-group:not(:last-child)::after {
    content: '';
    position: absolute;
    right: -0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 20px;
    background: var(--border-color);
}

.toolbar-toggle {
    margin-left: auto;
}

.toolbar-btn {
    background: transparent;
    border: 1px solid transparent;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toolbar-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(74, 158, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.toolbar-btn:hover::before {
    left: 100%;
}

.toolbar-btn:hover {
    background: var(--highlight-bg);
    border-color: var(--border-color);
    color: var(--link-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(74, 158, 255, 0.15);
}

.toolbar-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(74, 158, 255, 0.2);
}

.toolbar-btn.active,
.toggle-btn.active {
    background: var(--link-color);
    color: white;
    border-color: var(--link-color);
    box-shadow: 0 2px 8px rgba(74, 158, 255, 0.25);
}

.toolbar-btn.active:hover {
    background: var(--link-hover);
    border-color: var(--link-hover);
}

/* Editor Container - Split Pane Layout */
.editor-container {
    display: flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    height: 500px; /* Fixed height instead of min-height */
    animation: fadeIn 0.5s ease-out;
}

.editor-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    min-width: 0; /* Prevents flex overflow */
}

.editor-pane.fullwidth {
    border-right: none;
}

.preview-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    min-width: 0; /* Prevents flex overflow */
}

.preview-pane.hidden {
    display: none;
}

/* Editor Wrapper with Line Numbers */
.editor-wrapper {
    flex: 1;
    display: flex;
    position: relative;
    background: var(--bg-secondary);
    min-height: 0; /* Allows flex child to shrink */
}

.editor-gutter {
    background: var(--highlight-bg);
    border-right: 1px solid var(--border-color);
    width: 50px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden; /* Prevents overflow */
}

.line-numbers {
    padding: 1rem 0.5rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-secondary);
    text-align: right;
    user-select: none;
    white-space: pre;
    height: 100%;
    background: var(--highlight-bg);
    overflow: hidden; /* Prevents overflow */
}

.line-numbers::before {
    content: counter(line);
    counter-increment: line;
    display: block;
}

/* Enhanced Markdown Editor */
.editor-input-container {
    flex: 1;
    position: relative;
    background: var(--bg-secondary);
    min-width: 0; /* Prevents flex overflow */
}

.markdown-editor-enhanced {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    background: transparent;
    color: var(--text-primary);
    resize: none;
    tab-size: 4;
    white-space: pre-wrap;
    word-wrap: break-word;
    position: absolute; /* Absolute positioning for proper sizing */
    top: 0;
    left: 0;
    z-index: 2;
    transition: all 0.2s ease;
    box-sizing: border-box; /* Include padding in dimensions */
}

.markdown-editor-enhanced:focus {
    box-shadow: inset 0 0 0 2px rgba(74, 158, 255, 0.15);
}

/* Editor Overlay for Syntax Highlighting */
.editor-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    pointer-events: none;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: hidden;
    z-index: 1;
    color: transparent;
    background: transparent;
    border: none;
    outline: none;
    opacity: 0;
    visibility: hidden;
    box-sizing: border-box; /* Include padding in dimensions */
}

/* Syntax Highlighting Classes */
.syntax-heading { color: var(--link-color); font-weight: bold; }
.syntax-bold { color: var(--success-color); font-weight: bold; }
.syntax-italic { color: var(--warning-color); font-style: italic; }
.syntax-code { color: var(--danger-color); background: var(--code-bg); }
.syntax-link { color: var(--link-color); text-decoration: underline; }
.syntax-quote { color: var(--text-secondary); }
.syntax-list { color: var(--link-color); }

/* Editor Status Bar */
.editor-status {
    background: var(--highlight-bg);
    border-top: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.status-left,
.status-right {
    display: flex;
    gap: 1rem;
}

.status-item {
    transition: color 0.2s ease;
}

.status-item:hover {
    color: var(--text-primary);
}

#auto-save-status.saving {
    color: var(--warning-color);
}

#auto-save-status.saved {
    color: var(--success-color);
}

#auto-save-status.unsaved {
    color: var(--link-color);
}

#auto-save-status.error {
    color: var(--danger-color);
}

/* Preview Pane */
.preview-header {
    background: var(--highlight-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-header h3 {
    font-size: 0.9rem;
    color: var(--text-accent);
    margin: 0;
}

.preview-sync {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.preview-sync input[type="checkbox"] {
    accent-color: var(--link-color);
}

.preview-content {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    min-height: 0; /* Allows flex child to shrink */
    background: var(--bg-secondary);
    animation: fadeIn 0.3s ease-out;
}

.preview-placeholder {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 2rem;
}

/* Enhanced Editor Actions */
.editor-actions {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideInUp 0.4s ease-out;
}

.actions-left,
.actions-right {
    display: flex;
    gap: 0.75rem;
}

.btn-info {
    background: var(--link-color);
    color: white;
    border: 1px solid var(--link-color);
}

.btn-info:hover {
    background: var(--link-hover);
    border-color: var(--link-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 158, 255, 0.3);
}

/* Fullscreen Mode */
.edit-content.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: var(--bg-primary);
    animation: scaleIn 0.3s ease-out;
}

.edit-content.fullscreen .editor-container {
    min-height: calc(100vh - 200px);
}

/* View Mode Classes */
.editor-container.editor-only .preview-pane {
    display: none;
}

.editor-container.editor-only .editor-pane {
    border-right: none;
}

.editor-container.preview-only .editor-pane {
    display: none;
}

/* Markdown Cheat Sheet Modal */
.modal-wide {
    max-width: 900px;
    width: 90%;
}

.cheat-sheet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.cheat-section {
    background: var(--highlight-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    animation: fadeInUp 0.5s ease-out;
    animation-fill-mode: both;
}

.cheat-section:nth-child(1) { animation-delay: 0.1s; }
.cheat-section:nth-child(2) { animation-delay: 0.2s; }
.cheat-section:nth-child(3) { animation-delay: 0.3s; }
.cheat-section:nth-child(4) { animation-delay: 0.4s; }
.cheat-section:nth-child(5) { animation-delay: 0.5s; }
.cheat-section:nth-child(6) { animation-delay: 0.6s; }

.cheat-section h3 {
    margin-bottom: 0.75rem;
    color: var(--text-accent);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.cheat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.cheat-item:hover {
    background: var(--card-bg);
}

.cheat-item code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8rem;
    background: var(--code-bg);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    color: var(--danger-color);
    flex: 1;
    margin-right: 1rem;
}

.cheat-result {
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.cheat-table .cheat-item {
    flex-direction: column;
    align-items: flex-start;
}

.cheat-table code {
    margin-bottom: 0.5rem;
    margin-right: 0;
}

/* Keyboard Shortcuts */
.keyboard-shortcuts {
    background: var(--highlight-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    animation: fadeInUp 0.7s ease-out;
}

.keyboard-shortcuts h3 {
    margin-bottom: 1rem;
    color: var(--text-accent);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.shortcut-item:hover {
    background: var(--card-bg);
    transform: translateY(-1px);
}

.shortcut-item kbd {
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-family: monospace;
    color: var(--text-accent);
    box-shadow: 0 1px 2px var(--shadow-light);
    min-width: 60px;
    text-align: center;
}

.shortcut-item span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Responsive Design for Editor */
@media (max-width: 1024px) {
    .editor-container {
        flex-direction: column;
        height: auto; /* Allow height to expand on mobile */
        min-height: 400px;
    }

    .editor-pane {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        min-height: 300px; /* Ensure minimum height on mobile */
    }
    
    .toolbar-group {
        gap: 0.1rem;
        padding: 0 0.25rem;
    }
    
    .toolbar-btn {
        padding: 0.4rem 0.6rem;
        min-width: 32px;
    }
}

@media (max-width: 768px) {
    .editor-toolbar {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .editor-gutter {
        width: 35px;
    }
    
    .line-numbers {
        padding: 1rem 0.25rem;
        font-size: 0.7rem;
    }
    
    .markdown-editor-enhanced {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
    
    .editor-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .actions-left,
    .actions-right {
        width: 100%;
        justify-content: center;
    }
    
    .cheat-sheet-grid {
        grid-template-columns: 1fr;
    }
    
    .shortcuts-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
}

/* Animation Enhancements for Editor */
@keyframes slideInDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Editing Mode Enhancements */
body.editing-mode {
    overflow-x: auto;
}

body.editing-mode .content-body {
    max-width: none;
    padding: 0;
}

body.editing-mode .edit-content {
    max-width: none;
    margin: 0;
}

/* Auto-bracket highlighting */
.editor-input-container .auto-bracket {
    background: rgba(74, 158, 255, 0.1);
    animation: pulse 0.3s ease-out;
}

/* Enhanced focus states - Keep overlay hidden to prevent confusion */
.markdown-editor-enhanced:focus + .editor-overlay {
    opacity: 0;
    visibility: hidden;
}

/* Copy button for code blocks in preview */
.preview-content pre {
    position: relative;
}

.preview-content pre:hover::after {
    content: '📋';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--text-secondary);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Zen mode for distraction-free writing */
.edit-content.zen-mode {
    background: var(--bg-primary);
}

.edit-content.zen-mode .editor-toolbar,
.edit-content.zen-mode .editor-actions,
.edit-content.zen-mode .preview-pane {
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

.edit-content.zen-mode:hover .editor-toolbar,
.edit-content.zen-mode:hover .editor-actions,
.edit-content.zen-mode:hover .preview-pane {
    opacity: 1;
}

/* Enhanced animation for modal appearance */
.modal {
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(5px);
    }
}

/* Typewriter effect for placeholder */
.preview-placeholder p {
    animation: typewriter 2s steps(40) infinite;
}

@keyframes typewriter {
    0%, 50% { border-right: 2px solid var(--link-color); }
    51%, 100% { border-right: transparent; }
} 

/* Section Navigation Bar */
.section-nav-bar {
    position: fixed;
    bottom: 0;
    left: 300px; /* Account for sidebar width */
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 8px var(--shadow-light);
    z-index: 1000;
    padding: 12px;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
    max-height: 90px; /* Prevent bar from getting too tall */
}

.section-nav-bar.visible {
    transform: translateY(0);
}

.section-nav-container {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    max-width: 100%;
    scrollbar-width: none;
    -ms-overflow-style: none;
    position: relative;
    scroll-behavior: smooth;
    padding: 0 40px; /* Space for scroll indicators */
}

.section-nav-container::before,
.section-nav-container::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    pointer-events: none;
    z-index: 5;
    transition: opacity 0.3s ease;
}

.section-nav-container::before {
    left: 0;
    background: linear-gradient(to right, var(--bg-secondary), transparent);
}

.section-nav-container::after {
    right: 0;
    background: linear-gradient(to left, var(--bg-secondary), transparent);
}

.section-nav-container::-webkit-scrollbar {
    display: none;
}

/* Scroll indicators */
.nav-scroll-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px var(--shadow-light);
    z-index: 10;
    font-size: 14px;
    color: var(--text-primary);
}

.nav-scroll-indicator:hover {
    background: var(--link-color);
    color: white;
    transform: translateY(-50%) scale(1.1);
}

.nav-scroll-left {
    left: 8px;
}

.nav-scroll-right {
    right: 8px;
}

.nav-scroll-indicator.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Compact mode for many sections */
.section-nav-bar.compact .section-tile {
    min-width: 100px;
    max-width: 120px;
    height: 50px;
    padding: 6px 4px;
}

.section-nav-bar.compact .tile-emoji {
    font-size: 14px;
}

.section-nav-bar.compact .tile-chapter {
    font-size: 9px;
}

.section-nav-bar.compact .tile-text {
    font-size: 10px;
}

.section-tile {
    min-width: 140px;
    max-width: 180px;
    height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 8px 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
    text-align: center;
    position: relative;
    gap: 2px;
}

.tile-emoji {
    font-size: 16px;
    line-height: 1;
    margin-bottom: 1px;
    transition: transform 0.2s ease;
}

.tile-chapter {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tile-text {
    font-size: 11px;
    font-weight: 500;
    line-height: 1.1;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.section-tile:hover {
    background: var(--link-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 158, 255, 0.3);
}

.section-tile:hover .tile-chapter,
.section-tile:hover .tile-text {
    color: rgba(255, 255, 255, 0.9);
}

.section-tile:hover .tile-emoji {
    transform: scale(1.1);
}

.section-tile.active {
    background: var(--link-color);
    color: white;
    box-shadow: 0 2px 8px rgba(74, 158, 255, 0.4);
}

.section-tile.active .tile-chapter,
.section-tile.active .tile-text {
    color: rgba(255, 255, 255, 0.95);
}

.section-tile.active .tile-emoji {
    transform: scale(1.05);
}

.section-tile.h1 {
    border-left: 4px solid var(--link-color);
}

.section-tile.h2 {
    border-left: 4px solid var(--success-color);
}

.section-tile.h3 {
    border-left: 4px solid var(--warning-color);
}

.section-tile.h4,
.section-tile.h5,
.section-tile.h6 {
    border-left: 4px solid var(--text-secondary);
}

/* Animation for new tiles */
@keyframes slideInTile {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-tile.new {
    animation: slideInTile 0.3s ease-out;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .section-nav-bar {
        left: 0; /* Full width on mobile */
        padding: 8px;
        max-height: 70px; /* Smaller on mobile */
    }
    
    .section-nav-container {
        padding: 0 30px; /* Smaller scroll indicator space */
    }
    
    .nav-scroll-indicator {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .nav-scroll-left {
        left: 4px;
    }
    
    .nav-scroll-right {
        right: 4px;
    }
    
    .section-tile {
        min-width: 90px;
        max-width: 110px;
        height: 45px;
        padding: 4px 3px;
        gap: 1px;
    }
    
    .tile-emoji {
        font-size: 12px;
    }
    
    .tile-chapter {
        font-size: 8px;
    }
    
    .tile-text {
        font-size: 9px;
    }
    
    /* Compact mode adjustments for mobile */
    .section-nav-bar.compact .section-tile {
        min-width: 70px;
        max-width: 90px;
        height: 40px;
    }
    
    .section-nav-bar.compact .tile-emoji {
        font-size: 11px;
    }
    
    .section-nav-bar.compact .tile-chapter {
        font-size: 7px;
    }
    
    .section-nav-bar.compact .tile-text {
        font-size: 8px;
    }
}

/* JavaScript Masterclass Specific Styles */
/* These ensure the embedded styles in the JavaScript Masterclass content work properly */

/* Table of Contents Container */
.toc-container {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  border-radius: 15px !important;
  padding: 20px !important;
  margin: 20px 0 !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1) !important;
}

.toc-container h2 {
  color: white !important;
  text-align: center !important;
  margin-bottom: 15px !important;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3) !important;
}

.toc-container ol {
  list-style: none !important;
  counter-reset: toc-counter !important;
  padding: 0 !important;
}

.toc-container li {
  counter-increment: toc-counter !important;
  margin: 8px 0 !important;
  padding: 10px 15px !important;
  background: rgba(255, 255, 255, 0.1) !important;
  border-radius: 8px !important;
  transition: all 0.3s ease !important;
  position: relative !important;
}

.toc-container li:hover {
  background: rgba(255, 255, 255, 0.2) !important;
  transform: translateX(10px) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
}

.toc-container li::before {
  content: counter(toc-counter, decimal-leading-zero) !important;
  position: absolute !important;
  left: -30px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  background: #ff6b6b !important;
  color: white !important;
  width: 25px !important;
  height: 25px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 12px !important;
  font-weight: bold !important;
}

.toc-container a {
  color: white !important;
  text-decoration: none !important;
  font-weight: 500 !important;
  transition: color 0.3s ease !important;
}

.toc-container a:hover {
  color: #ffd700 !important;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5) !important;
}

/* Progress Indicator */
.progress-indicator {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 4px !important;
  background: linear-gradient(90deg, #ff6b6b, #ffd700, #4ecdc4) !important;
  z-index: 999993 !important;
  transform: scaleX(0) !important;
  transform-origin: left !important;
  transition: transform 0.3s ease !important;
}

/* Enhanced Section Styling */
.section-container {
  margin: 30px 0 !important;
  border-radius: 15px !important;
  overflow: hidden !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1) !important;
  transition: all 0.3s ease !important;
  position: relative !important;
}

.section-container:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15) !important;
}

.section-header-enhanced {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  padding: 20px !important;
  color: white !important;
  position: relative !important;
  overflow: hidden !important;
}

.section-header-enhanced::before {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  opacity: 0.3 !important;
}

.section-meta {
  display: flex !important;
  align-items: center !important;
  gap: 15px !important;
  margin-bottom: 10px !important;
  flex-wrap: wrap !important;
}

.section-number {
  background: rgba(255, 255, 255, 0.2) !important;
  padding: 5px 12px !important;
  border-radius: 20px !important;
  font-weight: bold !important;
  font-size: 14px !important;
  backdrop-filter: blur(10px) !important;
}

.difficulty-badge {
  padding: 5px 10px !important;
  border-radius: 15px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  backdrop-filter: blur(10px) !important;
}

.difficulty-badge.beginner {
  background: rgba(76, 175, 80, 0.3) !important;
  border: 1px solid rgba(76, 175, 80, 0.5) !important;
}

.difficulty-badge.intermediate {
  background: rgba(255, 193, 7, 0.3) !important;
  border: 1px solid rgba(255, 193, 7, 0.5) !important;
}

.difficulty-badge.advanced {
  background: rgba(244, 67, 54, 0.3) !important;
  border: 1px solid rgba(244, 67, 54, 0.5) !important;
}

.time-estimate {
  background: rgba(255, 255, 255, 0.1) !important;
  padding: 5px 10px !important;
  border-radius: 15px !important;
  font-size: 12px !important;
  backdrop-filter: blur(10px) !important;
}

.section-title {
  margin: 10px 0 !important;
  font-size: 1.8rem !important;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3) !important;
  position: relative !important;
  z-index: 1 !important;
}

.section-description {
  margin-bottom: 1rem !important;
  opacity: 0.9 !important;
  font-size: 1.1rem !important;
  line-height: 1.6 !important;
  position: relative !important;
  z-index: 1 !important;
}

.section-content {
  background: var(--bg-secondary, #1e1e1e) !important;
  color: var(--text-primary, #e0e0e0) !important;
  padding: 25px !important;
  position: relative !important;
}

.section-content::before {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 4px !important;
  height: 100% !important;
  background: linear-gradient(180deg, #667eea, #764ba2) !important;
}

/* Section Progress Indicators */
.section-progress {
  position: absolute !important;
  top: 20px !important;
  right: 20px !important;
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.2) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 18px !important;
  backdrop-filter: blur(10px) !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
}

.section-progress:hover {
  background: rgba(255, 255, 255, 0.3) !important;
  transform: scale(1.1) !important;
}

.section-progress.completed {
  background: rgba(76, 175, 80, 0.3) !important;
  color: #4CAF50 !important;
}

/* Learning objectives styling */
.section-content h3:first-child {
  color: #667eea !important;
  border-bottom: 2px solid #667eea !important;
  padding-bottom: 8px !important;
  margin-bottom: 20px !important;
  margin-top: 10px !important;
}

/* Fix spacing for all headings within sections */
.section-content h2,
.section-content h3,
.section-content h4,
.markdown-content .section-container h2,
.markdown-content .section-container h3,
.markdown-content .section-container h4 {
  margin-top: 1.5rem !important;
  margin-bottom: 1rem !important;
  line-height: 1.4 !important;
}

/* Better spacing for code blocks in sections */
.section-content pre,
.section-content code,
.markdown-content .section-container pre,
.markdown-content .section-container code {
  margin: 1rem 0 !important;
}

.section-content pre code {
  line-height: 1.5 !important;
}

/* Interactive code blocks */
.interactive-code {
  position: relative !important;
  margin: 20px 0 !important;
}

.run-code-btn {
  position: absolute !important;
  top: 10px !important;
  right: 10px !important;
  background: #4CAF50 !important;
  color: white !important;
  border: none !important;
  padding: 5px 12px !important;
  border-radius: 5px !important;
  cursor: pointer !important;
  font-size: 12px !important;
  opacity: 0.8 !important;
  transition: all 0.3s ease !important;
}

.run-code-btn:hover {
  opacity: 1 !important;
  transform: scale(1.05) !important;
}

/* Next section preview */
.next-section-preview {
  background: linear-gradient(45deg, var(--bg-secondary, #1e1e1e), var(--card-bg, #2d2d2d)) !important;
  border-radius: 10px !important;
  padding: 15px !important;
  margin: 20px 0 !important;
  border-left: 4px solid var(--success-color, #28a745) !important;
}

.next-section-preview h4 {
  color: var(--success-color, #28a745) !important;
  margin-bottom: 5px !important;
}

/* Section completion indicator */
.section-complete-btn {
  background: var(--success-color, #28a745) !important;
  color: white !important;
  border: none !important;
  padding: 10px 20px !important;
  border-radius: 25px !important;
  cursor: pointer !important;
  margin: 20px 0 !important;
  transition: all 0.3s ease !important;
}

.section-complete-btn:hover {
  background: var(--success-hover, #218838) !important;
  transform: translateY(-2px) !important;
}

/* Back to top button */
.back-to-top {
  position: fixed !important;
  bottom: 80px !important;
  right: 20px !important;
  width: 40px !important;
  height: 40px !important;
  background: rgba(0, 0, 0, 0.7) !important;
  border: 2px solid #fff !important;
  border-radius: 8px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  font-size: 18px !important;
  font-weight: bold !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
  opacity: 0 !important;
  transform: translateY(100px) !important;
  transition: all 0.3s ease !important;
  z-index: 999992 !important;
  backdrop-filter: blur(10px) !important;
}

.back-to-top.visible {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

.back-to-top:hover {
  background: rgba(0, 0, 0, 0.9) !important;
  transform: translateY(-2px) scale(1.05) !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4) !important;
}

/* Smooth scrolling for JavaScript Masterclass */
html {
  scroll-behavior: smooth !important;
}

.highlight-section {
  background: linear-gradient(90deg, rgba(255,107,107,0.1), transparent) !important;
  border-left: 4px solid #ff6b6b !important;
  padding-left: 20px !important;
  transition: all 0.5s ease !important;
}

/* Basic syntax highlighting fallback when Prism.js fails to load */
.basic-highlighted {
  background: var(--code-bg, #2d2d2d) !important;
  color: var(--text-primary, #e0e0e0) !important;
  padding: 1rem !important;
  border-radius: 8px !important;
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace !important;
  line-height: 1.5 !important;
  overflow-x: auto !important;
}

/* Basic keyword highlighting */
.basic-highlighted {
  /* JavaScript keywords */
  background-image: 
    linear-gradient(transparent, transparent),
    linear-gradient(transparent, transparent);
}

/* Enhanced fallback code styling */
pre code.basic-highlighted {
  display: block !important;
  white-space: pre !important;
}

code.basic-highlighted {
  background: var(--code-bg, #2d2d2d) !important;
  color: var(--danger-color, #f44336) !important;
  padding: 2px 6px !important;
  border-radius: 4px !important;
  font-size: 0.9em !important;
}

/* VSCode Markdown Editor Styles */
.vscode-markdown-editor {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

.vscode-editor-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100vh;
}

/* Toolbar Styles */
.vscode-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    min-height: 40px;
    flex-shrink: 0;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.toolbar-group:not(:last-child)::after {
    content: '';
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin: 0 8px;
}

.vscode-toolbar-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 28px;
    position: relative;
}

.vscode-toolbar-btn:hover {
    background: var(--highlight-bg);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.vscode-toolbar-btn:active {
    background: var(--bg-tertiary);
    transform: translateY(1px);
}

.vscode-toolbar-btn.active {
    background: var(--link-color);
    color: white;
    border-color: var(--link-color);
}

.vscode-toolbar-btn.toggle-btn.active {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.toolbar-view {
    margin-left: auto;
}

/* Main Content Area */
.vscode-main-content {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.vscode-left-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-right: 1px solid var(--border-color);
}

.vscode-right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-secondary);
}

/* Line Numbers */
.vscode-line-numbers {
    position: absolute;
    left: 0;
    top: 0;
    width: 50px;
    height: 100%;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.4;
    text-align: right;
    padding: 10px 5px;
    border-right: 1px solid var(--border-color);
    user-select: none;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 10;
    display: block !important;
    visibility: visible !important;
}

.vscode-line-numbers .line-number {
    display: block;
    padding: 0 4px;
    cursor: pointer;
}

.vscode-line-numbers .line-number:hover {
    background: var(--highlight-bg);
    color: var(--text-primary);
}

/* Editor Container */
.vscode-editor-container {
    position: relative;
    flex: 1;
    margin-left: 0;
}

.vscode-editor {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    resize: none;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.4;
    padding: 10px 15px;
    tab-size: 4;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.vscode-editor:focus {
    outline: none;
    background: var(--bg-primary);
}

.vscode-editor::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
    font-style: italic;
}

/* Syntax Overlay */
.vscode-syntax-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.4;
    padding: 10px 15px;
    margin-left: 0;
    color: transparent;
    background: transparent;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: hidden;
}

/* Preview Panel */
.vscode-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    min-height: 40px;
}

.vscode-preview-header h3 {
    margin: 0;
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.preview-controls {
    display: flex;
    gap: 8px;
}

.preview-btn {
    padding: 4px 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preview-btn:hover {
    background: var(--highlight-bg);
    color: var(--text-primary);
}

.vscode-preview-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* Preview Content Styling */
.vscode-preview-content h1,
.vscode-preview-content h2,
.vscode-preview-content h3,
.vscode-preview-content h4,
.vscode-preview-content h5,
.vscode-preview-content h6 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
    line-height: 1.25;
}

.vscode-preview-content h1 {
    font-size: 2em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid var(--border-color);
}

.vscode-preview-content h2 {
    font-size: 1.5em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid var(--border-light);
}

.vscode-preview-content h3 {
    font-size: 1.25em;
}

.vscode-preview-content p {
    margin-bottom: 16px;
    line-height: 1.6;
}

.vscode-preview-content code {
    background: var(--code-bg);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 85%;
    color: var(--text-primary);
}

.vscode-preview-content pre {
    background: var(--code-bg);
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 16px 0;
    border: 1px solid var(--border-color);
}

.vscode-preview-content pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: 14px;
}

.custom-preview-content blockquote {
    margin: 16px 0;
    padding: 0 16px;
    color: var(--text-secondary);
    border-left: 4px solid var(--border-color);
    background: var(--blockquote-bg);
}

.custom-preview-content ul,
.custom-preview-content ol {
    margin: 16px 0;
    padding-left: 24px;
}

.custom-preview-content li {
    margin: 4px 0;
}

.custom-preview-content table {
    border-collapse: collapse;
    margin: 16px 0;
    width: 100%;
}

.custom-preview-content th,
.custom-preview-content td {
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    text-align: left;
}

.custom-preview-content th {
    background: var(--bg-secondary);
    font-weight: 600;
}

.preview-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 40px;
    background: var(--bg-primary);
}

.vscode-preview-content blockquote {
    margin: 16px 0;
    padding: 0 16px;
    color: var(--text-secondary);
    border-left: 4px solid var(--border-color);
    background: var(--blockquote-bg);
    border-radius: 0 4px 4px 0;
}

.vscode-preview-content ul,
.vscode-preview-content ol {
    margin: 16px 0;
    padding-left: 24px;
}

.vscode-preview-content li {
    margin: 4px 0;
}

.vscode-preview-content table {
    border-collapse: collapse;
    margin: 16px 0;
    width: 100%;
    border: 1px solid var(--border-color);
}

.vscode-preview-content th,
.vscode-preview-content td {
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    text-align: left;
}

.vscode-preview-content th {
    background: var(--bg-secondary);
    font-weight: 600;
}

/* GitHub Features */
.vscode-preview-content .mention {
    color: var(--link-color);
    font-weight: 500;
    text-decoration: none;
}

.vscode-preview-content .mention:hover {
    text-decoration: underline;
}

.vscode-preview-content .issue-ref {
    color: var(--link-color);
    text-decoration: none;
}

.vscode-preview-content input[type="checkbox"] {
    margin-right: 8px;
}

.preview-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 40px;
    background: var(--bg-primary);
}

/* Status Bar */
.vscode-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    min-height: 24px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-left,
.status-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-item {
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 2px;
}

.status-item:hover {
    background: var(--highlight-bg);
    color: var(--text-primary);
}

/* Fullscreen Mode */
.custom-editor-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    background: var(--bg-primary);
    border-radius: 0;
}

.custom-editor-container.fullscreen .custom-editor-wrapper {
    border-radius: 0;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .custom-editor-main {
        flex-direction: column;
    }

    .custom-editor-left {
        flex: none;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .custom-editor-right {
        flex: none;
        height: 300px;
    }
}

@media (max-width: 768px) {
    .custom-line-numbers {
        width: 40px;
        font-size: 0.8rem;
        padding: 1rem 0.5rem;
    }

    .custom-editor-textarea {
        font-size: 0.9rem;
        padding: 1rem;
    }

    .custom-preview-content {
        font-size: 0.9rem;
    }

    .custom-editor-toolbar {
        padding: 0.5rem;
    }

    .custom-toolbar-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }
}

/* Theme-specific overrides */
[data-theme="dark"] .custom-line-numbers {
    background: #2d2d2d;
    color: #858585;
}

[data-theme="dark"] .custom-editor-textarea {
    background: #1e1e1e;
    color: #d4d4d4;
}

[data-theme="dark"] .custom-preview-content {
    background: #1e1e1e;
    color: #d4d4d4;
}

[data-theme="light"] .custom-line-numbers {
    background: #f8f8f8;
    color: #237893;
}

[data-theme="light"] .custom-editor-textarea {
    background: #ffffff;
    color: #383a42;
}

[data-theme="light"] .custom-preview-content {
    background: #ffffff;
    color: #383a42;
}

/* Text Editor Container Styles */
.text-editor-container {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 500px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: relative;
    font-family: var(--font-mono);
}

.text-editor-main {
    display: flex;
    width: 100%;
    position: relative;
}

.text-editor-line-numbers {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 16px 8px;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.4;
    text-align: right;
    user-select: none;
    border-right: 2px solid var(--border-color);
    width: 60px;
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
}

.text-editor-line-numbers .line-number {
    display: block;
    padding: 0 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
    margin: 1px 0;
}

.text-editor-line-numbers .line-number:hover {
    background: var(--highlight-bg);
    color: var(--text-primary);
    transform: translateX(-2px);
}

.text-editor-content {
    flex: 1;
    background: var(--bg-primary);
    position: relative;
    overflow: auto;
    outline: none;
    padding: 16px 20px;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.text-editor-content::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.status-item {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.status-item:hover {
    background: var(--highlight-bg);
    color: var(--text-primary);
}

/* Command Palette */
.vscode-command-palette {
    position: fixed;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    max-width: 90vw;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    overflow: hidden;
    animation: slideUpSmooth 0.2s ease-out;
}

.command-input {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    border-bottom: 1px solid var(--border-color);
}

.command-suggestions {
    max-height: 300px;
    overflow-y: auto;
}

.command-suggestion {
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background-color 0.15s ease;
}

.command-suggestion:hover,
.command-suggestion.selected {
    background: var(--highlight-bg);
}

.cmd-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.cmd-title {
    flex: 1;
    font-weight: 500;
}

.cmd-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.cmd-shortcut {
    font-size: 11px;
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

/* Search Panel */
.vscode-search-panel {
    position: fixed;
    top: 10%;
    right: 20px;
    width: 400px;
    max-width: 90vw;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    overflow: hidden;
    animation: slideUpSmooth 0.2s ease-out;
}

.search-header {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
    color: var(--text-primary);
}

.search-input,
.replace-input {
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    border-bottom: 1px solid var(--border-light);
}

.search-input:focus,
.replace-input:focus {
    background: var(--bg-primary);
    border-bottom-color: var(--accent-color);
}

.search-controls {
    padding: 12px 16px;
    display: flex;
    gap: 8px;
}

.search-btn {
    padding: 6px 12px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
}

.search-btn:hover {
    background: var(--accent-hover-color);
}

.search-options {
    padding: 8px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-primary);
}

.search-options label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
}

/* Cheat Sheet */
.vscode-cheat-sheet {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeInSmooth 0.3s ease-out;
}

.cheat-sheet-content {
    width: 90vw;
    max-width: 1000px;
    height: 80vh;
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: slideUpSmooth 0.3s ease-out;
}

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

.cheat-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
}

.close-cheat-sheet {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.close-cheat-sheet:hover {
    background: var(--highlight-bg);
    color: var(--text-primary);
}

.cheat-search {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light);
}

.cheat-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
}

.cheat-search-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-bg);
}

.cheat-sections {
    padding: 24px;
    height: calc(80vh - 140px);
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.cheat-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
}

.cheat-section h3 {
    margin: 0 0 12px 0;
    color: var(--text-primary);
    font-size: 16px;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 8px;
}

.cheat-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cheat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    border-radius: 4px;
    transition: background-color 0.15s ease;
    cursor: pointer;
}

.cheat-item:hover {
    background: var(--highlight-bg);
}

.cheat-syntax code {
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

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

.cheat-desc {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Zen Mode */
.vscode-markdown-editor.zen-mode .vscode-toolbar,
.vscode-markdown-editor.zen-mode .vscode-status-bar {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.vscode-markdown-editor.zen-mode:hover .vscode-toolbar,
.vscode-markdown-editor.zen-mode:hover .vscode-status-bar {
    opacity: 1;
}

/* Custom Scrollbars */
.vscode-editor::-webkit-scrollbar,
.text-editor-content::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.text-editor-content::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.vscode-editor::-webkit-scrollbar-track,
.cheat-sections::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.vscode-editor::-webkit-scrollbar-thumb,
.text-editor-content::-webkit-scrollbar-thumb,
.cheat-sections::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.text-editor-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.text-editor-content:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: -2px;
}

.text-content {
    position: relative;
}

.text-line {
    min-height: 1.4em;
    position: relative;
    white-space: pre-wrap;
    word-wrap: break-word;
    padding-right: 20px;
}

.text-line:empty::before {
    content: '\00a0';
    color: transparent;
}

.text-editor-cursor {
    position: absolute;
    width: 2px;
    background: var(--text-primary);
    z-index: 10;
    animation: cursorBlink 1s infinite;
}

.text-editor-cursor.blink {
    animation: cursorBlink 1s infinite;
}

@keyframes cursorBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.text-editor-selection {
    position: absolute;
    background: rgba(74, 158, 255, 0.3);
    border-radius: 2px;
    pointer-events: none;
    z-index: 5;
}

/* Syntax highlighting for text content */
.text-content .syntax-header {
    color: var(--link-color);
    font-weight: bold;
}

.text-content .syntax-bold {
    color: var(--success-color);
    font-weight: bold;
}

.text-content .syntax-italic {
    color: var(--warning-color);
    font-style: italic;
}

.text-content .syntax-code {
    background: var(--code-bg);
    color: var(--danger-color);
    padding: 0.1em 0.3em;
    border-radius: 3px;
    font-family: var(--font-mono);
}

.text-content .syntax-link {
    color: var(--link-color);
    text-decoration: underline;
}

.text-content .syntax-quote {
    color: var(--text-secondary);
    border-left: 3px solid var(--border-color);
    padding-left: 8px;
    font-style: italic;
}

.text-content .syntax-list {
    color: var(--link-color);
}

/* Theme-specific styles for text editor */
[data-theme="light"] .text-editor-container {
    border-color: #e1e4e8;
}

[data-theme="light"] .text-editor-line-numbers {
    background: #f6f8fa;
    color: #586069;
}

[data-theme="dark"] .text-editor-cursor {
    background: #ffffff;
}

.text-editor-container:focus-within .text-editor-line-numbers {
    background: var(--highlight-bg);
    color: var(--text-primary);
}

/* Edit content integration */
.edit-content {
    padding: 0;
    margin: 0;
}

.edit-content .text-editor-container {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    min-height: 600px;
    background: var(--bg-primary);
}

.text-line {
    min-height: 1.4em;
    line-height: 1.4;
}

.text-editor-cursor {
    height: 1.4em;
}

/* Mobile responsiveness for text editor */
@media (max-width: 768px) {
    .text-editor-container {
        min-height: 400px;
        border-radius: 6px;
        border-width: 1px;
    }

    .text-editor-line-numbers {
        width: 45px;
        padding: 12px 6px;
        font-size: 12px;
    }

    .text-editor-content {
        padding: 12px 16px;
        font-size: 13px;
    }

    .text-line {
        min-height: 1.3em;
        line-height: 1.3;
    }

    .text-editor-cursor {
        height: 1.3em;
        width: 1.5px;
    }

    .edit-content {
        padding: 0.5rem;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .text-editor-cursor {
        background: var(--text-primary);
        width: 3px;
    }

    .text-editor-selection {
        background: rgba(255, 255, 255, 0.4);
        border: 1px solid var(--text-primary);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .text-editor-cursor {
        animation: none;
        opacity: 1;
    }
}

.vscode-editor::-webkit-scrollbar-thumb:hover,
.text-editor-content::-webkit-scrollbar-thumb:hover,
.cheat-sections::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Responsive Design for VSCode Editor */
@media (max-width: 1024px) {
    .vscode-main-content {
        flex-direction: column;
    }

    .vscode-left-panel,
    .vscode-right-panel {
        flex: none;
        min-height: 300px;
    }

    .vscode-command-palette {
        width: 90vw;
    }

    .cheat-sections {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .vscode-line-numbers {
        width: 40px;
        font-size: 12px;
        padding: 8px 4px;
    }

    .vscode-editor {
        font-size: 13px;
        padding: 8px 12px;
    }

    .vscode-toolbar {
        padding: 6px 12px;
        flex-wrap: wrap;
    }

    .toolbar-group {
        gap: 2px;
    }

    .vscode-toolbar-btn {
        padding: 4px 6px;
        font-size: 12px;
    }

    .vscode-search-panel {
        right: 10px;
        width: calc(100vw - 20px);
    }

    .cheat-sheet-content {
        width: 95vw;
        height: 90vh;
    }
}

/* Theme-specific VSCode Editor Styles */
[data-theme="dark"] .vscode-markdown-editor {
    background: #1e1e1e;
}

[data-theme="dark"] .vscode-editor {
    background: #1e1e1e;
    color: #d4d4d4;
}

[data-theme="dark"] .vscode-line-numbers {
    background: #252526;
    color: #858585;
}

[data-theme="dark"] .vscode-toolbar {
    background: #2d2d30;
    border-bottom-color: #3e3e42;
}

[data-theme="light"] .vscode-markdown-editor {
    background: #ffffff;
}

[data-theme="light"] .vscode-editor {
    background: #ffffff;
    color: #383a42;
}

[data-theme="light"] .vscode-line-numbers {
    background: #f8f8f8;
    color: #237893;
}

[data-theme="light"] .vscode-toolbar {
    background: #f3f3f3;
    border-bottom-color: #e5e5e5;
}

/* Global styles for VSCode editor integration */
.vscode-markdown-editor * {
    box-sizing: border-box;
}

.vscode-toolbar-btn:focus,
.command-input:focus,
.search-input:focus,
.cheat-search-input:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: -1px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .vscode-markdown-editor {
        border: 2px solid var(--text-primary);
    }

    .vscode-toolbar-btn {
        border: 1px solid var(--text-primary);
    }
}

.custom-line-numbers::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(to bottom, 
        transparent 0%, 
        var(--link-color) 20%, 
        var(--link-color) 80%, 
        transparent 100%);
}

.line-number-item {
    padding: 0;
    margin: 0;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    box-sizing: border-box;
    font-weight: 400;
    flex-shrink: 0;
}

.line-number-item:hover {
    color: var(--link-color);
    background: var(--card-bg);
    margin: 0 -0.5rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

/* Keep old class for backwards compatibility */
.line-number {
    padding: 0;
    margin: 0;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    box-sizing: border-box;
    font-weight: 400;
    flex-shrink: 0;
}

.line-number:hover {
    color: var(--link-color);
    background: var(--card-bg);
    margin: 0 -0.5rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.custom-editor-textarea {
    flex: 1;
    border: none;
    outline: none;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    background: var(--bg-primary);
    color: var(--text-primary);
    resize: none;
    white-space: pre-wrap;
    word-wrap: break-word;
    tab-size: 4;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.custom-editor-textarea:focus {
    background: var(--bg-primary);
    box-shadow: inset 0 0 0 2px rgba(74, 158, 255, 0.1);
}

.custom-editor-textarea::-webkit-scrollbar {
    width: 8px;
}

.custom-editor-textarea::-webkit-scrollbar-track {
    background: transparent;
}

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

.custom-editor-textarea::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Right Side - Live Preview */
.custom-editor-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
}

.custom-preview-header {
    background: var(--highlight-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.custom-preview-header h3 {
    font-size: 0.9rem;
    color: var(--text-accent);
    margin: 0;
    font-weight: 600;
}

.custom-preview-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    background: var(--bg-secondary);
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.custom-preview-content::-webkit-scrollbar {
    width: 8px;
}

.custom-preview-content::-webkit-scrollbar-track {
    background: transparent;
}

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

.custom-preview-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Preview Content Styling */
.custom-preview-content h1,
.custom-preview-content h2,
.custom-preview-content h3,
.custom-preview-content h4,
.custom-preview-content h5,
.custom-preview-content h6 {
    color: var(--text-accent);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.custom-preview-content h1 {
    font-size: 1.75rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.custom-preview-content h2 {
    font-size: 1.4rem;
}

.custom-preview-content h3 {
    font-size: 1.2rem;
}

.custom-preview-content p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.custom-preview-content code {
    background: var(--code-bg);
    color: var(--danger-color);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85rem;
}

.custom-preview-content pre {
    background: var(--highlight-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.custom-preview-content pre code {
    background: none;
    color: var(--text-primary);
    padding: 0;
}

.vscode-preview-content blockquote {
    border-left: 4px solid var(--blockquote-border);
    background: var(--blockquote-bg);
    margin: 16px 0;
    padding: 8px 16px;
    color: var(--text-secondary);
}

.vscode-preview-content ul,
.vscode-preview-content ol {
    margin: 16px 0;
    padding-left: 32px;
}

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

.vscode-preview-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    border: 1px solid var(--border-color);
}

.vscode-preview-content th,
.vscode-preview-content td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.vscode-preview-content th {
    background: var(--bg-secondary);
    font-weight: 600;
}

/* GitHub Features Styling */
.vscode-preview-content .mention {
    color: var(--link-color);
    background: var(--highlight-bg);
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
}

.vscode-preview-content .issue-ref {
    color: var(--link-color);
    font-weight: 600;
}

.vscode-preview-content input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
}

/* Task List Styles */
.markdown-content .task-item,
.vscode-preview-content .task-item {
    list-style: none;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
    padding-left: 0;
}

.markdown-content .task-checkbox,
.vscode-preview-content .task-checkbox {
    margin: 0;
    margin-top: 2px;
    cursor: pointer;
    transform: scale(1.1);
    accent-color: var(--accent-color, #007acc);
}

.markdown-content .task-item:has(.task-checkbox:checked),
.vscode-preview-content .task-item:has(.task-checkbox:checked) {
    opacity: 0.7;
}

.markdown-content .task-item:has(.task-checkbox:checked) span,
.markdown-content .task-item:has(.task-checkbox:checked) em,
.markdown-content .task-item:has(.task-checkbox:checked) strong,
.vscode-preview-content .task-item:has(.task-checkbox:checked) span,
.vscode-preview-content .task-item:has(.task-checkbox:checked) em,
.vscode-preview-content .task-item:has(.task-checkbox:checked) strong {
    text-decoration: line-through;
    color: var(--text-secondary);
}

.preview-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

/* Status Bar */
.vscode-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 16px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
    min-height: 24px;
    flex-shrink: 0;
}

.status-left,
.status-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-item {
    padding: 2px 8px;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.status-item:hover {
    background: var(--highlight-bg);
    color: var(--text-primary);
}

/* Command Palette */
.vscode-command-palette {
    position: fixed;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 600px;
    max-width: 90vw;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    overflow: hidden;
}

.command-input {
    width: 100%;
    padding: 16px;
    border: none;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
}

.command-suggestions {
    max-height: 400px;
    overflow-y: auto;
}

.command-suggestion {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.command-suggestion:hover,
.command-suggestion.selected {
    background: var(--highlight-bg);
}

.cmd-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.cmd-title {
    font-weight: 500;
}

.cmd-desc {
    color: var(--text-secondary);
    font-size: 14px;
}

.cmd-shortcut {
    margin-left: auto;
    color: var(--text-secondary);
    font-size: 12px;
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 3px;
}

/* Search Panel */
.vscode-search-panel {
    position: fixed;
    top: 50px;
    right: 20px;
    width: 300px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    overflow: hidden;
}

.search-header {
    padding: 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.search-input,
.replace-input {
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: var(--bg-primary);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.search-input:focus,
.replace-input:focus {
    outline: 2px solid var(--link-color);
}

.search-controls {
    padding: 8px 12px;
    display: flex;
    gap: 8px;
}

.search-btn {
    padding: 4px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 3px;
    cursor: pointer;
}

.search-btn:hover {
    background: var(--highlight-bg);
}

.search-options {
    padding: 8px 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.search-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

/* Cheat Sheet */
.vscode-cheat-sheet {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cheat-sheet-content {
    background: var(--bg-primary);
    border-radius: 8px;
    width: 90vw;
    max-width: 1200px;
    height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.cheat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.cheat-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 24px;
}

.close-cheat-sheet {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.close-cheat-sheet:hover {
    background: var(--highlight-bg);
    color: var(--text-primary);
}

.cheat-search {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.cheat-search-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 16px;
}

.cheat-search-input:focus {
    outline: 2px solid var(--link-color);
}

.cheat-sections {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.cheat-section {
    background: var(--bg-secondary);
    border-radius: 6px;
    padding: 16px;
    border: 1px solid var(--border-color);
}

.cheat-section h3 {
    margin: 0 0 16px 0;
    color: var(--link-color);
    font-size: 18px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.cheat-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cheat-item {
    padding: 8px 12px;
    background: var(--bg-primary);
    border-radius: 4px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.cheat-item:hover {
    background: var(--highlight-bg);
}

.cheat-syntax code {
    background: var(--code-bg);
    color: var(--accent-color);
    padding: 2px 4px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 13px;
}

.cheat-result {
    margin-top: 4px;
    color: var(--text-secondary);
}

.cheat-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Zen Mode */
.vscode-markdown-editor.zen-mode .vscode-toolbar,
.vscode-markdown-editor.zen-mode .vscode-status-bar {
    display: none;
}

.vscode-markdown-editor.zen-mode:hover .vscode-toolbar,
.vscode-markdown-editor.zen-mode:hover .vscode-status-bar {
    display: flex;
}

/* Scrollbar Styles */
.vscode-editor::-webkit-scrollbar,
.vscode-preview-content::-webkit-scrollbar,
.text-editor-content::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.text-editor-content::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.vscode-editor::-webkit-scrollbar-track,
.vscode-preview-content::-webkit-scrollbar-track,
.vscode-line-numbers::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.vscode-editor::-webkit-scrollbar-thumb,
.vscode-preview-content::-webkit-scrollbar-thumb,
.text-editor-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.text-editor-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.text-editor-content:focus {
    outline: 2px solid var(--link-color);
}

.text-content {
    position: relative;
}

.text-line {
    min-height: 24px;
    line-height: 24px;
    font-family: inherit;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.text-line:empty::before {
    content: "\00a0";
}

.text-editor-cursor {
    position: absolute;
    width: 2px;
    background: var(--text-primary);
    z-index: 10;
    transition: left 0.1s ease;
}

.text-editor-cursor.blink {
    animation: cursorBlink 1s infinite;
}

@keyframes cursorBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.text-editor-selection {
    position: absolute;
    background: rgba(74, 158, 255, 0.3);
    z-index: 1;
    pointer-events: none;
    border-radius: 2px;
}

/* Syntax Highlighting */
.text-content .syntax-header {
    color: var(--link-color);
    font-weight: bold;
}

.text-content .syntax-bold {
    color: var(--success-color);
    font-weight: bold;
}

.text-content .syntax-italic {
    color: var(--warning-color);
    font-style: italic;
}

.text-content .syntax-code {
    color: var(--danger-color);
    background: var(--code-bg);
    padding: 2px 4px;
    border-radius: 3px;
}

.text-content .syntax-link {
    color: var(--link-color);
    text-decoration: underline;
}

.text-content .syntax-quote {
    color: var(--text-secondary);
    border-left: 3px solid var(--border-color);
    padding-left: 8px;
}

.text-content .syntax-list {
    color: var(--link-color);
}

/* Theme Specific Adjustments */
[data-theme="light"] .text-editor-container {
    background: #ffffff;
}

[data-theme="light"] .text-editor-line-numbers {
    background: #f8f9fa;
}

[data-theme="dark"] .text-editor-cursor {
    background: #ffffff;
}

.text-editor-container:focus-within .text-editor-line-numbers {
    border-right-color: var(--link-color);
}

.edit-content {
    padding: 0;
}

.edit-content .text-editor-container {
    margin: 0;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.text-line {
    position: relative;
}

.text-editor-cursor {
    height: 24px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .text-editor-container {
        height: 50vh;
        min-height: 300px;
        border-radius: 6px;
    }

    .text-editor-line-numbers {
        width: 60px;
        padding: 12px 8px;
    }

    .text-editor-content {
        padding: 12px;
        font-size: 14px;
    }

    .text-line {
        line-height: 20px;
        min-height: 20px;
    }

    .text-editor-cursor {
        height: 20px;
    }

    .edit-content {
        padding: 8px;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .text-editor-cursor {
        background: var(--text-primary);
        box-shadow: 0 0 0 1px var(--bg-primary);
    }

    .text-editor-selection {
        background: var(--link-color);
        opacity: 0.7;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .text-editor-cursor {
        animation: none;
    }
}

.vscode-editor::-webkit-scrollbar-thumb:hover,
.vscode-preview-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Responsive Design for VSCode Editor */
@media (max-width: 1024px) {
    .vscode-main-content {
        flex-direction: column;
    }

    .vscode-left-panel,
    .vscode-right-panel {
        width: 100%;
        min-height: 300px;
    }

    .vscode-command-palette {
        width: 90vw;
    }

    .cheat-sections {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .vscode-line-numbers {
        width: 50px;
        padding: 8px 4px;
        font-size: 12px;
    }

    .vscode-editor {
        font-size: 14px;
    }

    .vscode-toolbar {
        padding: 8px;
        flex-wrap: wrap;
    }

    .toolbar-group {
        margin-bottom: 4px;
    }

    .vscode-toolbar-btn {
        font-size: 12px;
        padding: 6px 8px;
    }

    .vscode-search-panel {
        width: 90vw;
        right: 5vw;
    }

    .cheat-sheet-content {
        width: 95vw;
        height: 95vh;
    }
}

/* Theme Specific VSCode Styles */
[data-theme="dark"] .vscode-markdown-editor {
    background: var(--bg-primary);
}

[data-theme="dark"] .vscode-editor {
    background: var(--bg-primary);
    color: var(--text-primary);
}

[data-theme="dark"] .vscode-line-numbers {
    background: var(--bg-secondary);
}

[data-theme="dark"] .vscode-toolbar {
    background: var(--bg-secondary);
}

[data-theme="light"] .vscode-markdown-editor {
    background: #ffffff;
}

[data-theme="light"] .vscode-editor {
    background: #ffffff;
    color: #333333;
}

[data-theme="light"] .vscode-line-numbers {
    background: #f8f9fa;
}

[data-theme="light"] .vscode-toolbar {
    background: #f8f9fa;
}

/* Focus and Accessibility */
.vscode-markdown-editor * {
    box-sizing: border-box;
}

.vscode-toolbar-btn:focus,
.vscode-editor:focus,
.command-input:focus,
.search-input:focus,
.cheat-search-input:focus {
    outline: 2px solid var(--link-color);
    outline-offset: 1px;
}

/* High Contrast Mode for VSCode Editor */
@media (prefers-contrast: high) {
    .vscode-markdown-editor {
        border: 2px solid var(--text-primary);
    }

    .vscode-toolbar-btn {
        border-width: 2px;
    }
}

/* Save Ribbon Notification */
.save-ribbon {
    position: fixed;
    bottom: 20px;
    right: -300px;
    background: linear-gradient(135deg, var(--success-color), var(--success-hover));
    color: white;
    padding: 12px 20px;
    border-radius: 25px 5px 5px 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    min-width: 150px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.save-ribbon.visible {
    right: 20px;
    transform: translateX(0);
}

.save-ribbon.error {
    background: linear-gradient(135deg, var(--error-color), var(--danger-hover));
}

.save-ribbon .ribbon-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    font-size: 14px;
}

.save-ribbon .ribbon-icon {
    font-size: 16px;
    animation: ribbonPulse 2s infinite;
}

.save-ribbon .ribbon-text {
    margin: 0;
    white-space: nowrap;
}

/* Animation for ribbon slide */
@keyframes ribbonSlideIn {
    from {
        right: -300px;
        opacity: 0;
    }
    to {
        right: 20px;
        opacity: 1;
    }
}

@keyframes ribbonSlideOut {
    from {
        right: 20px;
        opacity: 1;
    }
    to {
        right: -300px;
        opacity: 0;
    }
}

/* Pulse animation for the icon */
@keyframes ribbonPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Dark theme adjustments */
[data-theme="dark"] .save-ribbon {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Light theme adjustments */
[data-theme="light"] .save-ribbon {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .save-ribbon {
        bottom: 10px;
        right: -250px;
        padding: 10px 16px;
        border-radius: 20px 3px 3px 20px;
        min-width: 120px;
    }
    
    .save-ribbon.visible {
        right: 10px;
    }
    
    .save-ribbon .ribbon-content {
        font-size: 13px;
        gap: 8px;
    }
}

/* Subtle Save Icon Notification */
.save-icon-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    font-size: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px;
    border-radius: 50%;
    z-index: 9999;
    opacity: 0.8;
    animation: saveIconFadeIn 0.3s ease-in-out;
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.save-icon-notification.fade-out {
    animation: saveIconFadeOut 0.3s ease-in-out;
    opacity: 0;
}

@keyframes saveIconFadeIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 0.8;
        transform: scale(1);
    }
}

@keyframes saveIconFadeOut {
    from {
        opacity: 0.8;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.8);
    }
}

/* Dark theme adjustments */
[data-theme="dark"] .save-icon-notification {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Light theme adjustments */
[data-theme="light"] .save-icon-notification {
    background: rgba(0, 0, 0, 0.8);
    color: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Mobile responsive for save icon */
@media (max-width: 768px) {
    .save-icon-notification {
        top: 10px;
        right: 10px;
        font-size: 18px;
        padding: 6px;
    }
}

/* === ENHANCED PREVIEW STYLING - MAKE MAIN CONTENT LOOK LIKE EDITOR PREVIEW === */
/* Force the main page content to use the exact same beautiful styling as the editor preview */

/* Main Content Area - Match Preview Container */
.content-body {
    background: var(--bg-primary) !important;
    padding: 32px !important;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

/* Markdown Content Container - Exact Preview Match - ULTRA HIGH SPECIFICITY */
#markdown-content,
.markdown-content,
div[id="markdown-content"],
div.markdown-content,
.content-body .markdown-content,
.main-content .markdown-content {
    max-width: 800px !important;
    margin: 32px auto !important;
    padding: 24px 32px !important;
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    font-size: 16px !important;
    line-height: 1.6 !important;
    border-radius: 10px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04) !important;
    border: 1px solid var(--border-light) !important;
}

/* Preview Heading Styles - ULTRA HIGH SPECIFICITY */
#markdown-content h1,
.markdown-content h1,
.content-body .markdown-content h1,
.main-content .markdown-content h1,
div[id="markdown-content"] h1 {
    font-size: 2rem !important;
    font-weight: 700 !important;
    color: var(--text-accent) !important;
    margin: 0 0 1rem 0 !important;
    padding-bottom: 0.5rem !important;
    border-bottom: 2px solid var(--border-color) !important;
    line-height: 1.3 !important;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

#markdown-content h2,
.markdown-content h2,
.content-body .markdown-content h2,
.main-content .markdown-content h2,
div[id="markdown-content"] h2 {
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    margin: 1.5rem 0 1rem 0 !important;
    padding-bottom: 0.25rem !important;
    border-bottom: 1px solid var(--border-light) !important;
    line-height: 1.4 !important;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

#markdown-content h3,
.markdown-content h3,
.content-body .markdown-content h3,
.main-content .markdown-content h3,
div[id="markdown-content"] h3 {
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    margin: 1.25rem 0 0.75rem 0 !important;
    line-height: 1.4 !important;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    margin: 1rem 0 0.5rem 0 !important;
    line-height: 1.4 !important;
}

/* Preview Typography - Exact Match */
.markdown-content p {
    margin: 0 0 1rem 0 !important;
    line-height: 1.7 !important;
    color: var(--text-primary) !important;
}

/* Preview List Styles - Exact Match */
.markdown-content ul,
.markdown-content ol {
    margin: 1rem 0 !important;
    padding-left: 1.5rem !important;
}

.markdown-content li {
    margin-bottom: 0.5rem !important;
    line-height: 1.6 !important;
    color: var(--text-primary) !important;
}

/* Preview Blockquote Styles - Exact Match */
.markdown-content blockquote {
    margin: 1rem 0 !important;
    padding: 1rem 1.5rem !important;
    background: var(--highlight-bg) !important;
    border-left: 4px solid var(--accent-color) !important;
    border-radius: 0 6px 6px 0 !important;
    font-style: italic !important;
    color: var(--text-secondary) !important;
}

/* Preview Code Styles - Exact Match */
.markdown-content code {
    background: var(--code-bg) !important;
    color: var(--text-accent) !important;
    padding: 0.2rem 0.4rem !important;
    border-radius: 4px !important;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace !important;
    font-size: 0.9em !important;
}

.markdown-content pre {
    background: var(--code-bg) !important;
    border-radius: 6px !important;
    padding: 1rem !important;
    margin: 1rem 0 !important;
    overflow-x: auto !important;
}

.markdown-content pre code {
    background: none !important;
    padding: 0 !important;
    color: var(--text-primary) !important;
    font-size: 0.9rem !important;
}

/* Preview Link Styles - Exact Match */
.markdown-content a {
    color: var(--link-color) !important;
    text-decoration: none !important;
    border-bottom: 1px solid transparent !important;
    transition: border-color 0.2s ease !important;
}

.markdown-content a:hover {
    border-bottom-color: var(--link-color) !important;
}

/* Preview Table Styles - Exact Match */
.markdown-content table {
    border-collapse: collapse !important;
    width: 100% !important;
    margin: 1rem 0 !important;
}

.markdown-content th,
.markdown-content td {
    border: 1px solid var(--border-color) !important;
    padding: 0.75rem !important;
    text-align: left !important;
}

.markdown-content th {
    background: var(--bg-secondary) !important;
    font-weight: 600 !important;
}

/* Mobile Responsive - Match Preview */
@media (max-width: 768px) {
    .content-body {
        padding: 16px !important;
    }
    
    .markdown-content {
        margin: 16px auto !important;
        padding: 16px 20px !important;
        max-width: 100% !important;
    }
    
    .markdown-content h1 {
        font-size: 1.75rem !important;
    }
    
    .markdown-content h2 {
        font-size: 1.375rem !important;
    }
    
    .markdown-content h3 {
        font-size: 1.125rem !important;
    }
}

/* Mobile responsive for save icon */
@media (max-width: 768px) {
    .save-icon-notification {
        top: 10px;
        right: 10px;
        font-size: 18px;
        padding: 6px;
    }
}

/* Ribbon Notifications - Replace Modal Notifications */
.ribbon-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    max-width: 300px;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.ribbon-notification.visible {
    transform: translateX(0);
    opacity: 1;
}

.ribbon-notification.fade-out {
    transform: translateX(100%);
    opacity: 0;
}

.ribbon-notification .ribbon-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ribbon-notification .ribbon-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.ribbon-notification .ribbon-text {
    font-size: 14px;
    line-height: 1.4;
    font-weight: 500;
}

/* Ribbon type variations */
.ribbon-notification.ribbon-success {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.ribbon-notification.ribbon-error {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

.ribbon-notification.ribbon-warning {
    background: var(--warning-color);
    color: white;
    border-color: var(--warning-color);
}

.ribbon-notification.ribbon-info {
    background: var(--info-color, #17a2b8);
    color: white;
    border-color: var(--info-color, #17a2b8);
}

/* Dark theme adjustments */
[data-theme="dark"] .ribbon-notification {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .ribbon-notification.ribbon-info {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* Light theme adjustments */
[data-theme="light"] .ribbon-notification {
    background: var(--bg-primary);
    border-color: var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .ribbon-notification.ribbon-info {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* Mobile responsive for ribbon notifications */
@media (max-width: 768px) {
    .ribbon-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100%);
    }
    
    .ribbon-notification.visible {
        transform: translateY(0);
    }
    
    .ribbon-notification.fade-out {
        transform: translateY(-100%);
    }
    
    .ribbon-notification .ribbon-content {
        gap: 6px;
    }
    
    .ribbon-notification .ribbon-text {
        font-size: 13px;
    }
}