* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;

    /* Background image (as you have it) */
    background-image: url('moor-community.jpeg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;

    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.chat-container {
    width: 800px;
    height: 600px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    background: #202020;
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h2 {
    font-size: 1.2em;
    font-weight: 600;
}

.status-indicator {
    background: #4CAF50;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 500;
}

.status-indicator.disconnected {
    background: #f44336;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.message {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.user-message {
    align-items: flex-end;
}

.bot-message {
    align-items: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 15px 20px;
    border-radius: 20px;
    word-wrap: break-word;
    line-height: 1.4;
}

.user-message .message-content {
    background: #0082c9;
    color: white;
    border-bottom-right-radius: 5px;
}

.bot-message .message-content {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 5px;
}

.message-time {
    font-size: 0.7em;
    color: #999;
    margin-top: 5px;
    padding: 0 10px;
}

/* --- Consolidated Chat Input Container --- */
.chat-input-container {
    display: flex;
    align-items: center; /* Vertically align items in the middle */
    padding: 20px; /* From your existing, takes precedence */
    background: #202020; /* From your existing, takes precedence */
    border-top: 1px solid #e0e0e0; /* From your existing, takes precedence */
    gap: 10px; /* From both, remains consistent */
    width: 100%; /* Ensures it takes the full width */
    box-sizing: border-box; /* Important for responsive sizing */
}

/* --- Consolidated User Input Field --- */
/* Assuming your HTML uses id="messageInput" as per your latest CSS */
#messageInput {
    flex: 1; /* Combines flex-grow: 1, flex-shrink: 1, flex-basis: 0% */
    min-width: 0; /* Crucial: Allows the input to shrink smaller on mobile */
    padding: 15px 20px;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.3s;
    box-sizing: border-box; /* Important for responsive sizing */
}

#messageInput:focus {
    border-color: #0082c9;
}

/* --- Consolidated Send Button --- */
#sendButton {
    flex-shrink: 0; /* Prevents the button from shrinking on mobile */
    padding: 15px 30px;
    background: #0082c9; /* From your existing, takes precedence */
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
    font-size: 1rem; /* Added for consistency, ensures it's readable */
    box-sizing: border-box; /* Important for responsive sizing */
}

#sendButton:hover {
    background: #006ba3;
}

#sendButton:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.typing-indicator {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    border-bottom-left-radius: 5px;
    max-width: 70%;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.5s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* --- Media Queries for overall chat container and messages --- */
@media (max-width: 768px) {
    .chat-container {
        width: 95%;
        height: 90%;
        margin: 20px;
    }

    .message-content {
        max-width: 85%;
    }
}

/* --- Media Query specifically for smaller input area on very small screens --- */
@media (max-width: 480px) {
    .chat-input-container {
        padding: 10px; /* Slightly less padding for very small screens */
        gap: 8px;
    }
    #messageInput, #sendButton {
        padding: 10px 15px; /* Adjust padding for a more compact look */
        font-size: 0.9rem; /* Slightly smaller font size for input and button */
    }
    #sendButton {
        min-width: 60px; /* Ensure a minimum width for the button even if content is short */
    }
}