/* =========================================================================
   AI TRADING LAB (SIMULATOR) PREMIUM STYLES — build2026q12
   ========================================================================= */

#page-simulator {
    padding-bottom: 40px;
}

/* ── Relógio ao Vivo ──────────────────────────────────────────────────────── */

.sim-clock-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 8px;
    padding: 5px 12px;
}

.sim-live-clock {
    font-size: 15px;
    font-weight: 800;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: #a78bfa;
    letter-spacing: 1px;
    line-height: 1;
}

.sim-clock-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ── Countdown Próximo Heartbeat ─────────────────────────────────────────── */

.sim-countdown-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    background: rgba(6, 182, 212, 0.06);
    border: 1px solid rgba(6, 182, 212, 0.18);
    border-radius: 8px;
    padding: 5px 12px;
    transition: all 0.3s ease;
}

.sim-countdown-block.sim-countdown-soon {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.35);
    animation: soon-pulse 1s ease-in-out infinite alternate;
}

@keyframes soon-pulse {
    from { opacity: 0.8; }
    to   { opacity: 1; }
}

.sim-countdown-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.sim-countdown {
    font-size: 15px;
    font-weight: 800;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: #06b6d4;
    letter-spacing: 1px;
    line-height: 1;
}

.sim-countdown-soon .sim-countdown {
    color: #f59e0b;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */

.sim-scorecards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.sim-card {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
}

.sim-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--card-accent, #8b5cf6), transparent);
    opacity: 0.6;
}

.sim-card:hover {
    transform: translateY(-3px);
}

.card-agressivo {
    --card-accent: #ef4444;
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.06);
    border-top: 2px solid #ef4444;
}
.card-agressivo:hover { box-shadow: 0 16px 36px rgba(239, 68, 68, 0.14); }

.card-cauteloso {
    --card-accent: #10b981;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.06);
    border-top: 2px solid #10b981;
}
.card-cauteloso:hover { box-shadow: 0 16px 36px rgba(16, 185, 129, 0.14); }

.card-scalper {
    --card-accent: #06b6d4;
    box-shadow: 0 8px 24px rgba(6, 182, 212, 0.06);
    border-top: 2px solid #06b6d4;
}
.card-scalper:hover { box-shadow: 0 16px 36px rgba(6, 182, 212, 0.16); }

.card-day-trader {
    --card-accent: #f59e0b;
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.06);
    border-top: 2px solid #f59e0b;
}
.card-day-trader:hover { box-shadow: 0 16px 36px rgba(245, 158, 11, 0.16); }

.sim-card-header {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 14px;
    letter-spacing: 0.3px;
}

.sim-bal {
    font-size: 30px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 6px;
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.5px;
}

.sim-ret {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.sim-pnl-abs {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.85;
}

.ret-positive { color: #10b981; }
.ret-negative { color: #ef4444; }
.ret-neutral  { color: var(--text-muted); }

.sim-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ── Métricas nos Cards ───────────────────────────────────────────────────── */

.sim-metrics-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.sim-metric-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sim-metric-label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.sim-metric-val {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.sim-metric-sep {
    color: var(--glass-border);
    font-size: 16px;
    line-height: 1;
    align-self: center;
}

/* ── Section Label ───────────────────────────────────────────────────────── */

.sim-section-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 4px 4px;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 0;
}

/* ── Strip "Hoje" (Day Trading) ───────────────────────────────────────────── */

.sim-today-strip {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, rgba(6,182,212,0.06) 0%, rgba(245,158,11,0.06) 100%);
    border: 1px solid rgba(6, 182, 212, 0.15);
    border-radius: 12px;
    padding: 14px 20px;
    margin: 14px 0 0;
    flex-wrap: wrap;
    gap: 0;
}

.sim-today-kpi {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 90px;
    text-align: center;
    padding: 4px 0;
}

.sim-today-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.sim-today-val {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.5px;
    transition: color 0.3s ease;
}

.sim-today-divider {
    width: 1px;
    height: 32px;
    background: var(--glass-border);
    flex-shrink: 0;
    margin: 0 12px;
}

/* ── Badge "Hoje" dentro dos cards ─────────────────────────────────────────── */

.sim-today-badge-row {
    margin: 8px 0 10px;
}

.sim-today-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.25);
    color: #06b6d4;
    transition: color 0.3s ease;
}

.sim-today-badge-dt {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.25);
    color: #f59e0b;
}

/* ── Circuit Breaker Badge (A3) ─────────────────────────────────────────── */

.sim-cb-row { margin: 8px 0 10px; }
.sim-cb-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #ef4444;
    letter-spacing: 0.3px;
    animation: cb-pulse 2s ease-in-out infinite alternate;
}

@keyframes cb-pulse {
    from { opacity: 0.75; }
    to   { opacity: 1.0; }
}

/* ── Status Badge ────────────────────────────────────────────────────────── */

.sim-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.sim-status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sim-status-online  { background: rgba(16,185,129,.12); border-color: rgba(16,185,129,.3); color: #10b981; }
.sim-status-online .sim-status-dot { background: #10b981; box-shadow: 0 0 6px #10b981; animation: pulse-green 2s infinite; }

.sim-status-paused  { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.3); color: #f59e0b; }
.sim-status-paused .sim-status-dot { background: #f59e0b; }

.sim-status-scanning { background: rgba(139,92,246,.12); border-color: rgba(139,92,246,.35); color: #a78bfa; animation: scanning-pulse 1s ease-in-out infinite alternate; }
.sim-status-scanning .sim-status-dot { background: #a78bfa; box-shadow: 0 0 6px #a78bfa; }

.sim-status-offline { background: rgba(113,113,122,.12); border-color: rgba(113,113,122,.2); color: #71717a; }
.sim-status-offline .sim-status-dot { background: #71717a; }

.sim-status-loading { background: rgba(113,113,122,.08); border-color: rgba(113,113,122,.15); color: #71717a; }
.sim-status-loading .sim-status-dot { background: #71717a; animation: none; }

@keyframes scanning-pulse { from { opacity: 0.7; } to { opacity: 1; } }

/* ── Scan Button ─────────────────────────────────────────────────────────── */

.sim-scan-btn {
    background: rgba(139,92,246,.15) !important;
    border: 1px solid rgba(139,92,246,.4) !important;
    color: #a78bfa !important;
    transition: all 0.2s ease;
}
.sim-scan-btn:hover:not(:disabled) { background: rgba(139,92,246,.25) !important; box-shadow: 0 0 12px rgba(139,92,246,.3); }
.sim-scan-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Ticker Presets ─────────────────────────────────────────────────────── */

.sim-ticker-preset {
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    /* default: purple (misc) */
    background: rgba(139,92,246,.1);
    border: 1px solid rgba(139,92,246,.25);
    color: #a78bfa;
}
.sim-ticker-preset:hover { opacity: 0.85; transform: translateY(-1px); }

/* Variantes por classe de ativo */
.preset-crypto { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.3); color: #f59e0b; }
.preset-b3     { background: rgba(16,185,129,.08); border-color: rgba(16,185,129,.25); color: #10b981; }
.preset-us     { background: rgba(59,130,246,.1); border-color: rgba(59,130,246,.3); color: #60a5fa; }
.preset-fx     { background: rgba(156,163,175,.1); border-color: rgba(156,163,175,.25); color: #9ca3af; }
.preset-group-all {
    background: rgba(139,92,246,.08);
    border: 1px dashed rgba(139,92,246,.4);
    color: #a78bfa;
    font-size: 10px;
    padding: 3px 8px;
}
.preset-group-all:hover { background: rgba(139,92,246,.18); }

/* Botão limpar tickers */
.sim-ticker-clear {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    background: rgba(239,68,68,.08);
    border: 1px solid rgba(239,68,68,.2);
    color: #f87171;
    cursor: pointer;
    transition: all 0.15s ease;
}
.sim-ticker-clear:hover { background: rgba(239,68,68,.15); }

/* Grupos de presets */
.sim-preset-group {
    margin-top: 10px;
}

.sim-preset-group-label {
    display: block;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.sim-preset-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

/* ── Pulse Indicator ─────────────────────────────────────────────────────── */

.pulse-indicator {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0%   { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16,185,129,.7); }
    70%  { transform: scale(1);    box-shadow: 0 0 0 6px rgba(16,185,129,0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

/* ── Terminal ────────────────────────────────────────────────────────────── */

.sim-terminal-panel {
    border: 1px solid rgba(139,92,246,.2);
    box-shadow: 0 4px 20px rgba(139,92,246,.05);
}

.sim-terminal-window {
    background: #0d0d12;
    border: 1px solid rgba(255,255,255,.05);
    border-radius: 8px;
    height: 250px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    padding: 16px;
    color: #a1a1aa;
    box-shadow: inset 0 0 10px rgba(0,0,0,.5);
    line-height: 1.5;
}

.sim-terminal-window::-webkit-scrollbar { width: 5px; }
.sim-terminal-window::-webkit-scrollbar-thumb { background: rgba(139,92,246,.4); border-radius: 3px; }

.term-line { margin-bottom: 3px; word-break: break-all; }
.term-time { color: #6b7280; margin-right: 8px; font-size: 10px; }
.term-lvl-INFO  { color: #3b82f6; font-weight: bold; margin-right: 8px; width: 45px; display: inline-block; }
.term-lvl-WARN  { color: #f59e0b; font-weight: bold; margin-right: 8px; width: 45px; display: inline-block; }
.term-lvl-ERROR { color: #ef4444; font-weight: bold; margin-right: 8px; width: 45px; display: inline-block; }
.term-msg { color: #e4e4e7; }
.term-msg.highlight { color: #10b981; font-weight: 600; }

/* ── Tabelas Premium ─────────────────────────────────────────────────────── */

.sim-tables-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sim-table-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    overflow: hidden;
}

.sim-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 14px;
    border-bottom: 1px solid var(--glass-border);
    flex-wrap: wrap;
    gap: 6px;
}

.sim-table-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sim-table-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(255,255,255,.06);
    padding: 2px 7px;
    border-radius: 10px;
}

.sim-table-subtitle {
    font-size: 11px;
    color: var(--text-muted);
}

/* Wrapper com scroll horizontal (mobile) */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(139,92,246,.3) transparent;
}

.table-responsive::-webkit-scrollbar { height: 4px; }
.table-responsive::-webkit-scrollbar-thumb { background: rgba(139,92,246,.3); border-radius: 2px; }

/* Scroll vertical limitado a 350px */
.table-responsive {
    max-height: 350px;
    overflow-y: auto;
}

.sim-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    min-width: 640px;   /* força scroll horizontal em mobile */
}

.sim-table th {
    text-align: left;
    padding: 10px 14px;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 2;
    white-space: nowrap;
}

.sim-table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,.025);
    color: var(--text-primary);
    vertical-align: middle;
    white-space: nowrap;
}

.sim-table tbody tr:hover {
    background: rgba(255,255,255,.025);
}

/* Linhas coloridas para win/loss */
.sim-table tbody tr.row-win  { background: rgba(16,185,129,.025); }
.sim-table tbody tr.row-loss { background: rgba(239,68,68,.025); }
.sim-table tbody tr.row-win:hover  { background: rgba(16,185,129,.06); }
.sim-table tbody tr.row-loss:hover { background: rgba(239,68,68,.05); }

/* Células numéricas alinhadas à direita */
.num-cell  { text-align: right; font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.date-cell { color: var(--text-muted); font-size: 11px; }
.dur-cell  { color: var(--text-muted); font-size: 11px; text-align: center; }

/* ── Profile & Ticker Tags ─────────────────────────────────────────────── */

.sim-profile-tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    background: color-mix(in srgb, var(--pc, #8b5cf6) 15%, transparent);
    color: var(--pc, #8b5cf6);
    border: 1px solid color-mix(in srgb, var(--pc, #8b5cf6) 30%, transparent);
}

.sim-ticker-tag {
    display: inline-block;
    font-weight: 700;
    font-size: 12px;
    color: var(--text-primary);
    letter-spacing: 0.2px;
}

/* ── Badges (LONG / SHORT) ────────────────────────────────────────────────── */

.badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-long  { background: rgba(16,185,129,.15); color: #10b981; }
.badge-short { background: rgba(239,68,68,.15);  color: #ef4444; }

/* ── PNL Colors ──────────────────────────────────────────────────────────── */

.val-positive { color: #10b981; font-weight: 700; }
.val-negative { color: #ef4444; font-weight: 700; }
.val-neutral  { color: var(--text-muted); }

/* ── Responsive (Mobile) ─────────────────────────────────────────────────── */

@media (max-width: 768px) {
    /* Relógio e countdown menores */
    .sim-live-clock, .sim-countdown { font-size: 13px; }
    .sim-clock-block, .sim-countdown-block { padding: 4px 9px; }

    /* Cards em coluna única */
    .sim-scorecards { grid-template-columns: 1fr; gap: 12px; }

    /* Strip "Hoje" empilhada */
    .sim-today-strip { padding: 12px 14px; gap: 4px; }
    .sim-today-divider { display: none; }
    .sim-today-kpi { min-width: 45%; }

    /* Valores menores nos cards */
    .sim-bal { font-size: 24px; }
    .sim-ret { font-size: 13px; }

    /* Tabelas: título empilhado */
    .sim-table-header { flex-direction: column; align-items: flex-start; padding: 14px 14px 10px; }

    /* Terminal menor */
    .sim-terminal-window { height: 180px; font-size: 11px; }

    /* Botões de controle: wrap */
    .page-header > div:last-child { gap: 6px; }
    .sim-clock-block { display: none; }   /* esconde relógio em telas muito pequenas */
}

@media (max-width: 480px) {
    .sim-countdown-block { display: none; }
    .sim-bal { font-size: 21px; }
    .sim-today-val { font-size: 15px; }
    #page-simulator .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
}
