/*
 * ===============================================
 * Communications Log Component Styles (Corrected)
 * ===============================================
 */

#communications-log-container {
    max-width: 600px;
    width: 90vw;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 75vh;
    max-height: 550px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    overflow: hidden; 
}

.communications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0; 
}

.communications-header h2 {
    margin: 0;
    font-size: 1.2em;
}

.communications-message-list {
    flex-grow: 1; 
    overflow-y: auto; 
    overflow-x: hidden; 
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: #f8fafc;
    min-height: 0; 
}

.message-bubble {
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 80%;
    line-height: 1.4;
}

.message-text {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Ensure markdown-generated paragraphs have no extra margin */
.message-text p {
    margin: 0;
}

.message-meta {
    font-size: 0.7em;
    color: #64748b;
    margin-top: 5px;
    text-align: right;
    opacity: 0.8;
    display: flex; /* Use flexbox for alignment */
    justify-content: flex-end; /* Align items to the right */
    align-items: center; /* Vertically align items */
}

.message-bubble.sent {
    background-color: #4f46e5;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message-bubble.sent .message-meta {
    color: #c7d2fe;
}

.message-bubble.received {
    background-color: #e2e8f0;
    color: #1e293b;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message-list-empty {
    text-align: center;
    color: #94a3b8;
    margin: auto;
}

.communications-input-area {
    display: flex;
    padding: 15px 20px;
    border-top: 1px solid #e2e8f0;
    gap: 10px;
    align-items: flex-start;
    flex-shrink: 0; 
    background-color: #ffffff;
}

#communications-message-input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    resize: none;
    min-height: 120px;
    max-height: 200px;
    font-family: inherit;
    font-size: 1em;
    line-height: 1.5;
    overflow-y: auto;
    overflow-x: hidden; 
}

.communications-button-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

#communications-ai-assist-btn {
    height: 36px;
    padding: 8px 16px;
    background-color: #6366f1;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s;
}

#communications-ai-assist-btn:hover {
    background-color: #5855eb;
    transform: translateY(-1px);
}

#communications-ai-assist-btn:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

#communications-send-btn {
    flex-shrink: 0;
    height: 44px;
}

/* --- START OF NEW STYLE: Read Indicator --- */
.read-indicator {
    margin-left: 8px; /* Space it out from the timestamp */
    font-weight: 600;
    font-size: 0.9em;
    opacity: 0.9;
}
/* --- END OF NEW STYLE --- */