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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f0f0f;
    color: #ffffff;
    line-height: 1.6;
    overflow: hidden;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: #1a1a1a;
    border-bottom: 1px solid #333;
    height: 60px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.project-selector {
    position: relative;
}

.project-dropdown-btn {
    background: #2a2a2a;
    border: 1px solid #444;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 150px;
    justify-content: space-between;
}

.dropdown-arrow {
    font-size: 0.8rem;
    opacity: 0.7;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 0.5rem;
    min-width: 200px;
    display: none;
    z-index: 1000;
    margin-top: 0.5rem;
}

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

.dropdown-header {
    padding: 0.5rem;
    font-weight: 600;
    color: #888;
    border-bottom: 1px solid #444;
    margin-bottom: 0.5rem;
}

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

.project-item {
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    margin-bottom: 0.25rem;
}

.project-item:hover {
    background: #3a3a3a;
}

.project-item.active {
    background: #667eea;
    color: white;
}

.no-projects {
    padding: 1rem;
    color: #888;
    text-align: center;
    font-style: italic;
}

.new-project-btn {
    width: 100%;
    background: #667eea;
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 0.5rem;
}

.new-project-btn:hover {
    background: #5a6fd8;
}

.header-right {
    position: relative;
}

.settings-btn {
    background: #2a2a2a;
    border: 1px solid #444;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
}

.settings-panel {
    position: absolute;
    top: 100%;
    right: 0;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 1rem;
    min-width: 250px;
    display: none;
    z-index: 1000;
    margin-top: 0.5rem;
}

.settings-panel.show {
    display: block;
}

.model-select {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.model-select label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.25rem;
}

.model-select input {
    margin-right: 0.5rem;
}

.model-info {
    color: #888;
    font-size: 0.8rem;
    border-top: 1px solid #444;
    padding-top: 0.5rem;
}

.main-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: calc(100vh - 60px);
}

.chat-container {
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.welcome-message {
    text-align: center;
    color: #888;
    padding: 2rem;
}

.welcome-message h3 {
    margin-bottom: 0.5rem;
    color: #fff;
}

.message {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 8px;
    background: #1a1a1a;
    border: 1px solid #333;
}

.message.user {
    background: #2a2a2a;
    border-color: #444;
}

.message.ai {
    background: #1a1a1a;
}

.message-header {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #667eea;
}

.message-content {
    color: #ddd;
    white-space: pre-wrap;
}

.chat-input-container {
    padding: 1rem;
    border-top: 1px solid #333;
    display: flex;
    gap: 0.5rem;
    align-items: end;
}

#chatInput {
    flex: 1;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #fff;
    padding: 0.75rem;
    border-radius: 6px;
    resize: none;
    font-family: inherit;
    line-height: 1.4;
}

#chatInput:focus {
    outline: none;
    border-color: #667eea;
}

.send-btn {
    background: #667eea;
    border: none;
    color: white;
    padding: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.send-btn:hover {
    background: #5a6fd8;
}

.send-btn:disabled {
    background: #444;
    cursor: not-allowed;
}

.code-container {
    display: flex;
    flex-direction: column;
}

.code-header {
    padding: 1rem;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.code-actions {
    display: flex;
    gap: 0.5rem;
}

.copy-btn {
    background: #2a2a2a;
    border: 1px solid #444;
    color: #fff;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-btn:hover {
    background: #3a3a3a;
}

.code-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #0a0a0a;
}

.no-code {
    color: #888;
    text-align: center;
    padding: 2rem;
    font-style: italic;
}

.code-block {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.code-block pre {
    margin: 0;
    padding: 1rem;
    overflow-x: auto;
    background: #1a1a1a;
    color: #e1e1e1;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
}

.code-block .language {
    background: #2a2a2a;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    color: #888;
    border-bottom: 1px solid #333;
}

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

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Animation for new messages */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    animation: slideIn 0.3s ease-out;
}

/* Responsive design */
@media (max-width: 768px) {
    .main-container {
        grid-template-columns: 1fr;
    }
    
    .chat-container {
        border-right: none;
        border-bottom: 1px solid #333;
    }
    
    .header {
        padding: 1rem;
    }
    
    .logo {
        font-size: 1.2rem;
    }
}