/* General Body Styles */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #282c34;
    color: #e0e0e0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}

/* --- Main Chat Container --- */
.chat-container {
    background-color: #3a3f47;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 600px;
    height: 100%;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
}

h1 {
    text-align: center;
    color: #4CAF50;
    margin-bottom: 20px;
    font-size: 1.6em;
    flex-shrink: 0;
}

/* --- Messages Area --- */
.messages-box {
    flex-grow: 1;
    border: 1px solid #555;
    border-radius: 8px;
    padding: 15px;
    overflow-y: auto;
    margin-bottom: 15px;
    background-color: #2c313a;
    display: flex;
    flex-direction: column;
}

.message {
    padding: 10px 15px;
    border-radius: 15px;
    margin-bottom: 10px;
    max-width: 85%;
    word-wrap: break-word;
    display: flex;
    flex-direction: column;
}

.user-message {
    background-color: #007bff;
    color: white;
    align-self: flex-end;
}

.bot-message {
    background-color: #6c757d;
    color: white;
    align-self: flex-start;
}

.message img {
    margin-bottom: 5px;
    max-width: 100%;
    border-radius: 8px;
}

/* --- Input Area --- */
.input-area {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

#text-input {
    flex-grow: 1;
    padding: 10px 15px;
    border: 1px solid #555;
    border-radius: 20px;
    background-color: #444;
    color: #e0e0e0;
    font-size: 1em;
}

.action-button-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-button {
    padding: 10px 15px;
    border: none;
    border-radius: 20px;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    font-size: 1em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: background-color 0.2s ease;
}

.chat-button:hover {
    background-color: #0056b3;
}

.chat-button i {
    font-size: 1.2em;
}

#microphone-button.recording {
    background-color: #dc3545;
}

#microphone-button.recording:hover {
    background-color: #c82333;
}

.status-display {
    text-align: center;
    margin-top: 10px;
    font-size: 0.9em;
    color: #bbb;
}

/* --- Image Preview --- */
.image-preview-area {
    background-color: #2c313a;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    width: 100%;
    box-sizing: border-box;
}

.preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.preview-wrapper {
    position: relative;
    flex-shrink: 0;
}

.preview-wrapper img {
    width: 70px;
    height: 70px;
    border-radius: 5px;
    object-fit: cover;
}

.preview-remove-button {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #dc3545;
    color: white;
    border: 1px solid #fff;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    line-height: 20px;
}

.preview-remove-button:hover {
    background-color: #c82333;
}

#send-button span {
    display: inline;
}

@media (max-width: 600px) {
    .input-area {
        flex-direction: column;
        gap: 15px;
    }

    #text-input {
        width: 100%;
    }

    .action-button-group {
        display: flex;
        justify-content: center;
        gap: 20px;
        width: 100%;
    }   

    .action-button-group .chat-button {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        padding: 0;
        flex-shrink: 0;
        background-color: #6c757d;
    }

    #upload-image-button, #microphone-button, #send-button{ background-color: #007bff;}
    
    .action-button-group .chat-button i {
        font-size: 1.3em;
        margin: 0;
    }

    #send-button span {
        display: none;
    }
}