body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f9;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

.page-header {
    width: 100%;
    max-width: 800px;
    background-color: #fff;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h1 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

.page-header a {
    text-decoration: none;
    color: #007bff;
    font-weight: bold;
}

.chat-container {
    width: 100%;
    max-width: 800px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

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

.message {
    padding: 10px 15px;
    border-radius: 20px;
    margin-bottom: 10px;
    max-width: 70%;
    word-wrap: break-word;
    white-space: pre-wrap; /* preserve newlines from htmlToText() */
}

.user-message {
    background-color: #007bff;
    color: white;
    align-self: flex-end;
}

.bot-message {
    background-color: #e2e2e2;
    color: #333;
    align-self: flex-start;
}

.chat-input-form {
    display: flex;
    padding: 20px;
    border-top: 1px solid #ccc;
}

.chat-input-form input {
    flex-grow: 1;
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 20px;
    margin-right: 10px;
    font-size: 1rem;
}

.chat-input-form button {
    padding: 10px 20px;
    border: none;
    background-color: #007bff;
    color: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1rem;
}

/* Typing indicator (three-dot animation) */
.typing-indicator {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: #555;
    border-radius: 50%;
    display: inline-block;
    opacity: 0.2;
    animation: typingBlink 1s infinite ease-in-out;
}

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

@keyframes typingBlink {
    0%, 80%, 100% { opacity: 0.2; }
    40% { opacity: 1; }
}

/* Citations styling */
.citations {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #555;
}
.citations-title {
    font-weight: 600;
    margin-bottom: 4px;
}
.citations-list {
    list-style: disc inside;
    margin: 0;
    padding: 0;
}
.citation-item {
    opacity: 0.9;
}