/* =========================
   LAYOUT CONTAINER
========================= */
.chat-container {
    display: flex;
    height: 80vh;
    background: #444753;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}

/* =========================
   LEFT SIDEBAR (FRIENDS)
========================= */
.people-list {
    max-width: 280px;
    background: #191919;
    color: #fff;
    display: flex;
    flex-direction: column;
}

.search {
    padding: 15px;
}

    .search input {
        width: 100%;
        padding: 10px;
        border: none;
        border-radius: 4px;
    }

.friend-list {
    list-style: none;
    margin: 0;
    padding: 0 15px 15px;
    overflow-y: auto;
}

.friend-item {
    display: flex;
    gap: 10px;
    padding: 10px;
    cursor: pointer;
    border-radius: 6px;
}

    .friend-item img {
        width: 40px;
        height: 40px;
        border-radius: 50%;
    }

    .friend-item.active,
    .friend-item.active:hover {
        background: rgba(255,255,255,0.05) !important;
        border-left: 4px solid #2B988F;
    }

        .friend-item.active .name {
            font-weight: 600;
        }



/* Online / Offline status */
.friend-list .status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

    /* Presence dot (pseudo-element so theme CSS can't break it) */
    .friend-list .status::before {
        content: "";
        width: 8px;
        height: 8px;
        border-radius: 50%;
        flex: 0 0 8px;
    }

    .friend-list .status.online::before {
        background: #28c76f;
    }

    .friend-list .status.offline::before {
        background: #ea5455;
    }

    .friend-list .status.not-connected::before {
        background: #6b7280;
    }

/* Non-friend sidebar item */
.friend-item.non-friend img {
    opacity: 0.7;
    border: 2px dashed #4b5563;
    border-radius: 50%;
}
.friend-item.non-friend .name {
    color: #d1d5db;
}
.friend-item.non-friend .status.not-connected {
    font-size: .7rem;
    color: #6b7280;
    font-style: italic;
}

/* Divider between non-friend and friends */
.friend-list-divider {
    list-style: none;
    font-size: .65rem;
    color: #4b5563;
    text-transform: uppercase;
    letter-spacing: .07em;
    padding: 8px 10px 4px;
    user-select: none;
}

/* Add Friend button in chat header */
.chat-add-friend-btn {
    margin-left: auto;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 13px;
    font-size: .78rem;
    font-weight: 600;
    border-radius: 7px;
    border: 1px solid #a7d8d5;
    background: #e6f4f3;
    color: #2B988F;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.chat-add-friend-btn:hover:not(:disabled) {
    background: #2B988F;
    color: #fff;
    border-color: #2B988F;
}
.chat-add-friend-btn.sent,
.chat-add-friend-btn:disabled {
    opacity: 0.7;
    cursor: default;
}
.chat-add-friend-btn.sent {
    background: #f0fdf4;
    color: #15803d;
    border-color: #bbf7d0;
    opacity: 1;
}

/* =========================
   CHAT PANEL
========================= */
.chat {
    flex: 1;
    background: #F2F5F8;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 8px;
    display: flex;
    gap: 10px;
    align-items: center;
    background: #fff;
    border-bottom: #f8f8f8 !important;
}

#chatHeaderAvatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 auto;
    border: 2px solid #F2F5F8;
}

/* =========================
   MESSAGE AREA
========================= */
.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

#messageList {
    list-style: none;
    margin: 0;
    padding: 0;
}

    #messageList > li {
        display: flex;
        width: 100%;
    }

    /* The pre-chat version of this file can still be sitting in a browser's
       cache (it was linked without a ?v= stamp and is cached for a week) and
       load after this one. These out-rank its leftovers: column rows with a
       bottom margin, stretched bubbles, and the bubble tail arrows. */
    #messageList > li.dm-msg,
    #messageList > li.dm-day-sep,
    #messageList > li.dm-unread-sep,
    #messageList > li.dm-empty {
        flex-direction: row;
        margin-bottom: 0;
    }

    #messageList > li.dm-msg {
        align-items: flex-start;
    }

    #messageList > li .message {
        flex: 0 1 auto;
    }

    #messageList > li .message::after {
        content: none;
    }

    /* One row per message: yours on the right, theirs on the left */
    #messageList > li.dm-msg {
        margin-top: 10px;
    }

    #messageList > li.dm-msg.dm-cont {
        margin-top: 2px;
    }

    #messageList > li.dm-msg.me {
        justify-content: flex-end;
    }

    #messageList > li.dm-msg.them {
        justify-content: flex-start;
    }

/* Message bubble */
#messageList .message {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 2px 10px;
    max-width: 75%;
    min-width: 0;
    padding: 8px 12px;
    border-radius: 18px;
    font-size: .95rem;
    line-height: 1.35;
    box-shadow: 0 1px 1px rgba(0,0,0,0.06);
}

    #messageList .message.me {
        background: #2B988F;
        color: #fff;
        border-bottom-right-radius: 5px;
    }

    #messageList .message.them {
        background: #fff;
        color: #111;
        border-bottom-left-radius: 5px;
    }

.dm-text {
    min-width: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Time sits inside the bubble, bottom right */
#messageList .message-time {
    margin-left: auto;
    font-size: .68rem;
    line-height: 1.5;
    opacity: .7;
    white-space: nowrap;
}

/* Day separator ("Today", "Yesterday", "Mon, Oct 5") */
#messageList > li.dm-day-sep {
    justify-content: center;
    margin: 16px 0 6px;
}

    #messageList > li.dm-day-sep:first-child {
        margin-top: 0;
    }

    .dm-day-sep span {
        padding: 3px 12px;
        border-radius: 999px;
        background: rgba(0,0,0,0.07);
        color: #555;
        font-size: .7rem;
        font-weight: 600;
    }

/* "New messages" divider above the first unread message */
#messageList > li.dm-unread-sep {
    align-items: center;
    gap: 10px;
    margin: 14px 0 4px;
    color: #2B988F;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}

    .dm-unread-sep::before,
    .dm-unread-sep::after {
        content: "";
        flex: 1;
        height: 1px;
        background: rgba(43,152,143,0.4);
    }

/* Attachments (a [[file:…]] message, see messages.js buildAttachment).
   Fixed heights so the list doesn't jump when the media finishes loading. */
#messageList .message.has-attachment {
    padding: 4px 4px 6px;
    flex-direction: column;
    align-items: stretch;
}

    #messageList .message.has-attachment .message-time {
        margin-right: 8px;
    }

.dm-attach-image {
    display: block;
    line-height: 0;
}

    .dm-attach-image img,
    .dm-attach-video {
        display: block;
        height: 180px;
        width: auto;
        min-width: 90px;
        max-width: 100%;
        object-fit: cover;
        border-radius: 14px;
        background: rgba(0,0,0,0.08);
    }

.dm-attach-audio {
    display: block;
    width: 240px;
    max-width: 100%;
    height: 40px;
    margin: 4px;
}

.dm-attach-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    overflow-wrap: anywhere;
}

    .dm-attach-file:hover {
        color: inherit;
    }

    .dm-attach-file .material-icons {
        flex-shrink: 0;
        font-size: 22px;
    }

#messageList > li.dm-empty {
    justify-content: center;
    padding: 40px 0;
    color: #9ca3af;
    font-size: .85rem;
}

/* =========================
   CHAT INPUT
========================= */
.chat-input textarea {
    border-radius: 20px;
}

.chat-input .material-icons {
    font-size: 20px;
    vertical-align: middle;
}

/* =========================
   "+" EXTRAS (emoji / GIF / photo-file) — built by messages.js
========================= */
#messageModalBody .chat-input {
    position: relative;
}

.dm-plus-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    margin-right: 8px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(43,152,143,0.12);
    color: #2B988F;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s, transform .15s;
}

    .dm-plus-btn .material-icons {
        font-size: 24px;
    }

    .dm-plus-btn:hover {
        background: rgba(43,152,143,0.2);
    }

    /* the + turns into an x while something is open */
    .dm-plus-btn.open {
        transform: rotate(45deg);
    }

.dm-extras,
.dm-picker {
    position: absolute;
    left: 10px;
    bottom: calc(100% + 6px);
    z-index: 20;
    background: #fff;
    border: 1px solid #e6e8eb;
    border-radius: 16px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.18);
    animation: dm-extras-in .14s ease-out;
    transform-origin: bottom left;
}

@keyframes dm-extras-in {
    from { opacity: 0; transform: translateY(6px) scale(.96); }
    to   { opacity: 1; transform: none; }
}

.dm-extras {
    display: grid;
    grid-template-columns: repeat(3, 76px);
    gap: 4px;
    padding: 8px;
}

.dm-extras-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 2px;
    border: none;
    border-radius: 12px;
    background: none;
    color: #444;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

    .dm-extras-btn:hover,
    .dm-extras-btn:active {
        background: #f2f4f6;
    }

    .dm-extras-btn .material-icons {
        width: 40px;
        height: 40px;
        line-height: 40px;
        text-align: center;
        font-size: 1.5rem;
        border-radius: 50%;
        background: rgba(43,152,143,0.1);
        color: #2B988F;
    }

.dm-picker {
    display: flex;
    flex-direction: column;
    width: 370px;
    max-width: calc(100% - 20px);
    padding: 8px;
    overflow: hidden;
}

.dm-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2px 6px 6px;
    color: #111;
    font-size: .85rem;
    font-weight: 600;
}

    .dm-picker-head button {
        border: none;
        background: none;
        padding: 2px;
        color: #6b7280;
        line-height: 1;
        cursor: pointer;
    }

.dm-gif-search {
    width: 100%;
    padding: 7px 12px;
    margin-bottom: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #f4f4f5;
    color: #111;
    /* 16px stops iOS zooming the page when the box is focused */
    font-size: 16px;
    outline: none;
}

.dm-gif-results {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    height: 260px;
    overflow-y: auto;
    align-content: start;
}

    .dm-gif-results img {
        width: 100%;
        aspect-ratio: 1;
        object-fit: cover;
        border-radius: 8px;
        background: #f2f4f6;
        cursor: pointer;
    }

.dm-gif-note {
    grid-column: 1 / -1;
    padding: 24px 0;
    color: #9ca3af;
    font-size: .8rem;
    text-align: center;
}

.dm-upload-status {
    padding: 0 4px 6px;
    color: #6b7280;
    font-size: .75rem;
}

    .dm-upload-status:empty {
        display: none;
    }

    .dm-upload-status.is-error {
        color: #b91c1c;
    }

/* =========================
   CHAT SHIMMER LOADER
========================= */

.chat-shimmer {
    display: flex;
    height: 100%;
    animation: fadeIn .2s ease;
}

.shimmer-sidebar {
    width: 240px;
    padding: 20px;
    border-right: 1px solid #eee;
}

.shimmer-chat {
    flex: 1;
    padding: 20px;
}

.shimmer-line {
    height: 14px;
    border-radius: 6px;
    margin-bottom: 14px;
    background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
}

.shimmer-bubble {
    width: 60%;
    height: 16px;
    border-radius: 12px;
    margin-bottom: 18px;
    background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
}

    .shimmer-bubble.right {
        margin-left: auto;
        width: 45%;
    }

.w-60 {
    width: 60%;
}

.w-70 {
    width: 70%;
}

.w-80 {
    width: 80%;
}

.w-85 {
    width: 85%;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}


/* ===============================
   MESSAGE NOTIFICATION BADGE
=============================== */

/* =========================
   MESSAGE HIGHLIGHT (search)
========================= */
.msg-highlight {
    animation: msgHighlight 2.5s ease forwards;
}
@keyframes msgHighlight {
    0%   { background: rgba(251,191,36,0.35); border-radius: 8px; }
    70%  { background: rgba(251,191,36,0.2);  border-radius: 8px; }
    100% { background: transparent; }
}
.msg-highlight .message {
    outline: 2px solid rgba(251,191,36,0.7);
    outline-offset: 2px;
}

/* =========================
   SEARCH DROPDOWN
========================= */
.msg-search-dropdown {
    position: absolute; /* positioned via JS against body */
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 8px;
    z-index: 99999;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    max-height: 320px;
    overflow-y: auto;
}
.msg-search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    cursor: pointer;
    transition: background .1s;
    border-bottom: 1px solid #2a2a2a;
}
.msg-search-item:last-child { border-bottom: none; }
.msg-search-item:hover { background: rgba(255,255,255,0.06); }
.msg-search-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.msg-search-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.msg-search-user {
    font-size: 0.8rem;
    font-weight: 600;
    color: #e5e7eb;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msg-search-snippet {
    font-size: 0.74rem;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msg-search-snippet mark {
    background: rgba(251,191,36,0.35);
    color: #fbbf24;
    border-radius: 2px;
    padding: 0 1px;
}
.msg-search-time {
    font-size: 0.65rem;
    color: #6b7280;
    white-space: nowrap;
    flex-shrink: 0;
}
.msg-search-empty {
    padding: 14px 12px;
    font-size: 0.8rem;
    color: #6b7280;
    text-align: center;
}

/* =========================
   MESSAGE NOTIFICATION BADGE
========================= */
.message-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #e53935;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 999px;
    display: none; /* controlled by JS */
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ==============================
   MOBILE HANDLE
============================== */
.mm-mobile-handle {
    display: none;
    flex-direction: column;
    align-items: center;
    padding: 10px 16px 0;
    flex-shrink: 0;
    background: #fff;
    border-radius: 20px 20px 0 0;
}

.mm-handle-bar {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(0,0,0,0.15);
    margin-bottom: 8px;
    flex-shrink: 0;
}

.mm-handle-inner {
    display: flex;
    align-items: center;
    width: 100%;
    padding-bottom: 8px;
}

.mm-handle-title {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 600;
    color: #111;
}

/* Back button in chat header (shown on mobile when chat is open) */
.chat-back-btn {
    display: none;
    background: none;
    border: none;
    padding: 0 8px 0 0;
    cursor: pointer;
    color: #2B988F;
    align-items: center;
    flex-shrink: 0;
    line-height: 1;
}

.chat-back-btn .material-icons {
    font-size: 22px !important;
    vertical-align: middle;
}

/* ==============================
   MOBILE BOTTOM-SHEET LAYOUT
============================== */
@media (max-width: 991px) {
    #messageModal.fade .modal-dialog {
        transform: translateY(100%);
        transition: transform .35s cubic-bezier(0.32, 0.72, 0, 1) !important;
    }
    #messageModal.show .modal-dialog {
        transform: none;
    }

    #messageModal .modal-dialog {
        position: fixed !important;
        top: 80px !important;
        bottom: var(--mnav-clearance) !important;
        left: 0 !important;
        right: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        max-height: none !important;
        min-height: 0 !important;
        width: 100% !important;
        height: auto !important;
    }

    #messageModal .modal-content {
        height: 100% !important;
        overflow: hidden !important;
        border-radius: 20px 20px 0 0 !important;
        border: none !important;
        display: flex !important;
        flex-direction: column !important;
    }

    #messageModal .album-modal-close-btn {
        display: none !important;
    }

    .mm-mobile-handle {
        display: flex !important;
    }

    #messageModal .modal-body {
        flex: 1 !important;
        min-height: 0 !important;
        overflow: hidden !important;
        padding: 0 !important;
    }

    #messageModal #messageModalBody {
        height: 100%;
        overflow: hidden;
    }

    #messageModal .chat-container {
        height: 100% !important;
        border-radius: 0 !important;
        background: #fff !important;
    }

    /* Shimmer: single column on mobile */
    #messageModal .chat-shimmer {
        height: 100% !important;
    }

    #messageModal .shimmer-sidebar {
        width: 100% !important;
        border-right: none !important;
    }

    #messageModal .shimmer-chat {
        display: none !important;
    }

    /* Default: show people-list full width, hide chat panel */
    #messageModal .people-list {
        max-width: 100% !important;
        width: 100% !important;
        flex: 1 0 100% !important;
        min-height: 0 !important;
        background: #fff !important;
        color: #111 !important;
    }

    /* Search bar on light background */
    #messageModal .search {
        border-bottom: 1px solid #f0f0f0;
    }

    #messageModal .search input {
        background: #f4f4f5 !important;
        color: #111 !important;
        border: none !important;
    }

    #messageModal .search input::placeholder {
        color: #9ca3af !important;
    }

    /* Friend items on light background */
    #messageModal .friend-item .name {
        color: #111 !important;
    }

    #messageModal .friend-item:hover:not(.active) {
        background: rgba(0,0,0,0.04) !important;
    }

    #messageModal .friend-item.active,
    #messageModal .friend-item.active:hover {
        background: rgba(43,152,143,0.08) !important;
        border-left-color: #2B988F !important;
    }

    #messageModal .friend-item.active .name {
        color: #2B988F !important;
    }

    /* Status text visible on light bg */
    #messageModal .friend-list .status.offline {
        color: #9ca3af !important;
    }

    #messageModal .friend-list .status.online {
        color: #374151 !important;
    }

    #messageModal .friend-item.non-friend .name {
        color: #6b7280 !important;
    }

    #messageModal .friend-list-divider {
        color: #d1d5db !important;
    }

    #messageModal .chat {
        display: none !important;
    }

    /* When chat-showing: swap panels */
    #messageModal .chat-container.chat-showing .people-list {
        display: none !important;
    }

    #messageModal .chat-container.chat-showing .chat {
        display: flex !important;
        flex: 1 0 100% !important;
        min-height: 0 !important;
    }

    /* Show back button when chat is active */
    .chat-container.chat-showing .chat-back-btn {
        display: inline-flex !important;
    }
}

/* A message that has been drawn but not yet confirmed by the server
   (sendText in messages.js): slightly dimmed until it is saved. */
#messageList > li.dm-msg.dm-pending .message { opacity: .6; }

/* ── Emoji reactions (messages.js "Emoji reactions") ───────────────────────
   Pills hang off the bottom edge of the bubble; the row gets room for them. */
#messageList .message { position: relative; }
/* Padding, not margin: the pills hang 18px below the bubble, and a margin
   here collapses into the next row's. */
#messageList > li.dm-msg.has-reactions { padding-bottom: 26px; }

.dm-reactions {
    position: absolute;
    bottom: -18px;
    display: flex;
    gap: 3px;
    white-space: nowrap;
    z-index: 1;
}
    li.dm-msg.them .dm-reactions { left: 10px; }
    li.dm-msg.me .dm-reactions { right: 10px; }

.dm-reaction {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 24px;
    padding: 0 7px;
    border: 1px solid #e3e6ea;
    border-radius: 999px;
    background: #fff;
    color: #333;
    font-size: .85rem;
    line-height: 1;
    box-shadow: 0 1px 2px rgba(0,0,0,.08);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
    .dm-reaction.mine {
        border-color: rgba(43,152,143,.55);
        background: #e6f4f3;
    }
    .dm-reaction-count { font-size: .72rem; font-weight: 600; color: #555; }

/* Smiley beside the flag: hover-only, like the flag. Touch uses long-press. */
.dm-react-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    margin: 0 2px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #a3a9b6;
    cursor: pointer;
    opacity: 0;
    transition: background-color .15s ease, color .15s ease, opacity .15s ease;
}
    .dm-react-btn .material-icons { font-size: 17px; line-height: 1; }
    .dm-react-btn:hover,
    .dm-react-btn:focus-visible { color: #2B988F; background: rgba(43,152,143,.1); outline: none; }
    #messageList > li.dm-msg:hover .dm-react-btn,
    .dm-react-btn:focus-visible { opacity: 1; }

@media (hover: none) {
    .dm-react-btn { display: none; }
    /* The long-press is ours: no text selection or iOS callout under it.
       (Text messages get a Copy action in the long-press menu instead.) */
    #messageList .message {
        -webkit-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
    }
}

#messageList > li.dm-msg .message { transition: transform .15s ease; }
#messageList > li.dm-msg.dm-react-target .message { transform: scale(1.03); }

/* Quick bar: six emoji + "more", mounted in the modal, position: fixed */
.dm-react-menu {
    position: fixed;
    z-index: 1090;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    animation: dmReactIn .14s ease-out;
}
@keyframes dmReactIn { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }

.dm-react-bar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 4px 18px rgba(0,0,0,.18);
}
.dm-react-quick,
.dm-react-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform .12s ease, background-color .12s ease;
}
    .dm-react-quick:hover { transform: scale(1.18); }
    .dm-react-quick.mine { background: #e6f4f3; }
    .dm-react-more { background: #f1f3f5; color: #555; }
    .dm-react-more .material-icons { font-size: 20px; }
    .dm-react-more:hover { background: #e4e7eb; }

.dm-react-copy {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 0;
    border-radius: 12px;
    background: #fff;
    color: #222;
    font-size: .9rem;
    box-shadow: 0 4px 18px rgba(0,0,0,.18);
}
    .dm-react-copy .material-icons { font-size: 18px; color: #666; }

.dm-react-menu.is-picker {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 24px rgba(0,0,0,.22);
}
    .dm-react-menu.is-picker em-emoji-picker { height: 340px; max-width: calc(100vw - 16px); }

/* Who reacted: hover tooltip over a reaction pill (showReactorTip) */
.dm-reactor-tip {
    position: fixed;
    z-index: 1095;
    max-width: 220px;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(20,24,28,.92);
    color: #fff;
    font-size: .78rem;
    line-height: 1.4;
    text-align: center;
    pointer-events: none;
    box-shadow: 0 3px 12px rgba(0,0,0,.2);
}
    .dm-reactor-tip-emoji { display: block; font-size: 1.1rem; line-height: 1.3; }

/* ── Replies (messages.js "Replies" / "Reply bar") ───────────────────────── */
/* Reply button: beside the react smiley, hover-only like it. Phones reply
   from the long-press menu. */
.dm-reply-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #a3a9b6;
    cursor: pointer;
    opacity: 0;
    transition: background-color .15s ease, color .15s ease, opacity .15s ease;
}
    .dm-reply-btn .material-icons { font-size: 18px; line-height: 1; }
    .dm-reply-btn:hover,
    .dm-reply-btn:focus-visible { color: #2B988F; background: rgba(43,152,143,.1); outline: none; }
    #messageList > li.dm-msg:hover .dm-reply-btn,
    .dm-reply-btn:focus-visible { opacity: 1; }
@media (hover: none) {
    .dm-reply-btn { display: none; }
}

/* Quote of the original, at the top of the reply bubble */
#messageList .message.has-quote { flex-direction: row; }
.dm-quote {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1 0 100%;
    min-width: 0;
    max-width: 100%;
    margin: 0 0 2px;
    padding: 5px 9px;
    border: 0;
    border-left: 3px solid #2B988F;
    border-radius: 8px;
    background: rgba(0,0,0,.05);
    color: inherit;
    font-size: .82rem;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
}
    .message.me .dm-quote {
        border-left-color: rgba(255,255,255,.85);
        background: rgba(255,255,255,.16);
    }
    .dm-quote-who { font-weight: 700; font-size: .75rem; opacity: .9; }
    .dm-quote-text {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        overflow-wrap: anywhere;
        white-space: pre-wrap;
        opacity: .85;
    }

/* Flash on the original after clicking a quote (or a search result) */
#messageList > li.dm-msg.msg-highlight .message { animation: dmMsgFlash 2s ease; }
@keyframes dmMsgFlash {
    0%, 30% { box-shadow: 0 0 0 3px rgba(43,152,143,.55); }
    100%    { box-shadow: 0 1px 1px rgba(0,0,0,.06); }
}

/* "Replying to …" bar above the composer */
.dm-reply-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 8px;
    padding: 6px 6px 6px 10px;
    border-left: 3px solid #2B988F;
    border-radius: 8px;
    background: #f1f5f4;
}
    .dm-reply-bar-icon { color: #2B988F; font-size: 20px; }
    .dm-reply-bar-info { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
    .dm-reply-bar-who { font-size: .75rem; font-weight: 700; color: #2B988F; }
    .dm-reply-bar-text {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: .85rem;
        color: #444;
    }
    .dm-reply-bar-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 30px;
        height: 30px;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: transparent;
        color: #777;
    }
    .dm-reply-bar-close:hover { background: rgba(0,0,0,.06); }
    .dm-reply-bar-close .material-icons { font-size: 18px; }

/* Long-press actions (Reply / Copy) under the quick bar */
.dm-react-actions { display: flex; gap: 6px; }
