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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f8fafc;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    --agent-hover: #f1f5f9;
    --user-msg-bg: #2563eb;
    --assistant-msg-bg: #f1f5f9;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

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

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.main-content {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
    height: calc(100vh - 180px);
}

/* Agent Panel */
.agent-panel {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    overflow-y: auto;
}

.agent-panel h2 {
    margin-bottom: 15px;
    font-size: 1.3rem;
    color: var(--text-color);
}

.agent-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.agent-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.agent-card:hover {
    background: var(--agent-hover);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.agent-card.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.agent-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.agent-icon {
    font-size: 2rem;
}

.agent-card.active .agent-icon {
    filter: brightness(0) invert(1);
}

.agent-card h3 {
    font-size: 1.1rem;
    margin: 0;
}

.agent-card p {
    font-size: 0.9rem;
    opacity: 0.8;
    margin: 0;
}

.agent-card.active p {
    opacity: 0.9;
}

.loading {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
}

/* Chat Panel */
.chat-panel {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.agent-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.agent-info .agent-icon {
    font-size: 2.5rem;
}

.agent-info h3 {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.agent-description {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.btn-clear {
    background: #ef4444;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-clear:hover {
    background: #dc2626;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

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

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

.message {
    display: flex;
    gap: 12px;
    max-width: 80%;
    animation: slideIn 0.3s ease;
}

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

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: var(--user-msg-bg);
    color: white;
}

.message.assistant .message-avatar {
    background: var(--border-color);
}

.message-content {
    background: var(--assistant-msg-bg);
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
}

.message.user .message-content {
    background: var(--user-msg-bg);
    color: white;
}

.message-content pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 10px 0;
}

.message.user .message-content pre {
    background: rgba(255, 255, 255, 0.2);
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    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);
    }
    30% {
        transform: translateY(-10px);
    }
}

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

.chat-input {
    flex: 1;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: none;
    transition: border-color 0.2s;
}

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

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

.btn-send {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.btn-send:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-send:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.5;
}

/* Responsive */
@media (max-width: 968px) {
    .main-content {
        grid-template-columns: 1fr;
        height: auto;
    }

    .agent-panel {
        max-height: 300px;
    }

    .chat-panel {
        min-height: 500px;
    }

    .message {
        max-width: 90%;
    }
}
