/* PolySniper Command Center — style.css v6 */
:root {
    --bg:        #080b14;
    --card-bg:   #10172a;
    --border:    rgba(255,255,255,0.12);
    --green:     #00ff88;
    --cyan:      #03dac6;
    --purple:    #bb86fc;
    --orange:    #ff8c00;
    --red:       #ff3366;
    --muted:     #8e9bb0;
    --text:      #e8eaf6;
    --font-mono: 'JetBrains Mono', monospace;
    --font-main: 'Outfit', 'Inter', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-main);
    min-height: 100vh;
    overflow-x: hidden;   /* nunca scroll horizontal */
}

/* ── Glow background ── */
.glow-bg {
    position: fixed; top: -20%; left: -10%;
    width: 55vw; height: 55vh; pointer-events: none; z-index: 0;
    background: radial-gradient(ellipse, rgba(0,240,255,0.06) 0%, transparent 70%);
    animation: driftA 18s ease-in-out infinite alternate;
}
.glow-bg-2 {
    top: 40%; left: 60%;
    background: radial-gradient(ellipse, rgba(187,134,252,0.05) 0%, transparent 70%);
    animation: driftB 22s ease-in-out infinite alternate;
}
@keyframes driftA { from{transform:translate(0,0)} to{transform:translate(4vw,3vh)} }
@keyframes driftB { from{transform:translate(0,0)} to{transform:translate(-3vw,-4vh)} }

/* ── Layout wrapper ── */
.dashboard-wrapper {
    position: relative; z-index: 1;
    max-width: 1400px; margin: 0 auto;
    padding: 1.25rem 1.25rem 3rem;
    display: flex; flex-direction: column; gap: 1rem;
    width: 100%;
}

/* ── Card base ── */
.glass-panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.04);
    min-width: 0;   /* evita overflow em grid */
}

/* ── Header ── */
.main-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.9rem 1.4rem;
    background: #0d1221;
    border-color: rgba(0,240,255,0.15);
    flex-wrap: wrap; gap: 0.5rem;
}
.logo { display: flex; align-items: center; gap: 12px; }
.logo h1 { font-size: 1.3rem; font-weight: 800; white-space: nowrap; }
.logo h1 span { color: var(--cyan); }
.header-meta { display: flex; align-items: center; gap: 1rem; }
.update-time { font-size: 0.75rem; color: var(--muted); font-family: var(--font-mono); }

.pulse-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
    background: var(--green); box-shadow: 0 0 10px var(--green);
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{transform:scale(1);opacity:1} 50%{transform:scale(1.4);opacity:.7} }

.badge-live {
    padding: 3px 10px; border-radius: 20px; font-size: 0.7rem; font-weight: 700;
    letter-spacing: 1px; background: rgba(255,51,102,0.15);
    color: var(--red); border: 1px solid rgba(255,51,102,0.4);
    animation: blink 1.5s ease-in-out infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.5} }

/* ── Bots grid — auto-fit: 1 col em mobile, 2+ em desktop ── */
.bots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr));
    gap: 1rem;
    width: 100%;
}

/* ── Bot card ── */
.bot-card {
    padding: 1.25rem;
    display: flex; flex-direction: column; gap: 1rem;
    transition: border-color .3s, box-shadow .3s;
    min-width: 0;
}
.bot-card:hover {
    box-shadow: 0 6px 32px rgba(0,240,255,0.08), inset 0 1px 0 rgba(255,255,255,0.06);
}

.bot-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.bot-indicator { display: flex; align-items: center; gap: 10px; }
.bot-label { font-size: 0.95rem; font-weight: 700; }
.bot-ip { font-size: 0.68rem; color: var(--muted); font-family: var(--font-mono); margin-top: 2px; }

.status-dot {
    width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0;
    background: #444; transition: background .3s, box-shadow .3s;
}
.dot-online  { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 2s infinite; }
.dot-offline { background: var(--red);   box-shadow: 0 0 8px var(--red); }

.mode-badge {
    padding: 4px 14px; border-radius: 20px;
    font-size: 0.78rem; font-weight: 700;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.05);
    transition: color .3s, border-color .3s;
    white-space: nowrap;
}

/* ── KPI row ── */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
}
.kpi-mini {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px; padding: 0.65rem;
    text-align: center; min-width: 0;
}
.kpi-mini-label {
    font-size: 0.58rem; font-weight: 700;
    letter-spacing: 0.8px; color: var(--muted);
    text-transform: uppercase; margin-bottom: 5px;
}
.kpi-mini-value {
    font-size: 1.1rem; font-weight: 700;
    font-family: var(--font-mono);
    transition: color .3s; word-break: break-all;
}
.kpi-mini-value.green  { color: var(--green); }
.kpi-mini-value.purple { color: var(--purple); }
.kpi-mini-value.cyan   { color: var(--cyan); }

/* ── Sparkline chart ── */
.chart-wrap {
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    padding: 0.5rem 0.75rem 0.4rem;
}
.chart-label {
    font-size: 0.6rem; font-weight: 700; letter-spacing: 0.8px;
    text-transform: uppercase; color: var(--muted); margin-bottom: 4px;
}
.sparkline { width: 100%; display: block; border-radius: 4px; }

/* ── Bot footer ── */
.bot-footer-row {
    display: flex; align-items: center; justify-content: space-between;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.06);
    gap: 0.5rem; flex-wrap: wrap;
}
.rpg-info { display: flex; flex-direction: column; gap: 3px; font-size: 0.83rem; font-weight: 600; }
.kpi-sub { font-size: 0.7rem; color: var(--muted); font-family: var(--font-mono); }

.cb-badge {
    padding: 4px 12px; border-radius: 8px;
    font-size: 0.73rem; font-weight: 700; border: 1px solid;
    white-space: nowrap;
}
.cb-ok   { color: var(--green);  border-color: rgba(0,255,136,.3);  background: rgba(0,255,136,.06); }
.cb-open { color: var(--red);    border-color: rgba(255,51,102,.3); background: rgba(255,51,102,.08); animation: blink 1s infinite; }

/* ── Survival bar ── */
.survival-bar {
    background: rgba(255,170,0,0.1); border: 1px solid rgba(255,170,0,0.4);
    border-radius: 8px; padding: 7px 14px; text-align: center;
    font-size: 0.78rem; font-weight: 700; color: #ffaa00;
    animation: blink 2s ease-in-out infinite;
}
.hidden { display: none !important; }

/* ── Trades panel ── */
.trades-panel { padding: 1.25rem; }

.panel-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1rem; flex-wrap: wrap; gap: 0.5rem;
}
.panel-header h2 { font-size: 1rem; font-weight: 700; }

.feed-legend {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.72rem; color: var(--muted);
}
.dot-vps {
    display: inline-block; width: 8px; height: 8px;
    border-radius: 50%; margin-right: 3px;
}

/* Bot colors — up to 6 bots */
.bot-color-0 { background: var(--cyan); }
.bot-color-1 { background: var(--purple); }
.bot-color-2 { background: var(--orange); }
.bot-color-3 { background: var(--green); }
.bot-color-4 { background: #ff6eb4; }
.bot-color-5 { background: #ffd700; }

.trades-list { display: flex; flex-direction: column; gap: 5px; }
.trade-placeholder { color: var(--muted); font-size: 0.83rem; text-align: center; padding: 2rem; }

.trade-row {
    display: flex; align-items: center; gap: 8px;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 8px; padding: 7px 12px;
    font-size: 0.8rem; font-family: var(--font-mono);
    min-width: 0;
}
.trade-win  { border-left: 3px solid var(--green); }
.trade-loss { border-left: 3px solid var(--red); }

.trade-dot  { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.trade-icon { flex-shrink: 0; }
.trade-label { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.trade-exit { font-size: 0.68rem; color: var(--muted); white-space: nowrap; flex-shrink: 0; }
.trade-side { color: var(--muted); font-size: 0.72rem; white-space: nowrap; flex-shrink: 0; }
.trade-pnl  { font-weight: 700; min-width: 80px; text-align: right; white-space: nowrap; flex-shrink: 0; }
.trade-win  .trade-pnl { color: var(--green); }
.trade-loss .trade-pnl { color: var(--red); }

/* ── Paginação ── */
.pagination {
    display: flex; align-items: center; justify-content: center;
    gap: 1rem; margin-top: 1rem; padding-top: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.07);
    flex-wrap: wrap;
}
.page-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px; padding: 6px 16px;
    color: var(--text); font-family: var(--font-main);
    font-size: 0.82rem; font-weight: 600;
    cursor: pointer; transition: background .2s, border-color .2s;
}
.page-btn:hover:not(:disabled) {
    background: rgba(3,218,198,0.12);
    border-color: rgba(3,218,198,0.4);
    color: var(--cyan);
}
.page-btn:disabled { opacity: 0.3; cursor: default; }
.page-info { font-size: 0.78rem; color: var(--muted); font-family: var(--font-mono); text-align: center; }

/* ══════════════════════════════════════════
   RESPONSIVO — em telas pequenas, 1 coluna
   A grid auto-fit já faz o trabalho pesado.
   Aqui apenas ajustamos fontes e paddings.
   ══════════════════════════════════════════ */
@media (max-width: 600px) {
    .dashboard-wrapper { padding: 0.75rem 0.75rem 2rem; gap: 0.75rem; }
    .logo h1 { font-size: 1.05rem; }
    .update-time { font-size: 0.65rem; }

    /* KPI: 2 colunas */
    .kpi-row { grid-template-columns: 1fr 1fr; }
    .kpi-mini-value { font-size: 0.95rem; }
    .kpi-mini-label { font-size: 0.52rem; }

    .bot-card { padding: 0.9rem; gap: 0.75rem; }
    .bot-label { font-size: 0.85rem; }
    .mode-badge { font-size: 0.68rem; padding: 3px 8px; }

    /* Feed: esconde "side" pra não encher */
    .trade-side { display: none; }
    .trade-exit { display: none; }
    .trade-pnl  { min-width: 65px; font-size: 0.73rem; }
    .trade-row  { padding: 5px 9px; gap: 5px; }
    .trades-panel { padding: 0.9rem; }

    .page-btn { padding: 8px 14px; }
}

@media (max-width: 380px) {
    .logo h1 span { display: none; }
    .badge-live { display: none; }
}

/* -- Abas do Feed -- */
.feed-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.tab-btn {
    display: flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px; padding: 6px 16px;
    color: var(--muted); font-family: var(--font-main);
    font-size: 0.82rem; font-weight: 600;
    cursor: pointer; transition: all .2s;
}
.tab-btn:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text);
}
.tab-btn.tab-active {
    background: rgba(3,218,198,0.12);
    border-color: rgba(3,218,198,0.45);
    color: var(--cyan);
}
.tab-count {
    background: rgba(255,255,255,0.1);
    border-radius: 20px; padding: 1px 7px;
    font-size: 0.68rem; font-family: var(--font-mono);
    color: var(--muted);
}
.tab-btn.tab-active .tab-count { color: var(--cyan); }
