/* Custom styles - Zalo Online */

.rounded-2xl {
    border-radius: 6px !important;
}

/* Khoảng cách giữa các tin nhắn */
.chat-message-list > * + * {
    margin-top: 4px;
}
/* Các bubble liên tiếp của cùng 1 phía thì sát hơn nữa */
.chat-message-list .chat-msg-item + .chat-msg-item {
    margin-top: 3px;
}
.chat-message-list .chat-msg-item[data-is-mine="1"] + .chat-msg-item[data-is-mine="1"],
.chat-message-list .chat-msg-item[data-is-mine="0"] + .chat-msg-item[data-is-mine="0"] {
    margin-top: 2px;
}
/* Nếu tin phía trên có cảm xúc, nới khoảng cho tin ngay dưới */
.chat-message-list .chat-msg-item.chat-msg-item--with-reactions + .chat-msg-item {
    margin-top: 8px !important;
}

/* Thời gian tin nhắn - nhỏ, màu xám nhạt, bên dưới nội dung */
.chat-message-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
    margin-bottom: 0;
}

/* Separator thời gian giữa các cụm tin nhắn (Hôm nay / Hôm qua / ngày tháng năm) */
.chat-day-separator {
    display: flex;
    justify-content: center;
    margin: 12px 0;
}
.chat-day-separator-label {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 9999px;
    background: #cbd5e1;
    color: #ffffff;
    font-size: 11px;
    font-weight: 500;
}
.flex.items-center.gap-3.px-4.py-3.border-b.border-slate-200.bg-white.shrink-0 {
    padding-top: 1.25rem;
    padding-bottom: 1.25rem;
    
}

/* Bubble text: luôn xuống dòng cả chuỗi dài không có khoảng trắng */
.chat-bubble-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Chỉ khung tin nhắn được cuộn - header và ô nhập cố định */
#friendChatMessages,
#myDocumentMessages,
#groupChatMessages {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Cột chứa bubble + tim (neo theo bubble) */
.msg-bubble-col {
    position: relative;
    padding-bottom: 1px;
}
.msg-bubble-col--with-reactions {
    padding-bottom: 14px; /* nới thêm ~2px để tin dưới hở nhẹ */
}
.msg-bubble-col--with-reactions .chat-msg-bubble {
    padding-bottom: 8px !important; /* không đẩy badge quá cao lên trong bubble */
}

/* Nút trái tim tin nhắn - nằm góc dưới và đè lên viền */
.msg-like-wrapper {
    position: absolute;
    right: 5px;
    bottom: -2px; /* bám sát mép dưới bubble, không quá cao */
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 6px;
}
.msg-like-btn {
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 9999px;
    border: 1px solid #e2e8f0;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}
.msg-like-btn:hover {
    background-color: #f8fafc;
}
.msg-like-btn svg {
    width: 1.1rem;
    height: 1.1rem;
    transition: fill 0.2s;
}
.msg-like-btn.msg-like-btn--liked {
    color: #ef4444;
    border-color: #fecaca;
    background-color: #fff; /* giữ nền trắng */
}
.msg-like-btn.msg-like-btn--liked svg {
    fill: currentColor;
}

/* Badge tim + số (❤ 1, ❤ 2...) */
.msg-like-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 9999px;
    border: 1px solid #e2e8f0;     /* viền trắng như mẫu */
    background: #fff;        /* nền trắng */
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    font-size: 13px;
    line-height: 1;
    color: #271b1b;                /* chữ đen */
}
.msg-like-badge-heart {
    color: #ef4444;                /* tim đỏ trên nền trắng */
}

/* Emoji trong badge */
.msg-like-badge-emojis {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.reaction-chip {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    font-size: 14px;
    
}
/* Tim trong badge luôn đỏ */
.reaction-chip--heart {
    color: #ff0000;
}

/* Reaction picker (nhấn giữ) */
.reaction-picker {
    position: fixed;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
}
.reaction-picker.hidden {
    display: none;
}
.reaction-picker-bar {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 9px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
}
.reaction-emoji {
    font-size: 26px;
    line-height: 1;
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
}
/* Dòng đầu tiên (❤) trong picker: đỏ tươi */
.reaction-emoji[data-emoji="❤"] {
    color: #ff0000;
}
.reaction-emoji[data-emoji="❤"]:hover {
    filter: brightness(1.05);
}
.reaction-close {
    width: 44px;
    height: 44px;
    border-radius: 9999px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

/* Message long-press menu */
.message-menu {
    position: fixed;
    z-index: 9999;
}
.message-menu.hidden {
    display: none;
}
.message-menu-actions {
    width: 340px;
    background: #fff;
    border-radius: 18px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.22);
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.message-action {
    
    background: #fff;
    border-radius: 14px;
    padding: 10px 8px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    line-height: 1.1;
    min-height: 66px;
}
.message-action-icon {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #0f172a;
}
.message-action-icon svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}
.message-action-label {
    font-size: 12px;
    color: #0f172a;
}
.message-action:hover {
    background: #f8fafc;
}
.message-action[data-action="reply"] .message-action-icon,
.message-action[data-action="forward"] .message-action-icon {
    color: #2563eb; /* xanh dương như Zalo */
}
.message-action.danger {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.25);
}
.message-action.danger .message-action-icon,
.message-action.danger .message-action-label {
    color: #ef4444;
}

/* Hold sheet (preview message + reactions + tools) */
.hold-sheet {
    position: fixed;
    inset: 0;
    z-index: 99999;
}
.hold-sheet.hidden {
    display: none;
}
.hold-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.55);
    backdrop-filter: blur(1px);
}
.hold-sheet-panel {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: min(380px, calc(100vw - 24px));
}
.hold-sheet-preview {
    display: flex;
    justify-content: flex-start;
    margin-bottom: -6px;
}

.hold-sheet-preview .chat-msg-bubble {
    max-width: 85%;
}
.hold-sheet-reactions {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}
.hold-sheet-reactions .reaction-picker {
    position: static;
    display: inline-flex;
}
.hold-sheet-tools .message-menu-actions {
    width: 100%;
    border-radius: 18px;
}
.hold-sheet-tools .message-menu-actions {
    grid-template-columns: repeat(4, 1fr);
}

/* Modal chọn nơi chuyển tiếp tin nhắn */
.forward-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
}
.forward-modal.hidden {
    display: none;
}
.forward-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}
.forward-modal-dialog {
    position: absolute;
    inset: 0;              /* full màn hình */
    margin: 0;
    max-width: 100%;
    max-height: 100%;
    background: #fff;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
}
.forward-modal-header {
    padding: 43px 30px 16px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
}
.forward-modal-title {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    text-align: center;
    flex: 1;
}
.forward-close-btn {
    border: none;
    background: transparent;
    font-size: 20px;
    line-height: 1;
    padding: 0 4px 0 0;
    cursor: pointer;
    color: #6b7280;
}
.forward-close-btn:hover {
    color: #111827;
}
.forward-modal-search {
    padding: 8px 16px;
}
.forward-search-input {
    width: 100%;
    border-radius: 9999px;
    border: 1px solid #e5e7eb;
    padding: 7px 12px;
    font-size: 14px;
    outline: none;
}
.forward-search-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2);
}
.forward-modal-body {
    padding: 4px 0 0;
    overflow-y: auto;
}
.forward-section {
    padding: 4px 0 8px;
}
.forward-section-title {
    padding: 0 16px;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}
.forward-list {
    padding: 0 8px;
}
.forward-list--scroll {
    max-height: 220px;
    overflow-y: auto;
}
.forward-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 9999px;
    border: none;
    background: transparent;
    cursor: pointer;
}
.forward-item:hover {
    background: #f3f4f6;
}
.forward-item-avatar {
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.forward-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.forward-avatar-fallback {
    width: 100%;
    height: 100%;
    border-radius: 9999px;
    background: #bfdbfe;
    color: #1d4ed8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}
.forward-item-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.forward-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: justify;
}
.forward-item-sub {
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: justify;
}
.forward-item-check {
    width: 20px;
    height: 20px;
    border-radius: 9999px;
    border: 2px solid #d1d5db;
    flex-shrink: 0;
}
.forward-item--selected .forward-item-check {
    background: #3b82f6;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4);
}
.forward-empty-text {
    padding: 4px 16px 0;
    font-size: 13px;
    color: #9ca3af;
}
.forward-more-btn {
    display: block;
    width: 100%;
    text-align: center;
    padding: 6px 0 2px;
    border: none;
    background: transparent;
    font-size: 13px;
    color: #2563eb;
    cursor: pointer;
}
.forward-more-btn:hover {
    color: #1d4ed8;
}
.forward-modal-footer {
    padding: 8px 16px 12px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 8px;
}
.forward-selected-summary {
    flex: 1;
    font-size: 13px;
    color: #6b7280;
}
.forward-send-btn {
    border-radius: 9999px;
    background: #3b82f6;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 6px 18px;
    border: none;
    cursor: pointer;
}
.forward-send-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

/* Modal tạo nhóm (Nhóm mới) */
.group-modal {
    position: fixed;
    inset: 0;
    z-index: 70;
}
.group-modal.hidden {
    display: none;
}
.group-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}
.group-modal-dialog {
    position: absolute;
    inset: 0;
    margin: 0;
    max-width: 100%;
    max-height: 100%;
    background: #fff;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
}
.group-modal-header {
    padding: 40px 16px 8px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
}
.group-close-btn {
    border: none;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    padding: 0 8px 0 0;
    cursor: pointer;
    color: #6b7280;
}
.group-close-btn:hover {
    color: #111827;
}
.group-modal-header-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.group-modal-title {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
}
.group-modal-subtitle {
    font-size: 12px;
    color: #6b7280;
    margin: 0;
}
.group-modal-body {
    padding: 10px 16px 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.group-name-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.group-avatar-btn {
    width: 52px;
    height: 52px;
    border-radius: 9999px;
    border: none;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.group-avatar-icon {
    font-size: 22px;
}
.group-name-input {
    flex: 1;
    border-radius: 9999px;
    border: 1px solid #e5e7eb;
    padding: 10px 14px;
    font-size: 14px;
    outline: none;
}
.group-name-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2);
}
.group-modal-search {
    margin-bottom: 8px;
}
.group-search-input {
    width: 100%;
    border-radius: 9999px;
    border: 1px solid #e5e7eb;
    padding: 7px 12px;
    font-size: 14px;
    outline: none;
}
.group-search-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2);
}
.group-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    margin: 0 -16px 4px;
    padding: 0 16px;
}
.group-tab {
    flex: 1;
    padding: 8px 0;
    border: none;
    background: transparent;
    font-size: 14px;
    cursor: pointer;
    color: #6b7280;
}
.group-tab--active {
    color: #2563eb;
    font-weight: 600;
    border-bottom: 2px solid #2563eb;
}
.group-list {
    padding: 4px 0 0;
}
.group-list--scroll {
    max-height: 260px;
    overflow-y: auto;
}
.group-modal-footer {
    padding: 8px 12px 14px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 8px;
}
.group-selected-strip {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
}
.group-selected-item {
    position: relative;
}
.group-selected-avatar {
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    overflow: hidden;
    border: 2px solid #e5e7eb;
}
.group-selected-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.group-selected-avatar-fallback {
    width: 100%;
    height: 100%;
    border-radius: 9999px;
    background: #bfdbfe;
    color: #1d4ed8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}
.group-selected-remove {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    border-radius: 9999px;
    border: none;
    background: #111827;
    color: #fff;
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.group-create-btn {
    border-radius: 9999px;
    background: #0ea5e9;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 18px;
    border: none;
    cursor: pointer;
}
.group-create-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

/* Reply quote inside bubble */
.reply-quote {
    display: flex;
    gap: 8px;
    margin: -2px 0 8px;
    padding: 6px 8px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.05);
}
.reply-quote-bar {
    width: 3px;
    border-radius: 9999px;
    background: rgba(59, 130, 246, 0.9);
    flex: none;
}
.reply-quote-body {
    min-width: 0;
}
.reply-quote-title {
    font-size: 11px;
    font-weight: 700;
    color: rgba(15, 23, 42, 0.85);
    margin: 0;
}
.reply-quote-text {
    font-size: 11px;
    color: rgba(15, 23, 42, 0.65);
    margin: 2px 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}

/* Pinned messages strip (Zalo-like) */
.pinned-wrap {
    position: relative;
}
.pinned-bar {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
}
.pinned-bar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.pinned-icon {
    width: 22px;
    height: 22px;
    color: #3b82f6;
    flex: none;
}
.pinned-icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}
.pinned-bar-text {
    min-width: 0;
}
.pinned-bar-title {
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}
.pinned-bar-sub {
    font-size: 11px;
    color: #64748b;
    margin: 2px 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}
.pinned-bar-right {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: none;
}
.pinned-count {
    border: 1px solid rgba(15, 23, 42, 0.15);
    color: #0f172a;
    background: #fff;
    border-radius: 9999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}
.pinned-chevron {
    width: 18px;
    height: 18px;
    color: #0f172a;
    opacity: .65;
}
.pinned-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.22);
    border-radius: 14px;
    overflow: hidden;
    z-index: 50;
}
.pinned-dropdown.hidden { display: none; }
.pinned-item {
    width: 100%;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #fff;
    border: 0;
    cursor: pointer;
    text-align: left;
}
.pinned-item + .pinned-item {
    border-top: 1px solid rgba(15, 23, 42, 0.06);
}
.pinned-item-main {
    min-width: 0;
}
.pinned-item-title {
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 2px;
}
.pinned-item-text {
    font-size: 11px;
    color: #64748b;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pinned-item-go {
    color: #0f172a;
    opacity: .5;
    flex: none;
}
.pinned-item-unpin {
    border-radius: 9999px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 4px 8px;
    font-size: 11px;
    color: #ef4444;
    background: #fff;
    cursor: pointer;
}

/* Pinned overlay to keep dropdown above messages */
.pinned-overlay.hidden { display: none; }
.pinned-overlay-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99990;
    background: transparent;
}
.pinned-overlay-dropdown {
    position: fixed;
    z-index: 99991;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.22);
    border-radius: 14px;
    overflow: hidden;
}
/* Hiệu ứng highlight tin nhắn khi nhảy tới (rõ, nhưng gói trong viền bubble) */
.pinned-highlight .chat-msg-bubble {
    animation: pinnedBorderFlash 0.9s ease-out 1;
}

/* Delete confirm modal (Zalo-like) */
.delete-modal.hidden { display: none; }
.delete-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
}
.delete-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.55);
}
.delete-modal-dialog {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(520px, calc(100vw - 24px));
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 18px 48px rgba(2, 6, 23, 0.25);
}
.delete-modal-body {
    padding: 22px 22px 16px;
}
.delete-modal-title {
    margin: 0;
    font-size: 28px;
    line-height: 1.15;
    font-weight: 800;
    color: #0f172a;
}
.delete-modal-desc {
    margin: 14px 0 0;
    font-size: 26px;
    line-height: 1.2;
    font-weight: 800;
    color: #0f172a;
}
.delete-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    padding: 14px 16px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}
.delete-modal-btn {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 10px 14px;
    font-size: 22px;
    font-weight: 800;
    cursor: pointer;
    color: #0f172a;
}
.delete-modal-btn.danger {
    color: #ef4444;
}

/* Message detail modal (chi tiết tin nhắn) */
.msg-detail-modal.hidden { display: none; }
.msg-detail-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
}
.msg-detail-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.55);
}
.msg-detail-dialog {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(520px, calc(100vw - 24px));
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 18px 48px rgba(2, 6, 23, 0.25);
}
.msg-detail-body {
    padding: 18px 18px 14px;
}
.msg-detail-preview {
    margin-bottom: 12px;
}
.msg-detail-meta {
    margin: 0;
    font-size: 13px;
    color: #4b5563;
}
.msg-detail-meta-line + .msg-detail-meta-line {
    margin-top: 4px;
}
.msg-detail-meta-label {
    font-weight: 600;
    color: #111827;
}
.msg-detail-meta--center {
    text-align: center;
    font-size: 12px;
    color: #9ca3af;
}
.msg-detail-footer {
    display: flex;
    justify-content: flex-end;
    padding: 10px 14px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}
.msg-detail-close-btn {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 8px 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    color: #2563eb;
}

/* Toast thông báo tin nhắn mới */
.new-message-toast {
    position: fixed;
    left: 50%;
    bottom: 88px;
    transform: translateX(-50%);
    z-index: 100000;
    padding: 8px 14px;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.94);
    color: #f9fafb;
    font-size: 13px;
    display: none;
    align-items: center;
    gap: 6px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.4);
}
.new-message-toast.visible {
    display: inline-flex;
    animation: toastFade 2.2s ease-out 1;
}
.new-message-dot {
    width: 8px;
    height: 8px;
    border-radius: 9999px;
    background: #22c55e;
}
@keyframes toastFade {
    0%   { opacity: 0; transform: translate(-50%, 8px); }
    15%  { opacity: 1; transform: translate(-50%, 0); }
    85%  { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, 4px); }
}

/* Badge số tin nhắn chưa xem trong danh sách hội thoại */
.friend-unread-badge {
    min-width: 18px;
    padding: 0 5px;
    height: 18px;
    border-radius: 9999px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    font-weight: 600;
    display: none;
    margin-right: 15px;
}
.friend-unread-badge.visible {
    display: inline-block;
}

/* Badge tổng tin nhắn chưa xem trên tab Tin nhắn (dạng bong bóng đỏ) */
.nav-unread-badge {
    position: absolute;
    top: -30px;
    right: 1px;
    min-width: 18px;
    padding: 0 5px;
    height: 18px;
    border-radius: 9999px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    line-height: 18px;
    text-align: center;
    font-weight: 700;
    display: none;
    box-shadow: 0 0 0 2px #ffffff;
}
.nav-unread-badge.visible {
    display: inline-block;
}
@keyframes pinnedBorderFlash {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.9);
        border-color: rgba(59, 130, 246, 0.95);
        background-color: rgba(219, 234, 254, 0.9); /* xanh nhạt như Zalo */
    }
    50% {
        box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.35);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

/* Trạng thái tin nhắn: Đã nhận / Đã xem
   Đặt tuyệt đối trong cột bubble để KHÔNG đẩy vị trí nút tim */
.msg-status {
    position: absolute;
    right: 3px; /* chừa chỗ cho nút tim ở ngoài cùng bên phải */
    bottom: -26px;
    font-size: 11px;
    line-height: 1;
}
.msg-status--mine {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    color: #6b7280;
}
.msg-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 9999px;
    background: rgba(148, 163, 184, 0.12);
    color: #4b5563;
    white-space: nowrap; /* luôn trên 1 dòng: ✓✓ Đã nhận */
    transform: translate(4px, -3px); /* dịch sang phải 3px, lên trên 2px */
}
.msg-status-badge-icon {
    font-size: 12px;
}
.msg-status-avatar {
    width: 16px;
    height: 16px;
    border-radius: 9999px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
}
.msg-status-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.msg-status-avatar,
.msg-status-avatar-initials {
    width: 16px;      /* nhỏ hơn */
    height: 16px;
    border-radius: 9999px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
    /* dịch sang phải 2px và lên trên 2px */
    transform: translate(12px, -18px);
}
.msg-status-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.msg-status-avatar-initials {
    background: #60a5fa;
    color: #fff;
    font-size: 9px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chế độ chọn nhiều tin nhắn trong khung chat */
.chat-multi-select-mode .chat-msg-item {
    position: relative;
    padding-left: 26px;
}
.chat-multi-select-mode .chat-msg-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border-radius: 9999px;
    border: 2px solid #cbd5e1; /* xám nhạt khi chưa chọn */
    background-color: transparent;
    box-sizing: border-box;
}
.chat-multi-select-mode .chat-msg-item.chat-msg-item--selected::before {
    background-color: #0F86FF;
    border-color: #0F86FF;
    box-shadow: 0 0 0 3px rgba(15, 134, 255, 0.5);
}

.chat-multi-select-mode .chat-msg-item.chat-msg-item--selected::after {
    content: '';
    position: absolute;
    left: 9px;
    top: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 6px;
    height: 10px;
    border-right: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;
    box-sizing: border-box;
}

/* Đảm bảo tick hiển thị ngay cả khi có khác biệt DOM */
.chat-msg-item.chat-msg-item--selected::before {
    background-color: #0F86FF;
    border-color: #0F86FF;
    box-shadow: 0 0 0 3px rgba(15, 134, 255, 0.5);
}
.chat-msg-item.chat-msg-item--selected::after {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 6px;
    height: 10px;
    border-right: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;
    box-sizing: border-box;
}

/* Sticker picker đơn giản dưới ô nhập tin nhắn */
.sticker-picker {
    position: absolute;
    bottom: 56px;
    left: 60px;
    width: 260px;
    padding: 8px;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.25);
    border: 1px solid rgba(148, 163, 184, 0.4);
    display: none;
    z-index: 70;
    max-height: 260px;
    overflow-y: auto;
}
.sticker-picker.visible {
    display: grid;
}
.sticker-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.sticker-item {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    cursor: pointer;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    line-height: 1;
    background: #ffffff;
}
.sticker-item:hover {
    border-color: #0F86FF;
    background: #eff6ff;
}
.sticker-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
