/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    height: 100vh;
    overflow: hidden;
    background-color: var(--bg-primary);
}

/* App Container */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 320px;
    min-width: 280px;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    resize: horizontal;
    overflow: hidden;
    transition: width 0.3s ease, min-width 0.3s ease;
    background-color: var(--bg-primary);
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
}

.sidebar.collapsed {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    border-right: 1px solid var(--border-color);
    resize: none;
}

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

.sidebar-title {
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .sidebar-title {
    opacity: 0;
    pointer-events: none;
}

.sidebar-title h3 {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.refresh-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.add-project-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.settings-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.refresh-btn:hover {
    background-color: var(--hover-color);
    transform: scale(1.05);
}

.add-project-btn:hover {
    background-color: var(--hover-color);
    transform: scale(1.05);
}

.settings-btn:hover {
    background-color: var(--hover-color);
    transform: scale(1.05);
}

.refresh-btn:active {
    transform: scale(0.95);
}

.refresh-btn.spinning svg {
    animation: spin 0.6s linear;
}

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

/* Pulse animation for stop button */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(0.95);
    }
}

/* Thinking dots animation */
@keyframes thinkingDots {
    0%, 20% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
    100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
}

.btn-secondary.responding {
    animation: pulse 1.5s ease-in-out infinite;
    background-color: var(--accent-color);
    color: var(--accent-text);
    border-color: var(--accent-color);
}

/* LLM Thinking Indicator */
.llm-thinking {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.llm-thinking p {
    margin-top: 16px;
    font-size: 13px;
    font-weight: 500;
}

.thinking-dots {
    display: flex;
    gap: 8px;
}

.thinking-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--accent-color);
    animation: thinkingDots 1.4s ease-in-out infinite;
}

.thinking-dots span:nth-child(1) {
    animation-delay: 0s;
}

.thinking-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

.sidebar.collapsed .sidebar-toggle {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-toggle:hover {
    background-color: var(--hover-color);
    transform: scale(1.05);
}

.sidebar-toggle svg {
    transition: transform 0.2s ease;
}

.sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

/* Sidebar Expand Button */
.sidebar-expand-btn {
    position: fixed;
    top: 20px;
    left: 10px;
    width: 36px;
    height: 36px;
    background-color: var(--panel-header-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.sidebar.collapsed ~ .sidebar-expand-btn {
    display: flex;
}

.sidebar-expand-btn:hover {
    background-color: var(--hover-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.theme-switcher {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .theme-switcher {
    opacity: 0;
    pointer-events: none;
}

/* Theme Selector Button Group */
.theme-selector-group {
    display: flex;
    gap: 0;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.theme-btn {
    background: var(--input-bg);
    border: none;
    border-right: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-btn:last-child {
    border-right: none;
}

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

.theme-btn.active {
    background: var(--accent-color);
    color: var(--accent-text);
    font-weight: 600;
}

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

/* Storage Controls */
.storage-controls {
    display: flex;
    gap: 0;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .storage-controls {
    opacity: 0;
    pointer-events: none;
}

.storage-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.storage-btn:hover {
    background-color: var(--hover-color);
    transform: scale(1.05);
}

.storage-btn:active {
    transform: scale(0.95);
}

.project-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .project-list {
    opacity: 0;
    pointer-events: none;
}

.project-item {
    padding: 8px 12px;
    margin-bottom: 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    white-space: nowrap;
    position: relative;
}

.project-item:hover {
    background-color: var(--hover-color);
    transform: translateX(2px);
}

.project-item.active {
    background-color: var(--accent-color);
    color: var(--accent-text);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.project-item.active .project-name {
    color: var(--accent-text);
}

.project-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-info {
    display: flex;
    align-items: center;
    gap: 6px;
}

.project-delete-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
    font-size: 14px;
    line-height: 1;
}

.project-item:hover .project-delete-btn {
    opacity: 1;
}

.project-delete-btn:hover {
    background-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.project-difficulty {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.project-difficulty.easy {
    background-color: #22c55e;
    color: white;
}

.project-difficulty.medium {
    background-color: #f59e0b;
    color: white;
}

.project-difficulty.hard {
    background-color: #ef4444;
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Panel Headers */
.panel-header {
    padding: 4px 10px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--panel-header-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h4 {
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 600;
}

/* Maximize Button */
.maximize-btn {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-left: 6px;
}

.maximize-btn:hover {
    background: var(--hover-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.maximize-btn svg {
    display: block;
}

.editor-controls select,
.output-controls button {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.editor-controls {
    display: flex;
    align-items: center;
}

.output-controls {
    display: flex;
    align-items: center;
}

.output-controls button:hover {
    background: var(--hover-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* Language Selector Button Group */
.language-selector-group {
    display: flex;
    gap: 0;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.language-btn {
    background: var(--input-bg);
    border: none;
    border-right: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.language-btn:last-child {
    border-right: none;
}

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

.language-btn.active {
    background: var(--accent-color);
    color: var(--accent-text);
    font-weight: 600;
}

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

/* Editor Panel */
.editor-panel {
    height: 40%;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-primary);
    flex-shrink: 0;
    transition: height 0.3s ease;
}

#monaco-editor {
    flex: 1;
    min-height: 0; /* Important for flex children to allow scrolling */
    overflow: auto;
}

/* Output Panel */
.output-panel {
    height: 35%;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-primary);
    flex-shrink: 0;
    transition: height 0.3s ease;
}

.markdown-content {
    flex: 1;
    min-height: 0; /* Important for flex children to allow scrolling */
    padding: 12px;
    overflow-y: auto;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 12px;
    line-height: 1.6;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin-top: 14px;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 600;
}

.markdown-content h1 {
    font-size: 18px;
}

.markdown-content h2 {
    font-size: 15px;
}

.markdown-content h3 {
    font-size: 13px;
}

.markdown-content p {
    margin-bottom: 10px;
}

.markdown-content code {
    background-color: var(--code-bg);
    padding: 2px 5px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 11px;
    border: 1px solid var(--border-color);
}

.markdown-content pre {
    background-color: var(--code-bg);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.markdown-content pre code {
    background: none;
    padding: 0;
    border: none;
}

.markdown-content ul,
.markdown-content ol {
    margin-bottom: 10px;
    padding-left: 24px;
}

.markdown-content li {
    margin-bottom: 4px;
}

.markdown-content a {
    color: var(--accent-color);
    text-decoration: none;
}

.markdown-content a:hover {
    text-decoration: underline;
}

.markdown-content blockquote {
    border-left: 3px solid var(--accent-color);
    padding-left: 12px;
    margin: 12px 0;
    color: var(--text-secondary);
    font-style: italic;
}

.markdown-content strong {
    font-weight: 600;
    color: var(--text-primary);
}

.markdown-content em {
    font-style: italic;
}

.markdown-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 16px 0;
}

.markdown-content table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 12px;
}

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

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

/* Input Panel */
.input-panel {
    flex: 1;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-primary);
    transition: height 0.3s ease, flex 0.3s ease;
}

.input-container {
    flex: 1;
    min-height: 0; /* Important for flex children to allow scrolling */
    display: flex;
    flex-direction: column;
    padding: 8px;
}

#user-input {
    flex: 1;
    min-height: 0; /* Important for flex children to allow scrolling */
    background-color: var(--input-bg);
    border: none;
    color: var(--text-primary);
    padding: 8px;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    overflow-y: auto;
    transition: background-color 0.2s ease;
}

#user-input:focus {
    outline: none;
    background-color: var(--bg-secondary);
}

.input-controls {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.btn-primary,
.btn-secondary {
    padding: 3px 10px;
    border: none;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

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

.btn-primary:hover:not(:disabled) {
    background-color: var(--accent-hover);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--hover-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Help Button */
.help-btn {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 2px 8px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-right: 6px;
    font-size: 12px;
    font-weight: bold;
    width: 20px;
    height: 20px;
}

.help-btn:hover {
    background: var(--hover-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.help-btn.blink {
    animation: help-blink 1.5s ease-in-out infinite;
}

.add-project-btn.blink {
    animation: help-blink 1.5s ease-in-out infinite;
}

.storage-btn.blink {
    animation: help-blink 1.5s ease-in-out infinite;
}

@keyframes help-blink {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 rgba(59, 130, 246, 0);
    }
    50% {
        opacity: 0.3;
        box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
    }
}


.btn-danger {
    padding: 3px 10px;
    border: none;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: #dc2626;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

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

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

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

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
        min-width: 180px;
    }
    
    .sidebar.collapsed {
        width: 0;
        min-width: 0;
    }
    
    .input-panel {
        flex: 0 0 120px;
    }
    
    .sidebar-expand-btn {
        top: 10px;
        left: 5px;
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 180px;
        min-width: 150px;
    }
    
    .project-item {
        padding: 6px 10px;
    }
    
    .project-name {
        font-size: 11px;
    }
    
    .sidebar-expand-btn {
        width: 28px;
        height: 28px;
    }
    
    .sidebar-expand-btn svg {
        width: 14px;
        height: 14px;
    }
}

/* Animation improvements */
.sidebar * {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.sidebar.collapsed * {
    transition-delay: 0s;
}

/* Focus states for accessibility */
.sidebar-toggle:focus,
.sidebar-expand-btn:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Improved hover states */
.sidebar-toggle:hover svg,
.sidebar-expand-btn:hover svg {
    transform: scale(1.1);
}
/* Maximized Panel States */
.editor-panel.maximized,
.output-panel.maximized,
.input-panel.maximized {
    flex: 1 !important;
    height: 100% !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    border: none;
}

/* Hide all other panels when one is maximized */
.main-content:has(.editor-panel.maximized) .output-panel,
.main-content:has(.editor-panel.maximized) .input-panel {
    display: none;
}

.main-content:has(.output-panel.maximized) .editor-panel,
.main-content:has(.output-panel.maximized) .input-panel {
    display: none;
}

.main-content:has(.input-panel.maximized) .editor-panel,
.main-content:has(.input-panel.maximized) .output-panel {
    display: none;
}

/* Hide sidebar when any panel is maximized */
.app-container:has(.editor-panel.maximized) .sidebar,
.app-container:has(.output-panel.maximized) .sidebar,
.app-container:has(.input-panel.maximized) .sidebar {
    display: none;
}

.app-container:has(.editor-panel.maximized) .sidebar-expand-btn,
.app-container:has(.output-panel.maximized) .sidebar-expand-btn,
.app-container:has(.input-panel.maximized) .sidebar-expand-btn {
    display: none;
}

/* Adjust main content when panel is maximized */
.main-content:has(.editor-panel.maximized),
.main-content:has(.output-panel.maximized),
.main-content:has(.input-panel.maximized) {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
}

/* Resize Handles */
.resize-handle {
    height: 4px;
    background-color: var(--border-color);
    cursor: ns-resize;
    position: relative;
    flex-shrink: 0;
    transition: background-color 0.2s ease;
}

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

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

/* Hide resize handles when any panel is maximized */
.main-content:has(.editor-panel.maximized) .resize-handle,
.main-content:has(.output-panel.maximized) .resize-handle,
.main-content:has(.input-panel.maximized) .resize-handle {
    display: none;
}

/* Collapsed Panel States */
.editor-panel.panel-collapsed,
.output-panel.panel-collapsed,
.input-panel.panel-collapsed {
    height: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    flex: 0 0 32px !important;
    overflow: hidden;
}

/* Make panel headers look clickable with a subtle hint */
.panel-header {
    cursor: pointer;
    user-select: none;
}

.panel-header:hover {
    background-color: var(--hover-color);
}

/* Hide content when panel is collapsed */
.editor-panel.panel-collapsed #monaco-editor,
.output-panel.panel-collapsed .markdown-content,
.input-panel.panel-collapsed .input-container {
    display: none;
}

/* Dialog Overlay */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    backdrop-filter: blur(2px);
}

.dialog-overlay.active {
    display: flex;
}

.dialog-box {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: dialogSlideIn 0.2s ease-out;
}

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

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

.dialog-header h4 {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}

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

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

.dialog-content {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
}

.dialog-content textarea {
    width: 100%;
    min-height: 150px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--input-bg);
    color: var(--text-primary);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 13px;
    resize: vertical;
    outline: none;
    transition: all 0.2s ease;
}

.dialog-content textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.dialog-actions {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    background-color: var(--panel-header-bg);
}

.dialog-actions button {
    padding: 6px 14px;
    font-size: 12px;
}

/* Delete Dialog Styles */
.delete-dialog {
    max-width: 400px;
}

.delete-dialog .dialog-content {
    text-align: center;
}

.delete-dialog .dialog-content p {
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.5;
}

#delete-dialog-project-name {
    color: var(--accent-color);
    font-size: 14px;
}

/* Clarify Dialog Styles */
.clarify-dialog {
    max-width: 700px;
    max-height: 85vh;
}

.clarify-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0;
    height: 500px;
    max-height: 60vh;
}

.clarify-chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.clarify-welcome {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    padding: 20px;
    font-style: italic;
}

.clarify-message {
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.5;
    animation: messageSlideIn 0.2s ease-out;
}

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

.clarify-message.user {
    background-color: var(--accent-color);
    color: var(--accent-text);
    margin-left: 20%;
    border-bottom-right-radius: 2px;
}

.clarify-message.assistant {
    background-color: var(--code-bg);
    color: var(--text-primary);
    margin-right: 20%;
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 2px;
}

.clarify-message strong {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.clarify-message p {
    margin: 0;
}

.clarify-input-container {
    padding: 0 16px 16px 16px;
}

.clarify-input-container textarea {
    width: 100%;
    min-height: 80px;
    max-height: 150px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--input-bg);
    color: var(--text-primary);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 13px;
    resize: vertical;
    outline: none;
    transition: all 0.2s ease;
}

.clarify-input-container textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

/* Scrollbar for clarify chat history */
.clarify-chat-history::-webkit-scrollbar {
    width: 8px;
}

.clarify-chat-history::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 4px;
}

.clarify-chat-history::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

.clarify-chat-history::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-hover);
}

/* Editor Send Button */
#editor-send-btn {
    margin-left: 8px;
    padding: 4px 12px;
    font-size: 11px;
}

/* Clarify Button in Output Controls */
#clarify-btn {
    padding: 4px 10px;
    font-size: 11px;
    margin-right: 4px;
}

/* Settings Dialog Styles */
.settings-dialog {
    max-width: 600px;
    width: 90%;
}

.settings-content {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.settings-section {
    margin-bottom: 24px;
}

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

.settings-section h5 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-description {
    margin: 0 0 16px 0;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* LLM Selector Group */
.llm-selector-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.llm-btn {
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    padding: 16px;
    border-radius: 0px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
    font-family: inherit;
}

.llm-btn:hover {
    background-color: var(--hover-color);
    border-color: var(--accent-color);
    transform: translateX(4px);
}

.llm-btn.active {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.llm-btn.active:hover {
    transform: translateX(0);
    opacity: 0.95;
}

.llm-btn-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.llm-btn-content strong {
    font-size: 15px;
    font-weight: 600;
}

.llm-btn-content small {
    font-size: 12px;
    opacity: 0.85;
}

.llm-btn.active .llm-btn-content small {
    opacity: 1;
}


/* Library Dialog Styles */
.library-dialog {
    width: 800px;
    max-width: 90vw;
    max-height: 85vh;
    min-height: 600px;
}

.library-content {
    padding: 0;
    max-height: 650px;
    min-height: 500px;
    overflow: auto;
}

.library-explorer {
    padding: 12px;
}

/* Tree Explorer Styles */
.tree-item {
    user-select: none;
    margin: 2px 0;
}

.tree-node {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.15s ease;
    color: var(--text-primary);
}

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

.tree-node.selected {
    background-color: var(--accent-color);
    color: white;
}

.tree-node.folder {
    font-weight: 500;
}

.tree-toggle {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 4px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.tree-toggle.expanded {
    transform: rotate(90deg);
}

.tree-toggle svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

.tree-icon {
    width: 16px;
    height: 16px;
    margin-right: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tree-icon svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Folder icons with theme-aware colors */
.tree-node.folder .tree-icon svg {
    fill: #dcb67a;
}

[data-theme="light"] .tree-node.folder .tree-icon svg,
[data-theme="github"] .tree-node.folder .tree-icon svg {
    fill: #c09553;
}

/* File icons with theme-aware colors */
.tree-node.file .tree-icon svg {
    fill: #6e9cce;
}

[data-theme="light"] .tree-node.file .tree-icon svg,
[data-theme="github"] .tree-node.file .tree-icon svg {
    fill: #4078c0;
}

[data-theme="high-contrast"] .tree-node.folder .tree-icon svg {
    fill: #ffff00;
}

[data-theme="high-contrast"] .tree-node.file .tree-icon svg {
    fill: #00ffff;
}

/* Selected state icon colors */
.tree-node.selected.folder .tree-icon svg,
.tree-node.selected.file .tree-icon svg {
    fill: white;
}

[data-theme="light"] .tree-node.selected .tree-icon svg,
[data-theme="github"] .tree-node.selected .tree-icon svg {
    fill: white;
}

[data-theme="high-contrast"] .tree-node.selected .tree-icon svg {
    fill: #000000;
}

.tree-label {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
}

.tree-node.selected .tree-label {
    color: white;
}

[data-theme="light"] .tree-node.selected .tree-label,
[data-theme="github"] .tree-node.selected .tree-label {
    color: white;
}

[data-theme="high-contrast"] .tree-node.selected .tree-label {
    color: #000000;
}

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

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

/* Library dialog button spacing */
#dialog-library-btn {
    margin-left: auto;
}

/* Model Loading Progress Indicator */
.model-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.model-loading-content {
    background-color: var(--bg-primary);
    border-radius: 0px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    overflow: hidden;
}

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

.model-loading-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.model-loading-cancel {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.model-loading-cancel:hover {
    color: var(--text-primary);
}

.model-loading-body {
    padding: 20px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background-color: #007acc;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.progress-details {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    max-height: 100px;
    overflow-y: auto;
}

/* Progress Dialog */
.progress-dialog {
    max-width: 600px;
}

.progress-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.progress-step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

.progress-step.active {
    opacity: 1;
}

.progress-step.completed {
    opacity: 1;
}

.step-icon {
    position: relative;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
}

.progress-step.active .step-spinner {
    display: block;
}

.step-check {
    color: #4caf50;
    display: none;
}

.progress-step.completed .step-check {
    display: block;
    animation: checkmark-pop 0.3s ease-out;
}

.progress-step.completed .step-spinner {
    display: none;
}

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

@keyframes checkmark-pop {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.step-content {
    flex: 1;
}

.step-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

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

.progress-step.active .step-title {
    color: var(--accent-color);
}

.progress-step.completed .step-title {
    color: #4caf50;
}

