/* =====================================================
   APPLE STYLE MESSENGER — messages-new.css
   Consolidated & deduplicated. Each selector defined
   exactly once. Organized by component.
   ===================================================== */

/* -------------------------------------------------------
   1. MODAL OVERLAY
------------------------------------------------------- */
#messenger-modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(232, 232, 237, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#messenger-modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

#messenger-modal-overlay * {
    box-sizing: border-box;
}

/* -------------------------------------------------------
   2. MESSENGER MODAL WINDOW
------------------------------------------------------- */
#messenger-modal {
    width: 92vw;
    height: 90vh;
    max-width: 1400px;
    margin: 0 auto;
    background-color: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    display: flex;
    overflow: hidden;
    position: relative;
}

.close-message-modal {
    position: absolute;
    right: 20px;
    top: 20px;
    z-index: 10000;
    width: 28px;
    height: 28px;
    min-width: 28px;
    /* prevent flex from squeezing it */
    background: #f1f2f6;
    border-radius: 50%;
    padding: 6px;
    box-sizing: border-box;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.close-message-modal img,
.close-message-modal svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* -------------------------------------------------------
   3. SIDEBAR — Left Panel (Chat List)
------------------------------------------------------- */
.messenger-sidebar {
    width: 340px;
    flex-shrink: 0;
    background-color: #FBFBFD;
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

.messenger-sidebar .update-header {
    height: 72px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.messenger-sidebar h4 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
}

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

/* -------------------------------------------------------
   4. CHAT LIST ITEMS
------------------------------------------------------- */
.chat-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s, border-left-color 0.2s;
}

.chat-item:hover {
    background-color: #ffffff;
}

.chat-item.active {
    background-color: #ffffff;
    box-shadow: inset 4px 0 0 #6a38e5;
}

.chat-item>img {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 16px;
}

/* -------------------------------------------------------
   5. CHAT ITEM TEXT
------------------------------------------------------- */
.chat-info {
    flex: 1;
    overflow: hidden;
    min-width: 0;
    /* Critical: prevents flex child from overflowing and breaking truncation */
}

.chat-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2px;
}

.chat-top h4,
.chat-top h4 * {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1D1D1F;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-top .time {
    font-size: 11px;
    color: #aeaeb2;
    margin-left: 8px;
    flex-shrink: 0;
}

/* Sidebar message preview — always single line with ellipsis */
.chat-info p {
    margin: 0;
    font-size: 12px;
    color: #8E8E93;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    max-width: 100%;
    padding-right: 20px;
}

.chat-info p * {
    white-space: inherit;
    color: inherit;
}

/* Suppress any <br> tags in the sidebar preview so it stays on one line */
.chat-info p br {
    display: none;
}

.chat-info p span {
    color: inherit;
}

/* Unread badge on sidebar item */
.chat-item .new-message-count {
    position: absolute;
    right: 16px;
    bottom: 4px;
    transform: translateY(-50%);
    background: #0b93f6;
    color: white;
    height: 16px;
    min-width: 16px;
    border-radius: 10px;
    padding: 3px;
    font-size: 10px;
    line-height: 10px;
    text-align: center;
}

.text-bold {
    font-weight: bold;
}

/* -------------------------------------------------------
   6. CHAT AREA — Right Panel
------------------------------------------------------- */
.messenger-chat-area {
    flex: 1;
    min-width: 0;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* -------------------------------------------------------
   7. CHAT HEADER
------------------------------------------------------- */
.messenger-chat-area .chat-header {
    height: 72px;
    min-height: 72px;
    padding: 0 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
}

.user-messages-info img {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.user-messages-info h3 {
    margin: 0;
    font-size: 16px;
    line-height: 20px;
    font-weight: 600;
    color: #1D1D1F;
}

.user-messages-info span.status {
    display: block;
    line-height: 20px;
    font-size: 11px;
}

.user-messages-info span.status.online {
    color: #4ca340;
}

.user-messages-info span.status.offline {
    color: #777777;
}

/* Email block (admin hover) */
.mess-email-block {
    align-items: center;
    position: absolute;
    right: 70px;
    display: none;
}

.copy-img-block {
    font-size: 10px;
    width: 24px;
    cursor: pointer;
}

/* -------------------------------------------------------
   8. CHAT HISTORY (scrollable message area)
------------------------------------------------------- */
.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background-color: #ffffff;
}

.chat-history .message {
    display: flex;
    margin-bottom: 16px;
    flex-direction: column;
}

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

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

/* -------------------------------------------------------
   9. MESSAGE BUBBLES
------------------------------------------------------- */
.chat-history .bubble {
    max-width: 70%;
    padding: 12px 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.chat-history .message.sent .bubble {
    background-color: #774ff0;
    color: #ffffff;
    border-radius: 20px 20px 4px 20px;
    position: relative;
    padding-right: 30px;
    /* room for chevron */
}

.chat-history .message.received .bubble {
    background-color: #f5f6f8;
    color: #333333;
    border-radius: 20px 20px 20px 4px;
}

/* Edited label */
.edited {
    font-style: italic;
    margin-right: 4px;
    font-size: 11px;
    opacity: 0.7;
}

.bldo {
    display: flex;
    flex-direction: column;
}

/* -------------------------------------------------------
   10. MESSAGE TIMESTAMPS
------------------------------------------------------- */
.chat-history .message.sent .msg-time {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    font-size: 11px;
    color: #a0a0a0;
    margin-top: 4px;
    padding-right: 4px;
}

.chat-history .message.received .msg-time {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    font-size: 11px;
    color: #a0a0a0;
    margin-top: 4px;
    padding-left: 4px;
}

/* Reply icon inside received msg-time */
.reply-icon {
    width: 18px;
    opacity: 0.3;
    margin-left: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

/* -------------------------------------------------------
   11. MESSAGE CHEVRON (sent message action trigger)
------------------------------------------------------- */
.msg-chevron {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chat-history .message.sent:hover .msg-chevron {
    display: flex;
}

.msg-chevron svg {
    width: 14px;
    height: 14px;
}

.msg-chevron:hover {
    background: rgba(255, 255, 255, 0.8);
}

/* -------------------------------------------------------
   12. POPUP ACTIONS MENU (edit / delete)
------------------------------------------------------- */
.popup-actions {
    position: absolute;
    top: 30px;
    right: 5px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    padding: 6px;
    z-index: 100;
    min-width: 130px;
    overflow: hidden;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s ease;
    user-select: none;
    white-space: nowrap;
}

.action-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.action-btn--delete {
    color: #FF3B30;
}

.action-btn--delete:hover {
    background: rgba(255, 59, 48, 0.08);
}

.action-btn--edit {
    color: #007AFF;
}

.action-btn--edit:hover {
    background: rgba(0, 122, 255, 0.08);
}

/* -------------------------------------------------------
   13. MSG READ INDICATOR
------------------------------------------------------- */
.msg_read {
    color: lime;
}

/* -------------------------------------------------------
   14. REPLY BLOCK (above input, when replying)
------------------------------------------------------- */
.reply_block {
    padding: 10px 18px;
    background: #F0F2F5;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.reply_block .reply_f {
    border-left: 4px solid #06CF9C;
    padding: 0 10px;
}

.reply_block .reply-f-m {
    margin: 0;
    max-height: 34px;
    overflow: hidden;
    font-size: 12px;
}

.reply-block {
    font-weight: bold;
    cursor: pointer;
    display: block;
    width: 24px;
    height: 24px;
}

.reply-block img {
    width: 100%;
}

/* Reply quote inside bubble */
.reply-mess {
    background: #f9f4f4;
    color: #a17d7d;
    padding: 3px 10px;
    margin-bottom: 6px;
    border-radius: 8px;
    border-left: 4px solid #06CF9C;
}

.reply-mess .reply-mess-msg {
    font-size: 10px;
    margin: 0;
    max-height: 32px;
    overflow: hidden;
}

/* -------------------------------------------------------
   15. CHAT FOOTER & INPUT AREA
------------------------------------------------------- */
.chat-footer {
    padding: 16px 24px;
    background-color: #ffffff;
    border-top: 1px solid #EAEAEA;
}

.message-block-s {
    display: flex;
    align-items: center;
    background-color: transparent;
    padding: 0;
    gap: 12px;
}

.message-block-s .new-message {
    flex: 1;
    height: 44px;
    min-height: 44px;
    max-height: 160px;
    border: 1px solid #f1f2f6;
    background-color: #fcfcfd;
    border-radius: 10px;
    padding: 12px 15px;
    margin: 0;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    color: #333;
    outline: none;
    box-shadow: none;
    overflow-y: hidden;
}

.message-block-s .new-message::-webkit-scrollbar {
    display: none;
}

.message-block-s .for-del-mess {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    background-color: #f5f6f8;
    border-radius: 10px;
    cursor: pointer;
    flex-shrink: 0;
}

.message-block-s .for-del-mess svg {
    width: 18px;
    height: 18px;
    color: #555;
}

.message-block-s .send_message {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #774ff0;
    border-radius: 10px;
    height: 44px;
    padding: 0 24px;
    color: #ffffff;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
    width: auto;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.upload-mess-button {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* -------------------------------------------------------
   16. IMAGE PREVIEW (in footer)
------------------------------------------------------- */
.preview-mess-block {
    width: 100%;
    display: flex;
    justify-content: center;
}

#image-mess-preview {
    position: relative;
    display: flex;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    background-color: #f5f5f7;
    align-items: center;
    justify-content: center;
}

#image-mess-preview .pr-ms-for-del {
    display: block;
    max-width: 100%;
    max-height: 150px;
    object-fit: contain;
    border-radius: 12px;
    vertical-align: middle;
}

.prew-img-mess {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff3b30;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
    z-index: 10;
}

.prew-img-mess:hover {
    transform: scale(1.1);
}

.prew-img-mess svg {
    width: 14px;
    height: 14px;
}

.pr-ms-bl {
    display: none;
    margin: 16px 16px 32px;
}

/* -------------------------------------------------------
   17. SEARCH
------------------------------------------------------- */
.search-block {
    width: 70%;
    position: relative;
}

.search-block input,
.messenger-sidebar input {
    background: #f1f2f6;
    border: none;
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 13px;
    color: #333;
    width: 100%;
    outline: none;
}

.search-message-block {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    cursor: pointer;
}

.search-fix {
    margin-right: 15px;
    position: relative;
}

/* -------------------------------------------------------
   18. LOADER
------------------------------------------------------- */
#loader {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.loader {
    display: inline-block;
    border: 3px solid #dedede;
    border-radius: 50%;
    border-top-color: #676767;
    width: 32px;
    height: 32px;
    -webkit-animation: spin 1.5s linear infinite;
    animation: spin 1.5s linear infinite;
}

@-webkit-keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.msgs-local-loader {
    text-align: center;
    padding: 15px;
}

.msgs-loader-inner {
    position: relative;
    width: 24px;
    height: 24px;
    border-width: 3px;
    margin: 0 auto;
}

.btn-disabled {
    opacity: 0.5;
    pointer-events: none !important;
    cursor: not-allowed !important;
}

/* -------------------------------------------------------
   18.5 NEW CHAT IMAGES
------------------------------------------------------- */
.chat-image-wrapper {
    display: block;
    margin-top: 8px;
    max-width: 200px;
    max-height: 200px;
    overflow: hidden;
    border-radius: 8px;
}

.chat-image-preview {
    width: 200px;
    min-height: 200px;
    object-fit: cover;
    border-radius: 8px;
}

/* -------------------------------------------------------
   19. INLINE EDIT POPUP
------------------------------------------------------- */
#popup-container {
    display: none;
    position: sticky;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 104%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    align-items: center;
}

#popup-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 10px 10px 0 10px;
    border: 1px solid #888;
    width: fit-content;
    height: 0;
    border-radius: 10px;
    text-align: center;
}

#messages textarea[name=edited_message] {
    resize: none;
    border: none;
    background: #e9e1e1;
    line-height: 15px;
    min-height: 55px;
    margin-bottom: 5px;
    min-width: 260px;
    font-size: 12px;
}

#messages textarea[name=edited_message]::-webkit-scrollbar {
    display: none;
}

.msgs-st {
    padding: 0 !important;
    overflow: inherit !important;
}

/* -------------------------------------------------------
   20. APPLE MODAL (edit & delete confirmation dialogs)
------------------------------------------------------- */
.apple-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    backdrop-filter: blur(5px);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.apple-modal-content {
    background: #ffffff;
    border-radius: 14px;
    padding: 20px;
    width: 280px;
    max-width: 95%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    text-align: center;
    display: flex;
    flex-direction: column;
}

/* For Edit Modal we need it wider and more rounded */
.apple-modal-content--wide {
    width: 550px;
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.apple-modal-title {
    font-size: 15px;
    font-weight: 500;
    margin: 5px 0 20px 0;
    color: #1c1c1e;
    line-height: 1.4;
}

.apple-modal-content--wide .apple-modal-title {
    margin: 0 0 16px 0;
    font-size: 20px;
    font-weight: 600;
}

.apple-edit-textarea {
    width: 100%;
    box-sizing: border-box;
    height: 140px;
    border: 1px solid #d2d2d7;
    border-radius: 12px;
    padding: 14px;
    font-family: inherit;
    font-size: 15px;
    outline: none;
    resize: none;
    background: #fbfbfd;
    line-height: 1.5;
    color: #1d1d1f;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
    margin-bottom: 20px;
}

.apple-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.apple-modal-content--wide .apple-modal-actions {
    flex-direction: row;
    justify-content: flex-end;
    gap: 12px;
}

.apple-modal-btn {
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.apple-modal-content--wide .apple-modal-btn {
    padding: 10px 32px;
}

.apple-modal-content--wide .apple-modal-btn-cancel {
    padding: 10px 24px;
}

.apple-modal-btn-delete {
    background: #FF3B30;
    color: white;
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3);
}

.apple-modal-btn-delete:hover {
    background: #e6352b;
}

.apple-modal-btn-save {
    background: #6a38e5;
    color: white;
    box-shadow: 0 4px 12px rgba(106, 56, 229, 0.3);
}

.apple-modal-btn-save:hover {
    background: #5b2bd1;
}

.apple-modal-btn-cancel {
    background: #E5E5EA;
    color: #1d1d1f;
}

.apple-modal-btn-cancel:hover {
    background: #d1d1d6;
}

/* -------------------------------------------------------
   21. EDIT / DELETE ICON CONTROLS
------------------------------------------------------- */
.edit-message {
    background: url(../images/icons/menu_icon.svg) center center no-repeat;
    width: 14px;
    height: 14px;
    background-size: 14px;
    cursor: pointer;
    opacity: 0.5;
    margin-right: 10px;
}

.edit-message:hover {
    opacity: 1;
}

.edit-message-icons {
    display: flex;
    align-items: center;
}

.ok-edit-message {
    background: url(../images/icons/ok-icon.png) center center no-repeat;
    width: 20px;
    height: 20px;
    background-size: 20px;
    cursor: pointer;
    display: block;
}

.cancel-edit-message {
    background: url(../images/icons/x-icon.png) center center no-repeat;
    width: 20px;
    height: 20px;
    background-size: 20px;
    cursor: pointer;
    display: block;
}

.delete-mess-ok-button {
    background: url(../images/icons/delete.png) center center no-repeat;
    background-size: 30px;
    width: 40px;
    height: 40px;
    border: none;
}

.dont-delete-mess-button {
    background: url(../images/icons/no.svg) center center no-repeat;
    background-size: 30px;
    width: 40px;
    height: 40px;
    border: none;
}

/* -------------------------------------------------------
   22. AUDIO TOGGLE
------------------------------------------------------- */
.audio-change {
    cursor: pointer;
    height: 20px;
    width: 20px;
    margin-right: 6px;
}

/* -------------------------------------------------------
   23. BRANDS / ADMIN DIALOGS
------------------------------------------------------- */
.brands-messages .pair_us {
    display: flex;
    align-items: center;
    gap: 30px;
    border: 1px solid;
    border-radius: 5px;
    padding: 5px 10px;
    min-width: 280px;
    justify-content: space-between;
    cursor: pointer;
}

.brands-messages .mess-head {
    padding: 5px 0;
    border-bottom: 2px solid grey;
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: space-around;
    position: sticky;
    top: 0;
    z-index: 1002;
    background: white;
}

.brands-messages #overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1001;
}

.brands-messages .messageng-block {
    background: white;
    overflow: auto;
    border-radius: 10px;
    width: 800px;
    display: none;
    height: 800px;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1002;
}

.brands-messages .messageng-block::-webkit-scrollbar {
    width: 4px;
}

.brands-messages .messageng-block::-webkit-scrollbar-track {
    background: #efefef;
}

.brands-messages .messageng-block::-webkit-scrollbar-thumb {
    background: #777;
}

.brands-messages .messageng-block::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.brands-messages .dialog-icon {
    width: 50px;
    height: 50px;
}

.brands-messages .dialog-user {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
}

.brands-messages #overlay .close-pop-br {
    cursor: pointer;
    position: absolute;
    right: 10px;
    top: 10px;
    background: white;
    padding: 2px;
}

.brands-messages .dialog-users {
    display: flex;
    align-items: center;
    flex-direction: column;
}

.new_brand_message {
    position: absolute;
    right: -8px;
    top: -11px;
    background: #8fb78f;
    border-radius: 5px;
    padding: 0 3px;
    color: white;
}

/* -------------------------------------------------------
   24. LEGACY — OLD MESSAGES DROPDOWN (#messages-update-menu)
       Kept for backward compatibility with site-wide usage.
------------------------------------------------------- */
#messages-update-menu {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: 20px;
    right: 15px;
    height: 650px;
    max-height: 70vh;
    max-width: 500px;
    width: 100%;
    background: #F6F6F6;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.1s;
    z-index: 1001;
}

#messages.open #messages-update-menu {
    top: 70px;
    visibility: visible;
    opacity: 1;
}

#messages-update-menu .update-header {
    position: relative;
    background: #eaeaea;
    z-index: 2;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 55px;
}

#messages-update-menu .update-header h4 {
    margin: 0;
    padding: 20px;
    line-height: 20px;
}

#messages-update-menu .msgs {
    padding-bottom: 10px;
    position: relative;
    height: 100%;
    overflow-y: auto;
    background: white;
}

#messages-update-menu .msgs::-webkit-scrollbar {
    width: 4px;
}

#messages-update-menu .msgs::-webkit-scrollbar-track {
    background: #efefef;
}

#messages-update-menu .msgs::-webkit-scrollbar-thumb {
    background: #777;
}

#messages-update-menu .msgs::-webkit-scrollbar-thumb:hover {
    background: #555;
}

#messages-update-menu .msgs .msg {
    display: flex;
    padding: 10px 16px;
    transition: all 0.2s;
    font-size: 14px;
    line-height: 18px;
    cursor: pointer;
    border-bottom: 1px solid #efefef;
}

#messages-update-menu .msgs .msg:hover {
    background-color: #f2f2f2;
}

#messages-update-menu .msgs .msg.fixed {
    background: #d1e7f1;
}

#messages-update-menu .msgs .msg .created_at {
    text-align: right;
    color: #838383;
    display: block;
    font-size: 11px;
    margin-top: 4px;
}

#messages-update-menu .msgs .msg .avatar {
    position: relative;
    margin-right: 16px;
    height: 76px;
    width: 76px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    transition: all 0.2s;
}

#messages-update-menu .msgs .msg .avatar.svg {
    padding: 14px;
}

#messages-update-menu .msgs .msg:hover .avatar {
    background-color: #fff;
}

#messages-update-menu .msgs .msg .avatar.svg>img {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 50px;
    max-height: 40px;
    object-fit: contain;
}

#messages-update-menu .msgs .msg .avatar.not_svg>img {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 100%;
    max-height: 100%;
}

#messages-update-menu .msgs .msg .info {
    flex: 1;
}

#messages-update-menu .msgs .msg .info>div {
    margin-bottom: 2px;
}

#messages-update-menu .msgs .msg .info>div:last-child {
    margin-bottom: 0;
}

#messages-update-menu .msgs .msg .info>.note_date {
    color: #777;
    font-size: 12px;
}

#messages-update-menu .msgs .msg .info .note_edit {
    cursor: pointer;
    text-decoration: underline;
}

#messages-update-menu .msgs .msg .info .publisher_name {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

#messages-update-menu .msgs .msg .info .newpost_link {
    color: inherit;
    text-decoration: underline;
}

#messages-update-menu .msgs .msg .nots_picture {
    height: 76px;
    margin-left: 16px;
}

#messages-update-menu .msgs .msg .nots_picture>.in {
    height: 76px;
    width: 76px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

#messages-update-menu .msgs .msg .nots_picture .in>img {
    display: block;
    height: 100%;
}

#messages-update-menu .no_messages {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#messages-update-menu .messages_icon {
    height: 100px;
    width: 100px;
    margin-bottom: 30px;
    background: url('../images/icons/larg_mess.png') center center no-repeat;
    background-size: contain;
    filter: grayscale(80%);
    opacity: 0.3;
}

/* -------------------------------------------------------
   25. LEGACY — OLD BUBBLE STYLES (.message-blue/.message-orange)
       Used by messagesFilter() output for old pages.
------------------------------------------------------- */
.message-blue,
.message-orange {
    max-width: 336px;
    min-width: 150px;
    width: fit-content;
    position: relative;
    padding: 8px 14px;
    text-align: left;
    font: 400 0.9em 'Open Sans', sans-serif;
    box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.16);
}

.message-blue {
    background-color: #2C57B6;
    color: #fff;
    border-radius: 14px 14px 0 14px;
}

.message-orange {
    background-color: #f7f7f7;
    border-radius: 14px 14px 14px 0;
}

.message-blue .more_mess {
    font-size: 10px;
    color: white;
    cursor: pointer;
}

.message-orange .more_mess {
    font-size: 8px;
    color: black;
    cursor: pointer;
}

.cont-blue {
    display: flex;
    justify-content: flex-end;
    margin-right: 15px;
    margin-top: 10px;
    align-items: center;
}

.cont-blue:hover>.edit-message {
    opacity: 1;
}

.cont-blue .delete-message-text {
    color: white;
    opacity: 0.6;
    margin: 0 0 5px 0;
}

.cont-orange {
    display: flex;
    justify-content: flex-start;
    margin-left: 15px;
    margin-top: 10px;
}

.cont-orange img {
    vertical-align: baseline;
}

.cont-orange:hover>.reply-icon {
    opacity: 1;
}

.cont-orange .delete-message-text {
    color: black;
    opacity: 0.6;
    margin: 0 0 5px 0;
}

.bl-or-deleted {
    position: relative;
}

.message-date {
    font-weight: 500;
    font-size: 10px;
    margin: 5px 0 0 0;
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.date-hover {
    display: none;
    position: absolute;
    line-height: 20px;
    background: rgba(255, 255, 255, 0.51);
    border-radius: 8px;
    padding: 5px 8px;
    color: #685353;
}

.message-blue:hover .date-hover {
    bottom: -10px;
    left: 0;
    right: 0;
    margin: 0 auto;
    z-index: 13;
    font-size: 10px;
    line-height: 10px;
    width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.message-orange:hover .date-hover {
    right: 0;
    z-index: 5;
    font-size: 10px;
    line-height: 10px;
    width: 60px;
    left: 0;
    margin: 0 auto;
    bottom: -10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.curent-message {
    overflow: hidden;
    margin: 0;
    overflow-wrap: break-word;
    max-width: 300px;
}

.author-name {
    font-weight: bold;
    font-size: 12px;
    margin-bottom: 5px;
}

.maximum-height {
    max-height: fit-content !important;
}

/* -------------------------------------------------------
   26. UTILITIES & MISC
------------------------------------------------------- */
.product-link {
    display: block;
    width: fit-content;
}

.no-message {
    text-align: center;
    color: #a4a4b9;
    background: lavenderblush;
}

.message-gif {
    width: 280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.message-container {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
}

.message-author {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.message-author-img-block {
    position: relative;
    margin-right: 20px;
}

.child-message-fixed-block {
    width: 100%;
    display: none;
    background: white;
    border-top: 1px solid #f3e1e1;
}

.msg-close {
    color: white;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    margin-right: 10px;
}

.user_url {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: black;
    font-weight: 600;
}

.arrow-left {
    height: 22px;
    width: 22px;
}

.success-message {
    position: fixed;
    z-index: 1005;
    background: #bee2be;
    width: 200px;
    top: 100px;
    right: -300px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    color: white;
    font-weight: bold;
}

.error-message {
    position: fixed;
    z-index: 1005;
    background: #ed4f4f;
    width: 200px;
    top: 100px;
    right: -300px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    color: white;
}

.sender-user-photo {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 6px;
}

.created_date_mess {
    margin: 0 5px 0 0;
}

.messgae-se {
    margin-top: 10px;
    border-radius: 30px;
    border: 1px solid #efe7e7;
    width: 100%;
    text-align: center;
}

.chat-img-for-sup {
    display: block;
    width: 75px;
    height: 75px;
    margin-top: 10px;
}

.chat-img-for-sup img {
    object-fit: cover;
    width: 100%;
    height: 100%;
}

.edit-buttons {
    background: white;
    color: black;
    width: fit-content;
    border: 1px solid #bbb8b8;
    border-radius: 5px;
}

.request-types {
    list-style-type: none;
    color: #827c7c;
}

.req-types-subject {
    display: flex;
    align-items: center;
}

.deleted-msg {
    justify-content: flex-end;
    margin: 0;
}

.msg .msg_f {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    width: 100%;
}

/* -------------------------------------------------------
   27. LEGACY — HEADER LOADER & MESSAGE DISPLAY
------------------------------------------------------- */
#header #loader {
    text-align: center;
    margin-top: 20px;
}

#header #loader .loader {
    display: inline-block;
    border: 4px solid #dedede;
    border-radius: 50%;
    border-top-color: #676767;
    width: 40px;
    height: 40px;
    -webkit-animation: spin 1.5s linear infinite;
    animation: spin 1.5s linear infinite;
}

#header .mess {
    display: inline-block;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    color: #999;
}

#header .message {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
    max-height: 50px;
}

#header .message span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* -------------------------------------------------------
   28. UI FRAMEWORK OVERRIDES
------------------------------------------------------- */
.ui.message {
    box-shadow: none;
    color: #2c2c2c;
}

.ui.positive.message {
    background-color: #97cb50;
}

.close {
    color: rgba(44, 44, 44, 0.4);
}

.close:hover,
.close:focus {
    color: rgba(44, 44, 44, 0.6);
    text-decoration: none;
    cursor: pointer;
}

.fa-check-circle {
    font-size: 14px;
    position: relative;
    bottom: 1px;
    margin-right: 4px;
    opacity: 0.75;
}

/* -------------------------------------------------------
   32. MOBILE ADAPTATION
------------------------------------------------------- */
.mobile-back-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-right: 8px;
    cursor: pointer;
    background: transparent;
    border-radius: 50%;
    transition: background 0.2s;
}

.mobile-back-btn:active {
    background: rgba(0, 0, 0, 0.05);
}

.mobile-back-btn svg {
    width: 24px;
    height: 24px;
    fill: #6a38e5;
}

@media (max-width: 768px) {
    #messenger-modal {
        width: 100%;
        height: 100%;
        max-width: none;
        border-radius: 0;
    }

    .messenger-sidebar {
        width: 100%;
        display: flex !important;
    }

    .messenger-chat-area {
        display: none !important;
        width: 100%;
    }

    /* When a chat is active */
    #messenger-modal.chat-active .messenger-sidebar {
        display: none !important;
    }

    #messenger-modal.chat-active .messenger-chat-area {
        display: flex !important;
    }

    .mobile-back-btn {
        display: flex !important;
    }

    /* Adjust chat header padding */
    .messenger-chat-area .chat-header {
        padding: 0 16px;
    }

    /* Better scrolling and tap targets */
    .chat-item {
        padding: 12px 16px;
    }
}