:root {
    --bg-color: #f0f2f5;
    --chat-bg: #ffffff;
    --primary: #2563eb;
    --primary-gradient: linear-gradient(135deg, #2563eb, #1d4ed8);
    --user-msg-bg: #eff6ff;
    --ai-msg-bg: #ffffff;
    --text-color: #1e293b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.chat-container {
    width: 100%;
    max-width: 900px;
    height: 90vh;
    background: var(--chat-bg);
    border-radius: 20px;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Header */
.chat-header {
    padding: 20px;
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 10;
}

.logo {
    width: 40px;
    height: 40px;
    background: var(--primary-gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
}

.header-info h1 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-color);
}

.header-info p {
    margin: 0;
    font-size: 0.8rem;
    color: #64748b;
}

/* Chat Area */
#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

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

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

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

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

.message.ai .avatar {
    background: var(--primary-gradient);
    color: white;
}

.message.user .avatar {
    background: #64748b;
    color: white;
}

.bubble {
    padding: 12px 18px;
    border-radius: 15px;
    font-size: 0.95rem;
    line-height: 1.5;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.message.ai .bubble {
    background: var(--ai-msg-bg);
    border: 1px solid var(--border-color);
    border-top-left-radius: 2px;
}

.message.user .bubble {
    background: var(--user-msg-bg);
    color: #1e293b;
    border-top-right-radius: 2px;
}

/* Input Area */
.input-area {
    padding: 20px;
    background: white;
    border-top: 1px solid var(--border-color);
    position: relative;
}

.input-wrapper {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

textarea {
    width: 100%;
    padding: 15px 50px 15px 20px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    outline: none;
    resize: none;
    font-family: inherit;
    font-size: 1rem;
    max-height: 200px;
    line-height: 1.5;
    box-sizing: border-box;
    transition: all 0.2s;
    background: #f8fafc;
}

textarea:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#send-btn {
    position: absolute;
    right: 12px;
    bottom: 12px;
    background: var(--primary-gradient);
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
}

#send-btn:hover {
    opacity: 0.9;
}

#send-btn:active {
    transform: scale(0.95);
}

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

/* Formatting */
.bubble p { margin: 0 0 10px 0; }
.bubble p:last-child { margin: 0; }
.bubble code { background: #f1f5f9; padding: 2px 5px; border-radius: 4px; font-family: monospace; font-size: 0.9em; }
.bubble pre { background: #1e293b; color: #fff; padding: 10px; border-radius: 8px; overflow-x: auto; }
.bubble pre code { background: transparent; padding: 0; color: #fff; }

/* Loading Dots */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 10px 0;
}
.dot {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}
.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }

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