/* 1. Reset and Page Centering */
body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f2f5;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    /* Full screen height */
}

/* 2. The Main App Container */
#chat-container {
    background-color: white;
    width: 100%;
    max-width: 400px;
    height: 600px;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    /* Prevents children from leaking out */
}

/* 3. The Messages "Zone" */
#messages {
    flex: 1;
    /* Takes up all available space above the input */
    padding: 20px;
    overflow-y: auto;
    /* Enables scrolling */
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: #ffffff;

    /* FIX: Prevents messages from being cut off at the top */
    justify-content: flex-start;
    min-height: 0;
}

/* 4. Automatic Bubble Styling */
/* Targets every <div> added by Brython inside the messages zone */
#messages>div {
    background-color: #0084ff;
    color: white;
    padding: 10px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    /* Give it a "tail" look */
    align-self: flex-start;
    max-width: 80%;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 5. The Bottom Input Bar */
#input-area {
    display: flex;
    padding: 15px;
    background-color: #f8f9fa;
    border-top: 1px solid #eeeeee;
    gap: 10px;
}

input#message_input {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid #dddddd;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.2s;
}

input#message_input:focus {
    border-color: #0084ff;
}

button#send_button {
    background-color: #0084ff;
    color: white;
    border: none;
    padding: 0 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: background-color 0.2s;
}

button#send_button:hover {
    background-color: #0073e6;
}

/* Scrollbar Styling (Optional, for a cleaner look) */
#messages::-webkit-scrollbar {
    width: 6px;
}

#messages::-webkit-scrollbar-thumb {
    background-color: #cccccc;
    border-radius: 10px;
}