/* ─── Google Font ─── */
@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@300;400;500;600;700&display=swap');

/* ─── Root Variables & Base Styling ─── */
.fcb-wrap * { box-sizing: border-box; margin: 0; padding: 0; }
.fcb-wrap {
    font-family: 'Be Vietnam Pro', Arial, sans-serif;
    width: 100%;
    max-width: 480px;
    background: var(--fcb-container-bg, #0d0d0d);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 45px -14px rgba(0,0,0,.65), 0 2px 8px rgba(0,0,0,.35);
    border: 1px solid var(--fcb-border-color, #222222);
    position: relative;
}

/* Brand accent strip, ties the widget to the same accent used for the active tab / send button */
.fcb-wrap::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--fcb-active-tab-bg, #6366f1), var(--fcb-hover-tab-color, #38bdf8), var(--fcb-active-tab-bg, #6366f1));
    background-size: 200% 100%;
    animation: fcb-shimmer 4s linear infinite;
    z-index: 1;
}
@keyframes fcb-shimmer {
    0%   { background-position: 0% 0; }
    100% { background-position: -200% 0; }
}

/* ─── Tabs ─── */
.fcb-tabs {
    display: flex;
    align-items: center;
    background: var(--fcb-tab-header-bg, #111111);
    border-bottom: 1px solid var(--fcb-border-color, #1a1a1a);
    padding: 6px 6px 0;
    gap: 2px;
}
.fcb-tab {
    flex: 1;
    padding: 10px 6px;
    text-align: center;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--fcb-inactive-tab-color, #888888);
    cursor: pointer;
    transition: color .2s, background .2s;
    letter-spacing: .3px;
    position: relative;
    border-radius: 8px 8px 0 0;
}
.fcb-tab:hover { color: var(--fcb-hover-tab-color, #dddddd); background: rgba(255,255,255,.04); }
.fcb-tab.active {
    color: var(--fcb-active-tab-color, #ffffff);
    background: var(--fcb-active-tab-bg, #6366f1);
    box-shadow: 0 -2px 12px -2px color-mix(in srgb, var(--fcb-active-tab-bg, #6366f1) 60%, transparent);
}
.fcb-tab.reload-tab {
    flex: 0 0 auto;
    margin-left: auto;
    color: #a855f7;
    background: rgba(168,85,247,.12);
    display: flex; align-items: center; justify-content: center; gap: 4px;
    padding: 8px 12px;
    border-radius: 20px;
    margin-bottom: 6px;
}
.fcb-tab.reload-tab:hover { background: rgba(168,85,247,.2); }
.fcb-tab.reload-tab svg { width:12px; height:12px; fill:#a855f7; transition: transform .4s; }
.fcb-tab.reload-tab:active svg { transform: rotate(180deg); }
.fcb-tab.active.reload-tab { color: #fff; background: #a855f7; }
.fcb-tab.active.reload-tab svg { fill:#fff; }

/* ─── Login Banner ─── */
.fcb-login-banner {
    background: var(--fcb-login-banner-bg, #16213e);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    font-size: 11.5px;
    color: #9ca3af;
    border-bottom: 1px solid var(--fcb-border-color, #222222);
}
.fcb-login-banner svg {
    width: 13px;
    height: 13px;
    fill: #9ca3af;
    flex-shrink: 0;
}
.fcb-login-banner a {
    color: var(--fcb-login-link-color, #6366f1);
    text-decoration: none;
    font-weight: 700;
    letter-spacing: .3px;
}
.fcb-login-banner a:hover { text-decoration: underline; }

/* ─── Chat Input Bar (real chat mode) ─── */
.fcb-chat-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: var(--fcb-tab-header-bg, #111111);
    border-top: 1px solid var(--fcb-border-color, #222222);
}
/* One unified pill housing both fields, instead of two separate floating capsules */
.fcb-field-group {
    flex: 1;
    display: flex;
    align-items: stretch;
    min-width: 0;
    background: rgba(127,127,127,.08);
    border: 1.5px solid var(--fcb-border-color, #2a2a2a);
    border-radius: 999px;
    overflow: hidden;
    transition: border-color .2s, background .2s, box-shadow .2s;
}
.fcb-field-group:focus-within {
    border-color: var(--fcb-active-tab-bg, #6366f1);
    background: rgba(127,127,127,.14);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--fcb-active-tab-bg, #6366f1) 22%, transparent);
}
.fcb-field-divider {
    width: 1px;
    flex-shrink: 0;
    margin: 8px 0;
    background: var(--fcb-border-color, rgba(127,127,127,.3));
}
.fcb-field {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}
.fcb-field svg {
    width: 13px;
    height: 13px;
    fill: var(--fcb-input-placeholder-color, #6b7280);
    margin-left: 14px;
    flex-shrink: 0;
    transition: fill .2s;
}
.fcb-field-group:focus-within svg { fill: var(--fcb-active-tab-bg, #6366f1); }
.fcb-chat-input input {
    background: transparent;
    border: none;
    color: var(--fcb-input-text-color, #eeeeee);
    font-size: 12.5px;
    font-family: inherit;
    padding: 9px 10px 9px 7px;
    outline: none;
    min-width: 0;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fcb-chat-input input::placeholder { color: var(--fcb-input-placeholder-color, #6b7280); }
.fcb-field-name { flex: 0 0 132px; }
.fcb-field-msg { flex: 1; min-width: 0; }
.fcb-send-btn {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--fcb-active-tab-bg, #6366f1), color-mix(in srgb, var(--fcb-active-tab-bg, #6366f1) 70%, #000));
    color: var(--fcb-active-tab-color, #ffffff);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 6px 14px -4px color-mix(in srgb, var(--fcb-active-tab-bg, #6366f1) 70%, transparent);
    transition: transform .15s, box-shadow .15s, opacity .15s;
}
.fcb-send-btn svg { width: 15px; height: 15px; fill: currentColor; margin-left: -1px; }
.fcb-send-btn:hover { transform: translateY(-1px) scale(1.04); }
.fcb-send-btn:active { transform: translateY(0) scale(.97); }
.fcb-send-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.fcb-chat-error {
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    color: #f87171;
    padding: 0 12px 8px;
    display: none;
}
.fcb-chat-error.is-visible { display: flex; }
.fcb-chat-error svg { width: 12px; height: 12px; fill: #f87171; flex-shrink: 0; }

/* ─── Nav Buttons ─── */
.fcb-nav {
    display: flex;
    gap: 6px;
    padding: 8px 8px 6px;
    background: var(--fcb-tab-header-bg, #111111);
    border-bottom: 1px solid var(--fcb-border-color, #1e1e1e);
    overflow-x: auto;
    scrollbar-width: none;
}
.fcb-nav::-webkit-scrollbar { display: none; }
.fcb-nav-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all .2s;
    white-space: nowrap;
}
.fcb-nav-btn.telegram { background: #0088cc; color: #fff; }
.fcb-nav-btn.room     { background: #2c2c2c; color: #ccc; border: 1px solid #444; }
.fcb-nav-btn.vote     { background: #222; color: #000000; border: 1px solid #000000; }
.fcb-nav-btn.event    { background: linear-gradient(135deg,#e67e22,#f39c12); color: #fff; }
.fcb-nav-btn:hover { filter: brightness(1.15); transform: translateY(-1px); }
.fcb-nav-btn svg { width:13px; height:13px; }

/* ─── Messages Area ─── */
.fcb-messages {
    height: 340px;
    overflow-y: auto;
    background: var(--fcb-container-bg, #0d0d0d);
    padding: 8px 0;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}
.fcb-messages::-webkit-scrollbar { width: 4px; }
.fcb-messages::-webkit-scrollbar-track { background: transparent; }
.fcb-messages::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

/* ─── Single Message ─── */
.fcb-msg {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 12px;
    border-bottom: 1px solid var(--fcb-border-color, #161616);
    transition: background .15s;
    animation: fcb-fade-in .35s ease;
}
.fcb-msg:hover { background: rgba(255,255,255,0.035); }

@keyframes fcb-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Avatar + Level Stack */
.fcb-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    width: 36px;
}
.fcb-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #2a2a2a;
    display: block;
}
.fcb-avatar-placeholder {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2a2a2a, #3a3a3a);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: #9ca3af;
    border: 2px solid #2a2a2a;
    flex-shrink: 0;
}
.fcb-level {
    position: absolute;
    bottom: -4px; left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg,#22b573,#16a085);
    color: #fff;
    font-size: 7.5px;
    font-weight: 700;
    padding: 1.5px 5px;
    border-radius: 999px;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,.55), 0 0 0 2px var(--fcb-container-bg, #0d0d0d);
}
.fcb-level.high   { background: linear-gradient(135deg,#f5576c,#c0392b); }
.fcb-level.mid    { background: linear-gradient(135deg,#f7b733,#e67e22); }
.fcb-level.low    { background: linear-gradient(135deg,#27ae60,#16a085); }

/* Message Body */
.fcb-body {
    flex: 1;
    min-width: 0;
}
.fcb-name-row {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.fcb-name {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--fcb-username-color, #e5e7eb);
    line-height: 1.2;
}

.fcb-time {
    font-size: 9.5px;
    color: #565c68;
    margin-left: auto;
    flex-shrink: 0;
}
.fcb-text {
    font-size: 12px;
    color: var(--fcb-msg-text-color, #cccccc);
    margin-top: 3px;
    word-break: break-word;
    line-height: 1.45;
}
.fcb-text.highlight { color: #4ade80; }
.fcb-text.blue      { color: #60a5fa; }

/* Thumbnail images in messages */
.fcb-thumbs { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.fcb-thumb {
    width: 52px; height: 40px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid #333;
    cursor: pointer;
    transition: transform .2s;
}
.fcb-thumb:hover { transform: scale(1.05); }

/* vào gởi label */
.fcb-vao-gui {
    font-size: 9px;
    color: #565c68;
    margin-left: 4px;
    font-style: italic;
}

/* ─── Bottom Status Bar ─── */
.fcb-statusbar {
    background: var(--fcb-tab-header-bg, #0a0a0a);
    padding: 8px 14px;
    font-size: 10.5px;
    color: #6b7280;
    border-top: 1px solid var(--fcb-border-color, #1a1a1a);
    display: flex; align-items: center; gap: 7px;
    font-weight: 500;
}
.fcb-statusbar .fcb-online-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34,197,94,.18);
    animation: fcb-blink 1.5s infinite;
}
@keyframes fcb-blink {
    0%,100% { opacity:1; } 50% { opacity:.35; }
}

/* ─── Tab Content ─── */
.fcb-tab-content { display: none; }
.fcb-tab-content.active { display: block; }

/* ─── Replay / Kinh Nghiệm placeholders ─── */
.fcb-placeholder {
    height: 340px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 12px; color: #4b5563;
}
.fcb-placeholder svg { width: 44px; height: 44px; fill: #333; }
.fcb-placeholder p { font-size: 13px; }

/* ─── New message flash ─── */
.fcb-msg.new-flash {
    background: color-mix(in srgb, var(--fcb-active-tab-bg, #6366f1) 12%, transparent);
}
