/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light theme variables */
    --bg-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-secondary: rgba(255, 255, 255, 0.95);
    --bg-tertiary: #f8f9fa;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-light: rgba(255, 255, 255, 0.9);
    --border-color: #e9ecef;
    --accent-color: #667eea;
    --accent-hover: #764ba2;
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;
    --shadow: 0 8px 32px rgba(0,0,0,0.1);
    --shadow-hover: 0 12px 40px rgba(0,0,0,0.15);
    --border-radius: 15px;
    --border-radius-sm: 8px;
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --bg-primary: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --bg-secondary: rgba(30, 30, 30, 0.95);
    --bg-tertiary: #2d3748;
    --text-primary: #e2e8f0;
    --text-secondary: #a0aec0;
    --text-light: rgba(255, 255, 255, 0.9);
    --border-color: #4a5568;
    --accent-color: #667eea;
    --accent-hover: #764ba2;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--text-primary);
    overflow: hidden;
}

/* Header Styles */
.header {
    background: rgba(0, 0, 0, 0.8);
    color: var(--text-light);
    padding: 1rem;
    text-align: center;
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 100;
}

.header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.header p {
    opacity: 0.8;
    font-size: 1.1rem;
}

.theme-controls {
    position: absolute;
    top: 1rem;
    right: 6rem; /* Move it left to avoid the status indicator */
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-light);
    padding: 0.5rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Main Container - Split Layout */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 0;
    height: calc(100vh - 160px); /* Fixed height for entire container */
}

/* Panel Styles */
.chat-panel, .code-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    margin: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.chat-panel {
    flex: 1;
    min-width: 400px;
}

.code-panel {
    flex: 1.2;
    min-width: 500px;
}

.panel-header {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin: 0;
}

.panel-controls {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
    color: var(--text-secondary);
}

.btn-icon:hover {
    background: var(--accent-color);
    color: white;
    transform: translateY(-1px);
}

/* Panel Resizer */
.panel-resizer {
    width: 4px;
    background: var(--border-color);
    cursor: col-resize;
    transition: var(--transition);
    margin: 1rem 0;
}

.panel-resizer:hover {
    background: var(--accent-color);
    width: 6px;
}

/* Search Container */
.search-container {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    display: none;
}

.search-container.show {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    outline: none;
}

.search-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.search-close {
    background: var(--error-color);
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
}

/* Pinned Messages */
.pinned-messages {
    background: rgba(255, 193, 7, 0.1);
    border-bottom: 1px solid rgba(255, 193, 7, 0.3);
    padding: 0.5rem 1rem;
    display: none;
}

.pinned-messages.has-pins {
    display: block;
}

.pinned-message {
    background: rgba(255, 193, 7, 0.2);
    padding: 0.5rem;
    margin: 0.25rem 0;
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
    position: relative;
}

.pinned-message .unpin-btn {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background: none;
    border: none;
    color: var(--warning-color);
    cursor: pointer;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
    /* Force proper flex behavior */
    min-height: 0;
    max-height: 100%;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

.message {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 10px;
    max-width: 80%;
    word-wrap: break-word;
    position: relative;
    animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    color: white;
    margin-left: auto;
    text-align: right;
}

.kylie-message {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    margin-right: auto;
    color: var(--text-primary);
}

.message-header {
    font-weight: bold;
    margin-bottom: 0.5rem;
    opacity: 0.8;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.message-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    opacity: 0;
    transition: var(--transition);
}

.message:hover .message-actions {
    opacity: 1;
}

.message-timestamp {
    font-size: 0.8rem;
    opacity: 0.6;
    font-weight: normal;
}

.message-content {
    line-height: 1.6;
}

/* Code blocks in messages */
.message pre {
    background: #2d3748;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    overflow-x: auto;
    margin: 0.5rem 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    position: relative;
}

.message pre .code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #4a5568;
}

.message pre .code-actions {
    display: flex;
    gap: 0.5rem;
}

.code-copy-btn, .code-download-btn {
    background: rgba(102, 126, 234, 0.2);
    border: 1px solid rgba(102, 126, 234, 0.4);
    color: #e2e8f0;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
}

.code-copy-btn:hover, .code-download-btn:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

/* Input Container - Fixed at bottom */
.input-container {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    /* This should stay fixed at bottom of chat panel */
    flex-shrink: 0; /* Don't allow it to shrink */
}

.input-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    align-items: center;
    flex-wrap: wrap;
}

.toolbar-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: var(--transition);
    color: var(--text-secondary);
}

.toolbar-btn:hover, .toolbar-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.toolbar-separator {
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin: 0 0.25rem;
}

.font-size-select {
    padding: 0.3rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
}

.color-picker {
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    background: none;
}

.input-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.message-input-container {
    flex: 1;
    position: relative;
}

.message-input {
    width: 100%;
    min-height: 80px;
    max-height: 200px;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
    resize: vertical;
    font-family: inherit;
    background: var(--bg-secondary);
    color: var(--text-primary);
    overflow-y: auto;
    line-height: 1.5;
}

.message-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.message-input[data-placeholder]:empty::before {
    content: attr(data-placeholder);
    color: var(--text-secondary);
    opacity: 0.6;
    pointer-events: none;
}

.input-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.attach-button {
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 1.25rem;
    cursor: pointer;
    transition: var(--transition);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attach-button:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    transform: translateY(-2px);
}

.send-button {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: bold;
    min-height: 50px;
}

.send-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Loading Indicator */
.loading {
    display: none;
    text-align: center;
    padding: 1rem;
    color: var(--accent-color);
    font-style: italic;
}

.loading.show {
    display: block;
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60% { content: '...'; }
    80%, 100% { content: ''; }
}

/* Code Panel Tabs */
.code-tabs {
    display: flex;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
    background: rgba(102, 126, 234, 0.1);
}

/* Tab Content */
.tab-content {
    flex: 1;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.tab-content.active {
    display: flex;
}

/* Code Editor */
.code-editor {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#monaco-editor {
    width: 100%;
    height: 100%;
}

.language-select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
}

/* Live Preview */
.live-preview {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* Canvas Tab */
.canvas-toolbar {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    flex-wrap: wrap;
}

.canvas-tool {
    padding: 0.5rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.1rem;
}

.canvas-tool:hover, .canvas-tool.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.canvas-color {
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
}

.canvas-size {
    width: 80px;
}

.canvas-clear, .canvas-save {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.canvas-clear:hover {
    background: var(--error-color);
    color: white;
    border-color: var(--error-color);
}

.canvas-save:hover {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.drawing-canvas {
    width: 100%;
    height: 100%;
    cursor: crosshair;
    background: white;
}

/* File Tree */
.file-tree {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.file-tree-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-tertiary);
}

.file-tree-header h4 {
    margin: 0;
    color: var(--text-primary);
}

.file-tree-content {
    flex: 1;
    padding: 0.5rem;
    overflow-y: auto;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 0.25rem;
}

.file-item:hover {
    background: rgba(102, 126, 234, 0.1);
}

.file-item.active {
    background: var(--accent-color);
    color: white;
}

.file-icon {
    font-size: 1.2rem;
    margin-right: 0.5rem;
    width: 1.5rem;
    text-align: center;
}

.file-icon.code { color: #007acc; }
.file-icon.database { color: #336791; }
.file-icon.image { color: #ff6b6b; }
.file-icon.data { color: #51cf66; }
.file-icon.log { color: #ff8cc8; }
.file-icon.config { color: #ffd43b; }

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 500;
    margin-bottom: 0.1rem;
}

.file-details {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* File Upload Modal */
.file-upload-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.7) !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 99999 !important;
    backdrop-filter: blur(5px) !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: var(--transition) !important;
}

.file-upload-overlay.show {
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: all !important;
}

.file-upload-modal {
    background: var(--bg-secondary) !important;
    border-radius: var(--border-radius) !important;
    padding: 0 !important;
    max-width: 600px !important;
    width: 90% !important;
    max-height: 80vh !important;
    overflow-y: auto !important;
    box-shadow: var(--shadow-hover) !important;
    backdrop-filter: blur(10px) !important;
    border: 2px solid rgba(102, 126, 234, 0.3) !important;
    transform: scale(0.8) translateY(-50px) !important;
    transition: var(--transition) !important;
}

.file-upload-overlay.show .file-upload-modal {
    transform: scale(1) translateY(0) !important;
}

.modal-header {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover)) !important;
    color: white !important;
    padding: 1rem !important;
    border-radius: 13px 13px 0 0 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

.modal-header h3 {
    margin: 0 !important;
    font-size: 1.3rem !important;
}

.close-button {
    background: none !important;
    border: none !important;
    color: white !important;
    font-size: 1.5rem !important;
    cursor: pointer !important;
    padding: 0 !important;
    width: 30px !important;
    height: 30px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: var(--transition) !important;
}

.close-button:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}

.modal-content {
    padding: 1.5rem !important;
}

.file-drop-zone {
    border: 3px dashed var(--accent-color) !important;
    border-radius: 12px !important;
    padding: 2rem !important;
    text-align: center !important;
    background: rgba(102, 126, 234, 0.05) !important;
    transition: var(--transition) !important;
    cursor: pointer !important;
    position: relative !important;
    margin-bottom: 1rem !important;
}

.file-drop-zone:hover {
    border-color: var(--accent-hover) !important;
    background: rgba(102, 126, 234, 0.1) !important;
    transform: translateY(-2px) !important;
}

.file-drop-zone.drag-over {
    border-color: var(--accent-hover) !important;
    background: rgba(102, 126, 234, 0.15) !important;
    transform: scale(1.02) !important;
}

.drop-zone-content {
    pointer-events: none !important;
}

.drop-zone-icon {
    font-size: 3rem !important;
    margin-bottom: 1rem !important;
    opacity: 0.7 !important;
}

.drop-zone-text {
    color: var(--accent-color) !important;
    font-size: 1.1rem !important;
}

.drop-zone-text strong {
    display: block !important;
    margin-bottom: 0.5rem !important;
}

.drop-zone-text small {
    opacity: 0.8 !important;
    line-height: 1.4 !important;
}

#fileInput {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    opacity: 0 !important;
    cursor: pointer !important;
}

.uploaded-files {
    margin-bottom: 1rem !important;
}

.file-actions {
    display: flex !important;
    gap: 1rem !important;
    justify-content: flex-end !important;
}

.btn {
    padding: 0.75rem 1.5rem !important;
    border: none !important;
    border-radius: var(--border-radius-sm) !important;
    font-size: 1rem !important;
    cursor: pointer !important;
    font-weight: bold !important;
    transition: var(--transition) !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover)) !important;
    color: white !important;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3) !important;
}

.btn-primary:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}

.btn-secondary {
    background: #6c757d !important;
    color: white !important;
}

.btn-secondary:hover {
    background: #5a6268 !important;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 0;
    box-shadow: var(--shadow);
    z-index: 10000;
    min-width: 150px;
    display: none;
}

.context-menu.show {
    display: block;
}

.context-item {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-primary);
}

.context-item:hover {
    background: var(--accent-color);
    color: white;
}

.context-separator {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 1rem;
    box-shadow: var(--shadow);
    min-width: 300px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: toastSlide 0.3s ease-out;
}

@keyframes toastSlide {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--error-color);
}

.toast.warning {
    border-left: 4px solid var(--warning-color);
}

.toast-icon {
    font-size: 1.2rem;
}

.toast-message {
    flex: 1;
    color: var(--text-primary);
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Status Indicator */
.status-indicator {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    z-index: 1000; /* Lower than theme toggle */
    transition: var(--transition);
}

.status-healthy {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-unhealthy {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-container {
        flex-direction: column;
    }
    
    .chat-panel, .code-panel {
        flex: none;
        height: 50vh;
    }
    
    .panel-resizer {
        width: 100%;
        height: 4px;
        cursor: row-resize;
        margin: 0;
    }
    
    .panel-resizer:hover {
        height: 6px;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 1.5rem;
    }
    
    .main-container {
        margin: 0.5rem;
    }
    
    .chat-panel, .code-panel {
        margin: 0.5rem 0;
    }
    
    .message {
        max-width: 95%;
    }
    
    .input-row {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .input-buttons {
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
    }
    
    .send-button, .attach-button {
        flex: 1;
        max-width: 48%;
    }
    
    .file-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .input-toolbar {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .toolbar-btn {
        min-width: 40px;
    }
    
    .canvas-toolbar {
        justify-content: center;
    }
    
    .panel-controls {
        flex-wrap: wrap;
    }
    
    .code-tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1;
        min-width: 80px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0.5rem;
    }
    
    .header h1 {
        font-size: 1.3rem;
    }
    
    .header p {
        font-size: 0.9rem;
    }
    
    .theme-controls {
        position: static;
        margin-top: 0.5rem;
        text-align: center;
    }
    
    .chat-messages {
        padding: 0.5rem;
    }
    
    .message {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .input-container {
        padding: 0.5rem;
    }
    
    .message-input {
        min-height: 60px;
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .input-toolbar {
        padding: 0.25rem;
        gap: 0.25rem;
    }
    
    .toolbar-btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .canvas-toolbar {
        gap: 0.25rem;
        padding: 0.25rem;
    }
    
    .file-upload-modal {
        width: 95% !important;
        margin: 1rem !important;
    }
    
    .modal-content {
        padding: 1rem !important;
    }
    
    .file-drop-zone {
        padding: 1rem !important;
    }
    
    .drop-zone-icon {
        font-size: 2rem !important;
    }
    
    .drop-zone-text {
        font-size: 1rem !important;
    }
}

/* Print Styles */
@media print {
    .header, .input-container, .panel-controls, .code-tabs, .canvas-toolbar {
        display: none !important;
    }
    
    .main-container {
        flex-direction: column;
        height: auto;
    }
    
    .chat-panel, .code-panel {
        margin: 0;
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .chat-messages {
        max-height: none;
        overflow: visible;
    }
    
    .message {
        break-inside: avoid;
        margin-bottom: 1rem;
        border: 1px solid #ccc;
    }
    
    .user-message {
        background: #f0f0f0 !important;
        color: #000 !important;
    }
    
    .kylie-message {
        background: #fff !important;
        color: #000 !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000;
        --text-primary: #000;
        --text-secondary: #333;
        --bg-secondary: #fff;
        --bg-tertiary: #f0f0f0;
    }
    
    [data-theme="dark"] {
        --border-color: #fff;
        --text-primary: #fff;
        --text-secondary: #ccc;
        --bg-secondary: #000;
        --bg-tertiary: #333;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .message {
        animation: none;
    }
    
    .toast {
        animation: none;
    }
}

/* Focus Styles for Accessibility */
*:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

button:focus, input:focus, select:focus, textarea:focus, [contenteditable]:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 1px;
}

/* Custom Scrollbars for better UX */
.file-tree-content::-webkit-scrollbar,
.uploaded-files::-webkit-scrollbar {
    width: 6px;
}

.file-tree-content::-webkit-scrollbar-track,
.uploaded-files::-webkit-scrollbar-track {
    background: transparent;
}

.file-tree-content::-webkit-scrollbar-thumb,
.uploaded-files::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.file-tree-content::-webkit-scrollbar-thumb:hover,
.uploaded-files::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* Animation for theme switching */
body.theme-transitioning * {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease !important;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.show {
    display: block !important;
}

.flex-show {
    display: flex !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.5rem !important; }
.mb-2 { margin-bottom: 1rem !important; }
.mb-3 { margin-bottom: 1.5rem !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.5rem !important; }
.mt-2 { margin-top: 1rem !important; }
.mt-3 { margin-top: 1.5rem !important; }

.p-0 { padding: 0 !important; }
.p-1 { padding: 0.5rem !important; }
.p-2 { padding: 1rem !important; }
.p-3 { padding: 1.5rem !important; }

/* Model Selector Styles */
.model-selector-container {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    min-height: 60px;
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    flex: 1;
}

.model-selector label {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    font-size: 0.9rem;
}

.model-select {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    min-width: 220px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.model-select:hover {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.model-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.model-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(5px);
    transition: var(--transition);
}

[data-theme="dark"] .model-status {
    background: rgba(0, 0, 0, 0.3);
}

.status-dot {
    font-size: 12px;
    line-height: 1;
    transition: var(--transition);
}

.status-text {
    font-size: 12px;
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
}

/* Status indicator animations */
.status-dot.pulse {
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.7; }
}

/* Model status color variations */
.model-status.healthy {
    border-color: var(--success-color);
    background: rgba(40, 167, 69, 0.1);
}

.model-status.warning {
    border-color: var(--warning-color);
    background: rgba(255, 193, 7, 0.1);
}

.model-status.error {
    border-color: var(--error-color);
    background: rgba(220, 53, 69, 0.1);
}

/* Enhanced message styling to show which model responded */
.message-model-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 8px;
    opacity: 0.8;
    transition: var(--transition);
}

.message-model-tag.kylie {
    background: rgba(102, 126, 234, 0.2);
    color: var(--accent-color);
    border: 1px solid rgba(102, 126, 234, 0.3);
}

.message-model-tag.claude {
    background: rgba(255, 107, 107, 0.2);
    color: #e03131;
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.message-model-tag.fallback {
    background: rgba(255, 193, 7, 0.2);
    color: var(--warning-color);
    border: 1px solid rgba(255, 193, 7, 0.3);
}

/* Quick model switch buttons (optional enhancement) */
.model-quick-switch {
    display: flex;
    gap: 4px;
    margin-left: 8px;
}

.model-quick-btn {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.model-quick-btn:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.model-quick-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* Responsive adjustments for model selector */
@media (max-width: 768px) {
    .model-selector-container {
        padding: 10px 12px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        min-height: auto;
    }
    
    .model-selector {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .model-select {
        min-width: auto;
        width: 100%;
    }
    
    .model-status {
        margin-left: 0;
        justify-content: center;
        align-self: center;
        min-width: 120px;
    }
    
    .model-quick-switch {
        margin-left: 0;
        justify-content: center;
        margin-top: 4px;
    }
}

@media (max-width: 480px) {
    .model-selector-container {
        padding: 8px 10px;
    }
    
    .model-selector label {
        font-size: 0.8rem;
        text-align: center;
    }
    
    .model-select {
        font-size: 13px;
        padding: 6px 10px;
    }
    
    .status-text {
        font-size: 11px;
    }
    
    .message-model-tag {
        font-size: 0.7rem;
        padding: 1px 6px;
    }
}

/* Theme toggle positioning adjustment */
.theme-toggle-header {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-light);
    padding: 0.5rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
    z-index: 1001;
}

.theme-toggle-header:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Loading state for model selector */
.model-selector.loading .model-select {
    opacity: 0.6;
    pointer-events: none;
}

.model-selector.loading .status-dot {
    animation: statusPulse 1s infinite;
}

/* Model performance indicator (optional) */
.model-performance {
    font-size: 0.7rem;
    opacity: 0.6;
    margin-top: 2px;
}

.model-performance.fast { color: var(--success-color); }
.model-performance.medium { color: var(--warning-color); }
.model-performance.slow { color: var(--error-color); }

/* Connection quality indicator */
.connection-quality {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
}

.connection-quality.excellent { background: #28a745; }
.connection-quality.good { background: #ffc107; }
.connection-quality.poor { background: #dc3545; }
.connection-quality.unknown { background: #6c757d; }

/* Accessibility improvements */
.model-select[aria-expanded="true"] {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.model-selector label[for="modelSelect"] {
    cursor: pointer;
}

/* Dark theme specific adjustments */
[data-theme="dark"] .model-selector-container {
    background: var(--bg-tertiary);
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .model-select {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .model-select:hover {
    border-color: var(--accent-color);
}

[data-theme="dark"] .message-model-tag.kylie {
    background: rgba(102, 126, 234, 0.3);
    color: #8fa8ff;
}

[data-theme="dark"] .message-model-tag.claude {
    background: rgba(255, 107, 107, 0.3);
    color: #ff6b6b;
}

[data-theme="dark"] .message-model-tag.fallback {
    background: rgba(255, 193, 7, 0.3);
    color: #ffd43b;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    margin-bottom: 8px;
    background: var(--bg-secondary);
    transition: var(--transition);
}

.file-item:hover {
    background: var(--bg-tertiary);
    transform: translateY(-1px);
}

.file-remove {
    background: var(--error-color);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-left: auto;
    transition: var(--transition);
}

.file-remove:hover {
    background: #c82333;
    transform: scale(1.05);
}

.file-info {
    flex: 1;
    margin-left: 12px;
}

.file-name {
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.file-details {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ===== SIDEBAR & PROJECT MANAGEMENT STYLES ===== */

/* Updated main container for 3-panel layout */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 0;
    height: calc(100vh - 160px);
}

/* Sidebar Panel */
.sidebar-panel {
    width: 280px;
    min-width: 200px;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    margin: 1rem 0 1rem 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    overflow: hidden;
    transition: var(--transition);
}

.sidebar-panel.collapsed {
    width: 50px;
    min-width: 50px;
}

.sidebar-panel.collapsed .sidebar-header h3,
.sidebar-panel.collapsed .project-search,
.sidebar-panel.collapsed .projects-list {
    display: none;
}

.sidebar-header {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 60px;
}

.sidebar-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: 0;
}

.sidebar-controls {
    display: flex;
    gap: 0.5rem;
}

/* Project Search */
.project-search {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.project-search .search-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
}

/* Projects List */
.projects-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.loading-projects {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Project Item */
.project-item {
    margin-bottom: 0.5rem;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    transition: var(--transition);
}

.project-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.project-item.active {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.project-header {
    padding: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    border-left: 4px solid transparent;
    transition: var(--transition);
}

.project-item.active .project-header {
    border-left-color: var(--accent-color);
    background: rgba(102, 126, 234, 0.05);
}

.project-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.project-info {
    flex: 1;
    min-width: 0;
}

.project-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    gap: 0.5rem;
}

.project-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 3px;
    transition: var(--transition);
    font-size: 0.9rem;
}

.project-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.project-toggle.expanded {
    transform: rotate(90deg);
}

/* Threads List */
.threads-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: var(--bg-tertiary);
}

.project-item.expanded .threads-list {
    max-height: 300px;
}

.thread-item {
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    border-left: 2px solid transparent;
}

.thread-item:hover {
    background: rgba(102, 126, 234, 0.1);
}

.thread-item.active {
    background: rgba(102, 126, 234, 0.15);
    border-left-color: var(--accent-color);
    font-weight: 600;
}

.thread-icon {
    font-size: 0.9rem;
    opacity: 0.7;
}

.thread-name {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thread-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Sidebar Resizer */
.sidebar-resizer {
    width: 4px;
    background: var(--border-color);
    cursor: col-resize;
    transition: var(--transition);
    margin: 1rem 0;
}

.sidebar-resizer:hover {
    background: var(--accent-color);
    width: 6px;
}

/* Updated Chat Panel */
.chat-panel {
    flex: 1;
    min-width: 400px;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    margin: 1rem 0;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

/* Thread Header */
.thread-header {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 70px;
}

.thread-info {
    flex: 1;
}

.thread-title {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.thread-project {
    font-size: 0.9rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

.thread-controls {
    display: flex;
    gap: 0.5rem;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal-overlay.show {
    visibility: visible;
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-hover);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(102, 126, 234, 0.3);
    transform: scale(0.8) translateY(-50px);
    transition: var(--transition);
}

.modal-overlay.show .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    color: white;
    padding: 1rem;
    border-radius: 13px 13px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.modal-content {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Enhanced Thread Display */
.thread-item .thread-meta {
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

.thread-item.has-new-messages {
    position: relative;
}

.thread-item.has-new-messages::after {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--accent-color);
    border-radius: 50%;
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.empty-state-subtitle {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Quick Actions */
.quick-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: var(--transition);
}

.project-item:hover .quick-actions,
.thread-item:hover .quick-actions {
    opacity: 1;
}

.quick-action {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.25rem;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
}

.quick-action:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* Responsive Design Updates */
@media (max-width: 1200px) {
    .main-container {
        flex-direction: column;
    }
    
    .sidebar-panel {
        width: 100%;
        height: 200px;
        margin: 0.5rem;
        flex-direction: row;
        overflow-x: auto;
    }
    
    .projects-list {
        display: flex;
        gap: 0.5rem;
        padding: 0.5rem;
    }
    
    .project-item {
        min-width: 200px;
        margin-bottom: 0;
    }
    
    .sidebar-resizer {
        width: 100%;
        height: 4px;
        cursor: row-resize;
        margin: 0;
    }
    
    .chat-panel, .code-panel {
        flex: none;
        height: 50vh;
    }
}

@media (max-width: 768px) {
    .sidebar-panel {
        height: 150px;
    }
    
    .thread-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding: 0.75rem;
        min-height: auto;
    }
    
    .thread-controls {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .modal {
        width: 95%;
        margin: 1rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .sidebar-panel.collapsed {
        width: 100%;
        height: 60px;
    }
}

/* Dark theme adjustments */
[data-theme="dark"] .sidebar-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .project-item {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

[data-theme="dark"] .threads-list {
    background: rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .thread-item:hover {
    background: rgba(102, 126, 234, 0.2);
}

/* Animation for project/thread loading */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.project-item {
    animation: fadeInUp 0.3s ease-out;
}

.thread-item {
    animation: fadeInUp 0.2s ease-out;
}

/* Scrollbar styling for sidebar */
.projects-list::-webkit-scrollbar {
    width: 6px;
}

.projects-list::-webkit-scrollbar-track {
    background: transparent;
}

.projects-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.projects-list::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* Loading animation for projects */
.loading-projects::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60% { content: '...'; }
    80%, 100% { content: ''; }
}

/* Add this to your style.css to fix the chat panel layout */

/* Fix the main chat panel layout */
.chat-panel {
    flex: 1;
    min-width: 400px;
    display: flex !important;
    flex-direction: column !important;
    background: var(--bg-secondary);
    margin: 1rem 0;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    overflow: hidden;
    height: calc(100vh - 160px) !important; /* Fixed height */
}

/* Fix chat messages container */
.chat-messages {
    flex: 1 !important;
    padding: 1rem;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
    min-height: 0 !important; /* Important for flex behavior */
    max-height: none !important; /* Remove conflicting max-height */
}

/* Fix input container to be sticky at bottom */
.input-container {
    flex-shrink: 0 !important; /* Never shrink */
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary) !important; /* Remove weird colors */
    position: relative; /* Make it stick to bottom */
    z-index: 10;
}

/* Remove the weird yellow background from your HTML */
.input-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-tertiary) !important; /* Consistent with theme */
    border-radius: var(--border-radius-sm);
    align-items: center;
    flex-wrap: wrap;
}

/* Make sure message input looks normal */
.message-input {
    width: 100%;
    min-height: 80px;
    max-height: 200px;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
    resize: vertical;
    font-family: inherit;
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    overflow-y: auto;
    line-height: 1.5;
}

/* Remove any forced height overrides */
.chat-panel .chat-messages {
    height: auto !important; /* Let flex handle it */
    border: none !important; /* Remove debug borders */
}

.input-container {
    height: auto !important; /* Let content determine height */
    background: var(--bg-secondary) !important; /* Remove yellow */
    overflow: visible !important;
}

/* Fix the send button area */
.input-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.send-button {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover)) !important;
    color: white !important;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: bold;
    min-height: 50px;
}

/* Dark theme fixes */
[data-theme="dark"] .input-container {
    background: var(--bg-secondary) !important;
    border-top-color: var(--border-color);
}

[data-theme="dark"] .input-toolbar {
    background: var(--bg-tertiary) !important;
}

[data-theme="dark"] .message-input {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color);
}