/* ==========================================================================
   TradeExpert — Plataforma de treinamento de trade (moeda IrCoin)
   Tema escuro "trading desk": fundo frio (azul-aço), verde/vermelho para subir/descer.
   ========================================================================== */
:root {
  --bg:        #0a101c;
  --bg-soft:   #0e1626;
  --panel:     #111b2e;
  --panel-2:   #16223a;
  --panel-3:   #1b2a46;
  --border:    #21314f;
  --text:      #e7eefb;
  --muted:     #8ea3c2;
  --muted-2:   #64789b;
  --up:        #16c784;
  --up-soft:   rgba(22, 199, 132, .12);
  --down:      #ea3943;
  --down-soft: rgba(234, 57, 67, .12);
  --accent:    #2f81f7;
  --accent-soft: rgba(47, 129, 247, .12);
  --gold:      #f0b90b;
  --train:     #f0b90b;
  --radius:    14px;
  --radius-sm: 10px;
  --shadow:    0 10px 30px rgba(0, 0, 0, .35);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", "Consolas", "SFMono-Regular", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #12233f 0%, var(--bg) 55%) no-repeat, var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.up { color: var(--up); }
.down { color: var(--down); }
/* Valores fictícios (crédito de treino): sempre em amarelo (cor do modo treino).
   Verde = ganho real, vermelho = perda real, amarelo = ganho/perda fictícios. */
.fict { color: var(--train); }
.center { text-align: center; }
.hidden { display: none !important; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  padding: 10px 16px; border-radius: var(--radius-sm); font-weight: 600; font-size: 14px;
  cursor: pointer; transition: .15s ease; font-family: inherit;
}
.btn:hover { border-color: #2c4068; background: var(--panel-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #3d8ef8; border-color: #3d8ef8; }
.btn-up { background: var(--up); border-color: var(--up); color: #05271a; }
.btn-up:hover { background: #22d994; border-color: #22d994; }
.btn-down { background: var(--down); border-color: var(--down); color: #2a0507; }
.btn-down:hover { background: #f04a54; border-color: #f04a54; }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 22px; font-size: 16px; border-radius: 12px; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* CTA pulsante (Modo Valendo) */
@keyframes te-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(47, 129, 247, .55); transform: translateY(0); }
  50%      { box-shadow: 0 0 0 12px rgba(47, 129, 247, 0); transform: translateY(-1px); }
}
.pulse { animation: te-pulse 1.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

/* ---------- Layout de página ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 22px; border-bottom: 1px solid var(--border);
  background: rgba(10, 16, 28, .85); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 40;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; }
.topbar .brand img { height: 34px; width: 34px; object-fit: contain; border-radius: 8px; }
.topbar .spacer { flex: 1; }
.ticker { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--panel); }
.ticker img { height: 22px; width: 22px; }
.ticker .price { font-family: var(--mono); font-weight: 700; }
.ticker .chg { font-family: var(--mono); font-size: 12px; }
.userbox { display: flex; align-items: center; gap: 10px; }
.balance-pill { display: flex; align-items: center; gap: 8px; padding: 7px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--panel); font-family: var(--mono); font-weight: 700; }
.balance-pill .label { color: var(--muted); font-family: var(--font); font-weight: 600; font-size: 12px; }

/* Selo de modo (valendo x treino) */
.mode-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  border: 1px solid transparent;
}
.mode-badge.real { color: var(--up); background: var(--up-soft); border-color: rgba(22,199,132,.35); }
.mode-badge.training { color: var(--train); background: rgba(240,185,11,.12); border-color: rgba(240,185,11,.35); }
.mode-badge svg { width: 14px; height: 14px; }

/* Contador de participantes ativos na rodada (treino x valendo) */
.players-pill {
  position: relative;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--panel); font-size: 12px; font-weight: 600; color: var(--muted);
  white-space: nowrap;
}
.players-pill b { font-family: var(--mono); color: var(--text); font-weight: 700; }
.players-pill .dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.players-pill.train .dot { background: var(--train); animation: te-live-train 1.8s ease-out infinite; }
.players-pill.real  .dot { background: var(--up);    animation: te-live-real 1.8s ease-out infinite; }
@keyframes te-live-train {
  0%   { box-shadow: 0 0 0 0 rgba(240,185,11,.55); }
  70%  { box-shadow: 0 0 0 7px rgba(240,185,11,0); }
  100% { box-shadow: 0 0 0 0 rgba(240,185,11,0); }
}
@keyframes te-live-real {
  0%   { box-shadow: 0 0 0 0 rgba(22,199,132,.55); }
  70%  { box-shadow: 0 0 0 7px rgba(22,199,132,0); }
  100% { box-shadow: 0 0 0 0 rgba(22,199,132,0); }
}
@media (prefers-reduced-motion: reduce) { .players-pill .dot { animation: none; } }

/* Cortina (hover) — lista os participantes de cada modo */
.players-pill .curtain {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 60;
  min-width: 200px; max-height: 264px; overflow: auto;
  display: none; padding: 10px 12px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); text-align: left;
}
.players-pill:hover .curtain,
.players-pill:focus-within .curtain { display: block; }
.players-pill .curtain-title {
  display: block; margin-bottom: 6px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted-2);
}
.players-pill .curtain-list { display: flex; flex-direction: column; gap: 2px; }
.players-pill .curtain-item { padding: 3px 6px; border-radius: 6px; font-size: 12.5px; color: var(--text); }
.players-pill .curtain-item:nth-child(odd) { background: var(--panel-3); }
.players-pill .curtain-empty { padding: 3px 6px; font-size: 12px; color: var(--muted-2); }

/* ---------- Landing ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 22px; }
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; padding: 64px 0 48px; }
.hero h1 { font-size: clamp(30px, 4.2vw, 52px); }
.hero p.lead { font-size: 18px; color: var(--muted); max-width: 560px; }
.hero .cta { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.hero-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; padding: 24px 0 60px; }
.feature { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.feature h3 { font-size: 16px; }
.feature .ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 12px; }
.section-title { padding-top: 30px; }

/* Card de vídeo — "Como funciona" */
.video-card { display: grid; grid-template-columns: 1.5fr 1fr; gap: 28px; align-items: center; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-top: 44px; box-shadow: var(--shadow); }
.video-card h2 { margin: 12px 0 10px; font-size: clamp(22px, 2.6vw, 30px); }
.video-card .lead { color: var(--muted); }
.video-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius-sm); overflow: hidden; background: #000; border: 1px solid var(--border); }
.video-frame video, .video-frame iframe { width: 100%; height: 100%; display: block; border: 0; object-fit: cover; }
footer.site { border-top: 1px solid var(--border); padding: 24px 0; color: var(--muted); font-size: 14px; display: flex; gap: 16px; flex-wrap: wrap; align-items: center; justify-content: space-between; }

/* ---------- Modais ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(4, 8, 15, .7); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  width: 100%; max-width: 460px; max-height: 92vh; overflow: auto; box-shadow: var(--shadow);
  animation: pop .16s ease;
}
.modal.wide { max-width: 780px; }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-body { padding: 20px; }
.modal-foot { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.x-close { background: none; border: none; color: var(--muted); font-size: 22px; cursor: pointer; line-height: 1; }

/* ---------- Formulários ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.field input, .field select {
  width: 100%; padding: 11px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-soft); color: var(--text); font-family: inherit; font-size: 15px;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-msg { padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 12px; display: none; }
.form-msg.error { display: block; background: var(--down-soft); color: #ffb3b8; border: 1px solid rgba(234,57,67,.4); }
.form-msg.success { display: block; background: var(--up-soft); color: #7ff0c4; border: 1px solid rgba(22,199,132,.4); }
.tabs { display: flex; gap: 6px; padding: 6px; background: var(--bg-soft); border-radius: 999px; margin-bottom: 18px; }
.tabs button { flex: 1; border: none; background: transparent; color: var(--muted); padding: 9px; border-radius: 999px; font-weight: 700; cursor: pointer; font-family: inherit; }
.tabs button.active { background: var(--panel-3); color: var(--text); }

/* ---------- App de trade ---------- */
.app-grid { display: grid; grid-template-columns: 1fr 350px; gap: 18px; padding: 18px 22px 40px; max-width: 1400px; margin: 0 auto; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.panel-head h3 { margin: 0; font-size: 15px; }
.panel-body { padding: 18px; }

.chart-wrap { position: relative; }
#chart { width: 100%; height: 380px; display: block; }
.chart-meta { display: flex; gap: 22px; align-items: baseline; padding: 4px 18px 16px; flex-wrap: wrap; }
.chart-meta .big { font-family: var(--mono); font-size: 30px; font-weight: 700; }
.chart-meta .tag { font-size: 13px; }

.volume-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 0 18px 18px; }
.vol { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.vol .head { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.vol .num { font-family: var(--mono); font-size: 20px; font-weight: 700; }
.vol .track { height: 8px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; margin-top: 8px; }
.vol .fill { display: block; height: 100%; width: 0%; transition: width .4s ease; }
.vol.up .fill { background: var(--up); }
.vol.down .fill { background: var(--down); }

/* Painel de aposta */
.bet-side { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bet-btn { padding: 20px 12px; border-radius: var(--radius); border: 1px solid var(--border); cursor: pointer; text-align: center; background: var(--panel-2); transition: .15s; color: var(--text); font-family: inherit; }
.bet-btn .arrow { font-size: 26px; font-weight: 800; line-height: 1; display: block; margin-bottom: 6px; }
.bet-btn .lbl { font-weight: 700; font-size: 14px; }
.bet-btn.up:hover { border-color: var(--up); background: var(--up-soft); }
.bet-btn.down:hover { border-color: var(--down); background: var(--down-soft); }
.bet-btn:disabled { opacity: .45; cursor: not-allowed; }
.bet-btn.chosen-up { border-color: var(--up); background: var(--up-soft); }
.bet-btn.chosen-down { border-color: var(--down); background: var(--down-soft); }

.countdown { text-align: center; margin: 16px 0 4px; }
.countdown .t { font-family: var(--mono); font-size: 42px; font-weight: 800; letter-spacing: -1px; }
.countdown .bar { height: 6px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; margin-top: 8px; }
.countdown .bar > i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--accent), #7db4ff); transition: width 1s linear; }

.kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.kv:last-child { border-bottom: none; }
.kv .v { font-family: var(--mono); font-weight: 700; }

.notice { padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; border: 1px solid var(--border); background: var(--bg-soft); color: var(--muted); }

/* Tabela */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.tbl th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
table.tbl td.mono { font-family: var(--mono); }
.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; border: 1px solid var(--border); }
.pill.won { color: var(--up); border-color: rgba(22,199,132,.4); background: var(--up-soft); }
.pill.lost { color: var(--down); border-color: rgba(234,57,67,.4); background: var(--down-soft); }
.pill.void { color: var(--muted); }
.pill.pending { color: #ffd76e; border-color: rgba(240,185,11,.4); background: rgba(240,185,11,.1); }

/* Toggle modo treino */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .track { width: 44px; height: 24px; border-radius: 999px; background: var(--panel-3); border: 1px solid var(--border); position: relative; transition: .2s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: .2s; }
.switch input:checked + .track { background: rgba(240,185,11,.25); border-color: rgba(240,185,11,.6); }
.switch input:checked + .track::after { left: 22px; background: var(--train); }

/* Toast */
#toast-host { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { background: var(--panel-2); border: 1px solid var(--border); border-left: 4px solid var(--accent); padding: 12px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow); min-width: 240px; animation: pop .16s ease; font-size: 14px; }
.toast.ok { border-left-color: var(--up); }
.toast.err { border-left-color: var(--down); }
.toast.warn { border-left-color: var(--train); }

/* Widget FAQ flutuante (rodapé direito) */
.float-faq { position: fixed; right: 18px; bottom: 18px; z-index: 90; }

/* FAQ accordion */
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item summary { padding: 12px 0; cursor: pointer; font-weight: 600; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before { content: "+"; display: inline-block; width: 18px; color: var(--accent); font-weight: 800; }
.faq-item[open] summary::before { content: "–"; }
.faq-item .ans { padding: 0 0 14px 18px; color: var(--muted); font-size: 14px; }

/* Responsivo */
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; padding: 40px 0 30px; }
  .app-grid { grid-template-columns: 1fr; }
  #chart { height: 300px; }
  .video-card { grid-template-columns: 1fr; gap: 16px; }
}
@media (max-width: 560px) {
  .topbar { padding: 10px 14px; gap: 10px; }
  .topbar .brand span { display: none; }
  .balance-pill .label { display: none; }
  .players-pill { padding: 6px 10px; }
  .players-pill .plabel { display: none; }
  .wrap, .app-grid { padding-left: 14px; padding-right: 14px; }
  .chart-meta .big { font-size: 24px; }
}
