/**
 * Nepal Vivah - Modern Matrimonial Messaging & Chat Stylesheet
 * 
 * @package NepalVivah\Theme
 */

/* ==========================================================================
   1. CHAT CONTAINER & LAYOUT
   ========================================================================== */

.nv-chat-section-wrapper {
    margin: 0;
    padding: 0;
    width: 100%;
}

.nv-chat-pane {
    padding: 0;
    width: 100%;
}

.nv-chat-container {
    display: grid;
    grid-template-columns: 310px 1fr;
    height: calc(100vh - 130px);
    min-height: 520px;
    max-height: 800px;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

/* ==========================================================================
   2. CONVERSATION SIDEBAR (LEFT)
   ========================================================================== */

.nv-chat-sidebar {
    background: #F8FAFC;
    border-right: 1px solid #E2E8F0;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.chat-sidebar-header {
    padding: 12px 16px 10px;
    background: #FFFFFF;
    border-bottom: 1px solid #E2E8F0;
    flex-shrink: 0;
}

/* Back to Dashboard Button (Mobile/Tablet Only) */
.btn-back-to-dashboard {
    display: none;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--nv-primary, #8B0000);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 20px;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    margin-bottom: 10px;
    width: fit-content;
    transition: all 0.15s ease;
}

.btn-back-to-dashboard:hover,
.btn-back-to-dashboard:active {
    background: #FFFBEB;
    border-color: var(--nv-secondary, #C9A227);
    color: var(--nv-dark, #1E1B18);
}

.sidebar-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.sidebar-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-title-icon {
    font-size: 18px;
}

.sidebar-header-top h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--nv-primary, #8B1E3F);
    letter-spacing: -0.2px;
}

.conv-count-badge {
    background: #FEF3C7;
    color: #92400E;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid rgba(201, 162, 39, 0.3);
}

.chat-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.chat-search-wrap .search-icon {
    position: absolute;
    left: 12px;
    font-size: 13px;
    color: #94A3B8;
    pointer-events: none;
}

.chat-search-input {
    width: 100%;
    padding: 8px 12px 8px 34px;
    background: #F1F5F9;
    border: 1px solid transparent;
    border-radius: 20px;
    font-size: 13.5px;
    color: #1E293B;
    transition: all 0.2s ease;
}

.chat-search-input:focus {
    background: #FFFFFF;
    border-color: var(--nv-secondary, #C9A227);
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.15);
    outline: none;
}

.conversation-list {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 6px 0;
    scroll-behavior: smooth;
}

.conversation-list::-webkit-scrollbar {
    width: 5px;
}

.conversation-list::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 4px;
}

.nv-chat-loading-state {
    padding: 30px 20px;
    text-align: center;
    color: #64748B;
    font-size: 13.5px;
}

/* Conversation Item */
.conv-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid #F1F5F9;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    background: transparent;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.conv-item:hover {
    background: #F1F5F9;
}

.conv-item.active {
    background: #FFFBEB;
    border-left: 3.5px solid var(--nv-secondary, #C9A227);
}

.conv-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    width: 46px;
    height: 46px;
}

.conv-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid #E2E8F0;
    background: #E2E8F0;
    display: block;
}

.conv-online-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 12px;
    height: 12px;
    background: #94A3B8;
    border: 2px solid #FFFFFF;
    border-radius: 50%;
    display: none;
    transition: all 0.25s ease;
}

.conv-online-dot.is-online {
    display: block;
    background: #10B981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
    animation: nvOnlinePulse 2.5s infinite;
}

.conv-info {
    flex: 1 1 0%;
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.conv-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-width: 0;
    gap: 6px;
}

.conv-name {
    font-size: 14px;
    font-weight: 600;
    color: #0F172A;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1 1 auto;
}

.conv-item.active .conv-name {
    color: var(--nv-primary, #8B1E3F);
    font-weight: 700;
}

.conv-time {
    font-size: 11px;
    color: #94A3B8;
    flex-shrink: 0;
    margin-left: 6px;
    white-space: nowrap;
}

.conv-subtitle {
    font-size: 11.5px;
    color: #64748B;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.conv-last-msg-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-width: 0;
    gap: 6px;
}

.conv-last-msg {
    font-size: 12.5px;
    color: #64748B;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1 1 auto;
}

.conv-badge {
    background: var(--nv-primary, #8B1E3F);
    color: #FFFFFF;
    font-size: 10.5px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    flex-shrink: 0;
    line-height: 15px;
}

/* ==========================================================================
   3. CHAT MAIN PANEL (RIGHT)
   ========================================================================== */

.nv-chat-main {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    background: #FAF7F2;
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

/* Fixed Header */
.chat-main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #FFFFFF;
    border-bottom: 1px solid #E2E8F0;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.chat-header-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.btn-chat-back {
    display: none;
    background: transparent;
    border: none;
    padding: 6px;
    color: var(--nv-primary, #8B1E3F);
    cursor: pointer;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
}

.btn-chat-back:hover {
    background: #F1F5F9;
}

.chat-header-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    text-decoration: none;
}

.chat-active-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--nv-secondary, #C9A227);
    background: #E2E8F0;
    display: block;
}

.online-indicator-dot {
    position: absolute;
    bottom: 0px;
    right: 0px;
    width: 12px;
    height: 12px;
    background: #94A3B8;
    border: 2px solid #FFFFFF;
    border-radius: 50%;
    display: none;
}

.online-indicator-dot.is-online {
    display: block;
    background: #10B981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}

.chat-header-details {
    min-width: 0;
    flex: 1;
}

.chat-header-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-partner-name-link {
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.chat-partner-name-link:hover h4 {
    color: var(--nv-secondary-dark, #A28018);
    text-decoration: underline;
}

.chat-header-details h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--nv-dark, #1E1B18);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge-verified-mini {
    background: #10B981;
    color: #FFFFFF;
    font-size: 10px;
    font-weight: 800;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.active-status-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 1px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    background: #94A3B8;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

.status-indicator.is-online {
    background: #10B981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.7);
}

.active-status {
    font-size: 12.5px;
    color: #64748B;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* WhatsApp Style Header Action Icons */
.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.nv-header-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #54656F;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.nv-header-icon-btn:hover,
.nv-header-icon-btn.is-active {
    background: #F0F2F5;
    color: var(--nv-primary, #8B1E3F);
}

/* WhatsApp 3-Dots Dropdown Menu */
.chat-header-dropdown-wrap {
    position: relative;
}

.chat-header-menu-dropdown {
    position: absolute;
    top: 44px;
    right: 0;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
    min-width: 190px;
    padding: 6px 0;
    z-index: 100;
    display: none;
    animation: fadeInDown 0.15s ease;
}

.chat-header-menu-dropdown.is-open {
    display: block !important;
}

.chat-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 15px;
    font-size: 13.5px;
    font-weight: 500;
    color: #1E293B;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease;
    box-sizing: border-box;
}

.chat-menu-item:hover {
    background: #F8FAFC;
    color: var(--nv-primary, #8B1E3F);
}

.chat-menu-item .menu-item-icon {
    font-size: 15px;
    flex-shrink: 0;
}

.chat-menu-item.item-danger {
    color: #DC2626;
}

.chat-menu-item.item-danger:hover {
    background: #FEF2F2;
    color: #B91C1C;
}

.chat-menu-divider {
    height: 1px;
    background: #E2E8F0;
    margin: 4px 0;
}

/* ==========================================================================
   4. SCROLLABLE CHAT MESSAGES BODY
   ========================================================================== */

.chat-messages-body {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: #EFEAE2;
    background-image: 
        radial-gradient(#DFD8CE 0.75px, transparent 0.75px), 
        radial-gradient(#DFD8CE 0.75px, #EFEAE2 0.75px);
    background-size: 30px 30px;
    background-position: 0 0, 15px 15px;
    overscroll-behavior: contain;
    width: 100%;
    box-sizing: border-box;
}

.chat-messages-body::-webkit-scrollbar {
    width: 6px;
}

.chat-messages-body::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.chat-messages-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.35);
}

/* Empty State / Welcome Screen */
.chat-welcome-box {
    margin: auto;
    text-align: center;
    max-width: 440px;
    padding: 28px 24px;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.05);
}

.welcome-illustration {
    font-size: 44px;
    margin-bottom: 10px;
    line-height: 1;
}

.chat-welcome-box h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--nv-primary, #8B1E3F);
    margin: 0 0 6px 0;
}

.chat-welcome-box p {
    font-size: 13px;
    color: #64748B;
    line-height: 1.5;
    margin: 0 0 14px 0;
}

.welcome-features-pills {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.welcome-features-pills span {
    font-size: 11px;
    font-weight: 600;
    background: #F8FAFC;
    color: #475569;
    padding: 4px 10px;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
}

/* WhatsApp-Style Date Separator Pill */
.chat-date-separator {
    display: flex;
    justify-content: center;
    margin: 12px 0 6px;
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 3;
}

.chat-date-separator span {
    background: rgba(255, 255, 255, 0.92);
    color: #54656F;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 8px;
    letter-spacing: 0.3px;
    box-shadow: 0 1px 3px rgba(11, 20, 26, 0.12);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ==========================================================================
   5. MESSAGE ROWS, BUBBLES & ADVANCED ACTIONS (COPY, REPLY, PIN, SELECT)
   ========================================================================== */

/* Sticky Pinned Message Bar */
.chat-pinned-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: #FFFDF0;
    border-bottom: 1px solid #FDE68A;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    z-index: 8;
    animation: fadeInDown 0.2s ease-out;
}

.chat-pinned-bar .pinned-bar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.chat-pinned-bar .pinned-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.chat-pinned-bar .pinned-text-content {
    min-width: 0;
    flex: 1;
}

.chat-pinned-bar .pinned-label {
    display: block;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #92400E;
}

.chat-pinned-bar .pinned-text-preview {
    margin: 0;
    font-size: 12.5px;
    color: #1E293B;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-pinned-bar .pinned-bar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 12px;
    flex-shrink: 0;
}

.btn-pinned-action {
    background: #FEF3C7;
    color: #78350F;
    border: 1px solid #FCD34D;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-pinned-action:hover {
    background: #FDE68A;
}

.btn-pinned-action.btn-unpin {
    background: transparent;
    border: none;
    color: #94A3B8;
    font-size: 13px;
    padding: 2px 6px;
}

.btn-pinned-action.btn-unpin:hover {
    color: #DC2626;
}

/* Multi-Selection Toolbar */
.chat-selection-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    background: #1E293B;
    color: #FFFFFF;
    border-bottom: 1px solid #334155;
    z-index: 9;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    animation: fadeInDown 0.2s ease-out;
}

.chat-selection-toolbar .selection-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 600;
}

.chat-selection-toolbar .selection-count-badge {
    background: #8B1E3F;
    color: #FFFFFF;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
}

.chat-selection-toolbar .selection-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-sel-action {
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    background: #334155;
    color: #F8FAFC;
}

.btn-sel-action:hover {
    background: #475569;
}

.btn-sel-action.btn-sel-danger {
    background: #DC2626;
    color: #FFFFFF;
}

.btn-sel-action.btn-sel-danger:hover:not(:disabled) {
    background: #B91C1C;
}

.btn-sel-action.btn-sel-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-sel-action.btn-sel-cancel {
    background: transparent;
    border: 1px solid #475569;
    color: #CBD5E1;
}

.btn-sel-action.btn-sel-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
}

/* Quoted Reply Preview Bar in Send Form */
.chat-reply-preview-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-left: 4px solid #8B1E3F;
    border-radius: 8px;
    padding: 6px 12px;
    margin-bottom: 6px;
    animation: fadeInUp 0.2s ease-out;
}

.chat-reply-preview-bar .reply-bar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.chat-reply-preview-bar .reply-curve-icon {
    font-size: 14px;
    color: #8B1E3F;
}

.chat-reply-preview-bar .reply-text-wrap {
    min-width: 0;
    flex: 1;
}

.chat-reply-preview-bar .reply-author-tag {
    display: block;
    font-size: 11px;
    color: #8B1E3F;
    font-weight: 700;
}

.chat-reply-preview-bar .reply-snippet-text {
    margin: 0;
    font-size: 12.5px;
    color: #475569;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-reply-preview-bar .btn-close-reply {
    background: transparent;
    border: none;
    color: #94A3B8;
    font-size: 14px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.chat-reply-preview-bar .btn-close-reply:hover {
    color: #DC2626;
    background: #FEE2E2;
}

/* Message Rows Container */
.chat-msg-row {
    display: flex !important;
    align-items: flex-end;
    width: 100% !important;
    margin: 1.5px 0 !important;
    box-sizing: border-box !important;
    position: relative !important;
    transition: background 0.15s ease, opacity 0.25s ease, transform 0.25s ease;
}

.chat-msg-row.msg-fade-out {
    opacity: 0 !important;
    transform: scale(0.9) translateY(10px) !important;
}

/* Select Mode Checkboxes */
.msg-select-check-wrap {
    display: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    flex-shrink: 0;
    margin-right: 6px;
}

.is-select-mode .msg-select-check-wrap {
    display: flex !important;
}

.msg-select-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #8B1E3F;
}

.chat-msg-row.is-selected {
    background: rgba(139, 30, 63, 0.05);
    border-radius: 8px;
}

/* Message Bubble Container & Side Actions */
.chat-msg-bubble-container {
    position: relative !important;
    max-width: 76% !important;
    display: flex;
    flex-direction: column;
}

/* WhatsApp-Style Message Dropdown Arrow (Desktop Hover Only) */
.btn-msg-dropdown-arrow {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.08);
    border: none;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    color: #475569;
    padding: 0;
    transition: background 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
    z-index: 5;
    opacity: 0.85;
}

.chat-msg-row.mine .btn-msg-dropdown-arrow {
    background: rgba(0, 0, 0, 0.22);
    color: #FFFFFF;
}

.btn-msg-dropdown-arrow:hover,
.btn-msg-dropdown-arrow.is-open {
    opacity: 1 !important;
    transform: scale(1.1);
    background: rgba(0, 0, 0, 0.16) !important;
}

.chat-msg-row.mine .btn-msg-dropdown-arrow:hover,
.chat-msg-row.mine .btn-msg-dropdown-arrow.is-open {
    background: rgba(0, 0, 0, 0.35) !important;
}

/* Show arrow on hover on Desktop only */
@media (hover: hover) and (pointer: fine) {
    .chat-msg-row:hover .btn-msg-dropdown-arrow,
    .chat-msg-bubble:hover .btn-msg-dropdown-arrow,
    .btn-msg-dropdown-arrow.is-open {
        display: inline-flex !important;
    }
}

/* Hide on Touch/Mobile devices (Mobile uses long-press) */
@media (hover: none) or (pointer: coarse) {
    .btn-msg-dropdown-arrow {
        display: none !important;
    }
}

.is-select-mode .btn-msg-dropdown-arrow {
    display: none !important;
}

/* Floating Dropdown Menu (Position Fixed Portal) */
.msg-action-dropdown-menu {
    position: fixed !important;
    z-index: 999999 !important;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.2), 0 8px 12px -6px rgba(0, 0, 0, 0.12);
    padding: 6px;
    min-width: 175px;
    display: none;
    flex-direction: column;
    gap: 2px;
    animation: nvDropdownFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    max-width: calc(100vw - 20px);
}

.msg-action-dropdown-menu.is-active {
    display: flex !important;
}

/* Dropdown items */
.msg-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.3;
    box-sizing: border-box;
}

.msg-dropdown-item:hover,
.msg-dropdown-item:focus {
    background: #F8FAFC;
    color: #0F172A;
}

.msg-dropdown-item .dropdown-icon {
    font-size: 15px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    flex-shrink: 0;
}

.msg-dropdown-divider {
    height: 1px;
    background: #F1F5F9;
    margin: 4px 6px;
}

.msg-dropdown-item.item-danger {
    color: #DC2626;
}

.msg-dropdown-item.item-danger:hover,
.msg-dropdown-item.item-danger:focus {
    background: #FEE2E2;
    color: #B91C1C;
}

@keyframes msgMenuFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* INCOMING (THEIRS) */
.chat-msg-row.theirs {
    justify-content: flex-start !important;
}

.chat-msg-row.theirs .chat-msg-bubble {
    background: #FFFFFF !important;
    color: #111827 !important;
    border-radius: 12px 12px 12px 2px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08) !important;
    border: 1px solid #E2E8F0 !important;
    margin-right: auto !important;
    margin-left: 0 !important;
    min-width: 68px !important;
    padding: 6px 10px 6px 12px !important;
    position: relative !important;
    word-break: break-word !important;
    line-height: 1.4 !important;
}

/* OUTGOING (MINE) */
.chat-msg-row.mine {
    justify-content: flex-end !important;
}

.chat-msg-row.mine .chat-msg-bubble {
    background: linear-gradient(135deg, #8B1E3F 0%, #A02347 100%) !important;
    color: #FFFFFF !important;
    border-radius: 12px 12px 2px 12px !important;
    box-shadow: 0 2px 6px rgba(139, 30, 63, 0.22) !important;
    border: none !important;
    margin-left: auto !important;
    margin-right: 0 !important;
    min-width: 68px !important;
    padding: 6px 10px 6px 12px !important;
    position: relative !important;
    word-break: break-word !important;
    line-height: 1.4 !important;
}

/* Clearfix for inline float layout */
.chat-msg-bubble::after {
    content: "";
    display: table;
    clear: both;
}

/* Pinned Tag in Bubble */
.msg-pinned-tag {
    display: block;
    width: fit-content;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    margin-bottom: 4px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.chat-msg-row.theirs .msg-pinned-tag {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FDE68A;
}

.chat-msg-row.mine .msg-pinned-tag {
    background: rgba(255, 255, 255, 0.22);
    color: #FEF3C7;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

/* Quoted Reply Card in Bubble */
.msg-quoted-card {
    display: flex;
    align-items: stretch;
    border-radius: 8px;
    padding: 5px 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.msg-quoted-card:hover {
    opacity: 0.88;
}

.chat-msg-row.theirs .msg-quoted-card {
    background: #F1F5F9;
    border-left: 3.5px solid #8B1E3F;
}

.chat-msg-row.theirs .quote-author {
    color: #8B1E3F;
    font-size: 11.5px;
    font-weight: 700;
    display: block;
}

.chat-msg-row.theirs .quote-snippet {
    color: #475569;
    font-size: 12px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-msg-row.mine .msg-quoted-card {
    background: rgba(0, 0, 0, 0.2);
    border-left: 3.5px solid #FDE68A;
}

.chat-msg-row.mine .quote-author {
    color: #FDE68A;
    font-size: 11.5px;
    font-weight: 700;
    display: block;
}

.chat-msg-row.mine .quote-snippet {
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* WhatsApp-Style Inline Message Text & Meta */
.chat-msg-bubble .msg-text-content,
.chat-msg-bubble .msg-text {
    font-size: 14.5px !important;
    line-height: 1.45 !important;
    white-space: pre-wrap !important;
    display: inline !important;
    margin: 0 !important;
    vertical-align: top !important;
}

.chat-msg-bubble .msg-meta-inline {
    display: inline-flex !important;
    align-items: center !important;
    gap: 3px !important;
    float: right !important;
    margin-left: 8px !important;
    margin-top: 3px !important;
    font-size: 10.5px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    user-select: none !important;
    vertical-align: bottom !important;
    position: relative !important;
    bottom: -1px !important;
}

.chat-msg-row.theirs .msg-meta-inline .msg-time {
    font-size: 10.5px !important;
    color: #64748B !important;
    font-weight: 500 !important;
}

.chat-msg-row.mine .msg-meta-inline .msg-time {
    font-size: 10.5px !important;
    color: rgba(255, 255, 255, 0.85) !important;
    font-weight: 500 !important;
}

.chat-msg-row.mine .read-status {
    font-size: 11px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    color: rgba(255, 255, 255, 0.65) !important;
    letter-spacing: -0.5px !important;
    display: inline-block !important;
}

.chat-msg-row.mine .read-status.is-sent {
    color: rgba(255, 255, 255, 0.65) !important;
}

.chat-msg-row.mine .read-status.is-delivered {
    color: rgba(255, 255, 255, 0.9) !important;
}

.chat-msg-row.mine .read-status.is-read,
.chat-msg-row.mine .read-status.is-seen {
    color: #60A5FA !important; /* Double blue tick */
}

/* Golden Pulse Jump Highlight Animation */
@keyframes msgPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(201, 162, 39, 0.7);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(201, 162, 39, 0);
        transform: scale(1.03);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(201, 162, 39, 0);
        transform: scale(1);
    }
}

.msg-highlight-pulse {
    animation: msgPulse 1.6s ease-in-out !important;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   6. FIXED SEND INPUT BAR (BOTTOM)
   ========================================================================== */

.chat-send-bar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 7px 16px 9px;
    background: #FFFFFF;
    border-top: 1px solid #E2E8F0;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

/* Quick Emojis */
.chat-quick-emojis-bar {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.chat-quick-emojis-bar::-webkit-scrollbar {
    display: none;
}

.btn-emoji-tag {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 2px 9px;
    font-size: 12px;
    cursor: pointer;
    color: #475569;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.btn-emoji-tag:hover {
    background: #FFFBEB;
    border-color: var(--nv-secondary, #C9A227);
    color: var(--nv-dark, #1E1B18);
    transform: translateY(-1px);
}

/* Input Row */
.chat-input-controls-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-input-box-wrap {
    flex: 1 1 auto;
    position: relative;
}

.chat-input-area {
    width: 100%;
    min-height: 38px;
    height: 38px;
    max-height: 100px;
    padding: 8px 14px;
    background: #F8FAFC;
    border: 1.5px solid #E2E8F0;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.4;
    color: #0F172A;
    resize: none;
    outline: none;
    transition: all 0.2s ease;
    font-family: inherit;
    box-sizing: border-box;
}

.chat-input-area:focus {
    background: #FFFFFF;
    border-color: var(--nv-primary, #8B1E3F);
    box-shadow: 0 0 0 3px rgba(139, 30, 63, 0.12);
}

.chat-btn-send-solid {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 18px;
    background: linear-gradient(135deg, #8B1E3F, #A02347);
    color: #FFFFFF;
    border: none;
    border-radius: 20px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(139, 30, 63, 0.25);
}

.chat-btn-send-solid:hover {
    background: linear-gradient(135deg, #7A1936, #8B1E3F);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(139, 30, 63, 0.35);
}

.chat-btn-send-solid:active {
    transform: translateY(0);
}

.chat-btn-send-solid:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================================================
   7. RESPONSIVE & ALL-DEVICE DESIGN (COMPUTER, TAB, MOBILE)
   ========================================================================== */

/* Large Tablets & Medium Laptops (992px - 1199px) */
@media (max-width: 1199px) {
    .nv-chat-container {
        grid-template-columns: 290px 1fr;
        height: calc(100vh - 135px);
        max-height: 800px;
        min-height: 500px;
    }
    .chat-msg-bubble-container {
        max-width: 80% !important;
    }
}

/* Tablets & Mobile Phones (max-width: 991px) — WhatsApp Style 1-Screen at a Time */
@media (max-width: 991px) {
    .btn-back-to-dashboard {
        display: inline-flex !important;
    }

    .nv-chat-section-wrapper,
    .nv-chat-pane {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .nv-chat-container {
        display: block !important;
        grid-template-columns: none !important;
        height: calc(100dvh - 75px) !important;
        height: calc(100vh - 75px) !important;
        max-height: calc(100dvh - 75px) !important;
        min-height: 420px;
        border-radius: 12px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
        overflow: hidden;
        position: relative;
        width: 100%;
    }

    /* 1. Initial State: Show conversation list full-width, hide chat panel */
    .nv-chat-sidebar {
        display: flex !important;
        width: 100% !important;
        height: 100% !important;
        border-right: none !important;
    }

    .nv-chat-main {
        display: none !important;
        width: 100% !important;
        height: 100% !important;
    }

    /* 2. Active Chat State: Hide conversation list, show conversation view full-width */
    .nv-chat-container.mobile-chat-active .nv-chat-sidebar,
    .nv-chat-container.has-active-chat .nv-chat-sidebar {
        display: none !important;
    }

    .nv-chat-container.mobile-chat-active .nv-chat-main,
    .nv-chat-container.has-active-chat .nv-chat-main {
        display: flex !important;
        width: 100% !important;
        height: 100% !important;
    }

    /* 3. WhatsApp-style Back Button in Header */
    .btn-chat-back,
    #btn-back-to-convs {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        min-width: 40px;
        min-height: 40px;
        padding: 6px;
        margin-right: 4px;
        font-size: 20px;
        color: var(--nv-primary, #8B0000);
        cursor: pointer;
        border-radius: 50%;
        background: transparent;
        border: none;
        transition: background 0.15s ease, transform 0.15s ease;
        flex-shrink: 0;
    }

    .btn-chat-back:hover,
    .btn-chat-back:active,
    #btn-back-to-convs:hover,
    #btn-back-to-convs:active {
        background: #F1F5F9;
        transform: scale(1.05);
    }

    .chat-main-header {
        padding: 8px 12px;
        gap: 6px;
        min-height: 56px;
    }

    .chat-header-user-info {
        gap: 8px;
    }

    .chat-active-avatar {
        width: 40px;
        height: 40px;
    }

    .chat-header-details h4 {
        font-size: 14.5px;
        line-height: 1.3;
    }

    .active-status {
        font-size: 11.5px;
    }

    .chat-header-actions {
        gap: 4px;
    }

    .nv-header-icon-btn {
        width: 36px;
        height: 36px;
    }

    .chat-messages-body {
        padding: 10px 12px;
        gap: 6px;
    }

    .chat-msg-bubble-container {
        max-width: 86% !important;
    }

    .chat-msg-bubble .msg-text {
        font-size: 14px !important;
    }

    /* Fixed Composer Bar */
    .chat-send-bar {
        padding: 6px 10px calc(8px + env(safe-area-inset-bottom, 0px));
        gap: 5px;
        background: #FFFFFF;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
    }

    .chat-quick-emojis-bar {
        padding-bottom: 3px;
        gap: 4px;
    }

    .btn-emoji-tag {
        font-size: 11.5px;
        padding: 2px 8px;
    }

    .chat-input-controls-row {
        gap: 6px;
    }

    .chat-input-area {
        min-height: 38px;
        height: 38px;
        padding: 8px 14px;
        font-size: 15px; /* Prevent iOS zoom */
        border-radius: 19px;
    }

    .chat-btn-send-solid {
        height: 38px;
        padding: 0 14px;
        border-radius: 19px;
    }

    .chat-btn-send-solid .send-text {
        display: none;
    }

    .chat-btn-send-solid .send-svg-icon {
        width: 17px;
        height: 17px;
    }
}

/* Small & Ultra Small Mobile Screens (max-width: 480px) */
@media (max-width: 480px) {
    .nv-chat-container {
        border-radius: 8px;
        height: calc(100dvh - 70px) !important;
        height: calc(100vh - 70px) !important;
        max-height: calc(100dvh - 70px) !important;
        min-height: 380px;
    }

    .chat-main-header {
        padding: 6px 8px;
        gap: 4px;
    }

    .btn-chat-back,
    #btn-back-to-convs {
        min-width: 36px;
        min-height: 36px;
        padding: 4px;
        margin-right: 2px;
    }

    .chat-active-avatar {
        width: 36px;
        height: 36px;
    }

    .chat-header-details h4 {
        font-size: 13.5px;
    }

    .active-status {
        font-size: 11px;
    }

    .nv-header-icon-btn {
        width: 32px;
        height: 32px;
    }

    .chat-msg-bubble-container {
        max-width: 90% !important;
    }

    .chat-msg-bubble .msg-text {
        font-size: 13.5px !important;
    }

    .chat-send-bar {
        padding: 5px 8px calc(6px + env(safe-area-inset-bottom, 0px));
        gap: 4px;
    }

    .chat-input-area {
        min-height: 36px;
        height: 36px;
        padding: 7px 12px;
        font-size: 14px;
    }

    .chat-btn-send-solid {
        height: 36px;
        padding: 0 12px;
    }
}

/* ==========================================================================
   8. WEBRTC 1-TO-1 AUDIO & VIDEO CALLING STYLES
   ========================================================================== */

/* Header Call Buttons */
.btn-call-action {
    color: #475569;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-call-action:hover {
    transform: scale(1.08);
}

.btn-call-voice:hover {
    background: #ECFDF5 !important;
    color: #059669 !important;
}

.btn-call-video:hover {
    background: #EFF6FF !important;
    color: #2563EB !important;
}

/* --------------------------------------------------------------------------
   Incoming Call Popup Modal
   -------------------------------------------------------------------------- */
.nv-incoming-call-popup {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    align-items: center;
    animation: slideInDown 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInDown {
    from { opacity: 0; transform: translateY(-30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.incoming-call-card {
    background: #FFFFFF;
    border: 1.5px solid rgba(201, 162, 39, 0.3);
    border-radius: 20px;
    padding: 16px 20px;
    box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 320px;
    max-width: 400px;
    position: relative;
    backdrop-filter: blur(16px);
}

.incoming-avatar-wrap {
    position: relative;
    width: 52px;
    height: 52px;
    flex-shrink: 0;
}

.incoming-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--nv-secondary, #C9A227);
    position: relative;
    z-index: 2;
}

.incoming-ring-pulse {
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border-radius: 50%;
    border: 2px solid #10B981;
    opacity: 0.8;
    animation: pulseRing 1.5s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
    z-index: 1;
}

@keyframes pulseRing {
    0% { transform: scale(0.85); opacity: 0.9; }
    50% { transform: scale(1.3); opacity: 0.3; }
    100% { transform: scale(1.6); opacity: 0; }
}

.incoming-info {
    flex: 1;
    min-width: 0;
}

.incoming-info h4 {
    margin: 0 0 4px 0;
    font-size: 15.5px;
    font-weight: 700;
    color: var(--nv-dark, #1E1B18);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.incoming-type-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    font-weight: 600;
    color: #059669;
    background: #ECFDF5;
    padding: 2px 8px;
    border-radius: 12px;
}

.incoming-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Call Action Buttons (Accept, Decline, Control) */
.btn-call-ctrl {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.btn-call-accept {
    background: linear-gradient(135deg, #10B981, #059669);
    color: #FFFFFF;
}

.btn-call-accept:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: scale(1.1);
}

.btn-call-decline {
    background: linear-gradient(135deg, #EF4444, #DC2626);
    color: #FFFFFF;
}

.btn-call-decline:hover {
    background: linear-gradient(135deg, #DC2626, #B91C1C);
    transform: scale(1.1);
}

/* --------------------------------------------------------------------------
   Active Call Screen Modal Overlay
   -------------------------------------------------------------------------- */
.nv-call-overlay-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 15, 29, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeInModal 0.25s ease;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.nv-call-stage {
    width: 100%;
    max-width: 960px;
    height: calc(100vh - 80px);
    max-height: 640px;
    background: #0F172A;
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
}

/* Video Stage */
.call-video-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background: #020617;
}

.remote-video-stream {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.local-pip-wrap {
    position: absolute;
    bottom: 96px;
    right: 24px;
    width: 160px;
    height: 120px;
    background: #1E293B;
    border-radius: 14px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    cursor: grab;
    z-index: 20;
    transition: box-shadow 0.2s ease;
}

.local-pip-wrap:active {
    cursor: grabbing;
}

.local-video-stream {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror local selfie camera */
}

.pip-label {
    position: absolute;
    bottom: 6px;
    left: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: #FFFFFF;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: 600;
}

/* Voice Call Stage */
.call-voice-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #1E1B18 0%, #0F172A 100%);
}

.voice-avatar-stage {
    position: relative;
    width: 140px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.voice-partner-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--nv-secondary, #C9A227);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 5;
}

.voice-wave-ring {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    border: 2px solid rgba(201, 162, 39, 0.6);
    animation: wavePulse 2.4s infinite cubic-bezier(0.25, 1, 0.5, 1);
}

.voice-wave-ring.wave-2 {
    animation-delay: 1.2s;
}

@keyframes wavePulse {
    0% { transform: scale(0.9); opacity: 0.8; }
    100% { transform: scale(1.9); opacity: 0; }
}

/* Top Call Info Bar */
.call-top-bar {
    position: absolute;
    top: 20px;
    left: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 30;
    pointer-events: auto;
}

.call-partner-info {
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(12px);
    padding: 8px 18px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #FFFFFF;
}

.call-partner-info h3 {
    margin: 0 0 2px 0;
    font-size: 15px;
    font-weight: 700;
    color: #FFFFFF;
}

.call-status-row {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: #CBD5E1;
}

.call-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #E2E8F0;
}

.call-status-dot.status-calling,
.call-status-dot.status-ringing {
    background: #F59E0B;
    animation: blink 1s infinite alternate;
}

.call-status-dot.status-connected {
    background: #10B981;
}

.call-status-dot.status-declined,
.call-status-dot.status-busy,
.call-status-dot.status-failed {
    background: #EF4444;
}

@keyframes blink {
    from { opacity: 0.3; }
    to { opacity: 1; }
}

.call-timer-badge {
    background: rgba(255, 255, 255, 0.15);
    padding: 1px 7px;
    border-radius: 8px;
    font-size: 11.5px;
    font-family: monospace;
    font-weight: 700;
    color: #34D399;
}

.btn-top-call-action {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(12px);
    color: #FFFFFF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-top-call-action:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

/* Floating Bottom In-Call Controls */
.call-controls-bar {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 10px 20px;
    border-radius: 40px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    z-index: 30;
}

.call-controls-bar .btn-call-ctrl {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.15);
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.call-controls-bar .btn-call-ctrl:hover {
    background: rgba(255, 255, 255, 0.28);
    transform: translateY(-2px);
}

.call-controls-bar .btn-ctrl-mic.is-muted {
    background: #EF4444 !important;
    color: #FFFFFF;
}

.call-controls-bar .btn-ctrl-cam.is-off {
    background: #EF4444 !important;
    color: #FFFFFF;
}

.call-controls-bar .btn-ctrl-end {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #EF4444, #DC2626) !important;
    color: #FFFFFF !important;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

.call-controls-bar .btn-ctrl-end:hover {
    background: linear-gradient(135deg, #DC2626, #B91C1C) !important;
    transform: scale(1.08) translateY(-2px);
}

/* --------------------------------------------------------------------------
   Responsive Mobile Call Screens
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .nv-incoming-call-popup {
        top: 12px;
        right: 12px;
        left: 12px;
    }

    .incoming-call-card {
        min-width: 0;
        max-width: 100%;
        padding: 12px 14px;
        gap: 12px;
    }

    .incoming-avatar-wrap,
    .incoming-avatar {
        width: 44px;
        height: 44px;
    }

    .incoming-info h4 {
        font-size: 14px;
    }

    .incoming-type-pill {
        font-size: 11.5px;
    }

    .btn-call-ctrl {
        width: 38px;
        height: 38px;
    }

    .nv-call-overlay-modal {
        padding: 0;
    }

    .nv-call-stage {
        width: 100vw;
        height: 100dvh;
        height: 100vh;
        max-height: none;
        border-radius: 0;
    }

    .local-pip-wrap {
        bottom: 90px;
        right: 14px;
        width: 110px;
        height: 85px;
        border-radius: 10px;
    }

    .call-controls-bar {
        bottom: 18px;
        gap: 12px;
        padding: 8px 14px;
    }

    .call-controls-bar .btn-call-ctrl {
        width: 42px;
        height: 42px;
    }

    .call-controls-bar .btn-ctrl-end {
        width: 46px;
        height: 46px;
    }
}

/* ==========================================================================
   CALL LOG BUBBLE STYLES IN CHAT (MESSAGE-LIKE CHAT ITEM)
   ========================================================================== */
.call-log-msg-wrap {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    margin: 4px 0 !important;
}

.chat-msg-row.mine .call-log-msg-wrap {
    justify-content: flex-end !important;
}

.chat-msg-row.theirs .call-log-msg-wrap {
    justify-content: flex-start !important;
}

.chat-call-log-bubble {
    display: flex !important;
    flex-direction: column !important;
    min-width: 180px !important;
    max-width: 260px !important;
    padding: 10px 14px 10px 14px !important;
    border-radius: 14px !important;
    position: relative !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07) !important;
    box-sizing: border-box !important;
    transition: all 0.15s ease !important;
}

.chat-msg-row.mine .chat-call-log-bubble {
    background: linear-gradient(135deg, #8B1E3F 0%, #6E142F 100%) !important;
    color: #FFFFFF !important;
    border: 1px solid rgba(212, 160, 23, 0.3) !important;
    border-bottom-right-radius: 4px !important;
}

.chat-msg-row.theirs .chat-call-log-bubble {
    background: #FFFFFF !important;
    color: #0F172A !important;
    border: 1px solid #E2E8F0 !important;
    border-bottom-left-radius: 4px !important;
}

.call-log-header-row {
    display: flex !important;
    align-items: center !important;
    margin-bottom: 3px !important;
}

.call-log-type-title {
    font-size: 13.5px !important;
    font-weight: 700 !important;
    letter-spacing: -0.2px !important;
}

.chat-msg-row.mine .call-log-type-title {
    color: #FFFFFF !important;
}

.chat-msg-row.theirs .call-log-type-title {
    color: #0F172A !important;
}

.call-log-meta-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    font-size: 11.5px !important;
    margin-bottom: 8px !important;
}

.chat-msg-row.mine .call-log-status-desc {
    color: rgba(255, 255, 255, 0.85) !important;
}

.chat-msg-row.theirs .call-log-status-desc {
    color: #64748B !important;
}

.chat-call-log-bubble.call-status-missed .call-log-status-desc {
    color: #EF4444 !important;
    font-weight: 600 !important;
}

.chat-msg-row.mine .call-log-time {
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 10px !important;
}

.chat-msg-row.theirs .call-log-time {
    color: #94A3B8 !important;
    font-size: 10px !important;
}

.call-log-btn-row {
    display: flex !important;
}

.btn-call-back-action {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    padding: 4px 11px !important;
    border-radius: 14px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    border: none !important;
    transition: all 0.15s ease !important;
}

.chat-msg-row.mine .btn-call-back-action {
    background: rgba(255, 255, 255, 0.22) !important;
    color: #FFFFFF !important;
}

.chat-msg-row.mine .btn-call-back-action:hover {
    background: rgba(255, 255, 255, 0.35) !important;
}

.chat-msg-row.theirs .btn-call-back-action {
    background: #8B1E3F !important;
    color: #FFFFFF !important;
}

.chat-msg-row.theirs .btn-call-back-action:hover {
    background: #731732 !important;
}

.presence-online-badge {
    color: #059669;
    font-weight: 600;
}

.conv-last-msg.is-missed-call {
    color: #DC2626 !important;
    font-weight: 600;
}

.conv-badge.badge-missed-call {
    background: #DC2626 !important;
}

@keyframes nvOnlinePulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.8;
    }
}

/* ==========================================
   WEBRTC CALLING MOBILE RESPONSIVENESS
   ========================================== */
@media (max-width: 768px) {
    /* Fullscreen Calling Modal on Mobile */
    .nv-call-overlay-modal {
        padding: 0;
        background: #000000;
    }

    .nv-call-stage {
        width: 100vw;
        height: 100dvh;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    .local-pip-wrap {
        width: 90px;
        height: 135px;
        top: 70px;
        right: 14px;
    }

    .call-controls-bar {
        bottom: 24px;
        gap: 14px;
    }

    .btn-call-ctrl {
        width: 52px;
        height: 52px;
    }
}

/* ==========================================================================
   DESKTOP FLOATING MULTI-CHAT DOCK (FACEBOOK MESSENGER STYLE)
   ========================================================================== */
.nv-floating-chat-dock {
    position: fixed;
    bottom: 0;
    right: 24px;
    z-index: 9998;
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-end;
    gap: 14px;
    pointer-events: none;
    max-width: calc(100vw - 48px);
}

.nv-floating-chat-box {
    pointer-events: auto;
    width: 330px;
    height: 440px;
    max-height: calc(100vh - 90px);
    background: #FFFFFF;
    border: 1px solid #CBD5E1;
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    font-family: 'Poppins', sans-serif;
    transition: height 0.22s cubic-bezier(0.16, 1, 0.3, 1), width 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.15s ease;
}

.nv-floating-chat-box.is-minimized {
    height: 44px !important;
    width: 220px !important;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
    border-radius: 8px 8px 0 0;
}

.nv-floating-chat-box.is-minimized .nv-fc-body,
.nv-floating-chat-box.is-minimized .nv-fc-footer,
.nv-floating-chat-box.is-minimized .nv-fc-pinned-bar,
.nv-floating-chat-box.is-minimized .nv-fc-reply-preview,
.nv-floating-chat-box.is-minimized .nv-fc-btn-voice,
.nv-floating-chat-box.is-minimized .nv-fc-btn-video,
.nv-floating-chat-box.is-minimized .nv-fc-more-wrap {
    display: none !important;
}

.nv-floating-chat-box.is-focused {
    box-shadow: 0 -6px 28px rgba(139, 30, 63, 0.2), 0 0 0 1px #8B1E3F;
}

/* Floating Header */
.nv-fc-header {
    background: linear-gradient(135deg, #8B1E3F 0%, #A02347 100%);
    color: #FFFFFF;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
    gap: 8px;
    border-radius: 11px 11px 0 0;
}

.nv-fc-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    flex: 1;
    text-decoration: none;
    color: #FFFFFF;
}

.nv-fc-avatar-wrap {
    position: relative;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
}

.nv-fc-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid #FFFFFF;
    background: #E2E8F0;
    display: block;
}

.nv-fc-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10B981;
    position: absolute;
    bottom: -1px;
    right: -1px;
    border: 1.5px solid #FFFFFF;
}

.nv-fc-name-wrap {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.nv-fc-name {
    font-size: 13px;
    font-weight: 600;
    color: #FFFFFF;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.nv-fc-subtitle {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.nv-fc-controls {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.nv-fc-btn-ctrl {
    background: transparent;
    border: none;
    color: #FFFFFF;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s ease;
    font-size: 14px;
    line-height: 1;
}

.nv-fc-btn-ctrl:hover {
    background: rgba(255, 255, 255, 0.22);
}

.nv-fc-btn-ctrl svg {
    width: 14px;
    height: 14px;
}

/* Floating Body */
.nv-fc-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 8px;
    background: #F8FAFC;
    display: flex;
    flex-direction: column;
    gap: 3px;
    scroll-behavior: smooth;
    position: relative;
}

/* Floating Pinned Bar */
.nv-fc-pinned-bar {
    background: #FEF3C7;
    border-bottom: 1px solid #FDE68A;
    padding: 5px 8px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    color: #92400E;
}

.nv-fc-pinned-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
    font-weight: 500;
}

/* Floating Quoted Reply Preview */
.nv-fc-reply-preview {
    background: #F1F5F9;
    border-top: 2.5px solid #8B1E3F;
    padding: 4px 8px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.nv-fc-reply-snippet {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
    color: #475569;
}

/* Floating Footer Form */
.nv-fc-footer {
    padding: 6px 8px;
    background: #FFFFFF;
    border-top: 1px solid #E2E8F0;
    display: flex;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.nv-fc-input {
    flex: 1;
    border: 1px solid #CBD5E1;
    border-radius: 16px;
    padding: 6px 10px;
    font-size: 12.5px;
    outline: none;
    max-height: 80px;
    resize: none;
    line-height: 1.35;
    font-family: inherit;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.nv-fc-input:focus {
    border-color: #8B1E3F;
}

.nv-fc-btn-send {
    background: #8B1E3F;
    color: #FFFFFF;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    padding: 0;
}

.nv-fc-btn-send:hover {
    background: #A02347;
    transform: scale(1.05);
}

.nv-fc-btn-send svg {
    width: 14px;
    height: 14px;
    transform: rotate(45deg);
    margin-left: -2px;
}

/* Unread Badge on Minimized Box */
.nv-fc-unread-badge {
    background: #EF4444;
    color: #FFFFFF;
    font-size: 10px;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 5px;
    margin-left: 4px;
}

/* Strictly Hide Floating Dock on Mobile & Tablet */
@media (max-width: 991px) {
    .nv-floating-chat-dock {
        display: none !important;
    }
}

/* ==========================================================================
   10. ACTION MENUS, NEW CHAT & DROPDOWNS
   ========================================================================== */

/* New Chat Compose Button */
.btn-new-chat-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #FFFBEB;
    border: 1.5px solid rgba(201, 162, 39, 0.4);
    color: var(--nv-primary, #8B1E3F);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 0;
    flex-shrink: 0;
}

.btn-new-chat-action:hover {
    background: var(--nv-primary, #8B1E3F);
    color: #FFFFFF;
    border-color: var(--nv-primary, #8B1E3F);
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(139, 30, 63, 0.25);
}

.btn-new-chat-action:active {
    transform: scale(0.95);
}

/* New Chat Modal Box */
.nv-new-chat-modal-box {
    max-width: 480px !important;
    width: 92% !important;
    border-radius: 16px !important;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.nv-new-chat-search-wrap {
    position: relative;
    margin-bottom: 12px;
}

.nv-new-chat-search-wrap .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: #94A3B8;
}

.nv-new-chat-search-input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border-radius: 10px;
    border: 1px solid #CBD5E1;
    font-size: 14px;
    background: #F8FAFC;
    color: #1E293B;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.nv-new-chat-search-input:focus {
    outline: none;
    border-color: var(--nv-secondary, #C9A227);
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.15);
}

.nv-new-chat-members-list {
    max-height: 380px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
}

.nv-new-chat-member-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    gap: 12px;
}

.nv-new-chat-member-card:hover {
    background: #FFFBEB;
    border-color: var(--nv-secondary, #C9A227);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.nv-new-chat-member-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.nv-new-chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid #E2E8F0;
    flex-shrink: 0;
}

.nv-new-chat-member-info {
    min-width: 0;
    flex: 1;
}

.nv-new-chat-member-name {
    font-size: 14.5px;
    font-weight: 700;
    color: #1E293B;
    margin: 0 0 2px 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.nv-new-chat-member-sub {
    font-size: 12px;
    color: #64748B;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nv-btn-start-chat {
    padding: 6px 14px;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: 20px;
    background: var(--nv-primary, #8B1E3F);
    color: #FFFFFF;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease;
}

.nv-btn-start-chat:hover {
    background: #6B122D;
}

/* Conversation Item Actions & 3-Dot Button */
.conv-item-actions {
    position: relative;
    flex-shrink: 0;
    margin-left: 6px;
}

.btn-conv-more-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #94A3B8;
    cursor: pointer;
    padding: 0;
    transition: all 0.15s ease;
}

.btn-conv-more-action:hover,
.btn-conv-more-action.is-open {
    background: #E2E8F0;
    color: #1E293B;
}

.conv-item:hover .btn-conv-more-action {
    color: #475569;
}

/* Conversation 3-Dot Dropdown Menu (Position Fixed Portal) */
.conv-dropdown-menu {
    position: fixed !important;
    z-index: 999999 !important;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.2), 0 8px 12px -6px rgba(0, 0, 0, 0.12);
    padding: 6px;
    min-width: 185px;
    display: none;
    flex-direction: column;
    gap: 2px;
    animation: nvDropdownFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    max-width: calc(100vw - 20px);
}

.conv-dropdown-menu.is-active {
    display: flex !important;
}

.conv-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
    text-decoration: none;
    box-sizing: border-box;
}

.conv-menu-item:hover {
    background: #F8FAFC;
    color: #0F172A;
}

.conv-menu-icon {
    font-size: 15px;
    width: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.conv-menu-divider {
    height: 1px;
    background: #F1F5F9;
    margin: 4px 6px;
}

.conv-menu-item.item-danger {
    color: #DC2626;
}

.conv-menu-item.item-danger:hover {
    background: #FEE2E2;
    color: #B91C1C;
}

.conv-menu-item.item-warning {
    color: #D97706;
}

.conv-menu-item.item-warning:hover {
    background: #FEF3C7;
    color: #92400E;
}

/* ==========================================================================
   HIDE FOOTER IN CHATTING / CONVERSATION ON MOBILE & TABLET (< 992px)
   ========================================================================== */
@media (max-width: 991px) {
    body.page-template-page-dashboard .site-footer,
    body.page-template-page-dashboard #colophon,
    body.page-template-page-dashboard .nv-dhaka-bottom-border,
    body.nv-chat-active .site-footer,
    body.nv-chat-active #colophon,
    body.nv-chat-active .nv-dhaka-bottom-border,
    .nv-chat-container.has-active-chat ~ .site-footer,
    .nv-chat-container.mobile-chat-active ~ .site-footer,
    .dashboard-tab-pane#tab-messages ~ .site-footer,
    body.page-template-page-dashboard footer.site-footer {
        display: none !important;
    }
}