/* message.css */

.message-container {
    max-width: 1400px;
    margin: 8px auto 14px;
    padding: 0 12px;
    display: flex;
    gap: 12px;
    height: calc(100vh - 95px); /* Fill remaining height cleanly */
    min-height: 520px;
}

/* Sidebar */
.message-sidebar {
    width: 360px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.msg-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.msg-tab {
    flex: 1;
    padding: 0.75rem 0;
    background: transparent;
    border: none;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-medium);
    cursor: pointer;
    position: relative;
}

.msg-tab.active {
    color: var(--text-dark);
}

.msg-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary-green);
}

.msg-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #fdfdfd;
    border-bottom: 1px solid var(--border-color);
}

.btn-filter-small {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-dark);
}

.msg-list {
    flex: 1;
    overflow-y: auto;
}

/* Custom Scrollbar for msg-list */
.msg-list::-webkit-scrollbar {
    width: 5px;
}
.msg-list::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

.msg-item {
    display: flex;
    padding: 10px 14px;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}

.msg-item:hover {
    background: #f9f9f9;
}

.msg-item.active {
    background: #f0f4f8;
}

.msg-avatar-wrapper {
    position: relative;
}

.msg-avatar-wrapper img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
}

.online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: var(--primary-green);
    border: 2px solid white;
    border-radius: 50%;
}

.crown-badge {
    position: absolute;
    top: -5px;
    left: -5px;
    background: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.crown-badge i {
    font-size: 0.6rem;
    color: #6a1b9a; /* Purple color for premium */
}

.msg-info {
    flex: 1;
    overflow: hidden;
}

.msg-info-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.msg-info-top h4 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-date {
    font-size: 0.75rem;
    color: var(--text-light);
}

.msg-info p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-medium);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Assisted Service Item */
.msg-item.assisted-service {
    background: #f9f9f9;
}

.assisted-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--primary-orange); /* Or another brand color */
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 2px solid var(--primary-green);
}

.unread-count {
    background: var(--primary-orange);
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
}

/* Main Chat Area */
.chat-main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-top-search {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-medium);
}

.search-box input {
    border: none;
    border-bottom: 1px solid var(--border-color);
    padding: 5px;
    font-size: 0.9rem;
    outline: none;
    background: transparent;
    width: 200px;
}

.search-box input:focus {
    border-bottom-color: var(--primary-orange);
}

.chat-window {
    flex: 1;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* Chat Header */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.header-user-info h3 {
    margin: 0 0 2px 0;
    font-size: 1.05rem;
    color: var(--text-dark);
    line-height: 1.2;
}

.last-seen {
    font-size: 0.75rem;
    color: var(--text-light);
    display: inline-block;
    margin-bottom: 0;
}

.user-badges {
    display: flex;
    gap: 8px;
    font-size: 0.75rem;
}

.badge-verified {
    color: #007bff;
    display: flex;
    align-items: center;
    gap: 4px;
}

.badge-paid {
    color: #6a1b9a;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Dropdown */
.dropdown-container {
    position: relative;
}

.btn-menu {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    color: var(--text-medium);
    cursor: pointer;
    padding: 5px;
}

.chat-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 150px;
    display: none;
    z-index: 10;
}

.chat-menu-dropdown.active {
    display: block;
}

.chat-menu-dropdown a {
    display: block;
    padding: 10px 15px;
    font-size: 0.9rem;
    color: var(--text-dark);
    border-bottom: 1px solid #eee;
}

.chat-menu-dropdown a:last-child {
    border-bottom: none;
}

.chat-menu-dropdown a:hover {
    background: #f5f5f5;
}

/* Chat History */
.chat-history {
    flex: 1;
    padding: 12px 16px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
}

.date-divider {
    text-align: center;
    margin: 6px 0 12px;
    position: relative;
}

.date-divider span {
    background: #fff;
    border: 1px solid #e2e8f0;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.75rem;
    color: var(--text-light);
}

.chat-message {
    display: flex;
    gap: 8px;
    max-width: 72%;
    margin-bottom: 8px; /* Reduced gap between consecutive messages from 20px to 8px */
}

.chat-message.sent {
    align-self: flex-end;
}

.chat-message.received {
    align-self: flex-start;
}

.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.msg-bubble {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 7px 12px; /* Reduced padding */
    border-radius: 14px;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.msg-bubble p {
    margin: 0 0 2px 0; /* Reduced gap between text and timestamp from 10px to 2px */
    font-size: 0.92rem;
    color: var(--text-dark);
    line-height: 1.35;
    word-break: break-word;
}

.msg-time {
    display: block;
    text-align: right;
    font-size: 0.68rem;
    color: var(--text-light);
    margin-top: 1px;
}

/* Chat Input */
.chat-input-area {
    padding: 8px 14px; /* Reduced from 15px 20px */
    border-top: 1px solid var(--border-color);
    background: #fff;
}

.input-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    padding: 4px 14px;
}

.input-wrapper input {
    flex: 1;
    border: none;
    outline: none;
    padding: 6px 0;
    font-size: 0.92rem;
}

.btn-send {
    background: transparent;
    border: none;
    color: #ccc;
    font-size: 1.3rem;
    cursor: pointer;
    transition: color 0.2s;
    padding: 0 4px;
}

.btn-send:hover {
    color: var(--primary-green);
}
