/* CSS Styles for Northside Task Global Live Chat Widget (Telegram & Messenger App Interface) */
#northsidetaskCommunityChatRoot {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999998;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
}

#northsidetaskChatLauncher {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #0084ff 0%, #0099ff 50%, #6366f1 100%);
    color: #ffffff;
    padding: 10px 18px 10px 12px;
    border-radius: 50px;
    box-shadow: 0 10px 25px -3px rgba(0, 132, 255, 0.5), 0 4px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 2px solid rgba(255, 255, 255, 0.4);
    user-select: none;
    position: relative;
}
#northsidetaskChatLauncher:hover {
    transform: translateY(-4px) scale(1.04);
    box-shadow: 0 15px 30px -3px rgba(0, 132, 255, 0.65), 0 0 20px rgba(99, 102, 241, 0.4);
}
#northsidetaskChatLauncher:active {
    transform: scale(0.96);
}

.chat-launcher-icon-wrap {
    position: relative;
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-launcher-svg {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}
.chat-launcher-pulse {
    position: absolute;
    top: -4px; left: -4px; right: -4px; bottom: -4px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.7);
    animation: chatPulse 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
    pointer-events: none;
}
@keyframes chatPulse {
    0% { transform: scale(1); opacity: 0.9; }
    100% { transform: scale(1.4); opacity: 0; }
}

.chat-online-dot {
    position: absolute;
    bottom: 0px;
    right: 0px;
    width: 11px;
    height: 11px;
    background: #10b981;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 6px #10b981;
}
.chat-launcher-label {
    display: flex;
    flex-direction: column;
    text-align: left;
}
.chat-label-title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.2px;
}
.chat-label-sub {
    font-size: 11px;
    opacity: 0.9;
    font-weight: 500;
}

.chat-unread-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ef4444;
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    min-width: 22px;
    height: 22px;
    line-height: 22px;
    border-radius: 11px;
    text-align: center;
    padding: 0 6px;
    border: 2px solid #ffffff;
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.5);
    animation: bounceBadge 0.6s ease infinite alternate;
}
@keyframes bounceBadge {
    0% { transform: translateY(0); }
    100% { transform: translateY(-4px); }
}

/* Chat Window Container (Desktop Default) */
#northsidetaskChatWindow {
    position: fixed;
    bottom: 84px;
    right: 24px;
    width: 395px;
    max-width: calc(100vw - 32px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.25), 0 0 1px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 999999;
    transition: all 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0, 0, 0, 0.08);
}
#northsidetaskChatWindow.community-chat-hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

/* Header */
.chat-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #ffffff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.chat-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.chat-back-btn {
    display: none; /* Visible only on mobile */
    background: none;
    border: none;
    color: #ffffff;
    padding: 6px;
    margin-right: 2px;
    border-radius: 50%;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.chat-back-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.chat-header-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}
.chat-header-avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #0084ff 0%, #6366f1 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.chat-header-online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: #10b981;
    border: 2px solid #1e293b;
    border-radius: 50%;
}
.chat-header-info {
    overflow: hidden;
}
.chat-header-title {
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-header-status {
    font-size: 11.5px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
    white-space: nowrap;
}
.chat-status-indicator {
    width: 7px;
    height: 7px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 6px #10b981;
    flex-shrink: 0;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.chat-btn-action {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.2s, transform 0.2s;
}
.chat-btn-action:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.08);
}

/* Notice Bar */
.chat-notice-bar {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 7px 12px;
    font-size: 11.5px;
    color: #64748b;
    text-align: center;
    font-weight: 500;
}

/* Body / Message List (Telegram Wallpaper Layout) */
.chat-body {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
    overflow-x: hidden;
    overflow-anchor: none;
    overscroll-behavior-y: contain;
    background: #eef2f6;
    background-image: radial-gradient(rgba(0,0,0,0.03) 1px, transparent 0);
    background-size: 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
}

.chat-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #64748b;
    font-size: 13px;
    gap: 10px;
}
.chat-spinner {
    width: 26px;
    height: 26px;
    border: 3px solid #cbd5e1;
    border-top-color: #0084ff;
    border-radius: 50%;
    animation: chatSpin 0.8s linear infinite;
}
@keyframes chatSpin {
    to { transform: rotate(360deg); }
}

/* Message Rows (Telegram & Messenger Style) */
.chat-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 88%;
    animation: fadeInMsg 0.15s ease;
    transition: background-color 0.2s ease;
    margin-bottom: 2px;
}
@keyframes fadeInMsg {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-row-other {
    align-self: flex-start;
}
.chat-row-me {
    align-self: flex-end;
    flex-direction: row-reverse;
}

/* User Circular Avatar on Left */
.chat-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    user-select: none;
    margin-bottom: 2px;
}
.chat-user-avatar:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.chat-msg-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 100%;
}
.chat-row-me .chat-msg-wrapper {
    align-items: flex-end;
}

/* Telegram Message Bubble */
.chat-bubble {
    padding: 7px 12px 6px 12px;
    border-radius: 16px;
    font-size: 13.8px;
    line-height: 1.45;
    word-break: break-word;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.chat-row-other .chat-bubble {
    background: #ffffff;
    color: #0f172a;
    border-bottom-left-radius: 4px;
    border: 1px solid #e2e8f0;
}
.chat-row-me .chat-bubble {
    background: linear-gradient(135deg, #0084ff 0%, #0073e6 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 132, 255, 0.3);
}

/* Sticker Bubble (Transparent Telegram Style) */
.chat-bubble.is-pure-sticker {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 2px !important;
}

/* Message Header inside Bubble */
.chat-sender-head {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    margin-bottom: 3px;
    cursor: pointer;
}
.chat-sender-name {
    font-weight: 800;
    color: #0284c7;
    transition: color 0.15s;
}
.chat-sender-name:hover {
    text-decoration: underline;
}
.chat-row-me .chat-sender-name {
    color: #fef08a;
}

.chat-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}
.chat-badge-owner {
    background: #fef08a;
    color: #854d0e;
    border: 1px solid #facc15;
}
.chat-badge-admin {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #f87171;
}
.chat-badge-member {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}
.chat-badge-guest {
    background: #e2e8f0;
    color: #475569;
    border: 1px solid #cbd5e1;
}

/* Sticker & Image rendering */
.chat-bubble-sticker {
    max-width: 140px;
    max-height: 140px;
    min-height: 50px;
    display: block;
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.2s;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.15));
}
.chat-bubble-sticker:hover {
    transform: scale(1.08);
}

.chat-bubble-image {
    max-width: 250px;
    max-height: 250px;
    min-height: 80px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s;
    object-fit: cover;
    display: block;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    margin: 4px 0;
}
.chat-bubble-image:hover {
    transform: scale(1.02);
}

/* Quoted Reply inside Message Bubble */
.chat-reply-quote {
    background: #f1f5f9;
    border-left: 3px solid #0084ff;
    padding: 4px 8px;
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 11.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}
.chat-row-me .chat-reply-quote {
    background: rgba(255, 255, 255, 0.2);
    border-left: 3px solid #fef08a;
    color: #f8fafc;
}
.chat-reply-quote-head {
    font-weight: 700;
    color: #0084ff;
    font-size: 11px;
}
.chat-row-me .chat-reply-quote-head {
    color: #fef08a;
}
.chat-reply-quote-body {
    color: #475569;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
    font-size: 11px;
}
.chat-row-me .chat-reply-quote-body {
    color: #f1f5f9;
}

/* Mentions */
.chat-mention {
    display: inline-block;
    background: #e0e7ff;
    color: #3730a3;
    font-weight: 700;
    padding: 0 5px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}
.chat-row-me .chat-mention {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}
.chat-mention-me {
    background: #fef08a !important;
    color: #854d0e !important;
    border: 1px solid #facc15;
}

/* Bottom time & actions line inside bubble (Telegram Style) */
.chat-bubble-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 3px;
    font-size: 10.5px;
    color: #64748b;
    user-select: none;
    line-height: 1;
}
.chat-row-me .chat-bubble-foot {
    color: rgba(255, 255, 255, 0.85);
}

.chat-msg-time {
    font-size: 10px;
    opacity: 0.85;
}

/* Telegram Views Counter */
.chat-view-count {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 10px;
    opacity: 0.85;
    background: rgba(0, 0, 0, 0.04);
    padding: 1px 4px;
    border-radius: 6px;
    cursor: help;
    transition: all 0.2s ease;
}
.chat-row-me .chat-view-count {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}
.chat-view-count:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.08);
}
.chat-row-me .chat-view-count:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Telegram Checkmarks */
.chat-tick {
    font-size: 11px;
    font-weight: 700;
    margin-left: 2px;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: -1.5px;
    display: inline-block;
}
.chat-tick.is-seen {
    color: #93c5fd !important;
}

/* Floating Scroll to Bottom Button */
.chat-scroll-bottom-btn {
    position: absolute;
    bottom: 74px;
    right: 18px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #ffffff;
    color: #0084ff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s;
}
.chat-scroll-bottom-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 18px rgba(0, 132, 255, 0.3);
    background: #f8fafc;
}
.chat-scroll-bottom-btn:active {
    transform: scale(0.95);
}
.chat-scroll-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 10px;
    border: 2px solid #ffffff;
}

.chat-quick-action-link {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 10px;
    cursor: pointer;
    padding: 0 2px;
    margin-right: 2px;
    opacity: 0.7;
    transition: opacity 0.15s, color 0.15s;
}
.chat-row-me .chat-quick-action-link {
    color: rgba(255, 255, 255, 0.8);
}
.chat-quick-action-link:hover {
    color: #0084ff;
    opacity: 1;
    text-decoration: underline;
}
.chat-row-me .chat-quick-action-link:hover {
    color: #ffffff;
}

/* =========================================================
   LIVE TYPING INDICATOR (TELEGRAM / MESSENGER ANIMATION)
   ========================================================= */
.chat-typing-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    font-size: 11.5px;
    color: #475569;
    font-weight: 600;
    animation: chatTypingSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 50;
}
.chat-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 3.5px;
    background: #e2e8f0;
    padding: 4px 7px;
    border-radius: 12px;
}
.chat-typing-dot {
    width: 5px;
    height: 5px;
    background: #0084ff;
    border-radius: 50%;
    display: inline-block;
    animation: chatTypingBounce 1.3s infinite ease-in-out both;
}
.chat-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.chat-typing-dot:nth-child(2) { animation-delay: -0.16s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0s; }
.chat-typing-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #0284c7;
    font-style: italic;
}
@keyframes chatTypingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.35; }
    40% { transform: scale(1.25); opacity: 1; }
}
@keyframes chatTypingSlideIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   REACTIONS, GESTURES & AUTOCOMPLETE STYLING
   ========================================================= */

/* Popping Heart Animation on Double Click / Double Tap */
.chat-heart-pop {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 42px;
    line-height: 1;
    pointer-events: none;
    z-index: 99;
    filter: drop-shadow(0 4px 10px rgba(239, 68, 68, 0.45));
    animation: heartPopAnim 0.75s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes heartPopAnim {
    0% { transform: translate(-50%, -50%) scale(0) rotate(-15deg); opacity: 0.95; }
    40% { transform: translate(-50%, -50%) scale(1.35) rotate(0deg); opacity: 1; }
    70% { transform: translate(-50%, -60%) scale(1.1) rotate(5deg); opacity: 0.95; }
    100% { transform: translate(-50%, -85%) scale(0.8) rotate(0deg); opacity: 0; }
}

/* Floating Reaction Picker Bar */
.chat-reaction-picker {
    position: fixed;
    z-index: 10000005;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    border-radius: 30px;
    box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.22), 0 4px 12px -2px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(226, 232, 240, 0.9);
    padding: 5px 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    animation: popInPicker 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    user-select: none;
}
@keyframes popInPicker {
    from { transform: translateY(12px) scale(0.7); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}
.chat-reaction-picker-btn {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    padding: 6px 7px;
    cursor: pointer;
    border-radius: 50%;
    transition: transform 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.15s;
    outline: none;
}
.chat-reaction-picker-btn:hover, .chat-reaction-picker-btn:active {
    transform: scale(1.38) translateY(-4px);
    background: #f1f5f9;
}
.chat-reaction-picker-btn.is-active {
    background: #e0f2fe;
    transform: scale(1.2);
}

/* Reaction Badges on Messages */
.chat-reactions-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
    margin-bottom: 2px;
    user-select: none;
}
.chat-row-me .chat-reactions-container {
    justify-content: flex-end;
}
.chat-reaction-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 2px 7px;
    font-size: 11.5px;
    font-weight: 700;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.chat-reaction-pill:hover {
    background: #f8fafc;
    transform: scale(1.08);
}
.chat-reaction-pill.is-me {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}
.chat-reaction-avatars {
    display: inline-flex;
    align-items: center;
    margin-right: 1px;
}
.chat-reaction-mini-avatar {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    color: #ffffff;
    font-size: 8.5px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #ffffff;
    margin-left: -5px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
    flex-shrink: 0;
    text-transform: uppercase;
}
.chat-reaction-mini-avatar:first-child {
    margin-left: 0;
}
.chat-reaction-pill-emoji {
    font-size: 13px;
    line-height: 1;
}
.chat-reaction-pill-count {
    font-size: 11px;
}

/* Swipe Right to Reply Styling */
.chat-swipe-wrapper {
    position: relative;
    display: flex;
    align-items: flex-end;
    width: 100%;
    transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    touch-action: pan-y;
    user-select: none;
}
.chat-swipe-reply-icon {
    position: absolute;
    left: -32px;
    top: 50%;
    transform: translateY(-50%) scale(0.6);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #0084ff;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.15s, transform 0.15s, background 0.15s;
    pointer-events: none;
    box-shadow: 0 3px 8px rgba(0, 132, 255, 0.4);
}
.chat-swipe-reply-icon.is-active {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
    background: #059669;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.45);
}

/* Autocomplete @ Mentions Menu */
.chat-mention-menu {
    position: absolute;
    bottom: 100%;
    left: 8px;
    right: 8px;
    max-height: 190px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2), 0 4px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    overflow-y: auto;
    z-index: 99999;
    margin-bottom: 8px;
    padding: 5px;
    animation: slideUpMention 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUpMention {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.chat-mention-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s ease;
    user-select: none;
}
.chat-mention-item:hover, .chat-mention-item.is-selected {
    background: #eff6ff;
}
.chat-mention-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.chat-mention-uname {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
}
.chat-mention-badge {
    font-size: 10.5px;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 600;
    margin-left: auto;
}

/* Reply Preview Bar above Input */
.chat-reply-bar {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    border-left: 4px solid #0084ff;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    animation: fadeInMsg 0.2s ease;
}
.chat-reply-bar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}
.chat-reply-bar-icon {
    font-size: 14px;
    color: #0084ff;
}
.chat-reply-bar-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.chat-reply-bar-user {
    font-size: 11px;
    color: #475569;
}
.chat-reply-bar-text {
    font-size: 11.5px;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}
.chat-reply-bar-close {
    background: none;
    border: none;
    color: #64748b;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

/* Selected Image Preview Bar */
.chat-image-preview-bar {
    background: #f1f5f9;
    border-top: 1px solid #e2e8f0;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.chat-img-preview-thumb-wrap {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #cbd5e1;
    flex-shrink: 0;
}
#northsidetaskChatImagePreviewImg {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.chat-img-preview-remove-btn {
    position: absolute;
    top: 1px;
    right: 1px;
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 11px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}
.chat-img-preview-info {
    overflow: hidden;
}
.chat-img-preview-title {
    font-weight: 700;
    color: #0f172a;
    font-size: 11.5px;
}
.chat-img-preview-name {
    color: #64748b;
    font-size: 10.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* Telegram Sticker & Emoji Drawer */
#northsidetaskChatStickerDrawer {
    background: #1e293b;
    color: #ffffff;
    height: 270px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
#northsidetaskChatStickerDrawer.chat-drawer-hidden {
    height: 0 !important;
    padding: 0 !important;
    opacity: 0;
    pointer-events: none;
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #0f172a;
    gap: 8px;
}
.drawer-search-wrap {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 4px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.drawer-search-wrap svg {
    color: #94a3b8;
}
#drawerSearchInput {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 12.5px;
    outline: none;
    width: 100%;
}
#drawerSearchInput::placeholder {
    color: #94a3b8;
}
.drawer-close-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}
.drawer-close-btn:hover {
    color: #ffffff;
}

.drawer-category-bar {
    display: flex;
    gap: 6px;
    padding: 6px 12px;
    overflow-x: auto;
    white-space: nowrap;
    background: #1e293b;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.drawer-category-bar::-webkit-scrollbar {
    display: none;
}
.cat-tab-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    padding: 3px 10px;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.cat-tab-btn.active, .cat-tab-btn:hover {
    background: #0084ff;
    color: #ffffff;
    border-color: #0084ff;
}

.drawer-body {
    flex: 1;
    padding: 10px 12px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
    gap: 10px;
    align-content: start;
    -webkit-overflow-scrolling: touch;
}

.drawer-item-sticker {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
    user-select: none;
}
.drawer-item-sticker:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(1.15);
}
.drawer-item-sticker img {
    max-width: 54px;
    max-height: 54px;
    object-fit: contain;
}

.drawer-item-emoji {
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 8px;
    padding: 4px;
    transition: transform 0.15s, background 0.15s;
    user-select: none;
}
.drawer-item-emoji:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(1.25);
}

.drawer-footer-tabs {
    display: flex;
    background: #0f172a;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    gap: 8px;
    justify-content: center;
}
.drawer-mode-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 6px 18px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.drawer-mode-btn.active {
    background: #0084ff;
    color: #ffffff;
}

/* Footer Input Area */
.chat-footer {
    padding: 8px 10px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.03);
    box-sizing: border-box;
    width: 100%;
}
.chat-identity-bar {
    font-size: 11px;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.chat-identity-bar b {
    color: #0084ff;
}
.chat-footer-tip {
    font-size: 10px;
    color: #94a3b8;
}

#northsidetaskChatForm {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 5px;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.chat-action-circle-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
    padding: 0;
    box-sizing: border-box;
}
.chat-sticker-btn:hover {
    background: #fef08a;
    color: #854d0e;
    border-color: #facc15;
}
.chat-media-btn:hover {
    background: #e0f2fe;
    color: #0284c7;
    border-color: #7dd3fc;
}
.chat-quick-tag-btn:hover {
    background: #e0e7ff;
    color: #4338ca;
    border-color: #a5b4fc;
}

#northsidetaskChatInput {
    flex: 1 1 0%;
    min-width: 0 !important;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 24px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    color: #0f172a !important;
    background: #ffffff !important;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    line-height: 1.4;
}
#northsidetaskChatInput::placeholder {
    color: #64748b !important;
    font-weight: 500;
}
#northsidetaskChatInput:focus {
    border-color: #0084ff !important;
    background: #ffffff !important;
    color: #0f172a !important;
    box-shadow: 0 0 0 3px rgba(0, 132, 255, 0.2) !important;
}

#northsidetaskChatSendBtn {
    background: linear-gradient(135deg, #0084ff 0%, #0073e6 100%);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 10px rgba(0, 132, 255, 0.35);
    flex-shrink: 0 !important;
    position: relative;
    box-sizing: border-box;
}
#northsidetaskChatSendBtn:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 14px rgba(0, 132, 255, 0.45);
}
#northsidetaskChatSendBtn:active {
    transform: scale(0.95);
}
#northsidetaskChatSendBtn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.chat-send-spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: chatSpin 0.7s linear infinite;
}

/* User Profile Modal */
.chat-profile-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    z-index: 10000001;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeInMsg 0.2s ease;
}
.chat-profile-card {
    background: #ffffff;
    width: 340px;
    max-width: 92vw;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    position: relative;
    animation: slideUpProfile 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUpProfile {
    from { transform: translateY(30px) scale(0.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.profile-modal-close-btn {
    position: absolute;
    top: 10px;
    right: 12px;
    background: rgba(0, 0, 0, 0.35);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}
.profile-card-cover {
    height: 80px;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 40%, #4338ca 70%, #6366f1 100%);
}
.profile-card-body {
    padding: 0 18px 20px 18px;
    text-align: center;
    position: relative;
}
.profile-card-avatar-wrap {
    position: relative;
    width: 74px;
    height: 74px;
    margin: -37px auto 10px auto;
}
.profile-card-avatar {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    color: #ffffff;
    border: 3.5px solid #ffffff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}
.profile-card-online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: #10b981;
    border: 2.5px solid #ffffff;
    border-radius: 50%;
}
.profile-card-name-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.profile-card-username {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
}
.profile-card-role {
    font-size: 12px;
    font-weight: 700;
    color: #0284c7;
    margin-top: 2px;
}
.profile-card-meta {
    font-size: 11.5px;
    color: #64748b;
    margin-top: 4px;
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 14px;
}
.profile-stat-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 8px 10px;
}
.profile-stat-box.full-width {
    grid-column: span 2;
}
.profile-stat-lbl {
    font-size: 10.5px;
    color: #64748b;
    font-weight: 600;
}
.profile-stat-val {
    font-size: 15px;
    font-weight: 800;
    margin-top: 2px;
}

.profile-actions-wrap {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}
.profile-action-btn {
    flex: 1;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}
.btn-chat-tag {
    background: linear-gradient(135deg, #0084ff 0%, #0073e6 100%);
    color: #ffffff;
}
.btn-view-top {
    background: #fef3c7;
    color: #b45309 !important;
    border: 1px solid #fde68a;
}

/* Lightbox Modal */
.chat-image-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(8px);
    z-index: 10000002;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeInMsg 0.2s ease;
}
.chat-img-modal-content {
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
#northsidetaskChatModalImage {
    max-width: 100%;
    max-height: 75vh;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    object-fit: contain;
}
.chat-img-modal-close {
    position: absolute;
    top: 18px;
    right: 22px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    font-size: 32px;
    line-height: 1;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-img-modal-actions {
    display: flex;
    gap: 10px;
}
.chat-modal-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff !important;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* =======================================================
   MOBILE MESSAGING APP FULL-SCREEN UI (Max Width: 768px)
   ======================================================= */
@media (max-width: 768px) {
    #northsidetaskCommunityChatRoot {
        bottom: 16px;
        right: 16px;
    }
    #northsidetaskChatLauncher .chat-launcher-label {
        display: none;
    }
    #northsidetaskChatLauncher {
        padding: 8px;
        border-radius: 50%;
        width: 54px;
        height: 54px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 8px 20px rgba(0, 132, 255, 0.45);
    }
    
    #northsidetaskChatWindow {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100% !important;
        height: 100dvh !important;
        max-height: 100% !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        margin: 0 !important;
        z-index: 9999999 !important;
        box-shadow: none !important;
        border: none !important;
        display: flex !important;
        flex-direction: column !important;
        transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease !important;
    }
    
    #northsidetaskChatWindow.community-chat-hidden {
        transform: translateY(100%) !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
    
    #northsidetaskChatWindow:not(.community-chat-hidden) {
        transform: translateY(0) !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    body.northsidetask-chat-open {
        overflow: hidden !important;
        position: fixed;
        width: 100%;
        height: 100%;
    }
    
    body.northsidetask-chat-open #northsidetaskChatLauncher {
        display: none !important;
    }
    
    .chat-header {
        padding: 10px 14px;
        padding-top: max(10px, env(safe-area-inset-top));
    }
    
    .chat-back-btn {
        display: flex !important;
    }
    
    .chat-btn-close-desktop {
        display: none !important;
    }
    
    .chat-footer {
        padding: 5px 6px;
        padding-bottom: max(6px, env(safe-area-inset-bottom));
        box-sizing: border-box;
        width: 100%;
    }
    
    #northsidetaskChatForm {
        gap: 3px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .chat-action-circle-btn {
        width: 31px;
        height: 31px;
        font-size: 13px;
    }
    .chat-action-circle-btn svg {
        width: 17px;
        height: 17px;
    }
    
    #northsidetaskChatInput {
        padding: 7px 12px;
        font-size: 13.5px;
        font-weight: 600;
        min-width: 0 !important;
        color: #0f172a !important;
        background: #ffffff !important;
    }
    
    #northsidetaskChatSendBtn {
        width: 33px;
        height: 33px;
        flex-shrink: 0 !important;
    }
    #northsidetaskChatSendBtn svg {
        width: 15px;
        height: 15px;
    }
    
    .chat-row {
        max-width: 94%;
    }
    
    .chat-bubble-image {
        max-width: 210px;
        max-height: 210px;
    }
}