:root {
    --primary-color: #0366d6;
    --secondary-color: #586069;
    --success-color: #28a745;
    --danger-color: #d73a49;
    --bg-color: #f6f8fa;
    --panel-bg: #ffffff;
    --border-color: #e1e4e8;
    --text-color: #24292e;
    --text-muted: #586069;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 30px 0;
    background: linear-gradient(135deg, var(--primary-color), #0550ae);
    color: white;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

.main-content {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.config-panel {
    background: var(--panel-bg);
    padding: 25px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    height: fit-content;
}

.config-panel h2 {
    font-size: 1.5em;
    margin-bottom: 20px;
    color: var(--text-color);
}

.config-section {
    margin-bottom: 25px;
}

.config-section h3 {
    font-size: 1em;
    margin-bottom: 10px;
    color: var(--text-muted);
    font-weight: 600;
}

.config-section small {
    display: block;
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 0.85em;
}

.input-field {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary-color);
}

details {
    cursor: pointer;
}

details summary {
    padding: 10px;
    background: var(--bg-color);
    border-radius: 6px;
    font-weight: 600;
    user-select: none;
}

.advanced-settings {
    margin-top: 15px;
    padding: 15px;
    background: var(--bg-color);
    border-radius: 6px;
}

.advanced-settings label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.9em;
}

.advanced-settings input[type="checkbox"] {
    margin-right: 8px;
}

.provider-settings {
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.provider-settings .input-field {
    margin-bottom: 10px;
}

.btn {
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 10px;
}

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

.btn-primary:hover {
    background: #0550ae;
}

.btn-primary:disabled {
    background: var(--border-color);
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--danger-color);
    color: white;
}

.btn-secondary:hover {
    background: #cb2431;
}

.btn-send {
    width: auto;
    padding: 10px 30px;
    background: var(--primary-color);
    color: white;
}

.btn-send:hover {
    background: #0550ae;
}

.btn-send:disabled {
    background: var(--border-color);
    cursor: not-allowed;
}

.status {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 6px;
    font-size: 0.9em;
}

.status-indicator {
    margin-right: 8px;
    font-size: 1.2em;
}

.status-indicator.connected {
    color: var(--success-color);
}

.status-indicator.disconnected {
    color: var(--text-muted);
}

.chat-panel {
    background: var(--panel-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 250px);
    min-height: 500px;
}

.chat-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
}

.chat-header h2 {
    font-size: 1.5em;
    margin-bottom: 5px;
}

.chat-header small {
    color: var(--text-muted);
}

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

.welcome-message {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.welcome-message h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.welcome-message p {
    margin-bottom: 10px;
}

.welcome-message ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.welcome-message li {
    margin-bottom: 8px;
}

.welcome-message .note {
    margin-top: 15px;
    padding: 10px;
    background: white;
    border-radius: 6px;
    font-weight: 600;
    color: var(--primary-color);
}

.message {
    margin-bottom: 20px;
    animation: fadeIn 0.3s;
}

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

.message.user {
    text-align: right;
}

.message-bubble {
    display: inline-block;
    max-width: 80%;
    padding: 12px 18px;
    border-radius: 18px;
    word-wrap: break-word;
}

.message.user .message-bubble {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-bubble {
    background: var(--bg-color);
    color: var(--text-color);
    border-bottom-left-radius: 4px;
    text-align: left;
}

.message-bubble pre {
    background: #f0f0f0;
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 10px 0;
    white-space: pre-wrap;
}

.message-bubble code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

.typing-indicator {
    display: inline-block;
    padding: 12px 18px;
    background: var(--bg-color);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.chat-input-container {
    display: flex;
    gap: 10px;
    padding: 20px 25px;
    border-top: 1px solid var(--border-color);
}

.chat-input {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.chat-input:disabled {
    background: var(--bg-color);
    cursor: not-allowed;
}

footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.9em;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive design */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .config-panel {
        margin-bottom: 20px;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }
    
    .subtitle {
        font-size: 1em;
    }
    
    .chat-panel {
        height: 600px;
    }
}
