/* Codie - Theme System */

:root {
    /* Default Dark Theme */
    --bg-primary: #1e1e1e;
    --bg-secondary: #252526;
    --bg-tertiary: #2d2d30;
    --bg-hover: #2a2d2e;
    --bg-active: #094771;
    --border-color: #3e3e42;
    --text-primary: #cccccc;
    --text-secondary: #858585;
    --text-accent: #007acc;
    --accent: #007acc;
    --accent-hover: #1a8cd8;
    --sidebar-width: 240px;
    --preview-width: 400px;
    --menu-height: 30px;
}

/* Dark Theme */
body.theme-dark {
    --bg-primary: #1e1e1e;
    --bg-secondary: #252526;
    --bg-tertiary: #2d2d30;
    --bg-hover: #2a2d2e;
    --bg-active: #094771;
    --border-color: #3e3e42;
    --text-primary: #cccccc;
    --text-secondary: #858585;
    --accent: #007acc;
    --accent-hover: #1a8cd8;
}

/* Dark Modern Theme */
body.theme-dark-modern {
    --bg-primary: #1e1e1e;
    --bg-secondary: #2d2d30;
    --bg-tertiary: #3e3e42;
    --bg-hover: #37373d;
    --bg-active: #0e639c;
    --border-color: #454545;
    --text-primary: #cccccc;
    --text-secondary: #969696;
    --accent: #0e639c;
    --accent-hover: #1177bb;
}

/* Dark Midnight Theme */
body.theme-dark-midnight {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-hover: #1c2128;
    --bg-active: #1f6feb;
    --border-color: #30363d;
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --accent: #1f6feb;
    --accent-hover: #388bfd;
}

/* Monokai Theme */
body.theme-monokai {
    --bg-primary: #272822;
    --bg-secondary: #3e3d32;
    --bg-tertiary: #49483e;
    --bg-hover: #4a4a3f;
    --bg-active: #a6e22e;
    --border-color: #75715e;
    --text-primary: #f8f8f2;
    --text-secondary: #a6e22e;
    --accent: #a6e22e;
    --accent-hover: #b8e948;
}

/* Light Theme */
body.theme-light {
    --bg-primary: #ffffff;
    --bg-secondary: #f3f3f3;
    --bg-tertiary: #e8e8e8;
    --bg-hover: #e5e5e5;
    --bg-active: #0078d4;
    --border-color: #cccccc;
    --text-primary: #333333;
    --text-secondary: #656565;
    --accent: #0078d4;
    --accent-hover: #106ebe;
}

/* Light Modern Theme */
body.theme-light-modern {
    --bg-primary: #ffffff;
    --bg-secondary: #f6f6f6;
    --bg-tertiary: #ebebeb;
    --bg-hover: #ededed;
    --bg-active: #005fb8;
    --border-color: #e0e0e0;
    --text-primary: #323130;
    --text-secondary: #605e5c;
    --accent: #005fb8;
    --accent-hover: #0078d4;
}

/* Quiet Light Theme */
body.theme-quiet-light {
    --bg-primary: #f7f7f7;
    --bg-secondary: #e8e8e8;
    --bg-tertiary: #d6d6d6;
    --bg-hover: #dadada;
    --bg-active: #005a9e;
    --border-color: #c1c1c1;
    --text-primary: #262626;
    --text-secondary: #6a6a6a;
    --accent: #005a9e;
    --accent-hover: #0078d4;
}

/* Nord Theme */
body.theme-nord {
    --bg-primary: #2e3440;
    --bg-secondary: #3b4252;
    --bg-tertiary: #434c5e;
    --bg-hover: #4c566a;
    --bg-active: #5e81ac;
    --border-color: #4c566a;
    --text-primary: #eceff4;
    --text-secondary: #d8dee9;
    --accent: #5e81ac;
    --accent-hover: #81a1c1;
}

/* Dracula Theme */
body.theme-dracula {
    --bg-primary: #282a36;
    --bg-secondary: #343746;
    --bg-tertiary: #424450;
    --bg-hover: #44475a;
    --bg-active: #bd93f9;
    --border-color: #6272a4;
    --text-primary: #f8f8f2;
    --text-secondary: #bd93f9;
    --accent: #bd93f9;
    --accent-hover: #ff79c6;
}

/* One Dark Theme */
body.theme-one-dark {
    --bg-primary: #282c34;
    --bg-secondary: #21252b;
    --bg-tertiary: #1e222a;
    --bg-hover: #2c313c;
    --bg-active: #528bff;
    --border-color: #3e4451;
    --text-primary: #abb2bf;
    --text-secondary: #5c6370;
    --accent: #528bff;
    --accent-hover: #61afef;
}

/* GitHub Dark Theme */
body.theme-github-dark {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-hover: #1c2128;
    --bg-active: #1f6feb;
    --border-color: #30363d;
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --accent: #1f6feb;
    --accent-hover: #388bfd;
}

/* GitHub Light Theme */
body.theme-github-light {
    --bg-primary: #ffffff;
    --bg-secondary: #f6f8fa;
    --bg-tertiary: #eaeef2;
    --bg-hover: #f3f4f6;
    --bg-active: #0969da;
    --border-color: #d0d7de;
    --text-primary: #24292f;
    --text-secondary: #57606a;
    --accent: #0969da;
    --accent-hover: #0860ca;
}

/* Solarized Dark Theme */
body.theme-solarized-dark {
    --bg-primary: #002b36;
    --bg-secondary: #073642;
    --bg-tertiary: #0a4a5a;
    --bg-hover: #094a5a;
    --bg-active: #268bd2;
    --border-color: #586e75;
    --text-primary: #839496;
    --text-secondary: #657b83;
    --accent: #268bd2;
    --accent-hover: #2aa198;
}

/* Solarized Light Theme */
body.theme-solarized-light {
    --bg-primary: #fdf6e3;
    --bg-secondary: #eee8d5;
    --bg-tertiary: #ded8c4;
    --bg-hover: #e8e0cd;
    --bg-active: #268bd2;
    --border-color: #93a1a1;
    --text-primary: #586e75;
    --text-secondary: #657b83;
    --accent: #268bd2;
    --accent-hover: #2aa198;
}

/* Gruvbox Dark Theme */
body.theme-gruvbox-dark {
    --bg-primary: #282828;
    --bg-secondary: #3c3836;
    --bg-tertiary: #504945;
    --bg-hover: #458588;
    --bg-active: #458588;
    --border-color: #665c54;
    --text-primary: #ebdbb2;
    --text-secondary: #a89984;
    --accent: #458588;
    --accent-hover: #83a598;
}

/* Gruvbox Light Theme */
body.theme-gruvbox-light {
    --bg-primary: #fbf1c7;
    --bg-secondary: #ebdbb2;
    --bg-tertiary: #d5c4a1;
    --bg-hover: #d5c4a1;
    --bg-active: #458588;
    --border-color: #bdae93;
    --text-primary: #3c3836;
    --text-secondary: #504945;
    --accent: #458588;
    --accent-hover: #427b58;
}

/* Material Dark Theme */
body.theme-material-dark {
    --bg-primary: #212121;
    --bg-secondary: #303030;
    --bg-tertiary: #424242;
    --bg-hover: #3a3a3a;
    --bg-active: #00acc1;
    --border-color: #525252;
    --text-primary: #eceff1;
    --text-secondary: #b0bec5;
    --accent: #00acc1;
    --accent-hover: #00bcd4;
}

/* Catppuccin Mocha Theme */
body.theme-catppuccin {
    --bg-primary: #1e1e2e;
    --bg-secondary: #313244;
    --bg-tertiary: #45475a;
    --bg-hover: #585b70;
    --bg-active: #89b4fa;
    --border-color: #6c7086;
    --text-primary: #cdd6f4;
    --text-secondary: #bac2de;
    --accent: #89b4fa;
    --accent-hover: #a6e3a1;
}

/* Tokyo Night Theme */
body.theme-tokyo-night {
    --bg-primary: #1a1b26;
    --bg-secondary: #24283b;
    --bg-tertiary: #2f3549;
    --bg-hover: #3b4261;
    --bg-active: #7aa2f7;
    --border-color: #565f89;
    --text-primary: #c0caf5;
    --text-secondary: #9aa5ce;
    --accent: #7aa2f7;
    --accent-hover: #bb9af7;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

/* Menu Bar */
.menu-bar {
    height: var(--menu-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    position: relative;
    z-index: 100;
    user-select: none;
    cursor: default;
}

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

.app-brand {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    opacity: 0.5;
    padding: 4px 8px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    user-select: none;
    transition: opacity 0.2s;
    cursor: pointer;
}

.app-brand .beta-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
    color: #fff;
    background: var(--accent);
    opacity: 0.9;
}

.app-brand:hover {
    opacity: 0.8;
}

/* Quick Start Menu */
.quick-start-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 5000;
    animation: fadeIn 0.2s ease;
}

.quick-start-menu.show {
    display: flex;
}

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

.quick-start-menu > div {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 90%;
    max-width: 640px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    animation: slideUp 0.3s ease;
}

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

.quick-start-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

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

.quick-start-content {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(85vh - 120px);
}

.quick-start-section {
    margin-bottom: 32px;
}

.quick-start-section:last-child {
    margin-bottom: 0;
}

.quick-start-section h3 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin: 0 0 12px 0;
    padding: 0 12px;
}

.quick-start-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: 4px;
}

.quick-start-item:hover {
    background: var(--bg-hover);
    transform: translateX(4px);
}

.quick-start-icon {
    font-size: 24px;
    margin-right: 12px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-start-text {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.quick-start-text strong {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.quick-start-text span {
    font-size: 12px;
    color: var(--text-secondary);
}

.quick-start-divider {
    height: 1px;
    background: var(--border-color);
    margin: 12px 0;
}

.quick-start-footer {
    padding: 20px 12px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    margin-top: 20px;
}

.quick-start-footer p {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.quick-start-footer kbd {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    padding: 2px 6px;
    font-family: inherit;
    font-size: 11px;
    color: var(--text-primary);
}

.menu-dropdown {
    position: relative;
}

.menu-item {
    padding: 4px 12px;
    cursor: pointer;
    border-radius: 3px;
    font-size: 13px;
    transition: background 0.15s;
    user-select: none;
}

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

.menu-dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 2px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    display: none;
    flex-direction: column;
    min-width: 200px;
    padding: 4px;
    z-index: 1000;
}

.menu-dropdown:hover .menu-dropdown-content {
    display: flex;
}

.menu-dropdown-item {
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    border-radius: 3px;
    transition: background 0.1s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-dropdown-item:hover {
    background: var(--bg-hover);
}

.menu-dropdown-item-has-submenu {
    position: relative;
}

.menu-submenu {
    position: absolute;
    left: 100%;
    top: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    min-width: 160px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: none;
    padding: 4px;
    z-index: 1000;
}

.menu-dropdown-item-has-submenu:hover .menu-submenu {
    display: block;
}

.menu-shortcut {
    font-size: 11px;
    color: var(--text-secondary);
    margin-left: 12px;
}

.ai-export-dropdown {
    position: relative;
}

.ai-export-btn {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
    color: #fff;
    background: var(--accent);
    border: none;
    opacity: 0.9;
    cursor: pointer;
    transition: opacity 0.15s;
    text-transform: uppercase;
}

.ai-export-btn:hover {
    opacity: 0.8;
}

.dropdown-arrow {
    font-size: 10px;
    margin-left: 4px;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    display: none;
    flex-direction: column;
    min-width: 180px;
    padding: 4px;
    z-index: 1000;
}

.dropdown-menu.show {
    display: flex;
}

.dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    border-radius: 3px;
    transition: background 0.1s;
}

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

/* Context Menu */
.context-menu {
    position: fixed;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    display: none;
    flex-direction: column;
    min-width: 180px;
    padding: 4px;
    z-index: 1000;
}

.context-menu.show {
    display: flex;
}

.context-item {
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    border-radius: 3px;
    transition: background 0.1s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.context-item.danger {
    color: #f48771;
}

.context-item.danger:hover {
    background: rgba(244, 135, 113, 0.1);
}

.context-shortcut {
    font-size: 11px;
    color: var(--text-secondary);
    margin-left: 12px;
}

.divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* Container */
.container {
    display: flex;
    height: calc(100vh - var(--menu-height) - 24px);
}

/* Footer */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    font-size: 11px;
    color: var(--text-secondary);
    z-index: 100;
    user-select: none;
}

.app-footer span {
    opacity: 0.7;
    transition: opacity 0.2s;
}

.app-footer:hover span {
    opacity: 1;
}

.app-footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.app-footer a:hover {
    color: var(--accent);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    position: relative;
    min-width: 180px;
    max-width: 600px;
}

.sidebar-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    cursor: col-resize;
    z-index: 10;
    background: transparent;
    transition: background 0.15s;
}

.sidebar-resize-handle:hover {
    background: var(--accent);
}

.sidebar-resize-handle.dragging {
    background: var(--accent);
    opacity: 0.8;
}

.sidebar.hidden {
    display: none;
}

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

.sidebar-header h3 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    user-select: none;
    cursor: default;
}

.btn-new-file {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 3px;
    transition: all 0.15s;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

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

.btn-new-file .btn-icon {
    font-size: 16px;
    font-weight: bold;
}

.btn-new-file .btn-label {
    display: none;
}

.btn-new-file .btn-label.hidden {
    display: none;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 3px;
    transition: all 0.15s;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.icon-btn.active {
    background: rgba(0, 122, 204, 0.2);
    color: var(--accent);
}

.codie-highlight-line {
    background: rgba(0, 122, 204, 0.15);
}

.file-tree {
    flex: 1;
    overflow-y: auto;
    padding: 4px;
    display: block;
}

.tree-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
}

.tree-empty p {
    margin-bottom: 12px;
    font-size: 13px;
}

.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
    user-select: none;
}

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

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
    user-select: none;
}

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

/* File Tree Items */
.tree-item {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 3px;
    font-size: 13px;
    transition: background 0.1s;
    user-select: none;
    width: 100%;
}

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

.tree-item.active {
    background: var(--bg-active);
}

.tree-item-icon {
    margin-right: 6px;
    font-size: 14px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
    user-select: none;
}

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

.tree-folder-wrapper {
    display: block;
    width: 100%;
}

.tree-children {
    margin-left: 20px;
    display: none;
}

.tree-children.expanded {
    display: block;
}

.tree-children .tree-item {
    display: flex;
}

/* Editor Container */
.editor-container {
    flex: 1;
    flex-shrink: 1;
    min-width: 0; /* Allow flex shrinking below content size */
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.tabs {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-tertiary) var(--bg-secondary);
    position: relative;
    z-index: 10;
    min-height: 40px;
}

.tabs::-webkit-scrollbar {
    height: 4px;
}

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

.tabs::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 2px;
}

.tabs::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

.tab {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-right: 1px solid var(--border-color);
    cursor: pointer;
    font-size: 13px;
    position: relative;
    transition: all 0.15s;
    max-width: 250px;
    min-width: 120px;
    gap: 6px;
    user-select: none;
}

.tab:hover {
    background: var(--bg-hover);
}

.tab.active {
    background: var(--bg-primary);
    border-bottom: 2px solid var(--accent);
}

.tab-icon {
    font-size: 14px;
    flex-shrink: 0;
    user-select: none;
}

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

.tab-close {
    opacity: 0;
    transition: opacity 0.15s;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    flex-shrink: 0;
    font-size: 12px;
}

.tab:hover .tab-close {
    opacity: 1;
}

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

.editor-wrapper {
    flex: 1;
    flex-shrink: 1;
    min-width: 0; /* Allow flex shrinking */
    position: relative;
    font-size: 14px; /* Match Monaco fontSize setting */
    margin-top: 4px; /* Small top margin for visual breathing room */
}

.editor-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    z-index: 1;
}

.editor-placeholder.hidden {
    display: none;
}

.placeholder-content {
    text-align: center;
    color: var(--text-secondary);
}

.placeholder-title {
    font-size: 64px;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.placeholder-subtitle {
    font-size: 24px;
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.05em;
}

.placeholder-content h2 {
    font-size: 32px;
    margin-bottom: 12px;
    color: var(--text-primary);
    font-weight: 600;
}

.placeholder-content p {
    font-size: 16px;
    margin-bottom: 24px;
    opacity: 0.8;
}

.placeholder-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Preview Panel */
.preview-resize-handle {
    position: relative;
    width: 4px;
    cursor: col-resize;
    background: transparent;
    transition: background 0.15s;
    flex-shrink: 0;
    z-index: 10;
    /* Extend hit area with invisible padding */
    margin-left: -8px;
    margin-right: -8px;
    padding-left: 8px;
    padding-right: 8px;
}

.preview-resize-handle:hover {
    background: var(--accent);
}

.preview-resize-handle.dragging {
    background: var(--accent);
    opacity: 0.8;
}

.preview-resize-grabber {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    z-index: 10;
}

.preview-resize-handle:hover .preview-resize-grabber {
    opacity: 0.6;
}

.preview-resize-handle.dragging .preview-resize-grabber {
    opacity: 1;
}

.preview-resize-grabber span {
    width: 10px;
    height: 1.5px;
    background: var(--text-secondary);
    display: block;
}

.preview-panel {
    width: var(--preview-width);
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

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

/* Fullscreen Preview */
.fullscreen-preview {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    z-index: 2000;
    display: none;
    flex-direction: column;
}

.fullscreen-preview.show {
    display: flex;
}

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

.fullscreen-header span {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
}

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

.icon-btn[title="Fullscreen"] {
    font-size: 14px;
    font-weight: bold;
}

#fullscreenFrame {
    flex: 1;
    border: none;
    background: var(--bg-primary);
}

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

.preview-header h3 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    user-select: none;
    cursor: default;
    margin: 0;
}

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

#previewFrame {
    flex: 1;
    border: none;
    background: var(--bg-primary);
}

/* Console Panel */
.console-panel {
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    height: 300px;
    min-height: 200px;
}

.console-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.console-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    color: var(--text-primary);
}

.console-log {
    padding: 2px 0;
    display: flex;
    gap: 8px;
}

.console-log.info {
    color: var(--text-primary);
}

.console-log.error {
    color: #f48771;
}

.console-log.warn {
    color: #cca700;
}

.console-timestamp {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
    min-width: 640px;
    max-width: 720px;
}

.modal-content h2 {
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 5px;
}

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

/* Monaco Editor Customization */
/* Monaco Editor Theme Variables */
.monaco-editor {
    --vscode-editor-background: var(--bg-primary);
    --vscode-editor-foreground: var(--text-primary);
    --vscode-sideBar-background: var(--bg-secondary);
    --vscode-minimap-background: var(--bg-primary);
    --vscode-minimapSlider-background: rgba(121, 121, 121, 0.3);
}

.monaco-editor .margin,
.monaco-editor .minimap,
.monaco-editor .minimap-decorations-layer {
    background: var(--bg-primary) !important;
}

/* Ensure minimap canvases are visible and render content */
.monaco-editor .minimap canvas {
    opacity: 1 !important;
    display: block !important;
}

.monaco-editor .minimap-slider {
    background: rgba(121, 121, 121, 0.2) !important;
}

.monaco-editor .minimap-slider:hover {
    background: rgba(121, 121, 121, 0.3) !important;
}

body.theme-light .monaco-editor .margin,
body.theme-light .monaco-editor .minimap,
body.theme-light .monaco-editor .minimap-decorations-layer,
body.theme-light-modern .monaco-editor .margin,
body.theme-light-modern .monaco-editor .minimap,
body.theme-light-modern .monaco-editor .minimap-decorations-layer,
body.theme-quiet-light .monaco-editor .margin,
body.theme-quiet-light .monaco-editor .minimap,
body.theme-quiet-light .monaco-editor .minimap-decorations-layer {
    background: white !important;
}

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

.tab {
    animation: fadeIn 0.2s;
}

/* Export Modal File List */
#fileSelectionList label {
    transition: background 0.2s;
}

#fileSelectionList label:hover {
    background: var(--bg-tertiary);
}

#fileSelectionList input[type="checkbox"] {
    cursor: pointer;
}

#exportSummary {
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}

/* Wizard Steps */
.wizard-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    transition: all 0.2s;
    position: relative;
}

.wizard-step.active {
    color: var(--text-primary);
}

.wizard-step.completed {
    color: var(--text-primary);
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.wizard-step.active .step-number {
    background: var(--bg-secondary);
    border-color: var(--accent);
    color: var(--accent);
}

.wizard-step.completed .step-number {
    background: var(--bg-secondary);
    border-color: var(--text-secondary);
    color: var(--text-secondary);
}

.step-label {
    font-size: 13px;
    font-weight: 500;
}

.wizard-page {
    animation: fadeIn 0.2s;
}

/* Send to AI modal: enforce a consistent layout and typography across steps */
.send-to-ai-modal .modal-content {
    min-width: 720px;
    max-width: 720px;
}

.wizard-progress {
    display: flex;
    gap: 8px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.send-to-ai-modal .modal-body p,
.send-to-ai-modal #sendPreview,
.send-to-ai-modal #sendInstructions,
.send-to-ai-modal .size-warning {
    font-size: 13px;
}

.send-to-ai-modal .option-content h3 { font-size: 14px; }
.send-to-ai-modal .option-content p { font-size: 13px; }

/* Chunking view keeps same width and base font */
.send-to-ai-modal #chunkingContent { font-size: 13px; }
.send-to-ai-modal #chunkTitle { font-size: 15px; }
.send-to-ai-modal #chunkLabel { font-size: 12px; }
.send-to-ai-modal #chunkLines { font-size: 12px; }

/* Size Warnings */
.size-warning {
    display: flex;
    gap: 12px;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    border-left: 4px solid;
}

.size-warning .warning-icon {
    font-size: 24px;
    line-height: 1;
}

.size-warning .warning-content {
    flex: 1;
}

.size-warning .warning-content strong {
    display: block;
    margin-bottom: 8px;
    font-size: 15px;
}

.size-warning .warning-content p {
    margin: 8px 0;
    line-height: 1.5;
}

.size-warning .warning-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.size-warning .warning-content li {
    margin: 4px 0;
}

.size-warning .warning-tip {
    margin-top: 12px;
    font-size: 13px;
    line-height: 1.7;
    opacity: 0.95;
}

.warning-yellow {
    background: var(--bg-secondary);
    border-left-color: #d4a847;
    color: var(--text-primary);
}

.warning-yellow .warning-icon {
    color: #d4a847;
}

.warning-orange {
    background: var(--bg-secondary);
    border-left-color: #d89040;
    color: var(--text-primary);
}

.warning-orange .warning-icon {
    color: #d89040;
}

.warning-red {
    background: var(--bg-secondary);
    border-left-color: #d45a52;
    color: var(--text-primary);
}

.warning-red .warning-icon {
    color: #d45a52;
}

/* Prompts Library */
.prompts-library-modal .modal-content {
    height: 700px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.prompts-library-split {
    display: flex;
    height: calc(700px - 60px);
    overflow: hidden;
    flex-shrink: 0;
}

.prompts-sidebar {
    width: 320px;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.prompts-list {
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.prompts-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.prompt-form-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    min-height: 0;
}

.prompt-category {
    padding: 12px 8px 6px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    user-select: none;
}

.prompt-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    overflow: hidden;
    padding: 10px 12px;
}

.prompt-card:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.prompt-card.active {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.prompt-title {
    margin: 0 0 4px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.prompt-description {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.prompt-form-content .btn-primary {
    min-width: 120px;
}

/* Export for AI Modal */
.export-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.export-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    aspect-ratio: 1;
    min-height: 70px;
    position: relative;
}

.export-option input[type="radio"] {
    position: absolute;
    top: 4px;
    right: 4px;
    margin: 0;
    width: 12px;
    height: 12px;
}

.export-option:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.export-option input[type="radio"]:checked + .option-content {
    color: var(--text-primary);
}

.export-option:has(input[type="radio"]:checked) {
    border-color: var(--accent);
    background: var(--bg-hover);
    box-shadow: 0 0 0 3px rgba(0, 122, 204, 0.1);
}

.option-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.option-icon {
    font-size: 16px;
    line-height: 1;
    margin-bottom: 2px;
}

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

.option-content p {
    margin: 0;
    font-size: 10px;
    color: var(--text-secondary);
    line-height: 1.2;
}

/* Help Modal */
.help-content {
    padding: 0;
}

.help-section {
    margin-bottom: 32px;
}

.help-section:last-child {
    margin-bottom: 0;
}

.help-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.help-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 16px;
    margin-bottom: 8px;
}

.help-section p {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.help-section ul {
    margin: 8px 0 16px 0;
    padding-left: 20px;
}

.help-section li {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.help-section li strong {
    color: var(--text-primary);
}

.help-section a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

.help-section a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Keyboard Shortcuts Grid */
.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 12px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.shortcut-item kbd {
    display: inline-block;
    padding: 4px 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 80px;
    text-align: center;
}

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

/* AI Mode Cards */
.ai-mode-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 16px;
}

.ai-mode-card h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 8px;
}

.ai-mode-card p {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.ai-mode-card p:last-child {
    margin-bottom: 0;
}

.ai-mode-card p strong {
    color: var(--accent);
}

/* Responsive */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 180px;
        --preview-width: 300px;
    }
    
    .shortcuts-grid {
        grid-template-columns: 1fr;
    }
}


