/* ================================================================
   LOTTOCHAT — Ultra-Premium Light Theme
   Commercial-grade · Inter Font · Glassmorphism · Micro-animations
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ── CSS Variables ───────────────────────────────────────────── */
:root {
    --bg-primary:    #FFFFFF;
    --bg-secondary:  #F8FAFC;
    --bg-tertiary:   #F1F5F9;
    --bg-hover:      #F0F4F8;
    --border:        #E2E8F0;
    --border-light:  #EEF2F7;
    --text-primary:  #0F172A;
    --text-secondary:#475569;
    --text-muted:    #94A3B8;
    --red-primary:   #E63939;
    --red-dark:      #C62828;
    --red-light:     #FFF0F0;
    --red-mid:       #FFE4E4;
    --gold:          #F59E0B;
    --gold-light:    #FFFBEB;
    --blue:          #3B82F6;
    --blue-light:    #EFF6FF;
    --green:         #10B981;
    --green-light:   #ECFDF5;
    --purple:        #8B5CF6;
    --purple-light:  #F5F3FF;
    --shadow-sm:     0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
    --shadow-md:     0 4px 16px rgba(15,23,42,.08), 0 2px 6px rgba(15,23,42,.04);
    --shadow-lg:     0 12px 40px rgba(15,23,42,.12), 0 4px 12px rgba(15,23,42,.06);
    --radius-sm:     8px;
    --radius-md:     12px;
    --radius-lg:     18px;
    --radius-xl:     24px;
    --sidebar-w:     240px;
    --right-w:       220px;
    --transition:    0.18s cubic-bezier(0.4,0,0.2,1);
}
@media (min-width: 769px) {
    .container {
        max-width: 1300px !important;
    }
}
/* ── Base Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

.chat-page-wrap {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-secondary);
    min-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    color: var(--text-primary);
}

/* ════════════════════════════════════════════════════════════
   TICKER BAR
════════════════════════════════════════════════════════════ */
.cp-ticker {
    background: linear-gradient(135deg, #E63939 0%, #C62828 100%);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 0;
    height: 34px;
    overflow: hidden;
    display: flex;
    align-items: center;
    position: relative;
    letter-spacing: 0.01em;
}
.cp-ticker::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 60px;
    height: 100%;
    background: linear-gradient(to right, transparent, #C62828);
    z-index: 2;
    pointer-events: none;
}
.cp-ticker-label {
    background: rgba(0,0,0,0.2);
    padding: 0 16px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-right: 1px solid rgba(255,255,255,0.15);
}
.cp-ticker-dot {
    width: 7px;
    height: 7px;
    background: #4ADE80;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(74,222,128,0.3);
    animation: tickerPulse 2s ease infinite;
}
@keyframes tickerPulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(74,222,128,0.5); }
    50%      { box-shadow: 0 0 0 5px rgba(74,222,128,0); }
}
.cp-ticker-track {
    overflow: hidden;
    flex: 1;
    height: 100%;
    display: flex;
    align-items: center;
}
.cp-ticker-scroll {
    display: inline-flex;
    gap: 56px;
    animation: tickerScroll 40s linear infinite;
    white-space: nowrap;
    padding-left: 12px;
}
.cp-ticker-scroll:hover { animation-play-state: paused; }
@keyframes tickerScroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.cp-ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    opacity: 0.95;
}
.cp-ticker-item .ti-icon { font-size: 14px; }

/* ════════════════════════════════════════════════════════════
   MAIN LAYOUT
════════════════════════════════════════════════════════════ */
.cp-main {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr var(--right-w);
    flex: 1;
    height: 720px;
    min-height: 500px;
}

/* ════════════════════════════════════════════════════════════
   LEFT SIDEBAR
════════════════════════════════════════════════════════════ */
.cp-left-sidebar {
    grid-column: 1;
    background: var(--bg-primary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.cp-left-sidebar::-webkit-scrollbar { width: 4px; }
.cp-left-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Countdown box */
.cp-countdown-box {
    margin: 8px 12px;
    border-radius: var(--radius-md);
    padding: 14px 12px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: var(--transition);
    position: relative;
    border: 1px solid rgba(0,0,0,0.03);
}
.cp-countdown-box:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}
.cp-countdown-box.mn { background: #FFF5F5; } /* Soft Red */
.cp-countdown-box.mt { background: #F0F7FF; } /* Soft Blue */
.cp-countdown-box.mb { background: #F2FCF5; } /* Soft Green */


.cp-cd-label {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.cp-cd-label .cd-dot {
    width: 6px; height: 6px; border-radius: 50%;
}
/* Dots colors */
.cp-countdown-box.mn .cd-dot { background: var(--red-primary); box-shadow: 0 0 0 2px rgba(230,57,57,0.1); }
.cp-countdown-box.mt .cd-dot { background: var(--blue); box-shadow: 0 0 0 2px rgba(59,130,246,0.1); }
.cp-countdown-box.mb .cd-dot { background: var(--green); box-shadow: 0 0 0 2px rgba(16,185,129,0.1); }


.cp-cd-time {
    font-size: 20px;
    font-weight: 900;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: 1px;
}
.cp-cd-desc {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 500;
}
.cd-live-link {
    color: var(--red-primary);
    font-weight: 700;
    text-decoration: none;
    font-size: 14px;
    border: 1px solid var(--red-primary);
    padding: 2px 8px;
    border-radius: 4px;
}

.cp-countdown-jackpot strong { color: #FCD34D; }

/* Sidebar section */
.cp-sb-section {
    padding: 8px 0 4px;
    border-bottom: 1px solid var(--border-light);
}
.cp-sb-label {
    font-size: 9.5px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.9px;
    padding: 4px 16px 8px;
}

/* Channel items */
.cp-ch-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px 8px 16px;
    cursor: pointer;
    transition: background var(--transition);
    text-decoration: none;
    position: relative;
    border-radius: 0;
    margin: 1px 8px;
    border-radius: var(--radius-sm);
}
.cp-ch-item:hover {
    background: var(--bg-hover);
}
.cp-ch-item.active {
    background: var(--red-light);
}
.cp-ch-item.active::before {
    content: '';
    position: absolute;
    left: -8px; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 65%;
    background: var(--red-primary);
    border-radius: 0 3px 3px 0;
}

.cp-ch-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
    transition: transform var(--transition);
    position: relative;
}
.cp-ch-item:hover .cp-ch-icon { transform: scale(1.08) rotate(-2deg); }
.cp-ch-icon.red    { background: var(--red-light); }
.cp-ch-icon.blue   { background: var(--blue-light); }
.cp-ch-icon.gold   { background: var(--gold-light); }
.cp-ch-icon.green  { background: var(--green-light); }
.cp-ch-icon.purple { background: var(--purple-light); }

.cp-ch-info { flex: 1; min-width: 0; }
.cp-ch-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cp-ch-item.active .cp-ch-name { color: var(--red-primary); font-weight: 700; }

.cp-ch-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--red-primary);
    color: #fff !important;
    font-size: 10px;
    font-weight: 800;
    border-radius: 20px;
    flex-shrink: 0;
    animation: badgePop 0.4s cubic-bezier(0.175,0.885,0.32,1.275);
}
.cp-ch-badge.green { background: var(--green); }
.cp-ch-badge.gold  { background: var(--gold); color: var(--text-primary); }
@keyframes badgePop {
    0%   { transform: scale(0); }
    70%  { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* Online status dot on channel icon */
.cp-ch-online {
    position: absolute;
    bottom: 1px; right: 1px;
    width: 9px; height: 9px;
    background: var(--green);
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
    animation: onlinePulse 3s ease infinite;
}
@keyframes onlinePulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.5); }
    50%      { box-shadow: 0 0 0 4px rgba(16,185,129,0); }
}

/* Quick action links */
.cp-quick-links {
    padding: 8px 0px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.cp-quick-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition);
    cursor: pointer;
}
.cp-quick-link:hover {
    background: var(--red-light);
    border-color: rgba(230,57,57,0.2);
    color: var(--red-primary);
    transform: translateX(2px);
}
.cp-quick-link .ql-icon {
    width: 28px; height: 28px;
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    background: var(--bg-primary);
    flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════
   CHAT AREA (CENTER)
════════════════════════════════════════════════════════════ */
.cp-chat-area {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    min-width: 0;
    border-right: 1px solid var(--border);
}

/* Chat header */
.cp-chat-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 10;
}
.cp-ch-header-ico {
    width: 40px; height: 40px;
    background: var(--red-light);
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(230,57,57,0.15);
}
.cp-ch-header-info { flex: 1; min-width: 0; }
.cp-ch-header-name {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}
.cp-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, #E63939, #C62828);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 8px rgba(230,57,57,0.35);
    animation: liveBadgePulse 3s ease infinite;
}
.cp-live-badge::before {
    content: '●';
    font-size: 9px;
    animation: liveDot 1.5s ease infinite;
}
@keyframes liveDot { 0%,100% { opacity:1; } 50% { opacity:0.4; } }
@keyframes liveBadgePulse {
    0%,100% { box-shadow: 0 2px 8px rgba(230,57,57,0.35); }
    50%      { box-shadow: 0 2px 16px rgba(230,57,57,0.55); }
}
.cp-ch-header-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 1px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.cp-status-dot {
    width: 7px; height: 7px;
    background: var(--green);
    border-radius: 50%;
    display: inline-block;
    animation: onlinePulse 3s ease infinite;
}
.cp-header-tools {
    display: flex;
    align-items: center;
    gap: 4px;
}
.cp-tool-btn {
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    color: var(--text-muted);
    transition: all var(--transition);
    position: relative;
}
.cp-tool-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transform: scale(1.05);
}
.cp-tool-btn .tb-icon {
    transition: transform 0.2s;
}
.cp-tool-btn:hover .tb-icon { transform: scale(1.1); }

/* KQ Banner */
.cp-kq-banner {
    background: linear-gradient(90deg, #1E293B 0%, #334155 100%);
    color: #fff;
    padding: 9px 20px;
    font-size: 12.5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    border-bottom: 2px solid #E63939;
}
.cp-kq-icon { font-size: 16px; flex-shrink: 0; }
.cp-kq-text { 
    flex: 1; 
    line-height: 1.4; 
    overflow: hidden; 
    position: relative;
    white-space: nowrap;
}
.cp-kq-marquee {
    display: inline-block;
    padding-left: 100%;
    animation: cpMarquee 40s linear infinite;
}
.cp-kq-marquee:hover {
    animation-play-state: paused;
}
.cp-kq-marquee-content {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    font-size: 13px;
}
.cp-kq-text strong { color: #FCD34D; font-weight: 800; font-size: 13px; }

@keyframes cpMarquee {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-100%, 0); }
}
.cp-kq-close {
    width: 24px; height: 24px;
    background: rgba(255,255,255,0.12);
    border: none; color: rgba(255,255,255,0.7);
    border-radius: 50%; cursor: pointer; font-size: 13px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition);
}
.cp-kq-close:hover { background: rgba(255,255,255,0.25); color:#fff; transform: rotate(90deg); }

/* Tab bar */
.cp-tab-bar {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 0;
    flex-shrink: 0;
}
.cp-tab {
    padding: 12px 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    border: none;
    background: transparent;
    cursor: pointer;
    border-bottom: 2.5px solid transparent;
    transition: all var(--transition);
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.01em;
}
.cp-tab:hover { color: var(--text-secondary); }
.cp-tab.active {
    color: var(--red-primary);
    border-bottom-color: var(--red-primary);
    font-weight: 700;
}

/* Win notice */
.cp-win-notice-wrap { padding: 10px 20px 0; flex-shrink: 0; }
.cp-win-notice {
    background: linear-gradient(135deg, var(--gold-light), #FEF3C7);
    border: 1px solid #FDE68A;
    border-radius: var(--radius-md);
    padding: 10px 16px;
    font-size: 13px;
    color: #92400E;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    animation: noticeSlide 0.4s ease;
    box-shadow: 0 2px 8px rgba(245,158,11,0.15);
}
.cp-win-notice .wn-name { font-weight: 800; color: #B45309; }
@keyframes noticeSlide {
    from { opacity:0; transform: translateY(-8px); }
    to   { opacity:1; transform: translateY(0); }
}

/* Messages area */
.cp-messages {
    flex: none;
    height: 580px; /* Chiều cao cố định phù hợp với khoảng 5 tin nhắn */
    margin-top: auto; /* Đẩy khung chat xuống sát phần nhập tin nhắn */
    overflow-y: auto;
    padding: 16px 20px 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
    border-top: 1px solid var(--border-light);
}
.cp-messages::-webkit-scrollbar { width: 5px; }
.cp-messages::-webkit-scrollbar-track { background: transparent; }
.cp-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
.cp-messages::-webkit-scrollbar-thumb:hover { background: #CBD5E1; }

/* Date separator */
.cp-date-sep {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0 6px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.cp-date-sep::before,.cp-date-sep::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Single message */
.cp-msg {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 5px 4px;
    border-radius: var(--radius-md);
    transition: background var(--transition), box-shadow var(--transition);
    animation: msgAppear 0.22s ease-out;
    position: relative;
}
.cp-msg:hover { background: var(--bg-hover); }
@keyframes msgAppear {
    from { opacity:0; transform: translateY(6px); }
    to   { opacity:1; transform: translateY(0); }
}

.cp-msg-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-sm);
    position: relative;
}
.cp-msg-avatar img { width:100%; height:100%; object-fit:cover; }
.cp-msg-avatar-status {
    position: absolute;
    bottom: 0; right: 0;
    width: 10px; height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
    background: var(--green);
}

.cp-msg-body { flex: 1; min-width: 0; }
.cp-msg-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}
.cp-msg-username {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
}
.cp-msg-username:hover { text-decoration: underline; }

/* Moderation Buttons */
.cp-mod-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s ease;
    font-size: 13px;
    padding: 2px 4px;
    border-radius: 4px;
}
.cp-mod-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
}
.cp-mod-btn.pin.active {
    opacity: 1;
    color: var(--amber-primary);
}
.cp-mod-btn.del:hover {
    background: rgba(220, 38, 38, 0.1);
}

/* Role tags */
.cp-role {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 9.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    flex-shrink: 0;
}
.cp-role.admin  { background: #FEE2E2; color: #B91C1C; }
.cp-role.vip    { background: var(--gold-light); color: #92400E; border: 1px solid #FDE68A; }
.cp-role.mod    { background: var(--blue-light); color: #1D4ED8; }
.cp-role.expert { background: var(--purple-light); color: #6D28D9; }
.cp-role.soicau { background: var(--green-light); color: #065F46; }

.cp-msg-time {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

/* Message bubble */
.cp-msg-bubble {
    display: inline-block;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 4px 14px 14px 14px;
    padding: 9px 13px;
    font-size: 13.5px;
    color: var(--text-primary);
    line-height: 1.55;
    word-break: break-word;
    max-width: 100%;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}
.cp-msg:hover .cp-msg-bubble { box-shadow: var(--shadow-md); }
.cp-msg.prediction .cp-msg-bubble {
    background: linear-gradient(135deg, #FFFBEB, #FEF9EE);
    border-color: #FDE68A;
}
.cp-msg-bubble strong { color: var(--red-primary); font-weight: 800; }
.cp-msg-bubble .pred-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    background: var(--text-primary);
    color: #fff;
    border-radius: 9px;
    font-size: 15px;
    font-weight: 800;
    margin: 2px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s;
}
.cp-msg-bubble .pred-num:hover { transform: scale(1.08); }
.cp-msg-bubble .pred-num.hot { background: linear-gradient(135deg, var(--red-primary), #FF6B6B); }
.cp-msg-bubble .pred-num.warm { background: linear-gradient(135deg, var(--gold), #FCD34D); color: var(--text-primary); }

/* Reply quoted */
.cp-quoted {
    background: rgba(230,57,57,0.04);
    border-left: 3px solid var(--red-primary);
    border-radius: 6px;
    padding: 6px 10px;
    margin-bottom: 7px;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cp-quoted strong { color: var(--red-primary); display: block; font-size: 10.5px; margin-bottom: 1px; }

/* ── Messenger-style Reaction ──────────────────── */
.cp-msg-wrap {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

/* Tiny smiley trigger — visible on message hover */
.cp-react-trigger {
    position: absolute;
    bottom: -10px;
    right: -10px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 1.5px solid var(--border);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 0.15s, transform 0.18s cubic-bezier(0.175,0.885,0.32,1.275);
    z-index: 5;
    user-select: none;
}
.cp-msg:hover .cp-react-trigger {
    opacity: 1;
    transform: scale(1);
}
.cp-react-trigger:hover {
    background: var(--bg-tertiary);
    transform: scale(1.15) !important;
}

/* Floating reaction picker */
.cp-react-picker {
    position: absolute;
    bottom: calc(100% + 5px);
    left: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 6px 10px;
    box-shadow: var(--shadow-lg);
    display: none;
    align-items: center;
    gap: 4px;
    z-index: 100;
    white-space: nowrap;
    animation: pickerPop 0.2s cubic-bezier(0.175,0.885,0.32,1.275);
}
.cp-react-picker.open { display: flex; }
@keyframes pickerPop {
    from { opacity:0; transform: scale(0.8) translateY(6px); }
    to   { opacity:1; transform: scale(1) translateY(0); }
}
.cp-react-emoji {
    font-size: 22px;
    cursor: pointer;
    border-radius: 50%;
    padding: 3px;
    transition: transform 0.18s cubic-bezier(0.175,0.885,0.32,1.275), background 0.15s;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}
.cp-react-emoji:hover {
    transform: scale(1.45) translateY(-4px);
    background: var(--bg-tertiary);
}
.cp-react-emoji.selected {
    background: var(--red-light);
}

/* Reaction badges below bubble */
.cp-react-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 5px;
}
.cp-react-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    background: var(--bg-primary);
    border: 1.5px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    color: var(--text-secondary);
    user-select: none;
}
.cp-react-badge:hover {
    border-color: rgba(230,57,57,0.3);
    background: var(--red-light);
    transform: translateY(-1px);
}
.cp-react-badge.mine {
    border-color: rgba(59,130,246,0.4);
    background: var(--blue-light);
    color: var(--blue);
}
.cp-react-badge .rb-count { font-size: 11px; }

/* Reply btn */
.cp-reply-btn {
    opacity: 0;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    background: transparent;
    border: 1px solid transparent;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    font-family: 'Inter', sans-serif;
}
.cp-msg:hover .cp-reply-btn {
    opacity: 1;
    pointer-events: auto;
}
.cp-reply-btn:hover {
    background: var(--bg-primary);
    border-color: var(--border);
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
}

/* ── Load older messages indicator ─────────────── */
.cp-load-older {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 0 4px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}
.cp-load-spinner {
    width: 16px; height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--red-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
    flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty channel state ── */
.cp-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    opacity: 0.7;
    animation: fadeIn 0.4s ease;
}
.cp-empty-icon {
    font-size: 36px;
    line-height: 1;
}
.cp-empty-state p {
    margin: 0;
    line-height: 1.5;
}

.cp-no-more {
    text-align: center;
    font-size: 11.5px;
    color: var(--text-muted);
    padding: 6px 0;
    font-weight: 500;
}

/* ════════════════════════════════════════════════════════════
   INPUT SECTION
════════════════════════════════════════════════════════════ */
.cp-input-section {
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    padding: 12px 20px 14px;
    flex-shrink: 0;
    box-shadow: 0 -4px 16px rgba(15,23,42,0.04);
}

/* Reply bar */
.cp-reply-bar {
    display: none;
    align-items: center;
    gap: 10px;
    background: var(--red-light);
    border-left: 3px solid var(--red-primary);
    border-radius: var(--radius-sm);
    padding: 7px 12px;
    margin-bottom: 10px;
    font-size: 12.5px;
    color: var(--text-secondary);
    animation: replyBarIn 0.2s ease;
}
.cp-reply-bar.active { display: flex; }
@keyframes replyBarIn {
    from { opacity:0; transform: translateY(-4px); }
    to   { opacity:1; transform: translateY(0); }
}
.cp-reply-bar-text { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cp-reply-bar-text strong { color: var(--red-primary); }
.cp-cancel-reply {
    background: none; border: none;
    font-size: 18px; color: var(--text-muted); cursor: pointer;
    padding: 0; flex-shrink: 0; line-height: 1;
    transition: all var(--transition);
}
.cp-cancel-reply:hover { color: var(--red-primary); transform: rotate(90deg); }

/* Shortcuts */
.cp-shortcuts {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    overflow-x: auto;
    padding-bottom: 2px;
}
.cp-shortcuts::-webkit-scrollbar { display: none; }
.cp-shortcut {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
    font-family: 'Inter', sans-serif;
}
.cp-shortcut:hover {
    background: var(--red-light);
    border-color: rgba(230,57,57,0.25);
    color: var(--red-primary);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(230,57,57,0.15);
}
.cp-shortcut .sc-ico { font-size: 14px; }

/* Predict panel */
.cp-predict-panel {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-lg);
    display: none;
    animation: panelIn 0.3s cubic-bezier(0.175,0.885,0.32,1.1);
}
.cp-predict-panel.active { display: block; }
@keyframes panelIn {
    from { opacity:0; transform: translateY(8px) scale(0.98); }
    to   { opacity:1; transform: translateY(0) scale(1); }
}
.cp-predict-title {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cp-predict-close {
    margin-left: auto;
    background: var(--bg-tertiary);
    border: none;
    width: 26px; height: 26px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 13px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    transition: all var(--transition);
}
.cp-predict-close:hover { background: var(--red-primary); color: #fff; transform: rotate(90deg); }

.cp-predict-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.cp-predict-select, .cp-predict-number {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    outline: none;
    height: 38px;
    color: var(--text-primary);
    background: var(--bg-secondary);
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: 'Inter', sans-serif;
}
.cp-predict-select:focus, .cp-predict-number:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(245,158,11,0.12);
}
.cp-predict-select { flex: 2; padding: 0 10px; }
.cp-predict-number {
    flex: 1;
    text-align: center;
    -moz-appearance: textfield;
    appearance: none;
}
.cp-predict-number::-webkit-outer-spin-button,
.cp-predict-number::-webkit-inner-spin-button { -webkit-appearance: none; margin:0; }
.cp-predict-submit {
    flex: 1;
    background: linear-gradient(135deg, #1E293B, #334155);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    height: 38px;
    white-space: nowrap;
    transition: all var(--transition);
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.01em;
}
.cp-predict-submit:hover {
    background: linear-gradient(135deg, var(--red-primary), var(--red-dark));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(230,57,57,0.3);
}

/* Input row */
.cp-input-row {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border);
    border-radius: 50px;
    padding: 5px 8px 5px 10px;
    transition: border-color var(--transition), box-shadow var(--transition);
    position: relative;
}
.cp-input-row:focus-within {
    border-color: rgba(230,57,57,0.4);
    box-shadow: 0 0 0 3px rgba(230,57,57,0.08);
    background: var(--bg-primary);
}
.cp-input-icon-btn {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    transition: all var(--transition);
    color: var(--text-muted);
}
.cp-input-icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: scale(1.1);
}
.cp-main-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    padding: 6px 4px;
    min-width: 0;
}
.cp-main-input::placeholder { color: var(--text-muted); }
.cp-send-btn {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--red-primary) 0%, var(--red-dark) 100%);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition);
    box-shadow: 0 3px 12px rgba(230,57,57,0.4);
}
.cp-send-btn:hover {
    transform: scale(1.08) rotate(-5deg);
    box-shadow: 0 6px 20px rgba(230,57,57,0.5);
}
.cp-send-btn:active { transform: scale(0.95); }
.cp-send-btn:disabled { background: var(--border); box-shadow: none; cursor: not-allowed; transform: none; }

/* Login prompt */
.cp-login-prompt {
    background: linear-gradient(135deg, var(--bg-tertiary), var(--blue-light));
    border: 1.5px dashed #BFDBFE;
    border-radius: var(--radius-lg);
    padding: 16px;
    text-align: center;
    font-size: 13.5px;
    color: var(--text-secondary);
    font-weight: 500;
}
.cp-login-prompt a {
    color: var(--red-primary);
    font-weight: 800;
    text-decoration: none;
    transition: opacity var(--transition);
}
.cp-login-prompt a:hover { opacity: 0.8; text-decoration: underline; }

/* ════════════════════════════════════════════════════════════
   RIGHT SIDEBAR
════════════════════════════════════════════════════════════ */


.cp-right-sidebar {
    grid-column: 3;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}


.cp-right-sidebar::-webkit-scrollbar { width: 4px; }
.cp-right-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Right sidebar tabs */
.cp-right-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-primary);
    padding: 0 6px;
}
.cp-right-tab {
    flex: 1;
    padding: 10px 4px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-muted);
    border: none;
    background: transparent;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    font-family: 'Inter', sans-serif;
    text-align: center;
}
.cp-right-tab:hover { color: var(--text-secondary); }
.cp-right-tab.active { color: var(--red-primary); border-bottom-color: var(--red-primary); }

/* Online section header */
.cp-right-section-hd {
    padding: 12px 14px 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.cp-right-section-title {
    font-size: 10px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.9px;
}
.cp-online-count-badge {
    background: var(--green);
    color: #fff;
    font-size: 9.5px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(16,185,129,0.3);
}

/* Online user items */
.cp-online-list { flex: 1; }
.cp-user-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 14px;
    cursor: pointer;
    transition: background var(--transition);
}
.cp-user-item:hover { background: var(--bg-hover); }
.cp-user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
    background: var(--bg-tertiary);
    box-shadow: var(--shadow-sm);
}
.cp-user-avatar img { width:100%; height:100%; object-fit:cover; }
.cp-user-status {
    position: absolute;
    bottom: 0; right: 0;
    width: 9px; height: 9px;
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
    background: var(--green);
}
.cp-user-info { flex: 1; min-width: 0; }
.cp-user-name {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cp-user-title {
    font-size: 10.5px;
    color: var(--text-muted);
}
.cp-user-role {
    font-size: 9px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 10px;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.cp-user-role.vip  { background: var(--gold-light); color: #92400E; border: 1px solid #FDE68A; }
.cp-user-role.mod  { background: var(--blue-light); color: #1D4ED8; }
.cp-user-role.reg  { display: none; }

/* Right panel content divs */
.cp-right-panel { flex: 1; }

/* Hot numbers in So panel */
.cp-hot-nums {
    padding: 12px 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.cp-num-chip {
    width: 36px; height: 36px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: transform var(--transition);
    box-shadow: var(--shadow-sm);
}
.cp-num-chip:hover { transform: scale(1.1) translateY(-1px); }
.cp-num-chip.hot  { background: linear-gradient(135deg, #E63939, #FF6B6B); color:#fff; }
.cp-num-chip.warm { background: linear-gradient(135deg, #F59E0B, #FCD34D); color: var(--text-primary); }
.cp-num-chip.cool { background: var(--text-primary); color:#fff; }

/* KQ card in right panel */
.cp-kq-card {
    margin: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}
.cp-kq-card-header {
    background: linear-gradient(135deg, var(--red-primary), var(--red-dark));
    color: #fff;
    padding: 9px 14px;
    font-size: 12px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.cp-kq-card-body {
    background: var(--bg-primary);
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.9;
    color: var(--text-secondary);
}
.cp-kq-db {
    font-size: 22px;
    font-weight: 900;
    color: var(--red-primary);
    line-height: 1.3;
}

/* ════════════════════════════════════════════════════════════
   SKELETON LOADING
════════════════════════════════════════════════════════════ */
.cp-skeleton {
    background: linear-gradient(90deg, #F1F5F9 25%, #E8ECF0 50%, #F1F5F9 75%);
    background-size: 400% 100%;
    animation: skelAnim 1.4s ease infinite;
    border-radius: var(--radius-sm);
}
@keyframes skelAnim {
    0%   { background-position: 100% 50%; }
    100% { background-position: -100% 50%; }
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE PREMIUM
   ════════════════════════════════════════════════════════════ */
.cp-sidebar-backdrop { display: none; }

/* Tablet & Small Desktop */

@media (max-width: 1024px) {
    .cp-main { grid-template-columns: var(--sidebar-w) 1fr 0; }
    .cp-right-sidebar { display: none; }
    .cp-chat-area { border-right: none; }
}

/* Mobile Devices */
@media (max-width: 767px) {
    /* .cp-ticker { display: none; } */
    .cp-main { 
        display: flex; 
        flex-direction: column;
        height: calc(100vh - 80px); 
        margin-top: 5px; /* Tạo khoảng cách an toàn */
        gap: 0;
        width: 100%;
        position: relative;
        overflow: hidden;
    }


    /* Drawer Sidebars */
    .cp-left-sidebar, .cp-right-sidebar {
        display: flex !important;
        position: fixed;
        top: 0; bottom: 0;
        z-index: 10005;
        width: 280px;
        max-width: 85%;
        background: var(--bg-primary);
        box-shadow: 20px 0 50px rgba(0,0,0,0.3);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        padding-top: 60px;
    }
    .cp-left-sidebar { left: 0; transform: translateX(-105%); }
    .cp-right-sidebar { right: 0; transform: translateX(105%); box-shadow: -20px 0 50px rgba(0,0,0,0.3); }
    .cp-left-sidebar.active, .cp-right-sidebar.active { transform: translateX(0); }

    .cp-sidebar-backdrop {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        backdrop-filter: blur(2px);
        z-index: 10004;
    }
    .cp-sidebar-backdrop.active { display: block; }
    
    .cp-chat-area { width: 100%; flex: 1; display: flex; flex-direction: column; border: none; }
    .chat-page-wrap{ margin-top: 52px;}
    .cp-win-notice-wrap{ display: none;}

    /* Khóa cuộn nền */
    body.cp-no-scroll {
        overflow: hidden !important;
        position: fixed;
        width: 100%;
        height: 100%;
    }


    /* Header Chat on Mobile */
    .cp-chat-header { 
        height: 52px; 
        padding: 0 8px; 
        gap: 4px; 
        z-index: 1000; /* Tăng z-index để không bị che */
        background: #fff; /* Đảm bảo nền trắng để không bị xuyên thấu */
        position: relative;
        box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    }

    .cp-ch-header-name { font-size: 14px; }
    .cp-header-tools { gap: 4px; }
    .cp-header-tools .cp-tool-btn:not(.team-btn):not(.menu-btn) { display: none; }
    .cp-tool-btn.menu-btn { display: flex; }

    /* Messages & Bubbles */
    .cp-messages { padding: 10px; }
    .cp-msg-bubble { font-size: 14px; padding: 8px 12px; max-width: 88%; }
    .cp-msg-avatar { width: 32px; height: 32px; }
    .cp-msg-avatar img { width: 32px; height: 32px; }

    /* Input Section with Scrollable Shortcuts */
    .cp-input-section { padding: 8px 10px; background: var(--bg-primary); }
    .cp-shortcuts {
        display: flex;
        overflow-x: auto;
        padding-bottom: 6px;
        gap: 8px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .cp-shortcuts::-webkit-scrollbar { display: none; }
    .cp-shortcut {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 5px 12px;
        font-size: 12px;
        border-radius: 20px;
        background: var(--bg-secondary);
    }
    
    .cp-input-row { gap: 6px; }
    .cp-main-input { height: 38px; font-size: 14px; }
    .cp-send-btn { width: 38px; height: 38px; }
}


@keyframes fadeIn {
    from { opacity: 0; } to { opacity: 1; }
}




/* ── Emoji picker ────────────────────────────────────────── */
.cp-emoji-picker {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 220px;
    animation: panelIn 0.25s ease;
}
.cp-emoji-btn-pick {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 22px;
    padding: 5px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    line-height: 1;
}
.cp-emoji-btn-pick:hover {
    background: var(--bg-tertiary);
    transform: scale(1.2);
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Search Box */
.cp-search-wrap {
    background: var(--bg-secondary);
    padding: 10px 15px;
    display: flex;
    gap: 10px;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    animation: slideDown 0.3s ease;
}
.cp-search-wrap input {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    color: var(--text-primary);
}
.cp-search-btn {
    background: var(--brand-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 15px;
    cursor: pointer;
    font-size: 13px;
}
.cp-search-close {
    background: none; border: none; font-size: 16px; color: var(--text-muted); cursor: pointer;
}

/* Pinned Banner */
.cp-pinned-wrap {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    position: relative;
    z-index: 10;
    font-size: 13px;
}
.cp-pinned-banner {
    display: flex;
    align-items: center;
    padding: 8px 15px;
    cursor: pointer;
    transition: background 0.2s;
}
.cp-pinned-banner:hover { background: var(--bg-hover); }
.cp-pin-icon { color: var(--amber-primary); font-size: 14px; margin-right: 8px; }
.cp-pin-content { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary); }
.cp-pin-count {
    background: var(--amber-primary);
    color: #fff;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}
.cp-pin-expand {
    background: none; border: none; font-size: 10px; margin-left: 8px; color: var(--text-muted); cursor: pointer;
}
.cp-pinned-list {
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    max-height: 250px;
    overflow-y: auto;
    position: absolute;
    top: 100%; left: 0; right: 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.cp-pinned-item { padding: 10px 15px; border-bottom: 1px solid var(--border-color); cursor: pointer; transition: background 0.2s; }
.cp-pinned-item:hover { background: var(--bg-hover); }
.cp-pi-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; display: flex; justify-content: space-between; }
.cp-pi-meta strong { color: var(--text-primary); }
.cp-pi-text { color: var(--text-primary); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Template Menu */
.cp-template-menu {
    position: fixed;
    bottom: 50px;
    left: 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    z-index: 100;
    width: 280px;
    overflow: hidden;
    animation: panelIn 0.2s ease;
}
.cp-tm-item {
    padding: 12px 16px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(0,0,0,0.03);
}
.cp-tm-item:last-child { border-bottom: none; }
.cp-tm-item:hover { background: var(--bg-tertiary); }
.cp-tm-divider { height: 1px; background: var(--border-color); margin: 4px 0; }
.cp-tm-input-wrap {
    padding: 10px;
    display: flex;
    gap: 8px;
    background: var(--bg-tertiary);
}
.cp-tm-input-wrap input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
}
.cp-tm-input-wrap button {
    background: var(--brand-primary);
    color: #000000;
    border: none;
    border-radius: 6px;
    padding: 0 12px;
    font-size: 12px;
    cursor: pointer;
}

/* Animation */
@keyframes slideDown {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes panelIn {
    from { transform: translateY(10px) scale(0.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Mention highlight */
}

/* ════════════════════════════════════════════════
   PROFILE MODAL (Phase 3)
════════════════════════════════════════════════ */
.cp-profile-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.cp-profile-card {
    background: #fff;
    width: 100%;
    max-width: 320px;
    border-radius: 20px;
    padding: 24px;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.cp-profile-close {
    position: absolute;
    top: 15px; right: 15px;
    background: none; border: none;
    font-size: 20px; color: #94a3b8;
    cursor: pointer;
}

.cp-profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.cp-profile-avatar-wrap {
    position: relative;
    width: 70px; height: 70px;
}

#pfAvatar {
    width: 100%; height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #f8fafc;
}

.cp-vip-badge {
    position: absolute;
    bottom: -5px; right: -5px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    font-size: 10px; font-weight: 800;
    padding: 2px 6px;
    border-radius: 10px;
    border: 2px solid #fff;
}

.cp-profile-main h3 {
    margin: 0; font-size: 18px; color: #1e293b;
}

.cp-profile-role {
    font-size: 12px; color: #64748b; font-weight: 600;
    text-transform: uppercase;
}

.cp-profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
    background: #f8fafc;
    padding: 15px;
    border-radius: 16px;
}

.cp-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cp-stat-val {
    font-size: 16px; font-weight: 800; color: #0f172a;
}

.cp-stat-lbl {
    font-size: 10px; color: #64748b; margin-top: 2px;
}

.cp-profile-body {
    margin-bottom: 16px;
}

.cp-profile-bio {
    font-size: 13px; color: #475569; line-height: 1.5;
    text-align: center;
    background: rgba(241, 245, 249, 0.5);
    padding: 10px; border-radius: 12px;
}

.cp-profile-footer {
    margin-top: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.cp-btn-profile-ask {
    background: #f1f5f9;
    color: #334155;
    border: 1.5px solid #e2e8f0;
    padding: 0 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s;
    font-family: inherit;
}
.cp-btn-profile-ask:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.cp-btn-profile-full {
    display: block;
    text-align: center;
    color: #64748b;
    font-size: 12px;
    text-decoration: none;
    padding: 8px 0 2px;
    transition: color 0.15s;
    grid-column: span 2;
}
.cp-btn-profile-full:hover { color: #e63939; text-decoration: underline; }

.cp-profile-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cp-btn-primary {
    background: var(--brand-primary);
    color: #000000;
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
}

.cp-btn-outline {
    border: 2px solid #e2e8f0;
    color: #475569;
    padding: 10px;
    border-radius: 12px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    font-size: 13px;
}

/* ════════════════════════════════════════════════
   LUCKY PICKER GAME (Phase 3)
════════════════════════════════════════════════ */
.cp-lucky-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.cp-lucky-card {
    background: #fff;
    width: 100%;
    max-width: 360px;
    border-radius: 24px;
    padding: 30px;
    text-align: center;
    position: relative;
    box-shadow: 0 0 50px rgba(230, 57, 57, 0.2);
    animation: cpBounceIn 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

@keyframes cpBounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); opacity: 1; }
}

.cp-lucky-close {
    position: absolute;
    top: 15px; right: 15px;
    background: none; border: none;
    font-size: 20px; color: #94a3b8; cursor: pointer;
}

.cp-lucky-header h3 {
    margin: 10px 0; font-size: 20px; font-weight: 800; color: #1e293b;
}

.cp-lucky-wheel-container {
    position: relative;
    width: 250px;
    height: 250px;
    margin: 30px auto;
    background: #f8fafc;
    border-radius: 50%;
    padding: 10px;
    box-shadow: 0 0 30px rgba(0,0,0,0.05), inset 0 0 20px rgba(0,0,0,0.02);
}

.cp-lucky-wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 8px solid #334155;
    position: relative;
    overflow: hidden;
    transition: transform 4s cubic-bezier(0.15, 0, 0.15, 1);
    background: conic-gradient(
        #ef4444 0deg 45deg, 
        #f59e0b 45deg 90deg, 
        #10b981 90deg 135deg, 
        #3b82f6 135deg 180deg, 
        #8b5cf6 180deg 225deg, 
        #ec4899 225deg 270deg,
        #06b6d4 270deg 315deg,
        #6366f1 315deg 360deg
    );
}

.cp-wheel-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 900;
    color: #ef4444;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 10;
    border: 4px solid #334155;
}

.cp-lucky-pointer {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 40px;
    background: #1e293b;
    clip-path: polygon(50% 100%, 0 0, 100% 0);
    z-index: 11;
}

.cp-lucky-msg {
    font-size: 15px; color: #475569; margin: 20px 0; font-weight: 500;
}

.cp-btn-spin {
    width: 100%;
    background: linear-gradient(135deg, #e63939, #c41e1e);
    color: #fff; border: none; padding: 16px;
    border-radius: 50px; font-size: 18px; font-weight: 800;
    cursor: pointer; transition: 0.3s;
}

.cp-btn-spin:disabled { opacity: 0.5; }
.cp-btn-spin:hover:not(:disabled) { transform: scale(1.05); }

/* ════════════════════════════════════════════════
   MENTION SUGGESTION
════════════════════════════════════════════════ */
.cp-mention-list {
    position: absolute;
    bottom: 70px; left: 15px;
    background: #fff;
    width: 220px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    border: 1px solid #e2e8f0;
    max-height: 200px;
    overflow-y: auto;
    z-index: 50;
    padding: 6px;
    display: flex; flex-direction: column; gap: 2px;
}

.cp-mention-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 8px;
    cursor: pointer; transition: 0.2s;
}

.cp-mention-item:hover, .cp-mention-item.active {
    background: #f1f5f9;
}

.cp-mention-item img {
    width: 24px; height: 24px; border-radius: 50%;
}

.cp-mention-item span {
    font-size: 13px; font-weight: 600; color: #1e293b;
}

/* Reaction Details Tooltip */
.cp-react-details {
    position: absolute;
    bottom: 110%; left: 0;
    background: #1e293b; color: #fff;
    padding: 8px 12px; border-radius: 8px;
    font-size: 11px; white-space: nowrap;
    z-index: 100;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    pointer-events: none;
    animation: cpFadeIn 0.2s;
}





/* ─────────────────────────────────────────────────────────────
   PRIVATE CHAT (PM) STYLES
   ───────────────────────────────────────────────────────────── */
.cp-private-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cp-private-list .cp-ch-item {
    padding: 10px 14px;
    height: auto;
}

.cp-private-list .cp-ch-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cp-ch-last-msg {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    max-width: 130px;
}

.cp-unread-dot {
    position: absolute;
    top: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: var(--red-primary);
    border: 2px solid #fff;
    border-radius: 50%;
    z-index: 2;
}

.cp-ch-badge.red {
    background: var(--red-primary);
    color: #fff !important;
    box-shadow: 0 2px 6px rgba(231, 76, 60, 0.4);
}

.cp-role.pm {
    background: #4b5563;
    color: #f3f4f6;
    border: none;
}

/* Profile button chat */
.cp-btn-profile-chat:hover {
    background: var(--red-dark) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.cp-btn-profile-chat i {
    font-size: 13px;
}

/* Animations for new messages in PM */
.cp-private-list .cp-ch-item.active {
    background: var(--bg-hover);
    border-left: 3px solid var(--blue);
}

.cp-private-list .cp-ch-item.active .cp-ch-name {
    color: var(--blue);
}
