body {
    font-family: sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f0f2f5;
    margin: 0;
}

.chat-container {
    width: 90%;
    max-width: 500px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    height: 70vh; /* Limit height */
    overflow: hidden; /* Needed for flex structure */
}

.chat-header {
    background-color: #007bff;
    color: white;
    padding: 10px 15px;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h2 {
    margin: 0;
    font-size: 1.1em;
}

#reset-button {
    background: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
}
#reset-button:hover {
    background: #c82333;
}


.chat-box {
    flex-grow: 1; /* Takes available space */
    overflow-y: auto; /* Enables scrolling for messages */
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    padding: 8px 12px;
    border-radius: 15px;
    max-width: 75%;
    word-wrap: break-word;
    line-height: 1.4;
}

.message.user {
    background-color: #007bff;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.message.assistant {
    background-color: #e9ecef;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    align-self: center; /* Center error messages */
    max-width: 90%;
    text-align: center;
}

.chat-input {
    display: flex;
    padding: 10px;
    border-top: 1px solid #ddd;
}

#message-input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 20px;
    margin-right: 10px;
    outline: none;
}

#send-button {
    padding: 10px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
}

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

.status {
    padding: 5px 15px;
    font-size: 0.8em;
    color: #666;
    text-align: center;
    min-height: 1.2em; /* Prevent layout shift */
}