:root {
    --primary-color: #ff6b6b; /* Warm color, friendly */
    --secondary-color: #feca57;
    --bg-color: #f0f2f5;
    --chat-bg-user: #95ec69;
    --chat-bg-ai: #ffffff;
    --text-color: #333333;
    --border-color: #ddd;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 18px; /* Base font size larger for older users */
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 600px;
    margin: 0 auto;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    position: relative;
}

/* Header */
header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 10;
}

header h1 {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 5px;
}

header p {
    font-size: 16px;
    opacity: 0.9;
}

/* Chat Area */
#chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: var(--bg-color);
    scroll-behavior: smooth;
}

.message {
    display: flex;
    margin-bottom: 20px;
    align-items: flex-start;
}

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

.avatar {
    font-size: 30px;
    margin: 0 10px;
    flex-shrink: 0;
}

.content {
    padding: 15px;
    border-radius: 15px;
    max-width: 80%;
    font-size: 18px;
    line-height: 1.6;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.system-message .content, 
.ai-message .content {
    background-color: var(--chat-bg-ai);
    border-top-left-radius: 0;
    border: 1px solid var(--border-color);
}

.user-message .content {
    background-color: var(--chat-bg-user);
    border-top-right-radius: 0;
}

/* Markdown Styles in Chat */
.content ul, .content ol {
    margin-left: 20px;
    margin-top: 10px;
    margin-bottom: 10px;
}

.content p {
    margin-bottom: 10px;
}

.content p:last-child {
    margin-bottom: 0;
}

/* Input Area */
.input-area {
    background-color: #fff;
    padding: 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

#question-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    font-size: 18px;
    outline: none;
    resize: none;
    height: 50px;
    line-height: 24px;
    transition: border-color 0.3s;
}

#question-input:focus {
    border-color: var(--primary-color);
}

#send-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 0 25px;
    height: 50px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

#send-btn:active {
    background-color: #e65b5b;
}

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

/* Loading Animation */
.typing-indicator {
    display: inline-block;
}
.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #999;
    border-radius: 50%;
    animation: typing 1s infinite;
    margin: 0 2px;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}
