/* =====================================================
   CLEARCODE COMPLETE STYLES - v1.0 FIXED
   Editor layout restored + Debug panel working
   ===================================================== */

/* Theme Variables */
:root {
    /* Light Theme (Default) */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #2c3e50;
    --text-secondary: #495057;
    --text-muted: #6c757d;
    --border-color: #e9ecef;
    --shadow-color: rgba(0,0,0,0.1);
    --editor-bg: #ffffff;
}

[data-theme="dark"] {
    --bg-primary: #1e1e1e;
    --bg-secondary: #252526;
    --text-primary: #d4d4d4;
    --text-secondary: #cccccc;
    --text-muted: #858585;
    --border-color: #3e3e42;
    --shadow-color: rgba(0,0,0,0.5);
    --editor-bg: #1e1e1e;
}

[data-theme="ayu"] {
    --bg-primary: #0f1419;
    --bg-secondary: #1a1f29;
    --text-primary: #bfbdb6;
    --text-secondary: #8a919d;
    --text-muted: #5c6166;
    --border-color: #232834;
    --shadow-color: rgba(0,0,0,0.6);
    --editor-bg: #0d1016;
}

[data-theme="tokyo-night"] {
    --bg-primary: #1a1b26;
    --bg-secondary: #16161e;
    --text-primary: #c0caf5;
    --text-secondary: #a9b1d6;
    --text-muted: #565f89;
    --border-color: #292e42;
    --shadow-color: rgba(0,0,0,0.5);
    --editor-bg: #1a1b26;
}

[data-theme="nord"] {
    --bg-primary: #2e3440;
    --bg-secondary: #3b4252;
    --text-primary: #eceff4;
    --text-secondary: #d8dee9;
    --text-muted: #81a1c1;
    --border-color: #434c5e;
    --shadow-color: rgba(0,0,0,0.4);
    --editor-bg: #2e3440;
}

[data-theme="night-owl"] {
    --bg-primary: #011627;
    --bg-secondary: #01111d;
    --text-primary: #d6deeb;
    --text-secondary: #a6b5c5;
    --text-muted: #5f7e97;
    --border-color: #1d3b53;
    --shadow-color: rgba(0,0,0,0.6);
    --editor-bg: #011627;
}

[data-theme="monokai-pro"] {
    --bg-primary: #2d2a2e;
    --bg-secondary: #221f22;
    --text-primary: #fcfcfa;
    --text-secondary: #c1c0c0;
    --text-muted: #727072;
    --border-color: #3e3a3e;
    --shadow-color: rgba(0,0,0,0.5);
    --editor-bg: #2d2a2e;
}

[data-theme="one-dark-pro"] {
    --bg-primary: #282c34;
    --bg-secondary: #21252b;
    --text-primary: #abb2bf;
    --text-secondary: #9da5b4;
    --text-muted: #5c6370;
    --border-color: #3e4451;
    --shadow-color: rgba(0,0,0,0.5);
    --editor-bg: #282c34;
}

[data-theme="synthwave"] {
    --bg-primary: #2b213a;
    --bg-secondary: #241b2f;
    --bg-tertiary: #1e1629;
    --text-primary: #f92aad;
    --text-secondary: #fe4450;
    --text-muted: #848bbd;
    --border-color: #495495;
    --shadow-color: rgba(249, 42, 173, 0.3);
    --editor-bg: #2b213a;
}

[data-theme="material"] {
    --bg-primary: #263238;
    --bg-secondary: #1e272c;
    --bg-tertiary: #182025;
    --text-primary: #eeffff;
    --text-secondary: #b2ccd6;
    --text-muted: #546e7a;
    --border-color: #37474f;
    --shadow-color: rgba(0,0,0,0.5);
    --editor-bg: #263238;
}

[data-theme="palenight"] {
    --bg-primary: #292d3e;
    --bg-secondary: #1e2233;
    --bg-tertiary: #161a28;
    --text-primary: #a6accd;
    --text-secondary: #8796b0;
    --text-muted: #676e95;
    --border-color: #3e445e;
    --shadow-color: rgba(0,0,0,0.5);
    --editor-bg: #292d3e;
}

[data-theme="cobalt2"] {
    --bg-primary: #193549;
    --bg-secondary: #122738;
    --bg-tertiary: #0d1e2c;
    --text-primary: #ffffff;
    --text-secondary: #eaf2ff;
    --text-muted: #0088ff;
    --border-color: #1f4662;
    --shadow-color: rgba(0,0,0,0.6);
    --editor-bg: #193549;
}

[data-theme="dracula"] {
    --bg-primary: #282a36;
    --bg-secondary: #21222c;
    --bg-tertiary: #191a21;
    --text-primary: #f8f8f2;
    --text-secondary: #e0e0e0;
    --text-muted: #6272a4;
    --border-color: #44475a;
    --shadow-color: rgba(0,0,0,0.5);
    --editor-bg: #282a36;
}

[data-theme="gruvbox"] {
    --bg-primary: #282828;
    --bg-secondary: #1d2021;
    --bg-tertiary: #161819;
    --text-primary: #ebdbb2;
    --text-secondary: #d5c4a1;
    --text-muted: #928374;
    --border-color: #3c3836;
    --shadow-color: rgba(0,0,0,0.5);
    --editor-bg: #282828;
}

[data-theme="atom-one"] {
    --bg-primary: #282c34;
    --bg-secondary: #21252b;
    --bg-tertiary: #1b1f26;
    --text-primary: #abb2bf;
    --text-secondary: #9da5b4;
    --text-muted: #5c6370;
    --border-color: #3e4451;
    --shadow-color: rgba(0,0,0,0.5);
    --editor-bg: #282c34;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-secondary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 250px;
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 0;
    border-right: 1px solid var(--border-color);
    box-shadow: 2px 0 10px var(--shadow-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    display: flex;
    flex-direction: column;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.logo img {
    border-radius: 6px;
}

.logo h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
}

.logo h3::after {
    content: ".";
    color: #e74c3c;
    font-weight: bold;
}

.file-explorer {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.file-explorer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.btn-new-file {
    width: 24px !important;
    height: 24px !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 18px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #2ecc71 0%, #27ae60 50%, #1e8449 100%) !important;
    border: 1px solid #1e8449 !important;
}

.btn-new-file:hover {
    background: linear-gradient(145deg, #58d68d 0%, #2ecc71 50%, #27ae60 100%) !important;
}

.file-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    margin: 2px 0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 13px;
    color: var(--text-secondary);
    background: transparent;
}

.file-item:hover {
    background: var(--bg-secondary);
}

.file-item.active {
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: 600;
    border-left: 3px solid #3498db;
}

.file-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-close {
    width: 20px;
    height: 20px;
    padding: 0 !important;
    margin: 0 0 0 8px !important;
    font-size: 14px !important;
    opacity: 0;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-item:hover .file-close {
    opacity: 1;
}

.file-close:hover {
    background: rgba(231, 76, 60, 0.2) !important;
    color: #e74c3c !important;
    transform: none !important;
}

.editor-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    transition: background-color 0.3s ease;
}

.toolbar {
    background: var(--bg-secondary);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.menu-bar {
    display: flex;
    align-items: center;
    gap: 4px;
}

.menu-item {
    position: relative;
}

.menu-button {
    padding: 8px 16px !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.menu-button:hover {
    background: var(--bg-primary) !important;
    transform: none !important;
}

.menu-button:active,
.menu-button.active {
    background: var(--bg-primary) !important;
}

.menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px var(--shadow-color);
    padding: 6px;
    z-index: 1000;
    margin-top: 4px;
}

.menu-dropdown.show {
    display: block;
    animation: menuSlideIn 0.15s ease;
}

@keyframes menuSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.menu-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.1s ease;
    user-select: none;
}

.menu-option:hover {
    background: var(--bg-secondary);
}

.menu-option span:first-child {
    flex: 1;
}

.menu-shortcut {
    margin-left: 24px;
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'SF Mono', monospace;
}

.menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 6px 8px;
}

.menu-option-submenu {
    position: relative;
}

.menu-arrow {
    margin-left: auto;
    font-size: 10px;
    color: var(--text-muted);
}

.menu-submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: -6px;
    min-width: 200px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px var(--shadow-color);
    padding: 6px;
    z-index: 1001;
    margin-left: 4px;
}

.menu-submenu.show {
    display: block;
    animation: menuSlideIn 0.15s ease;
}

.menu-option-submenu:hover > .menu-submenu {
    display: block;
}

.tab-bar {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 12px;
    gap: 12px;
    overflow: hidden;
    min-height: 42px;
}

.tabs-container {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
    padding: 6px 0;
}

.tabs-container::-webkit-scrollbar {
    height: 6px;
}

.tabs-container::-webkit-scrollbar-track {
    background: transparent;
}

.tabs-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.tabs-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.file-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px 6px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    user-select: none;
    min-width: 100px;
    max-width: 200px;
}

.file-tab:hover {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

.file-tab.active {
    background: var(--bg-primary);
    border-color: var(--border-color);
    border-bottom-color: var(--bg-primary);
    color: var(--text-primary);
    font-weight: 600;
    position: relative;
}

.file-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: #3498db;
}

.tab-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tab-close {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    font-size: 16px;
    color: var(--text-muted);
    transition: all 0.15s ease;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    opacity: 0.6;
}

.tab-close:hover {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    opacity: 1;
}

.file-tab.active .tab-close {
    opacity: 1;
}

.tab-new-btn {
    padding: 6px 14px !important;
    margin: 0 !important;
    background: linear-gradient(145deg, #2ecc71 0%, #27ae60 50%, #1e8449 100%) !important;
    border: 1px solid #1e8449 !important;
    box-shadow: 
        0 4px 8px rgba(46, 204, 113, 0.4),
        0 2px 4px rgba(39, 174, 96, 0.3),
        inset 0 1px 0 rgba(255,255,255,0.2) !important;
    font-size: 12px !important;
    white-space: nowrap;
}

.tab-new-btn:hover {
    background: linear-gradient(145deg, #58d68d 0%, #2ecc71 50%, #27ae60 100%) !important;
    box-shadow: 
        0 6px 12px rgba(46, 204, 113, 0.5),
        0 3px 6px rgba(39, 174, 96, 0.4),
        inset 0 1px 0 rgba(255,255,255,0.25) !important;
}

.toolbar-btn {
    padding: 10px 20px !important;
    margin: 0 !important;
    width: auto !important;
    white-space: nowrap;
    background: linear-gradient(145deg, #34495e 0%, #2c3e50 50%, #1a252f 100%);
}

.toolbar-btn:hover {
    background: linear-gradient(145deg, #3d566e 0%, #34495e 50%, #253242 100%);
}

.toolbar-btn-debug {
    background: linear-gradient(145deg, #e74c3c 0%, #c0392b 50%, #a93226 100%) !important;
    border: 1px solid #a93226 !important;
    box-shadow: 
        0 4px 8px rgba(231, 76, 60, 0.4),
        0 2px 4px rgba(192, 57, 43, 0.3),
        inset 0 1px 0 rgba(255,255,255,0.2) !important;
}

.toolbar-btn-debug:hover {
    background: linear-gradient(145deg, #ec7063 0%, #e74c3c 50%, #c0392b 100%) !important;
    box-shadow: 
        0 6px 12px rgba(231, 76, 60, 0.5),
        0 3px 6px rgba(192, 57, 43, 0.4),
        inset 0 1px 0 rgba(255,255,255,0.25) !important;
}

.toolbar-btn-debug.active {
    background: linear-gradient(145deg, #2ecc71 0%, #27ae60 50%, #1e8449 100%) !important;
    border: 1px solid #1e8449 !important;
}

.toolbar-btn-tts {
    background: linear-gradient(145deg, #f39c12 0%, #e67e22 50%, #d35400 100%) !important;
    border: 1px solid #d35400 !important;
    box-shadow: 
        0 4px 8px rgba(243, 156, 18, 0.4),
        0 2px 4px rgba(230, 126, 34, 0.3),
        inset 0 1px 0 rgba(255,255,255,0.2) !important;
}

.toolbar-btn-tts:hover {
    background: linear-gradient(145deg, #f5b041 0%, #f39c12 50%, #e67e22 100%) !important;
    box-shadow: 
        0 6px 12px rgba(243, 156, 18, 0.5),
        0 3px 6px rgba(230, 126, 34, 0.4),
        inset 0 1px 0 rgba(255,255,255,0.25) !important;
}

.toolbar-btn-tts.active {
    background: linear-gradient(145deg, #2ecc71 0%, #27ae60 50%, #1e8449 100%) !important;
    border: 1px solid #1e8449 !important;
}

.toolbar-btn-preview {
    background: linear-gradient(145deg, #3498db 0%, #2980b9 50%, #1c5d8b 100%) !important;
    border: 1px solid #1c5d8b !important;
    box-shadow: 
        0 4px 8px rgba(52, 152, 219, 0.4),
        0 2px 4px rgba(41, 128, 185, 0.3),
        inset 0 1px 0 rgba(255,255,255,0.2) !important;
}

.toolbar-btn-preview:hover {
    background: linear-gradient(145deg, #5dade2 0%, #3498db 50%, #2980b9 100%) !important;
    box-shadow: 
        0 6px 12px rgba(52, 152, 219, 0.5),
        0 3px 6px rgba(41, 128, 185, 0.4),
        inset 0 1px 0 rgba(255,255,255,0.25) !important;
}

.toolbar-btn-preview.active {
    background: linear-gradient(145deg, #2ecc71 0%, #27ae60 50%, #1e8449 100%) !important;
    border: 1px solid #1e8449 !important;
}

.toolbar-btn-help {
    background: linear-gradient(145deg, #9b59b6 0%, #8e44ad 50%, #6c3483 100%) !important;
    border: 1px solid #6c3483 !important;
    box-shadow: 
        0 4px 8px rgba(155, 89, 182, 0.4),
        0 2px 4px rgba(142, 68, 173, 0.3),
        inset 0 1px 0 rgba(255,255,255,0.2) !important;
}

.toolbar-btn-help:hover {
    background: linear-gradient(145deg, #af7ac5 0%, #9b59b6 50%, #8e44ad 100%) !important;
    box-shadow: 
        0 6px 12px rgba(155, 89, 182, 0.5),
        0 3px 6px rgba(142, 68, 173, 0.4),
        inset 0 1px 0 rgba(255,255,255,0.25) !important;
}

button {
    padding: 12px 20px;
    background: linear-gradient(145deg, #34495e 0%, #2c3e50 50%, #1a252f 100%);
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.15s ease;
    box-shadow: 
        0 4px 8px rgba(0,0,0,0.3),
        0 2px 4px rgba(0,0,0,0.2),
        inset 0 1px 0 rgba(255,255,255,0.1);
    border: 1px solid #1a252f;
    position: relative;
    overflow: hidden;
}

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

button:hover {
    background: linear-gradient(145deg, #3d566e 0%, #34495e 50%, #253242 100%);
    transform: translateY(-2px);
    box-shadow: 
        0 6px 12px rgba(0,0,0,0.4),
        0 3px 6px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.15);
}

button:hover::before {
    left: 100%;
}

button:active {
    transform: translateY(1px);
    box-shadow: 
        0 2px 4px rgba(0,0,0,0.4),
        0 1px 2px rgba(0,0,0,0.3),
        inset 0 1px 3px rgba(0,0,0,0.2);
}

/* =====================================================
   MAIN CONTAINER - CRITICAL FIX
   This holds the editor and bottom panel
   ===================================================== */
.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0; /* Important for flex children */
}

/* Search & Replace Panel */
.search-panel {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 4px 12px var(--shadow-color);
    z-index: 100;
    min-width: 500px;
}

.search-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.search-row:last-child {
    margin-bottom: 0;
}

.search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'SF Mono', monospace;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s ease;
}

.search-input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.search-btn, .search-btn-replace {
    padding: 8px 12px !important;
    margin: 0 !important;
    width: auto !important;
    font-size: 13px !important;
    background: linear-gradient(145deg, #34495e 0%, #2c3e50 50%, #1a252f 100%);
}

.search-btn:hover, .search-btn-replace:hover {
    background: linear-gradient(145deg, #3d566e 0%, #34495e 50%, #253242 100%);
}

.search-btn-replace {
    background: linear-gradient(145deg, #3498db 0%, #2980b9 50%, #1c5d8b 100%) !important;
    border: 1px solid #1c5d8b !important;
}

.search-btn-replace:hover {
    background: linear-gradient(145deg, #5dade2 0%, #3498db 50%, #2980b9 100%) !important;
}

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

.search-option input[type="checkbox"] {
    cursor: pointer;
}

.match-count {
    font-size: 12px;
    color: var(--text-muted);
    font-family: 'SF Mono', monospace;
    white-space: nowrap;
}

.search-close {
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 20px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.search-close:hover {
    background: rgba(231, 76, 60, 0.2) !important;
    color: #e74c3c !important;
    transform: none !important;
}

/* =====================================================
   EDITOR CONTAINER - CRITICAL FIX
   This must be visible and take most of the space
   ===================================================== */
.editor-container {
    flex: 1; /* Takes available space above bottom panel */
    display: flex;
    background: transparent;
    transition: background-color 0.3s ease;
    min-width: 0;
    min-height: 0; /* Important for flex children */
    position: relative;
    overflow: hidden;
}

.line-numbers {
    background: var(--bg-secondary);
    color: var(--text-muted);
    padding: 25px 10px 25px 15px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', 'Roboto Mono', monospace;
    font-size: 15px;
    line-height: 1.6;
    text-align: right;
    min-width: 40px;
    user-select: none;
    border-right: 1px solid var(--border-color);
    white-space: pre;
    overflow: hidden;
    transition: all 0.3s ease;
}

.editor-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    overflow: hidden;
    background: var(--bg-primary); /* Added background here */
}

.syntax-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 25px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', 'Roboto Mono', monospace;
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: hidden;
    pointer-events: none;
    z-index: 3;
}

#editor {
    flex: 1;
    border: none;
    outline: none;
    padding: 25px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', 'Roboto Mono', monospace;
    font-size: 15px;
    line-height: 1.6;
    resize: none;
    background: transparent; /* Transparent so highlight shows through */
    color: var(--text-primary);
    margin: 0;
    transition: all 0.3s ease;
    font-weight: 500;
    position: relative;
    z-index: 1; /* Changed from 2 to 1 - below highlight */
    caret-color: var(--text-primary);
}

#editor.syntax-enabled {
    color: transparent;
    caret-color: var(--text-primary);
}

#editor::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

#editor:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px rgba(52, 152, 219, 0.4);
}

/* Active Line Highlight - Full Width Across Line Numbers + Editor */
.active-line-highlight {
    position: absolute;
    left: 0;
    right: 0;
    background: rgba(52, 152, 219, 0.15);
    pointer-events: none;
    z-index: 2; /* Above editor, below syntax overlay */
    transition: top 0.1s ease;
    mix-blend-mode: screen; /* Blend mode for better visibility */
}

/* Theme-specific active line colors - Brighter */
[data-theme="light"] .active-line-highlight {
    background: rgba(52, 152, 219, 0.12);
}

[data-theme="dark"] .active-line-highlight {
    background: rgba(100, 150, 200, 0.15);
}

[data-theme="ayu"] .active-line-highlight {
    background: rgba(255, 180, 84, 0.12);
}

[data-theme="tokyo-night"] .active-line-highlight {
    background: rgba(125, 127, 255, 0.15);
}

[data-theme="nord"] .active-line-highlight {
    background: rgba(129, 161, 193, 0.15);
}

[data-theme="night-owl"] .active-line-highlight {
    background: rgba(128, 203, 196, 0.12);
}

[data-theme="monokai-pro"] .active-line-highlight {
    background: rgba(255, 216, 102, 0.12);
}

[data-theme="one-dark-pro"] .active-line-highlight {
    background: rgba(97, 175, 239, 0.15);
}

[data-theme="synthwave"] .active-line-highlight {
    background: rgba(249, 42, 173, 0.18);
    box-shadow: 0 0 20px rgba(249, 42, 173, 0.15);
}

[data-theme="material"] .active-line-highlight {
    background: rgba(128, 203, 196, 0.15);
}

[data-theme="palenight"] .active-line-highlight {
    background: rgba(130, 170, 255, 0.15);
}

[data-theme="cobalt2"] .active-line-highlight {
    background: rgba(0, 136, 255, 0.15);
}

[data-theme="dracula"] .active-line-highlight {
    background: rgba(189, 147, 249, 0.15);
}

[data-theme="gruvbox"] .active-line-highlight {
    background: rgba(251, 184, 108, 0.15);
}

[data-theme="atom-one"] .active-line-highlight {
    background: rgba(97, 175, 239, 0.15);
}

/* =====================================================
   BOTTOM PANEL - FIXED HEIGHT
   ===================================================== */
.bottom-panel {
    height: 250px; /* Fixed height - does NOT take flex: 1 */
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0; /* Prevents shrinking */
}

.bottom-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.bottom-tab {
    padding: 8px 16px !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.bottom-tab:hover {
    background: var(--bg-primary) !important;
    color: var(--text-primary);
    transform: none !important;
}

.bottom-tab.active {
    background: var(--bg-primary) !important;
    color: var(--text-primary);
    border-bottom: 2px solid #3498db;
}

.bottom-panel-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    background: var(--bg-primary);
    padding: 16px;
}

.bottom-panel-content.active {
    display: flex;
    flex-direction: column;
}

/* Console Panel */
.console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

.btn-clear {
    padding: 6px 12px !important;
    margin: 0 !important;
    font-size: 12px !important;
    background: linear-gradient(145deg, #e74c3c 0%, #c0392b 50%, #a93226 100%) !important;
    border: 1px solid #a93226 !important;
}

.console-output {
    flex: 1;
    overflow-y: auto;
    font-family: 'SF Mono', monospace;
    font-size: 12px;
    line-height: 1.6;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
}

.console-message {
    padding: 6px 10px;
    margin-bottom: 4px;
    border-left: 3px solid var(--border-color);
    border-radius: 3px;
    background: var(--bg-primary);
}

.console-message.log {
    border-left-color: #3498db;
}

.console-message.error {
    border-left-color: #e74c3c;
    color: #e74c3c;
}

.console-message.success {
    border-left-color: #2ecc71;
    color: #2ecc71;
}

.console-message.info {
    border-left-color: #9b59b6;
    color: var(--text-secondary);
}

.console-timestamp {
    color: var(--text-muted);
    font-size: 11px;
    margin-right: 8px;
}

/* Git Panel Styles */
.git-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
    overflow-y: auto;
}

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

.git-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

.btn-git-primary {
    flex: 1;
    padding: 10px 16px;
    background: linear-gradient(145deg, #3498db 0%, #2980b9 50%, #1f6391 100%);
    border: 1px solid #1f6391;
    box-shadow: 
        0 4px 8px rgba(52, 152, 219, 0.4),
        0 2px 4px rgba(41, 128, 185, 0.3),
        inset 0 1px 0 rgba(255,255,255,0.2);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-git-primary:hover {
    background: linear-gradient(145deg, #5dade2 0%, #3498db 50%, #2980b9 100%);
    transform: translateY(-1px);
    box-shadow: 
        0 6px 12px rgba(52, 152, 219, 0.5),
        0 3px 6px rgba(41, 128, 185, 0.4),
        inset 0 1px 0 rgba(255,255,255,0.25);
}

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

.btn-git-action:hover {
    background: rgba(52, 152, 219, 0.1);
    border-color: #3498db;
}

.git-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.git-commit-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s ease;
}

.git-commit-input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.git-info {
    color: var(--text-muted);
    font-size: 13px;
    padding: 12px;
    text-align: center;
}

.git-status {
    font-family: 'SF Mono', monospace;
    font-size: 12px;
}

.git-branch-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.git-select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease;
}

.git-select:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.git-files-list {
    max-height: 150px;
    overflow-y: auto;
}

.git-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin: 4px 0;
    background: var(--bg-secondary);
    border-radius: 6px;
    font-size: 12px;
}

.git-file-name {
    flex: 1;
    font-family: 'SF Mono', monospace;
}

.git-file-status {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.git-file-status.modified {
    background: rgba(243, 156, 18, 0.2);
    color: #f39c12;
}

.git-history-list {
    max-height: 200px;
    overflow-y: auto;
}

.git-commit-item {
    padding: 12px;
    margin: 8px 0;
    background: var(--bg-secondary);
    border-radius: 6px;
    border-left: 3px solid #3498db;
}

.git-commit-hash {
    font-family: 'SF Mono', monospace;
    font-size: 11px;
    color: #3498db;
    font-weight: 600;
}

.git-commit-message {
    margin: 6px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.git-commit-author {
    font-size: 11px;
    color: var(--text-muted);
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
    font-family: 'SF Mono', monospace;
}

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

.status-separator {
    color: var(--border-color);
}

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

#statusMessage.success {
    color: #2ecc71;
}

#statusMessage.error {
    color: #e74c3c;
}

#statusMessage.saving {
    color: #f39c12;
}

#statusMessage.running {
    color: #3498db;
}

/* =====================================================
   FLOATING PREVIEW PANEL
   ===================================================== */
.preview-panel {
    position: fixed;
    top: 100px;
    right: 50px;
    width: 500px;
    height: 600px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

.preview-panel.minimized {
    height: 48px !important;
    width: 250px !important;
}

.preview-panel.maximized {
    top: 10px !important;
    left: 10px !important;
    right: 10px !important;
    bottom: 10px !important;
    width: calc(100% - 20px) !important;
    height: calc(100% - 20px) !important;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    cursor: move;
    user-select: none;
    border-radius: 12px 12px 0 0;
}

.preview-header:active {
    cursor: grabbing;
}

.preview-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

.preview-filename {
    color: var(--text-muted);
    font-size: 11px;
    font-family: 'SF Mono', monospace;
    padding: 2px 8px;
    background: var(--bg-primary);
    border-radius: 4px;
}

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

.preview-btn {
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.preview-btn:hover {
    background: var(--bg-primary) !important;
    color: var(--text-primary);
    transform: none !important;
}

.preview-close:hover {
    background: rgba(231, 76, 60, 0.2) !important;
    color: #e74c3c !important;
}

.preview-body {
    flex: 1;
    overflow: hidden;
    background: #ffffff;
    display: none;
}

.preview-panel:not(.minimized) .preview-body {
    display: block;
}

#previewFrame {
    width: 100%;
    height: 100%;
    border: none;
    background: #ffffff;
}

.preview-resize-handle {
    position: absolute;
    background: transparent;
    z-index: 10;
}

.preview-resize-n {
    top: 0;
    left: 10px;
    right: 10px;
    height: 5px;
    cursor: ns-resize;
}

.preview-resize-s {
    bottom: 0;
    left: 10px;
    right: 10px;
    height: 5px;
    cursor: ns-resize;
}

.preview-resize-e {
    right: 0;
    top: 10px;
    bottom: 10px;
    width: 5px;
    cursor: ew-resize;
}

.preview-resize-w {
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 5px;
    cursor: ew-resize;
}

.preview-resize-ne {
    top: 0;
    right: 0;
    width: 10px;
    height: 10px;
    cursor: nesw-resize;
}

.preview-resize-nw {
    top: 0;
    left: 0;
    width: 10px;
    height: 10px;
    cursor: nwse-resize;
}

.preview-resize-se {
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    cursor: nwse-resize;
}

.preview-resize-sw {
    bottom: 0;
    left: 0;
    width: 10px;
    height: 10px;
    cursor: nesw-resize;
}

/* =====================================================
   DEBUG PANEL - SLIDES FROM RIGHT
   ===================================================== */
.debug-panel {
    position: fixed;
    top: 0;
    right: -450px;
    width: 450px;
    height: 100vh;
    background: var(--bg-primary);
    border-left: 1px solid var(--border-color);
    box-shadow: -4px 0 20px var(--shadow-color);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.debug-panel.open {
    right: 0;
}

.debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
    flex-shrink: 0;
}

.debug-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.debug-title span:first-child {
    font-size: 18px;
}

.debug-controls {
    display: flex;
    gap: 6px;
}

.debug-btn {
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.debug-btn:hover {
    background: var(--bg-primary) !important;
    color: var(--text-primary);
    transform: none !important;
}

.debug-close:hover {
    background: rgba(231, 76, 60, 0.2) !important;
    color: #e74c3c !important;
}

.debug-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    overflow-x: auto;
}

.debug-filter {
    padding: 6px 12px !important;
    margin: 0 !important;
    background: var(--bg-primary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    box-shadow: none !important;
}

.debug-filter:hover {
    background: var(--bg-secondary) !important;
    border-color: var(--text-muted) !important;
    transform: none !important;
}

.debug-filter.active {
    background: linear-gradient(145deg, #3498db 0%, #2980b9 50%, #1f6391 100%) !important;
    border-color: #1f6391 !important;
    color: white !important;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.3) !important;
}

.debug-filter-clear {
    padding: 6px 12px !important;
    margin: 0 0 0 auto !important;
    background: linear-gradient(145deg, #e74c3c 0%, #c0392b 50%, #a93226 100%) !important;
    border: 1px solid #a93226 !important;
    color: white;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(231, 76, 60, 0.3) !important;
}

.debug-filter-clear:hover {
    background: linear-gradient(145deg, #ec7063 0%, #e74c3c 50%, #c0392b 100%) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.4) !important;
}

.debug-count {
    display: inline-block;
    min-width: 18px;
    padding: 2px 6px;
    background: var(--bg-secondary);
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    margin-left: 6px;
}

.debug-filter.active .debug-count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.debug-console {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    background: var(--bg-primary);
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.6;
}

.debug-message {
    padding: 8px 12px;
    margin-bottom: 6px;
    border-left: 3px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    word-wrap: break-word;
    transition: all 0.2s ease;
}

.debug-message.hidden {
    display: none;
}

.debug-message.debug-log {
    border-left-color: #3498db;
    background: rgba(52, 152, 219, 0.05);
}

.debug-message.debug-error {
    border-left-color: #e74c3c;
    background: rgba(231, 76, 60, 0.05);
    color: #e74c3c;
}

.debug-message.debug-warn {
    border-left-color: #f39c12;
    background: rgba(243, 156, 18, 0.05);
    color: #f39c12;
}

.debug-message.debug-info {
    border-left-color: #9b59b6;
    background: rgba(155, 89, 182, 0.05);
    color: var(--text-secondary);
    font-style: italic;
}

.debug-timestamp {
    color: var(--text-muted);
    font-size: 11px;
    margin-right: 8px;
}

.debug-line-number {
    color: var(--text-muted);
    font-size: 11px;
    margin-left: 8px;
}

.debug-sections {
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    overflow-y: auto;
    max-height: 300px;
    flex-shrink: 0;
}

.debug-section {
    border-bottom: 1px solid var(--border-color);
}

.debug-section:last-child {
    border-bottom: none;
}

.debug-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-primary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    transition: background 0.2s ease;
    user-select: none;
}

.debug-section-header:hover {
    background: var(--bg-secondary);
}

.debug-section-toggle {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.debug-section-header.collapsed .debug-section-toggle {
    transform: rotate(-90deg);
}

.debug-section-content {
    padding: 12px 16px;
    background: var(--bg-secondary);
    font-size: 12px;
}

.debug-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.debug-metric:last-child {
    border-bottom: none;
}

.debug-metric-label {
    color: var(--text-secondary);
    font-family: 'SF Mono', monospace;
    font-size: 12px;
}

.debug-metric-value {
    color: var(--text-primary);
    font-family: 'SF Mono', monospace;
    font-size: 12px;
    font-weight: 600;
}

.debug-info-text {
    color: var(--text-muted);
    font-style: italic;
    font-size: 12px;
    text-align: center;
    padding: 12px;
}

.debug-console::-webkit-scrollbar,
.debug-sections::-webkit-scrollbar {
    width: 8px;
}

.debug-console::-webkit-scrollbar-track,
.debug-sections::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.debug-console::-webkit-scrollbar-thumb,
.debug-sections::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.debug-console::-webkit-scrollbar-thumb:hover,
.debug-sections::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Syntax Highlighting Tokens */
.token-keyword {
    color: #c678dd;
    font-weight: 600;
}

.token-string {
    color: #98c379;
}

.token-comment {
    color: #5c6370;
    font-style: italic;
}

.token-number {
    color: #d19a66;
}

.token-function {
    color: #61afef;
}

.token-plain {
    color: var(--text-primary);
}

.token-tag {
    color: #e06c75;
}

.token-attribute {
    color: #d19a66;
}

.token-property {
    color: #61afef;
}

.token-value {
    color: #98c379;
}

/* Modal System */
#shortcutsModal .modal-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: 100000;
    animation: fadeIn 0.2s ease;
}

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

.modal-content {
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

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

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

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

.modal-close {
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 24px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.modal-close:hover {
    background: rgba(231, 76, 60, 0.2) !important;
    color: #e74c3c !important;
    transform: none !important;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .debug-panel {
        width: 380px;
        right: -380px;
    }
    
    .debug-panel.open {
        right: 0;
    }
}

@media (max-width: 768px) {
    .debug-panel {
        width: 100%;
        right: -100%;
    }
    
    .debug-panel.open {
        right: 0;
    }
    
    .sidebar {
        width: 200px;
    }
    
    .preview-panel {
        width: 90%;
        height: 70%;
        top: 80px;
        right: 5%;
    }
}

/* =====================================================
   TTS PANEL - SLIDES FROM RIGHT (BELOW DEBUG WHEN BOTH OPEN)
   ===================================================== */
.tts-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: var(--bg-primary);
    border-left: 1px solid var(--border-color);
    box-shadow: -4px 0 20px var(--shadow-color);
    z-index: 9998; /* Below debug panel */
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tts-panel.open {
    right: 0;
}

/* When debug panel is also open, shift TTS panel left */
.debug-panel.open ~ .tts-panel.open {
    right: 450px; /* Width of debug panel */
}

.tts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
    flex-shrink: 0;
}

.tts-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.tts-title span:first-child {
    font-size: 18px;
}

.tts-controls-header {
    display: flex;
    gap: 6px;
}

.tts-btn {
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.tts-btn:hover {
    background: var(--bg-primary) !important;
    color: var(--text-primary);
    transform: none !important;
}

.tts-close:hover {
    background: rgba(231, 76, 60, 0.2) !important;
    color: #e74c3c !important;
}

.tts-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.tts-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tts-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tts-action-btn {
    padding: 12px 16px !important;
    margin: 0 !important;
    width: 100% !important;
    background: linear-gradient(145deg, #f39c12 0%, #e67e22 50%, #d35400 100%) !important;
    border: 1px solid #d35400 !important;
    box-shadow: 
        0 4px 8px rgba(243, 156, 18, 0.4),
        0 2px 4px rgba(230, 126, 34, 0.3),
        inset 0 1px 0 rgba(255,255,255,0.2) !important;
    color: white;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tts-action-btn:hover {
    background: linear-gradient(145deg, #f5b041 0%, #f39c12 50%, #e67e22 100%) !important;
    transform: translateY(-1px) !important;
    box-shadow: 
        0 6px 12px rgba(243, 156, 18, 0.5),
        0 3px 6px rgba(230, 126, 34, 0.4),
        inset 0 1px 0 rgba(255,255,255,0.25) !important;
}

.tts-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.tts-playback-controls {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.tts-playback-btn {
    flex: 1;
    padding: 10px 12px !important;
    margin: 0 !important;
    background: linear-gradient(145deg, #3498db 0%, #2980b9 50%, #1f6391 100%) !important;
    border: 1px solid #1f6391 !important;
    box-shadow: 
        0 4px 8px rgba(52, 152, 219, 0.4),
        0 2px 4px rgba(41, 128, 185, 0.3),
        inset 0 1px 0 rgba(255,255,255,0.2) !important;
    color: white;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tts-playback-btn:hover:not(:disabled) {
    background: linear-gradient(145deg, #5dade2 0%, #3498db 50%, #2980b9 100%) !important;
    transform: translateY(-1px) !important;
    box-shadow: 
        0 6px 12px rgba(52, 152, 219, 0.5),
        0 3px 6px rgba(41, 128, 185, 0.4),
        inset 0 1px 0 rgba(255,255,255,0.25) !important;
}

.tts-playback-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tts-playback-btn.stop {
    background: linear-gradient(145deg, #e74c3c 0%, #c0392b 50%, #a93226 100%) !important;
    border: 1px solid #a93226 !important;
    box-shadow: 
        0 4px 8px rgba(231, 76, 60, 0.4),
        0 2px 4px rgba(192, 57, 43, 0.3),
        inset 0 1px 0 rgba(255,255,255,0.2) !important;
}

.tts-playback-btn.stop:hover:not(:disabled) {
    background: linear-gradient(145deg, #ec7063 0%, #e74c3c 50%, #c0392b 100%) !important;
}

.tts-setting {
    margin-bottom: 16px;
}

.tts-setting:last-child {
    margin-bottom: 0;
}

.tts-setting-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}

.tts-setting-value {
    color: var(--text-primary);
    font-family: 'SF Mono', monospace;
    font-size: 12px;
}

.tts-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-primary);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.tts-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(145deg, #f39c12 0%, #e67e22 100%);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: all 0.15s ease;
}

.tts-slider::-webkit-slider-thumb:hover {
    background: linear-gradient(145deg, #f5b041 0%, #f39c12 100%);
    transform: scale(1.1);
}

.tts-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(145deg, #f39c12 0%, #e67e22 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: all 0.15s ease;
}

.tts-slider::-moz-range-thumb:hover {
    background: linear-gradient(145deg, #f5b041 0%, #f39c12 100%);
    transform: scale(1.1);
}

.tts-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease;
}

.tts-select:focus {
    border-color: #f39c12;
    box-shadow: 0 0 0 2px rgba(243, 156, 18, 0.2);
}

.tts-status {
    padding: 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    border-left: 3px solid #f39c12;
    font-size: 12px;
    color: var(--text-secondary);
    font-family: 'SF Mono', monospace;
}

.tts-status.speaking {
    border-left-color: #2ecc71;
    color: #2ecc71;
}

.tts-status.paused {
    border-left-color: #3498db;
    color: #3498db;
}

.tts-shortcut-hint {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'SF Mono', monospace;
    text-align: center;
    padding: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    margin-top: 8px;
}

/* Responsive */
@media (max-width: 1200px) {
    .tts-panel {
        width: 350px;
        right: -350px;
    }
}

@media (max-width: 768px) {
    .tts-panel {
        width: 100%;
        right: -100%;
    }
    
    .debug-panel.open ~ .tts-panel.open {
        right: 0;
        top: 50vh;
        height: 50vh;
    }
}

/* =====================================================
   TUTORIAL SYSTEM STYLES
   Interactive walkthrough with spotlight animations
   ===================================================== */

.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.tutorial-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Tutorial Spotlight - Highlights target elements */
.tutorial-spotlight {
    position: absolute;
    background: transparent;
    border: 3px solid #3498db;
    border-radius: 8px;
    box-shadow: 
        0 0 0 9999px rgba(0, 0, 0, 0.85),
        0 0 30px rgba(52, 152, 219, 0.6),
        inset 0 0 30px rgba(52, 152, 219, 0.3);
    pointer-events: none;
    z-index: 100001;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: spotlightPulse 2s ease-in-out infinite;
}

@keyframes spotlightPulse {
    0%, 100% {
        box-shadow: 
            0 0 0 9999px rgba(0, 0, 0, 0.85),
            0 0 30px rgba(52, 152, 219, 0.6),
            inset 0 0 30px rgba(52, 152, 219, 0.3);
    }
    50% {
        box-shadow: 
            0 0 0 9999px rgba(0, 0, 0, 0.85),
            0 0 50px rgba(52, 152, 219, 0.8),
            inset 0 0 40px rgba(52, 152, 219, 0.4);
    }
}

/* Tutorial Card */
.tutorial-card {
    position: absolute;
    width: 90%;
    max-width: 500px;
    background: var(--bg-primary);
    border: 2px solid #3498db;
    border-radius: 16px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 40px rgba(52, 152, 219, 0.4);
    z-index: 100002;
    animation: cardSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

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

/* Tutorial Header */
.tutorial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tutorial-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tutorial-close {
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2) !important;
    border: none !important;
    box-shadow: none !important;
    color: white;
    font-size: 24px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.tutorial-close:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: rotate(90deg) !important;
}

/* Tutorial Content */
.tutorial-content {
    padding: 24px;
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.6;
    min-height: 80px;
}

/* Tutorial Footer */
.tutorial-footer {
    padding: 20px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

/* Progress Indicator */
.tutorial-progress {
    margin-bottom: 16px;
}

.tutorial-progress-text {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    font-family: 'SF Mono', monospace;
    margin-bottom: 8px;
}

.tutorial-current-step {
    color: #3498db;
    font-weight: 700;
}

.tutorial-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
}

.tutorial-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db 0%, #2ecc71 100%);
    border-radius: 3px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tutorial Navigation */
.tutorial-nav {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.tutorial-btn {
    padding: 10px 20px !important;
    margin: 0 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tutorial-btn-prev {
    background: var(--bg-primary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    box-shadow: none !important;
}

.tutorial-btn-prev:hover:not(:disabled) {
    background: var(--bg-secondary) !important;
    border-color: #3498db !important;
}

.tutorial-btn-prev:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tutorial-btn-skip {
    background: var(--bg-primary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-muted) !important;
    box-shadow: none !important;
}

.tutorial-btn-skip:hover {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

.tutorial-btn-next {
    background: linear-gradient(145deg, #3498db 0%, #2980b9 50%, #1f6391 100%) !important;
    border: 1px solid #1f6391 !important;
    color: white !important;
    box-shadow: 
        0 4px 12px rgba(52, 152, 219, 0.4),
        inset 0 1px 0 rgba(255,255,255,0.2) !important;
}

.tutorial-btn-next:hover {
    background: linear-gradient(145deg, #5dade2 0%, #3498db 50%, #2980b9 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 
        0 6px 16px rgba(52, 152, 219, 0.5),
        inset 0 1px 0 rgba(255,255,255,0.25) !important;
}

/* Tutorial Button in Toolbar */
.toolbar-btn-tutorial {
    background: linear-gradient(145deg, #9b59b6 0%, #8e44ad 50%, #6c3483 100%) !important;
    border: 1px solid #6c3483 !important;
    box-shadow: 
        0 4px 8px rgba(155, 89, 182, 0.4),
        0 2px 4px rgba(142, 68, 173, 0.3),
        inset 0 1px 0 rgba(255,255,255,0.2) !important;
}

.toolbar-btn-tutorial:hover {
    background: linear-gradient(145deg, #af7ac5 0%, #9b59b6 50%, #8e44ad 100%) !important;
    box-shadow: 
        0 6px 12px rgba(155, 89, 182, 0.5),
        0 3px 6px rgba(142, 68, 173, 0.4),
        inset 0 1px 0 rgba(255,255,255,0.25) !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .tutorial-card {
        width: 95%;
        max-width: none;
    }
    
    .tutorial-header {
        padding: 16px;
    }
    
    .tutorial-title {
        font-size: 18px;
    }
    
    .tutorial-content {
        padding: 16px;
        font-size: 14px;
    }
    
    .tutorial-footer {
        padding: 12px 16px;
    }
    
    .tutorial-nav {
        flex-wrap: wrap;
    }
    
    .tutorial-btn {
        flex: 1;
        min-width: 100px;
    }
}

/* Theme-specific enhancements */
[data-theme="synthwave"] .tutorial-card {
    border-color: #f92aad;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 40px rgba(249, 42, 173, 0.5);
}

[data-theme="synthwave"] .tutorial-spotlight {
    border-color: #f92aad;
    box-shadow: 
        0 0 0 9999px rgba(0, 0, 0, 0.85),
        0 0 30px rgba(249, 42, 173, 0.6),
        inset 0 0 30px rgba(249, 42, 173, 0.3);
}

[data-theme="synthwave"] .tutorial-header {
    background: linear-gradient(135deg, #f92aad 0%, #fe4450 100%);
}

/* ===================================================== */