/* Basic styling for the chat interface */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    direction: rtl; /* Right-to-left for Farsi */
    text-align: right;
}

#chat-container {
    width: 90%;
    max-width: 600px;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column; /* Stack chat-box, controls, and input vertically */
    height: 80vh; /* Give it a fixed height for scrolling demo */
}

#chat-box {
    flex-grow: 1; /* Allow chat-box to fill available space */
    padding: 20px;
    overflow-y: auto; /* Enable scrolling */
    border-bottom: 1px solid #eee;
    display: flex; /* Use flex for message alignment wrappers */
    flex-direction: column; /* Stack messages vertically */
}

.message-wrapper {
    display: flex; /* Use flex to align the message div within the wrapper */
    margin-bottom: 15px;
    max-width: 100%; /* Wrapper can take full width */
}

.user-message-wrapper {
    justify-content: flex-end; /* Align user message bubble to the right */
}

.bot-message-wrapper {
    justify-content: flex-start; /* Align bot message bubble to the left */
}

.message {
    padding: 10px;
    border-radius: 5px;
    max-width: 80%; /* Limit message bubble width */
    word-wrap: break-word; /* Break long words */
}

.user-message {
    background-color: #dcf8c6;
}

.bot-message {
    background-color: #e9e9eb;
}

#controls-area {
    padding: 10px 15px;
    background-color: #e9e9eb;
    border-bottom: 1px solid #ddd;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

#controls-area label {
    font-weight: bold;
}

#controls-area select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    background-color: #fff;
}


#input-area {
    display: flex;
    padding: 15px;
    background-color: #f9f9f9;
    align-items: center;
    border-top: 1px solid #eee;
}

#user-input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-left: 10px;
    font-size: 1rem;
    text-align: right;
    box-sizing: border-box;
}

#send-button {
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
    box-sizing: border-box;
}

#send-button:hover {
    background-color: #0056b3;
}

/* Styling for the loading indicator */
.bot-message-wrapper .message.loading {
    font-style: italic;
    color: #888;
}

/* Style for error messages */
.bot-message-wrapper .message.error {
    background-color: #ffcccc; /* Light red background */
    color: #d32f2f; /* Dark red text */
    border: 1px solid #d32f2f;
}