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

#chat-container {
    width: 80%;
    max-width: 800px;
    height: 90vh;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

#chat-box {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    border-bottom: 1px solid #ddd;
}

.message {
    margin-bottom: 15px;
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 70%;
    line-height: 1.4;
}

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

.ai-message {
    background-color: #e9e9eb;
    color: #333;
    align-self: flex-start;
}

.message p {
    margin: 0;
    white-space: pre-wrap; /* Preserve whitespace and newlines */
}

#loading-indicator {
    padding: 10px 20px;
    color: #888;
    font-style: italic;
}

#chat-form {
    display: flex;
    padding: 20px;
    border-top: 1px solid #ddd;
    background-color: #f9f9f9;
}

#prompt-input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    resize: none;
    font-size: 16px;
    margin-right: 10px;
}

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

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

#chat-form input[type="file"] {
    border: 1px solid #ccc;
    padding: 8px;
    border-radius: 5px;
    margin-right: 10px;
    background-color: white;
}

#save-button {
    background-color: #28a745;
    margin-left: 10px;
}

#save-button:hover {
    background-color: #218838;
}

@media (max-width: 768px) {
    #chat-container {
        width: 100%;
        height: 100vh;
        border-radius: 0;
        box-shadow: none;
    }

    #chat-form {
        flex-direction: column;
        align-items: stretch;
    }

    #prompt-input {
        margin-right: 0;
        margin-bottom: 10px;
        min-height: 60px; /* Ensure textarea is tall enough on mobile */
    }

    #chat-form input[type="file"] {
        margin-right: 0;
        margin-bottom: 10px;
    }

    #chat-form button {
        width: 100%;
    }

    #save-button {
        margin-left: 0;
        margin-top: 10px;
    }

    .message {
        max-width: 90%;
    }
}
