/* messaging.css */

/* Reset & body */
* {
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background-color: #fff8f1; /* pale orange/cream */
    color: #222222;
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Container for messaging app */
.messaging-container {
    display: flex;
    flex: 1;
    height: calc(100vh - 60px); /* adjust for header/footer if any */
    overflow: hidden;
    background: white;
    box-shadow: 0 0 10px rgb(0 0 0 / 0.05);
    border-radius: 8px;
    margin: 20px;
}

/* Left pane: Thread list */
.thread-list {
    width: 320px;
    border-right: 1px solid #eee;
    overflow-y: auto;
    background-color: #fff8f1;
}

/* Thread list header */
.thread-list-header {
    padding: 16px;
    font-weight: 700;
    font-size: 1.25rem;
    border-bottom: 1px solid #eee;
    color: #ff6a00;
}

/* Individual thread item */
.thread-item {
    display: flex;
    flex-direction: row;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s ease;
    align-items: center;
}
.thread-item:hover,
.thread-item.active {
    background-color: #ffe0b2; /* light orange */
}

/* Avatar circle */
.thread-item .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #ff6a00;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    margin-right: 12px;
    flex-shrink: 0;
}

/* Thread info */
.thread-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Thread subject and snippet */
.thread-subject {
    font-weight: 600;
    font-size: 1rem;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.thread-snippet {
    font-size: 0.875rem;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Thread timestamp */
.thread-time {
    font-size: 0.75rem;
    color: #999;
    margin-left: 8px;
    flex-shrink: 0;
}

/* Unread badge */
.thread-unread-badge {
    background-color: #d84315;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 9999px;
    margin-left: 8px;
}

/* Right pane: Conversation view */
.conversation-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 20px 30px;
    background-color: #fff;
}

/* Conversation header */
.conversation-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-weight: 700;
    font-size: 1.2rem;
    color: #ff6a00;
}

/* Messages container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Individual message card */
.message-card {
    max-width: 70%;
    padding: 15px 20px;
    background-color: #fff8f1;
    border-radius: 12px;
    box-shadow: 0 2px 5px rgb(0 0 0 / 0.05);
    position: relative;
    font-size: 1rem;
    line-height: 1.4;
}

/* Differentiate sender and receiver */
.message-card.sent {
    background-color: #ff6a00;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}
.message-card.received {
    background-color: #fff8f1;
    color: #222;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

/* Message metadata: time and sender */
.message-meta {
    font-size: 0.75rem;
    color: #666;
    margin-top: 6px;
    display: flex;
    justify-content: space-between;
}

/* Input area for replying */
.message-reply {
    padding-top: 15px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 12px;
}

/* Reply textarea */
.message-reply textarea {
    flex: 1;
    resize: none;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 12px 15px;
    font-size: 1rem;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    transition: border-color 0.2s ease;
}
.message-reply textarea:focus {
    border-color: #ff6a00;
    outline: none;
}

/* Reply send button */
.message-reply button {
    background-color: #ff6a00;
    border: none;
    color: white;
    padding: 12px 18px;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
.message-reply button:hover {
    background-color: #cc5500;
}

/* Scrollbar styling */
.thread-list::-webkit-scrollbar,
.messages-container::-webkit-scrollbar {
    width: 8px;
}
.thread-list::-webkit-scrollbar-thumb,
.messages-container::-webkit-scrollbar-thumb {
    background-color: #ff6a00;
    border-radius: 4px;
}

/* Responsive */
@media (max-width: 768px) {
    .messaging-container {
        flex-direction: column;
        height: auto;
        margin: 10px;
    }
    .thread-list {
        width: 100%;
        height: 200px;
        border-right: none;
        border-bottom: 1px solid #eee;
    }
    .conversation-view {
        padding: 15px;
        height: auto;
    }
    .message-card {
        max-width: 100%;
    }
    .message-reply {
        flex-direction: column;
    }
    .message-reply button {
        width: 100%;
    }
}
