:root {
    --bg-color: #0a0e1a;
    --bg-card: rgba(22, 28, 45, 0.85);
    --text-color: #e2e8f0;
    --text-muted: #94a3b8;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --accent: #10b981;
    --accent-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --secondary: #475569;
    --border: rgba(255, 255, 255, 0.08);
    --glow-blue: rgba(99, 102, 241, 0.3);
    --glow-green: rgba(16, 185, 129, 0.3);
    --glow-gold: rgba(251, 191, 36, 0.3);
    --glow-pink: rgba(236, 72, 153, 0.3);
    --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-color);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08), transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(16, 185, 129, 0.06), transparent 50%);
    color: var(--text-color);
    min-height: 100vh;
    padding: 1.5rem;
    line-height: 1.5;
    
    
    box-sizing: border-box;
}

html {
    
    
}

.container { max-width: 1280px; width: 100%; margin: 0 auto; box-sizing: border-box; }

/* ---- HEADER ---- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-left h1 {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, #818cf8, #a78bfa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.75rem;
}

#user-info-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .header-left h1 {
        font-size: 1.3rem; margin-bottom: 0.5rem;
    }
    .header-right {
        justify-content: center;
        width: 100%;
        gap: 0.5rem;
    }
    #user-info-badge {
        justify-content: center;
        width: 100%;
        margin-right: 0 !important;
    }
    .input-area {
        flex-direction: column;
    }
}

#lang-select {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
}
#lang-select option { background: #161c2d; }

.status-panel {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 0.85rem;
}

.status-dot { width: 10px; height: 10px; border-radius: 50%; transition: all 0.3s; }
.status-dot.disconnected { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.status-dot.live { background: var(--accent); box-shadow: 0 0 12px var(--accent); animation: pulse 1.5s infinite; }
.status-dot.offline { background: #f59e0b; box-shadow: 0 0 8px #f59e0b; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ---- GLASS PANEL ---- */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

/* ---- CONNECT + STATS ROW ---- */
.connect-stats-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    align-items: stretch;
}
.connect-bar-mini {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0.6rem 0.8rem !important;
    flex-shrink: 0;
}
.connect-bar-mini input[type="text"] {
    width: 160px;
    padding: 0.45rem 0.6rem;
    font-size: 0.85rem;
}
.connect-bar-mini button {
    padding: 0.45rem 0.8rem;
    font-size: 0.8rem;
}
.connect-stats-row .stats-grid-compact {
    flex: 1;
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .connect-stats-row {
        flex-direction: column;
    }
    .connect-bar-mini input[type="text"] {
        width: 100%;
        flex: 1;
    }
}

input[type="text"], input[type="number"], select {
    background: rgba(10, 14, 26, 0.7);
    border: 1px solid var(--border);
    color: white;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.3s;
}
input:focus, select:focus { border-color: var(--primary); }
select option { background: #161c2d; }

#username-input { flex: 1; }

/* ---- BUTTONS ---- */
button {
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
button:active { transform: scale(0.97); }

.btn-primary, #connect-btn { background: var(--primary); color: white; }
.btn-primary:hover, #connect-btn:hover { background: var(--primary-hover); box-shadow: 0 4px 15px var(--glow-blue); }

.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-hover); }

.btn-secondary, #reset-btn { background: var(--secondary); color: white; }
.btn-secondary:hover { background: #64748b; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-hover); }

.full-w { width: 100%; }

/* ---- STATS ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    border-radius: 4px 0 0 4px;
}

.card-diamond::before { background: linear-gradient(to bottom, #60a5fa, #3b82f6); }
.card-time::before { background: linear-gradient(to bottom, #a78bfa, #8b5cf6); }
.card-usd::before { background: linear-gradient(to bottom, #34d399, #10b981); }
.card-vnd::before { background: linear-gradient(to bottom, #fbbf24, #f59e0b); }

.stat-icon { font-size: 2rem; opacity: 0.8; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1.2; }
.stat-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

.stats-grid-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 900px) { .stats-grid-5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .stats-grid-5 { grid-template-columns: repeat(2, 1fr); } }

.card-viewer::before { background: linear-gradient(to bottom, #38bdf8, #0ea5e9); }
.card-total-view::before { background: linear-gradient(to bottom, #a78bfa, #7c3aed); }
.card-follow::before { background: linear-gradient(to bottom, #4ade80, #22c55e); }
.card-like::before { background: linear-gradient(to bottom, #fb7185, #e11d48); }
.card-share::before { background: linear-gradient(to bottom, #fbbf24, #d97706); }

.summary-card {
    background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(139,92,246,0.1));
    border: 1px solid rgba(99,102,241,0.3);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.summary-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 0.75rem; flex-wrap: wrap; gap: 0.5rem;
}
.summary-header h3 { font-size: 1.1rem; color: #a78bfa; }
.btn-summary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white; font-size: 0.8rem; padding: 0.4rem 1rem;
}
.btn-summary:hover { box-shadow: 0 4px 12px var(--glow-blue); }

/* ---- COMPACT ENGAGEMENT STATS ---- */
.stats-grid-compact {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.stat-compact {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px !important;
    flex: 1;
    min-width: 100px;
    position: relative;
    overflow: hidden;
}
.stat-compact::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px; height: 100%;
    border-radius: 3px 0 0 3px;
    background: linear-gradient(to bottom, #6366f1, #a78bfa);
}
.stat-compact-icon { font-size: 1rem; }
.stat-compact-label { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-compact-val { font-size: 1rem; font-weight: 800; margin-left: auto; }

@media (max-width: 600px) {
    .stats-grid-compact { gap: 0.35rem; }
    .stat-compact { min-width: 80px; padding: 5px 8px !important; }
    .stat-compact-label { display: none; }
}

/* ---- MAIN GRID (3-column) ---- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 280px 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 1100px) {
    .dashboard-grid { grid-template-columns: 280px 1fr; }
    .chat-col { grid-column: 1 / -1; }
}
@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

.leaderboard-col { display: flex; flex-direction: column; gap: 1rem; }
.chat-col { display: flex; flex-direction: column; }
.dashboard-right { display: flex; flex-direction: column; gap: 1.5rem; }

/* ---- LEADERBOARD ---- */
.leaderboard h2 { font-size: 1.1rem; margin-bottom: 0.75rem; }
.leaderboard ul { list-style: none; }
.leaderboard li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    transition: background 0.2s;
}
.leaderboard li:hover { background: rgba(255,255,255,0.03); border-radius: 6px; }
.leaderboard li:last-child { border-bottom: none; }
.rank { font-weight: bold; color: #fbbf24; margin-right: 0.4rem; }

/* ---- BGM ---- */
.bgm-panel h2 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.bgm-controls { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
.bgm-controls select { flex: 1; }

.volume-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.volume-row input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
    outline: none;
}
.volume-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px; height: 16px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 6px var(--glow-blue);
}
.volume-row span { font-size: 0.8rem; color: var(--text-muted); min-width: 35px; text-align: right; }

/* ---- SETTINGS ---- */
.settings-panel h2 { font-size: 1.1rem; margin-bottom: 0.75rem; }

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
    font-size: 0.9rem;
}
.settings-row input[type="number"] { width: 110px; }

.help-text { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.75rem; line-height: 1.4; }

.divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }

/* ---- AUDIO ROW ---- */
.audio-row {
    display: grid;
    grid-template-columns: 1.2fr 1.5fr auto;
    gap: 8px;
    background: rgba(0,0,0,0.25);
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 8px;
    border: 1px solid rgba(255,255,255,0.04);
    align-items: center;
}

@media (max-width: 768px) {
    .audio-row {
        grid-template-columns: 1fr;
    }
}

.audio-col { display: flex; flex-direction: column; gap: 4px; }
.audio-col select, .audio-col input[type="text"] { width: 100%; font-size: 0.8rem; padding: 0.4rem; }
.audio-col input[type="file"] { font-size: 0.7rem; padding: 3px; background: rgba(255,255,255,0.04); border-radius: 4px; color: var(--text-muted); }
.audio-col label { font-size: 0.75rem; color: var(--text-muted); }

.audio-actions { display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 768px) {
    .audio-actions { flex-direction: row; margin-top: 10px; }
    .audio-actions .btn-sm { flex: 1; padding: 0.6rem; font-size: 0.9rem; }
}

.btn-sm {
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 6px;
}

.btn-update { background: var(--accent); color: white; }
.btn-update:hover { background: var(--accent-hover); }
.btn-del { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-del:hover { background: var(--danger); color: white; }

.btn-add-effect {
    width: 100%;
    margin-top: 0.75rem;
    border: 2px dashed var(--primary);
    background: rgba(99, 102, 241, 0.1);
    color: #818cf8;
    font-size: 0.9rem;
}
.btn-add-effect:hover { background: rgba(99, 102, 241, 0.2); }

/* ---- NOTIFICATIONS ---- */
#notification-area {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 50;
    max-height: 80vh;
    overflow: hidden;
}

.notification {
    background: rgba(10, 14, 26, 0.95);
    border: 1px solid var(--accent);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    box-shadow: 0 4px 20px var(--glow-green);
    animation: slideIn 0.35s ease-out, fadeOut 0.5s ease-in 4s forwards;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
}
.notification img { width: 40px; height: 40px; border-radius: 6px; }

@keyframes slideIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut { to { opacity: 0; pointer-events: none; } }

/* ---- TAB NAV ---- */
.tab-nav {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.tab-btn {
    flex: 1;
    padding: 0.8rem 1.5rem;
    border-radius: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    transition: all 0.2s;
}
.tab-btn:hover { background: rgba(255,255,255,0.05); color: var(--text-color); }
.tab-btn.active {
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: white;
    box-shadow: 0 4px 15px var(--glow-blue);
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

@media (max-width: 600px) {
    .tab-nav { flex-wrap: wrap; }
    .tab-btn { padding: 0.6rem 0.5rem; font-size: 0.85rem; }
    body { padding: 0.5rem; }
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---- HISTORY ---- */
.history-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: border-color 0.2s;
}
.history-card:hover { border-color: var(--primary); }

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.history-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #818cf8;
}

.history-actions { display: flex; gap: 0.5rem; }

.history-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.history-stat {
    background: rgba(255,255,255,0.03);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
}
.history-stat .hs-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }
.history-stat .hs-value { font-size: 1.1rem; font-weight: 700; }

.history-gifters {
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    padding-top: 0.5rem;
}
.history-gifters span { color: #fbbf24; font-weight: 600; }

.btn-excel {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
}
.btn-excel:hover { box-shadow: 0 4px 10px var(--glow-green); }

.btn-del-hist {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
}
.btn-del-hist:hover { background: var(--danger); color: white; }

/* ---- GIFTS CATALOG ---- */
.gifts-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 0.75rem; flex-wrap: wrap; gap: 0.75rem;
}
.gifts-header h2 { margin: 0; font-size: 1.2rem; }
.gifts-controls { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.gifts-controls select, .gifts-controls input { min-width: 140px; }

.gifts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
    gap: 12px; margin-top: 1rem;
}
.gift-card {
    background: rgba(0,0,0,0.3); border: 1px solid var(--border);
    border-radius: 12px; padding: 12px; text-align: center;
    position: relative; cursor: default;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.gift-card:hover {
    transform: translateY(-3px);
    border-color: rgba(99,102,241,0.4);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}
.gift-card img { width: 64px; height: 64px; object-fit: contain; margin-bottom: 6px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }
.gift-card .gift-name { font-size: 0.75rem; font-weight: 600; line-height: 1.2; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gift-card .gift-coins { font-size: 0.7rem; color: #fbbf24; font-weight: 700; }
.gift-fav-btn {
    position: absolute; top: 6px; right: 6px;
    width: 26px; height: 26px; border-radius: 50%; border: none;
    background: transparent; color: rgba(255,255,255,0.5); font-size: 18px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.25s; padding: 0; line-height: 1;
}
.gift-fav-btn:hover { color: rgba(239,68,68,0.8); transform: scale(1.15); }
.gift-fav-btn.active { color: #ef4444; transform: scale(1.1); }
.gift-card.favorited { border-color: rgba(239,68,68,0.3); }

/* ---- CUSTOM GIFT SELECT ---- */
.custom-gift-select {
    position: relative;
    width: 100%;
    outline: none;
}
.cgs-trigger {
    background: rgba(10, 14, 26, 0.7);
    border: 1px solid var(--border);
    color: white;
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    transition: border-color 0.3s;
}
.custom-gift-select:focus .cgs-trigger,
.cgs-trigger:hover {
    border-color: var(--primary);
}
.cgs-options {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    max-height: 250px;
    overflow-y: auto;
    background: #1e293b;
    border: 1px solid rgba(255,255,255,0.1);
    z-index: 100;
    display: none;
    border-radius: 6px;
    margin-top: 4px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}
.cgs-options.open {
    display: block;
}
.cgs-option {
    padding: 0.5rem;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
}
.cgs-option:hover {
    background: rgba(255,255,255,0.1);
}
.cgs-img {
    width: 20px; height: 20px; object-fit: contain;
}
.cgs-lbl {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- MODAL UI ---- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}
.modal-content {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    animation: modal-pop 0.3s ease-out;
}
@keyframes modal-pop {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.close-btn {
    background: transparent;
    border: none;
    color: #a1a1aa;
    font-size: 1.8rem;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
    margin-top: -5px;
}

.close-btn:hover {
    color: #ef4444;
}

/* Custom Modal scrollbar */
#modal-gifts-grid::-webkit-scrollbar {
    width: 6px;
}
#modal-gifts-grid::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}
#modal-gifts-grid::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
}

/* ---- FOOTER ---- */
.app-footer {
    margin-top: 3rem;
    padding: 1.5rem 0;
    text-align: center;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 0.3px;
}

/* ---- UPSELL POPUP PREMIUM ---- */
.upsell-modal-overlay { position: fixed; top: 0; left: 0;  height: 100vh; background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; z-index: 99999; opacity: 0; transition: opacity 0.3s ease; }
.upsell-modal-overlay.active { opacity: 1; }
.upsell-card { background: rgba(20, 20, 30, 0.95); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 20px; width: 90%; max-width: 480px; padding: 2.5rem 2rem; position: relative; text-align: center; box-shadow: 0 0 50px rgba(111, 66, 193, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.05); transform: translateY(30px) scale(0.95); transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.upsell-modal-overlay.active .upsell-card { transform: translateY(0) scale(1); }
.upsell-icon { font-size: 3.5rem; margin-bottom: 1rem; text-shadow: 0 0 20px rgba(111, 66, 193, 0.8); animation: upsellFloat 3s ease-in-out infinite; }
@keyframes upsellFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.upsell-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 1rem; background: linear-gradient(90deg, #ff8a00, #e52e71, #6f42c1); -webkit-background-clip: text; -webkit-text-fill-color: transparent; letter-spacing: -0.5px; }
.upsell-desc { color: #a1a1aa; font-size: 0.95rem; line-height: 1.5; margin-bottom: 2rem; }
.upsell-btn-pro { display: block; width: 100%; background: linear-gradient(135deg, #6f42c1 0%, #e52e71 100%); color: white; text-decoration: none; padding: 1rem; border-radius: 12px; font-weight: 700; font-size: 1.1rem; box-shadow: 0 4px 15px rgba(229, 46, 113, 0.4); border: none; cursor: pointer; transition: all 0.3s ease; margin-bottom: 1rem; }
.upsell-btn-pro:hover { filter: brightness(1.1); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(229, 46, 113, 0.6); }
.upsell-btn-basic { display: block; width: 100%; background: rgba(255, 255, 255, 0.05); color: #e5e5e5; text-decoration: none; padding: 0.9rem; border-radius: 12px; font-weight: 600; font-size: 0.95rem; border: 1px solid rgba(255, 255, 255, 0.1); cursor: pointer; transition: all 0.3s ease; }
.upsell-btn-basic:hover { background: rgba(255, 255, 255, 0.1); color: white; }
.upsell-close { position: absolute; top: 1rem; right: 1rem; background: transparent; border: none; color: #666; font-size: 1.5rem; cursor: pointer; transition: color 0.2s; }
.upsell-close:hover { color: #fff; }

/* ---- TOAST NOTIFICATIONS ---- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
    pointer-events: none;
}
.toast {
    background: rgba(20, 20, 25, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.toast.show {
    transform: translateX(0);
    opacity: 1;
}
.toast.success { border-left: 4px solid #10b981; }
.toast.error { border-left: 4px solid #ef4444; }
.toast.info { border-left: 4px solid #3b82f6; }

@media (max-width: 600px) {
    .toast-container { top: 10px; left: 10px; right: 10px; align-items: stretch; }
    .toast { transform: translateY(-120%); }
    .toast.show { transform: translateY(0); }
}

/* ---- HIGHLIGHT UNSAVED ---- */
@keyframes pulseGlow { 
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); border-color: #ef4444; } 
    70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); border-color: #ef4444; } 
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } 
}
.btn-pulse {
    animation: pulseGlow 1.5s infinite !important;
    background: rgba(239, 68, 68, 0.2) !important;
    color: white !important;
    border-color: #ef4444 !important;
}

/* ---- CUSTOM FILE UPLOAD ---- */
.custom-file-upload {
    position: relative;
    display: inline-block;
    width: 100%;
}
.custom-file-upload input[type="file"] {
    position: absolute;
    left: 0; top: 0;
    width: 100%; height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}
.custom-file-upload .upload-btn-ui {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #94a3b8;
    transition: 0.2s;
}
.custom-file-upload:hover .upload-btn-ui {
    background: rgba(255, 255, 255, 0.1);
    border-color: #a78bfa;
    color: white;
}
.upload-filename {
    display: inline-block;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

/* ---- LIVE CHAT PANEL ---- */
.chat-panel {
    height: 100%;
    display: flex;
    flex-direction: column;
}
/* Toolbar: everything on ONE row */
.chat-toolbar {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 8px;
    flex-wrap: nowrap;
}
.chat-title {
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Compact selects */
.chat-select {
    padding: 3px 5px;
    font-size: 0.7rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    color: #cbd5e1;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
    cursor: pointer;
    min-width: 0;
    flex: 1;
    max-width: 100px;
}
.chat-select:focus,
.chat-select:hover {
    border-color: rgba(99,102,241,0.5);
}
.chat-select option {
    background: #1e293b;
}

/* Toggle Pill Button */
.toggle-pill {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}
.toggle-pill input[type="checkbox"] { display: none; }
.toggle-pill-label {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--text-muted);
    transition: all 0.25s;
    white-space: nowrap;
}
.toggle-pill input:checked + .toggle-pill-label {
    background: linear-gradient(135deg, rgba(99,102,241,0.3), rgba(139,92,246,0.3));
    border-color: rgba(99,102,241,0.6);
    color: #c4b5fd;
    box-shadow: 0 0 10px rgba(99,102,241,0.2);
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    min-height: 200px;
    max-height: 420px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 4px;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }

.chat-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 2rem 0;
}

/* Individual Chat Message */
.chat-msg {
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.04);
    animation: chatSlideIn 0.3s ease-out;
    font-size: 0.82rem;
    line-height: 1.4;
}
.chat-msg-user {
    font-weight: 700;
    color: #a78bfa;
    margin-right: 6px;
}
.chat-msg-text {
    color: var(--text-color);
    word-break: break-word;
}
.chat-msg-translated {
    display: block;
    margin-top: 3px;
    padding-top: 3px;
    border-top: 1px solid rgba(255,255,255,0.06);
    color: #6ee7b7;
    font-size: 0.78rem;
    font-style: italic;
}
.chat-msg-translated::before {
    content: '↳ ';
    opacity: 0.6;
}

@keyframes chatSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
