/* VS Code Dark Theme - SourceDesk */

:root[data-theme="dark"] {
    /* VS Code Dark+ Theme Colors */
    --bg-primary: #1e1e1e;
    --bg-secondary: #252526;
    --bg-tertiary: #2d2d30;
    --bg-hover: #2a2d2e;
    --bg-input: #3c3c3c;
    
    --text-primary: #cccccc;
    --text-secondary: #969696;
    --text-muted: #6a737d;
    
    --border-color: #3c3c3c;
    --border-light: #2b2b2b;
    
    --accent-blue: #007acc;
    --accent-blue-hover: #005a9e;
    
    --activity-active: #37373d;
    --activity-border: #007acc;
    
    --tab-active: #1e1e1e;
    --tab-inactive: #2d2d2d;
    --tab-hover: #2a2a2a;
    
    --statusbar-bg: #007acc;
    --statusbar-text: #ffffff;
    
    --editor-bg: #1e1e1e;
    --editor-line-numbers: #858585;
    --editor-selection: #264f78;
    
    --scrollbar-bg: #1e1e1e;
    --scrollbar-thumb: #424242;
    --scrollbar-hover: #4f4f4f;
}

:root[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f3f3f3;
    --bg-tertiary: #e8e8e8;
    --bg-hover: #e8e8e8;
    --bg-input: #ffffff;
    
    --text-primary: #3b3b3b;
    --text-secondary: #6c6c6c;
    --text-muted: #959595;
    
    --border-color: #e5e5e5;
    --border-light: #eaeaea;
    
    --accent-blue: #007acc;
    --accent-blue-hover: #005a9e;
    
    --activity-active: #ffffff;
    --activity-border: #007acc;
    
    --tab-active: #ffffff;
    --tab-inactive: #ececec;
    --tab-hover: #e8e8e8;
    
    --statusbar-bg: #007acc;
    --statusbar-text: #ffffff;
    
    --editor-bg: #ffffff;
    --editor-line-numbers: #237893;
    --editor-selection: #add6ff;
    
    --scrollbar-bg: #ffffff;
    --scrollbar-thumb: #c4c4c4;
    --scrollbar-hover: #a6a6a6;
}

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

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13px;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Titlebar */
.titlebar {
    height: 30px;
    background: var(--bg-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    -webkit-app-region: drag;
}

.titlebar-drag-region {
    flex: 1;
    display: flex;
    align-items: center;
    padding-left: 8px;
}

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

.window-controls {
    display: flex;
    -webkit-app-region: no-drag;
}

.window-control {
    width: 46px;
    height: 30px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 10px;
    transition: background 0.1s;
}

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

.window-control.close:hover {
    background: #e81123;
    color: white;
}

/* Menubar */
.menubar {
    height: 35px;
    background: var(--bg-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 8px;
    border-bottom: 1px solid var(--border-color);
}

.menubar-menu {
    display: flex;
    gap: 2px;
}

.menu-button {
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 6px 10px;
    font-size: 13px;
    cursor: pointer;
    border-radius: 3px;
    position: relative;
}

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

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

/* Dropdown Menus */
.menu-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    z-index: 1000;
    display: none;
    padding: 4px 0;
}

.menu-dropdown.active {
    display: block;
}

.menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.1s;
}

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

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

.menu-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.menu-item.disabled:hover {
    background: transparent;
}

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

.menubar-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.icon-button {
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 3px;
    font-size: 14px;
}

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

.wallet-button {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 4px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

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

/* Main Layout */
.main-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Activity Bar */
.activitybar {
    width: 48px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.activitybar-items,
.activitybar-bottom {
    display: flex;
    flex-direction: column;
}

.activity-item {
    width: 48px;
    height: 48px;
    background: transparent;
    border: none;
    border-left: 2px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.1s;
}

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

.activity-item.active {
    color: var(--text-primary);
    border-left-color: var(--activity-border);
    background: var(--activity-active);
}

/* Sidebar */
.sidebar {
    width: 300px;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar-view {
    display: none;
    flex-direction: column;
    height: 100%;
}

.sidebar-view.active {
    display: flex;
}

.sidebar-header {
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.sidebar-actions {
    display: flex;
    gap: 4px;
}

.action-button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
    font-size: 14px;
}

.action-button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
}

.section-header {
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

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

.section-actions {
    margin-left: auto;
    display: flex;
    gap: 4px;
    opacity: 0;
}

.section-header:hover .section-actions {
    opacity: 1;
}

.file-explorer {
    padding: 0 8px;
}

.file-item,
.folder-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    cursor: pointer;
    border-radius: 3px;
    font-size: 13px;
    user-select: none;
}

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

.file-item.active {
    background: var(--editor-selection);
}

.file-icon,
.folder-icon {
    font-size: 16px;
    width: 16px;
}

.folder-children {
    margin-left: 16px;
}

/* Search Box */
.search-box {
    padding: 8px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.search-box input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 8px;
    border-radius: 3px;
    font-size: 13px;
    font-family: inherit;
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

/* Empty State */
.empty-state {
    padding: 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
}

/* Editor Area */
.editor-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--editor-bg);
}

/* Tab Bar */
.tab-bar {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    min-height: 35px;
}

.tabs {
    display: flex;
    overflow-x: auto;
}

.tabs::-webkit-scrollbar {
    height: 0;
}

.tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    height: 35px;
    background: var(--tab-inactive);
    border-right: 1px solid var(--border-color);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 120px;
    max-width: 200px;
}

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

.tab.active {
    background: var(--tab-active);
    color: var(--text-primary);
    border-bottom: 1px solid var(--tab-active);
}

.tab-icon {
    font-size: 14px;
}

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

.tab-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px;
    border-radius: 3px;
    font-size: 14px;
    opacity: 0;
}

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

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

/* Editor Container */
.editor-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.code-editor {
    width: 100%;
    height: 100%;
    display: none;
    position: absolute;
}

.code-editor.active {
    display: block;
}

.editor-textarea {
    width: 100%;
    height: 100%;
    background: var(--editor-bg);
    color: var(--text-primary);
    border: none;
    outline: none;
    padding: 16px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    tab-size: 4;
}

/* Welcome Page */
.welcome-page {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.welcome-content {
    text-align: center;
    max-width: 600px;
}

.welcome-content h1 {
    font-size: 48px;
    font-weight: 300;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.welcome-content > p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.welcome-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 48px;
}

.welcome-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 32px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s;
}

.welcome-action:hover {
    background: var(--bg-hover);
    border-color: var(--accent-blue);
}

.welcome-action i {
    font-size: 32px;
    color: var(--accent-blue);
}

.welcome-tips {
    text-align: left;
}

.welcome-tips h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.welcome-tips ul {
    list-style: none;
    color: var(--text-secondary);
    font-size: 13px;
}

.welcome-tips li {
    padding: 4px 0;
}

.welcome-tips li:before {
    content: "•";
    margin-right: 8px;
    color: var(--accent-blue);
}

/* Status Bar */
.statusbar {
    height: 22px;
    background: var(--statusbar-bg);
    color: var(--statusbar-text);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 12px;
    font-size: 12px;
}

.statusbar-left,
.statusbar-right {
    display: flex;
    gap: 16px;
}

.statusbar-item {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 0 4px;
}

.statusbar-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* AI Panel */
.ai-panel {
    width: 350px;
    background: var(--bg-primary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

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

.ai-header h3 {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.ai-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.ai-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 2px solid transparent;
}

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

.ai-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent-blue);
}

.ai-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-tab-content {
    display: none;
    flex-direction: column;
    height: 100%;
}

.ai-tab-content.active {
    display: flex;
}

.ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-message {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message-header {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
}

.message-role {
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.message-content {
    background: var(--bg-secondary);
    padding: 12px;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.ai-message.user .message-content {
    background: var(--bg-tertiary);
}

.ai-message.assistant .message-content.completion {
    background: #1a3d1a;
    border-left: 3px solid #4caf50;
}

:root[data-theme="light"] .ai-message.assistant .message-content.completion {
    background: #e8f5e9;
    border-left: 3px solid #4caf50;
    color: #1b5e20;
}

.ai-input-container {
    padding: 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
}

.ai-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px;
    border-radius: 3px;
    font-size: 13px;
    font-family: inherit;
    resize: none;
}

.ai-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.ai-send {
    background: var(--accent-blue);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
}

.ai-send:hover {
    background: var(--accent-blue-hover);
}

.ai-send:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.loading-indicator {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.ai-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    min-width: 180px;
}

.context-item {
    padding: 6px 16px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
}

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

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

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

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

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

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

/* Loading Indicator */
.loading-indicator {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Utility Classes */
.hidden {
    display: none !important;
}

.disabled {
    opacity: 0.5;
    pointer-events: none;
}
