/* ============================================
   CHEAT-HUB — PUBLIC CHAT WIDGET
   Bottom-right collapsible panel.
   ============================================ */

.chw {
    --chw-bg: rgba(15, 15, 18, 0.92);
    --chw-border: rgba(255, 255, 255, 0.08);
    --chw-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1080;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ===== Toggle button ===== */
.chw-toggle {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: var(--gradient-primary, linear-gradient(135deg, #C9A84C 0%, #B8942F 100%));
    color: #0F0F12;
    border: none;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(201, 168, 76, .35), 0 0 0 1px rgba(255,255,255,.08) inset;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .25s;
    position: relative;
}
.chw-toggle:hover { transform: translateY(-2px) scale(1.04); }
.chw-toggle:active { transform: scale(.96); }

.chw-toggle__badge {
    position: absolute;
    top: -4px; right: -4px;
    min-width: 20px; height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #CF4444;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #0F0F12;
}
.chw-toggle__badge:empty { display: none; }

/* ===== Panel ===== */
.chw-panel {
    position: absolute;
    right: 0;
    bottom: 70px;
    width: min(380px, calc(100vw - 32px));
    height: min(540px, calc(100vh - 120px));
    background: var(--chw-bg);
    border: 1px solid var(--chw-border);
    border-radius: 18px;
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    box-shadow: var(--chw-shadow);
    display: flex;
    flex-direction: column;
    transform-origin: 100% 100%;
    transform: scale(.92) translateY(8px);
    opacity: 0;
    pointer-events: none;
    transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s ease;
    overflow: hidden;
}
.chw.is-open .chw-panel {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Header */
.chw-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--chw-border);
    background: linear-gradient(180deg, rgba(201,168,76,.08) 0%, transparent 100%);
}
.chw-head__title {
    display: flex; align-items: center; gap: 8px;
    color: #fff;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 0.98rem;
    letter-spacing: -0.01em;
}
.chw-head__dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #4CAF7D;
    box-shadow: 0 0 0 0 rgba(76,175,125,.6);
    animation: chwPulse 1.6s infinite;
}
@keyframes chwPulse {
    0%   { box-shadow: 0 0 0 0 rgba(76,175,125,.55); }
    70%  { box-shadow: 0 0 0 10px rgba(76,175,125,0); }
    100% { box-shadow: 0 0 0 0 rgba(76,175,125,0); }
}
.chw-head__sub { color: rgba(255,255,255,.55); font-size: 0.78rem; font-weight: 500; }
.chw-head__close {
    background: transparent; border: none;
    color: rgba(255,255,255,.7);
    cursor: pointer;
    width: 28px; height: 28px;
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .15s, color .15s;
}
.chw-head__close:hover { color: #fff; background: rgba(255,255,255,.06); }

/* List */
.chw-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 12px 6px;
    scroll-behavior: smooth;
}
.chw-list::-webkit-scrollbar { width: 6px; }
.chw-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 3px; }

.chw-msg {
    display: flex;
    gap: 10px;
    padding: 8px 6px;
    border-radius: 10px;
    transition: background .15s;
}
.chw-msg + .chw-msg { margin-top: 2px; }
.chw-msg:hover { background: rgba(255,255,255,.025); }
.chw-msg--own .chw-msg__name { color: var(--accent-secondary, #D4B96A); }

.chw-msg__avatar {
    flex: 0 0 32px; width: 32px; height: 32px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    align-items: center; justify-content: center;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 800;
    font-size: 0.82rem;
    color: rgba(255,255,255,.85);
    background: linear-gradient(135deg, #2a2a30, #18181b);
    border: 1px solid rgba(255,255,255,.06);
    user-select: none;
}
.chw-msg__avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Special glow for staff avatars */
.chw-msg--admin .chw-msg__avatar { box-shadow: 0 0 0 2px rgba(207,68,68,.45); }
.chw-msg--moderator .chw-msg__avatar { box-shadow: 0 0 0 2px rgba(91,155,213,.45); }
.chw-msg--support .chw-msg__avatar { box-shadow: 0 0 0 2px rgba(76,175,125,.45); }

.chw-msg__body { min-width: 0; flex: 1; }
.chw-msg__head {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    line-height: 1.2;
    margin-bottom: 2px;
}
.chw-msg__name {
    font-weight: 700;
    color: #fff;
    font-size: 0.86rem;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chw-msg__time {
    color: rgba(255,255,255,.4);
    font-size: 0.7rem;
}

.chw-role {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 5px;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.4;
    border: 1px solid transparent;
}
.chw-role--admin     { color: #FF8585; background: rgba(207,68,68,.18); border-color: rgba(207,68,68,.35); }
.chw-role--moderator { color: #87BAEC; background: rgba(91,155,213,.18); border-color: rgba(91,155,213,.35); }
.chw-role--support   { color: #6DD8A4; background: rgba(76,175,125,.18); border-color: rgba(76,175,125,.35); }

.chw-msg__text {
    color: rgba(255,255,255,.86);
    font-size: 0.9rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.chw-msg__text--deleted { color: rgba(255,255,255,.3); font-style: italic; }

.chw-msg__del {
    background: transparent;
    border: none;
    color: rgba(255,255,255,.3);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 6px;
    align-self: flex-start;
    opacity: 0;
    transition: opacity .15s, color .15s, background .15s;
}
.chw-msg:hover .chw-msg__del { opacity: 1; }
.chw-msg__del:hover { color: #ff8585; background: rgba(207,68,68,.12); }

/* Empty / login states */
.chw-empty, .chw-login {
    text-align: center;
    color: rgba(255,255,255,.5);
    padding: 28px 14px;
    font-size: 0.9rem;
}
.chw-empty b, .chw-login b { color: #fff; display: block; margin-bottom: 4px; font-family: 'Space Grotesk', sans-serif; }
.chw-login a {
    display: inline-block;
    margin-top: 8px;
    color: #0F0F12;
    background: var(--gradient-primary, linear-gradient(135deg, #C9A84C 0%, #B8942F 100%));
    padding: 7px 14px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.84rem;
    text-decoration: none;
}
.chw-login a:hover { color: #0F0F12; }

/* Composer */
.chw-foot {
    padding: 10px 12px;
    border-top: 1px solid var(--chw-border);
    background: rgba(255,255,255,.02);
}
.chw-form {
    display: flex; align-items: flex-end; gap: 8px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 12px;
    padding: 6px 6px 6px 10px;
    transition: border-color .15s, background .15s;
}
.chw-form:focus-within {
    border-color: rgba(201,168,76,.4);
    background: rgba(255,255,255,.05);
}
.chw-form textarea {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: #fff;
    resize: none;
    font-family: inherit;
    font-size: 0.92rem;
    padding: 6px 0;
    max-height: 110px;
    min-height: 22px;
    line-height: 1.4;
}
.chw-form textarea::placeholder { color: rgba(255,255,255,.35); }
.chw-form button {
    flex: 0 0 32px;
    width: 32px; height: 32px;
    border-radius: 9px;
    border: none;
    background: var(--gradient-primary, linear-gradient(135deg, #C9A84C 0%, #B8942F 100%));
    color: #0F0F12;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: transform .15s, box-shadow .2s, opacity .15s;
}
.chw-form button:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(201,168,76,.3); }
.chw-form button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.chw-meta {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 6px;
    color: rgba(255,255,255,.35);
    font-size: 0.72rem;
}
.chw-meta__counter { font-variant-numeric: tabular-nums; }
.chw-meta__counter--limit { color: #ffaaaa; }
.chw-error {
    color: #ff8585;
    font-size: 0.78rem;
    margin-top: 4px;
    min-height: 16px;
}

/* New-message divider */
.chw-divider {
    text-align: center;
    color: rgba(255,255,255,.4);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin: 10px 0 6px;
    position: relative;
}
.chw-divider::before, .chw-divider::after {
    content: '';
    position: absolute;
    top: 50%; width: 30%; height: 1px;
    background: rgba(255,255,255,.08);
}
.chw-divider::before { left: 6%; }
.chw-divider::after  { right: 6%; }

/* Mobile */
@media (max-width: 600px) {
    .chw { right: 12px; bottom: 12px; }
    .chw-panel {
        right: 0; bottom: 66px;
        width: calc(100vw - 24px);
        height: calc(100vh - 110px);
        max-height: 70vh;
    }
    .chw-toggle { width: 50px; height: 50px; border-radius: 16px; }
}


/* ===== Message actions menu ===== */
.chw-msg { position: relative; }

.chw-msg__menu {
    position: relative;
    align-self: flex-start;
    opacity: 0;
    transition: opacity .15s;
}
.chw-msg:hover .chw-msg__menu,
.chw-msg__menu.is-open { opacity: 1; }

.chw-msg__menu-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,.4);
    cursor: pointer;
    width: 26px; height: 26px;
    border-radius: 7px;
    font-size: 1rem;
    line-height: 1;
    display: inline-flex; align-items: center; justify-content: center;
    transition: color .15s, background .15s;
}
.chw-msg__menu-btn:hover { color: #fff; background: rgba(255,255,255,.06); }

.chw-msg__menu-pop {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: rgba(20, 20, 25, 0.98);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 10px;
    padding: 4px;
    display: none;
    flex-direction: column;
    min-width: 130px;
    box-shadow: 0 12px 28px rgba(0,0,0,.6);
    z-index: 5;
}
.chw-msg__menu.is-open .chw-msg__menu-pop { display: flex; }

.chw-act {
    background: transparent;
    border: none;
    color: rgba(255,255,255,.85);
    cursor: pointer;
    text-align: left;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: background .12s, color .12s;
}
.chw-act:hover { background: rgba(255,255,255,.06); color: #fff; }
.chw-act--del { color: #ff8585; }
.chw-act--del:hover { background: rgba(207,68,68,.12); color: #ffaaaa; }


/* ===== Moderation modal ===== */
.chw-mod {
    position: fixed;
    inset: 0;
    z-index: 1090;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: chwModIn .2s ease;
}
@keyframes chwModIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.chw-mod__panel {
    width: min(420px, 100%);
    background: linear-gradient(180deg, #1a1a1f 0%, #0F0F12 100%);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 16px;
    box-shadow: 0 30px 60px rgba(0,0,0,.7);
    overflow: hidden;
    animation: chwModPop .25s cubic-bezier(.34,1.56,.64,1);
}
@keyframes chwModPop {
    from { transform: translateY(20px) scale(.95); opacity: 0; }
    to { transform: none; opacity: 1; }
}
.chw-mod__head {
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    display: flex; align-items: center; justify-content: space-between;
}
.chw-mod__head h3 {
    margin: 0;
    color: rgba(255,255,255,.7);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    font-weight: 600;
}
.chw-mod__close {
    background: transparent; border: none;
    color: rgba(255,255,255,.5);
    cursor: pointer;
    width: 28px; height: 28px;
    border-radius: 7px;
    font-size: 1.2rem; line-height: 1;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .15s, color .15s;
}
.chw-mod__close:hover { background: rgba(255,255,255,.06); color: #fff; }

.chw-mod__body { padding: 18px; }
.chw-mod__label {
    display: block;
    color: rgba(255,255,255,.55);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    margin-bottom: 8px;
}
.chw-mod__label + .chw-mod__label { margin-top: 14px; }

.chw-mod__presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
}
.chw-mod__presets button {
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.06);
    color: rgba(255,255,255,.8);
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all .15s;
}
.chw-mod__presets button:hover {
    background: rgba(255,255,255,.07);
    border-color: rgba(255,255,255,.14);
    color: #fff;
}
.chw-mod__presets button.is-active {
    background: rgba(201,168,76,.15);
    border-color: rgba(201,168,76,.5);
    color: #C9A84C;
}
.chw-mod__forever.is-active {
    background: rgba(207,68,68,.15);
    border-color: rgba(207,68,68,.5);
    color: #ff8585;
}

.chw-mod__input {
    width: 100%;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 9px;
    padding: 10px 12px;
    color: #fff;
    font: 400 0.9rem 'Inter', sans-serif;
    margin-top: 6px;
    transition: border-color .15s, background .15s;
}
.chw-mod__input:focus {
    outline: none;
    border-color: rgba(201,168,76,.5);
    background: rgba(255,255,255,.06);
}

.chw-mod__actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 18px;
}
.chw-mod__btn {
    padding: 10px 18px;
    border-radius: 9px;
    border: none;
    font: 600 0.9rem 'Inter', sans-serif;
    cursor: pointer;
    transition: transform .15s, box-shadow .2s, background .15s;
}
.chw-mod__btn--ghost {
    background: rgba(255,255,255,.05);
    color: rgba(255,255,255,.7);
}
.chw-mod__btn--ghost:hover { background: rgba(255,255,255,.08); color: #fff; }
.chw-mod__btn--warn {
    background: linear-gradient(135deg, #D4A03C, #B8842F);
    color: #0F0F12;
}
.chw-mod__btn--warn:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(212,160,60,.35); }
.chw-mod__btn--danger {
    background: linear-gradient(135deg, #CF4444, #A03333);
    color: #fff;
}
.chw-mod__btn--danger:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(207,68,68,.35); }


/* ===== Restricted banner (instead of composer) ===== */
.chw-restricted {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(212, 160, 60, .08);
    border: 1px solid rgba(212, 160, 60, .25);
}
.chw-restricted.is-ban {
    background: rgba(207, 68, 68, .08);
    border-color: rgba(207, 68, 68, .25);
}
.chw-restricted__icon {
    font-size: 1.4rem;
    line-height: 1;
}
.chw-restricted b {
    display: block;
    color: #fff;
    font-size: 0.92rem;
    margin-bottom: 2px;
    font-family: 'Space Grotesk', sans-serif;
}
.chw-restricted__until {
    color: rgba(255,255,255,.6);
    font-size: 0.8rem;
}
.chw-restricted__reason {
    margin-top: 4px;
    color: rgba(255,255,255,.55);
    font-size: 0.78rem;
    font-style: italic;
}
