/* ==================== FLOATING MESSENGER – FINAL & PERFECT ==================== */

.messenger-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: #1d9bf0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 9999;
    transition: all 0.3s ease;
}
.messenger-toggle:hover { transform: scale(1.1); }
.unread-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ff3040;
    color: white;
    font-size: 12px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

#weukMessenger {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    height: 520px;
    background: #000;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.8);
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
#weukMessenger.open {
    transform: scale(1);
    opacity: 1;
    pointer-events: all;
}

.messenger-header {
    background: #1d1d1d;
    padding: 14px 16px;
    border-bottom: 1px solid #2f3336;
    flex-shrink: 0;
}
.messenger-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    font-weight: 600;
    font-size: 17px;
}
.messenger-close {
    cursor: pointer;
    font-size: 28px;
    opacity: 0.7;
}
.messenger-close:hover { opacity: 1; }

.messenger-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #000;
    min-height: 0; /* crucial for flex children */
}

.messages-list {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 10px;
}

.msg {
    display: flex;
    flex-direction: column;
}
.msg.sent { align-items: flex-end; }
.msg.received { align-items: flex-start; }
.bubble {
    max-width: 80%;
    padding: 9px 14px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
}
.msg.received .bubble { background: #e7e9ea; color: #202225; }
.msg.sent .bubble { background: #1d9bf0; color: white; }
.time {
    font-size: 11px;
    color: #71767b;
    margin-top: 4px;
    padding: 0 8px;
}

.messenger-input {
    flex-shrink: 0;
    display: flex;
    padding: 12px;
    background: #000;
    border-top: 1px solid #2f3336;
    gap: 8px;
}
.messenger-input input {
    flex: 1;
    background: #202225;
    border: none;
    border-radius: 20px;
    padding: 12px 16px;
    color: white;
    font-size: 15px;
}
.messenger-input input::placeholder { color: #71767b; }
.messenger-input button {
    background: #1d9bf0;
    color: white;
    border: none;
    padding: 0 18px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
}

/* ==================== CUSTOM SCROLLBAR – X/TWITTER STYLE ==================== */

.messages-list {
    /* Existing rules you already have */
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 10px;

    /* CUSTOM SCROLLBAR – X-style */
    scrollbar-width: thin;           /* Firefox */
    scrollbar-color: #2f3336 #000;   /* thumb + track */
}

/* WebKit browsers (Chrome, Safari, Edge) */
.messages-list::-webkit-scrollbar {
    width: 6px;                      /* thin scrollbar */
}

.messages-list::-webkit-scrollbar-track {
    background: transparent;         /* invisible track */
    margin: 8px 0;                   /* small gap from top/bottom */
}

.messages-list::-webkit-scrollbar-thumb {
    background: #2f3336;             /* dark gray thumb */
    border-radius: 3px;
    transition: background 0.2s;
}

.messages-list::-webkit-scrollbar-thumb:hover {
    background: #4a4f54;             /* slightly lighter on hover */
}

/* Optional: hide scrollbar when not scrolling (like real X) */
.messages-list {
    -ms-overflow-style: none;        /* IE and Edge */
}
.messages-list::-webkit-scrollbar {
    display: none;                   /* hide when idle */
}
.messages-list:hover::-webkit-scrollbar,
.messages-list:active::-webkit-scrollbar {
    display: block;                  /* show only on hover/active */
}

/* Mobile full-screen */
@media (max-width: 480px) {
    #weukMessenger.open { width: 100%; height: 100%; bottom: 0; right: 0; border-radius: 0; }
    .messenger-toggle { bottom: 15px; right: 15px; }
}