:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #252525;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --border: #2a2a2a;
    --success: #22c55e;
    --error: #ef4444;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

.app {
    display: flex;
    height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.experts-list {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.expert-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
}

.expert-card:hover {
    background: var(--bg-tertiary);
    border-color: var(--border);
}

.expert-card.active {
    background: var(--bg-tertiary);
    border-color: var(--accent);
}

.expert-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.expert-card.active .expert-icon {
    background: var(--accent);
}

.expert-info h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.expert-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.api-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

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

.current-expert {
    display: flex;
    align-items: center;
    gap: 10px;
}

.expert-name {
    font-size: 16px;
    font-weight: 600;
}

.expert-badge {
    font-size: 11px;
    padding: 4px 10px;
    background: var(--accent);
    border-radius: 20px;
    font-weight: 500;
}

.clear-btn {
    font-size: 13px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.clear-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Messages */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.welcome-message {
    max-width: 500px;
    margin: auto;
    text-align: center;
    padding: 40px 20px;
}

.welcome-message h2 {
    font-size: 24px;
    margin-bottom: 12px;
}

.welcome-message p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.message {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 16px 20px;
    border-radius: 16px;
    line-height: 1.6;
}

.message.user {
    background: var(--accent);
    margin-left: auto;
}

.message.assistant {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
}

.message-header {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    opacity: 0.8;
}

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

.message.loading {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
}

.message.loading .message-content {
    display: flex;
    gap: 4px;
}

.message.loading .message-content span {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.message.loading .message-content span:nth-child(1) { animation-delay: -0.32s; }
.message.loading .message-content span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Input Area */
.input-area {
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    background: var(--bg-primary);
}

.input-area textarea {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
}

.input-area textarea:focus {
    border-color: var(--accent);
}

.input-area textarea::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 48px;
    height: 48px;
    background: var(--accent);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

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

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

/* Scrollbar */
.messages::-webkit-scrollbar {
    width: 6px;
}

.messages::-webkit-scrollbar-track {
    background: transparent;
}

.messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.messages::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
