/* --- Base & Body --- */
body {
    font-family: 'Inter', sans-serif;
    /* Changed background to the neutral gray behind the app */
    background-color: #D6DBD5; 
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    color: #1F2937;
}

.chat-app-wrapper {
    width: 100%;
    max-width: 480px;
    height: 90vh;
    min-height: 600px;
    padding: 1rem;
}

#chat-container {
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #D1D5DB;
}

/* --- Header --- */
#chat-header {
    background-color: #F0F2F5; 
    color: #1F2937;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #E5E7EB;
    flex-shrink: 0;
}

.avatar-image {
    width: 40px; 
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px; 
    flex-shrink: 0;
    border: 1px solid #E0E0E0;
}

/* UPDATED: Simplified header */
.header-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.header-info h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #111B21; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis;
    line-height: 1.2; /* Ensures good vertical alignment */
}
/* REMOVED: .status-text styles are no longer needed */

/* --- Message Area --- */
#chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: #E5DDD5;
    background-image: url("https://user-images.githubusercontent.com/15075759/28719144-86336F9C-734E-11E7-831F-122B6E1B861D.png");
}

.message-bubble {
    padding: 8px 12px;
    border-radius: 8px; 
    max-width: 85%;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}

.message-timestamp {
    display: block;
    font-size: 0.7rem;
    margin-top: 4px;
    text-align: right;
    color: #54656F;
    opacity: 0.7;
}

/* --- CHANGED THIS RULE --- */
/* 1. Renamed from .bot-message to .received-message to match your JS */
/* 2. Changed background-color from #FFFFFF to grey */
.received-message {
    background-color: #F0F2F5; /* This is the grey color you wanted */
    color: #1F2937;
    border-top-left-radius: 0;
    align-self: flex-start;
}

.received-message .message-timestamp {
    text-align: right;
}

.user-message {
    background-image: none;
    background-color: #DCF8C6;
    color: #111B21;
    border-top-right-radius: 0;
    align-self: flex-end;
}

.user-message .message-timestamp {
    color: #54656F;
}

/* --- Typing Indicator --- */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background-color: #FFFFFF;
    border-radius: 8px;
    border-top-left-radius: 0;
    align-self: flex-start;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}
.typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: #9CA3AF;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: bounce 1.4s infinite both;
}
.typing-indicator span:nth-child(1) { animation-delay: 0.0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/* --- Input Form --- */
#chat-input-form {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background-color: #F0F2F5;
    border-top: 1px solid #E5E7EB;
}

#attach-button {
    background: none;
    border: none;
    color: #54656F;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    margin-right: 5px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
#attach-button:hover {
    background-color: #E0E0E0;
}
#attach-button svg {
    transform: rotate(45deg);
}

#message-input {
    flex-grow: 1;
    border: none;
    background-color: #FFFFFF; 
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 0.9rem;
    outline: none;
    transition: background-color 0.2s ease;
}

#message-input:focus {
    background-color: #FAFAFA;
}

#send-button {
    background: none;
    border: none;
    color: #54656F; 
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    margin-left: 10px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

#send-button:hover:not(:disabled) {
    background-color: #E0E0E0;
}

#send-button:disabled {
    color: #9CA3AF;
    cursor: not-allowed;
}

#send-button svg {
    margin-left: 2px;
}