/* ============================================================
   PulseBet AI — Design System
   Paleta: #16161E (fundo), #FFE202 (amarelo/acento),
           #ff4d4d (vermelho/banker), #3d8bff (azul/player)
   ============================================================ */

:root {
  /* Fundos */
  --bg-primary:      #16161E;
  --bg-secondary:    #12121a;
  --bg-card:         #1c1c26;
  --bg-card-deep:    #14141c;
  --fill:            #22222e;
  --fill-deep:       #2a2a38;

  /* Acentos */
  --accent:          #FFE202;
  --accent-light:    #fff04d;
  --accent-dark:     #c9b000;
  --accent-glow:     rgba(255, 226, 2, 0.28);

  --red:             #ff4d4d;
  --red-light:       #ff7070;
  --red-dark:        #cc3333;
  --red-glow:        rgba(255, 77, 77, 0.25);

  --blue:            #3d8bff;
  --blue-light:      #6aa8ff;
  --blue-glow:       rgba(61, 139, 255, 0.25);

  --yellow:          #D4A017;
  --yellow-light:    #ffe066;
  --yellow-glow:     rgba(212, 160, 23, 0.28);

  --green:           #33ffa0;
  --green-glow:      rgba(51, 255, 160, 0.25);

  /* Texto */
  --text-primary:    #ffffff;
  --text-secondary:  rgba(255, 255, 255, 0.78);
  --text-muted:      rgba(255, 255, 255, 0.48);

  /* Bordas */
  --border:          rgba(255, 255, 255, 0.10);
  --border-strong:   rgba(255, 255, 255, 0.18);
  --border-accent:   rgba(255, 226, 2, 0.45);

  /* Gradientes */
  --grad-primary:    linear-gradient(135deg, var(--accent), var(--accent-dark));
  --grad-danger:     linear-gradient(135deg, var(--red), var(--red-dark));
  --grad-player:     linear-gradient(135deg, var(--blue), #2060cc);
  --grad-banker:     linear-gradient(135deg, var(--red), var(--red-dark));

  /* Layout */
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;

  --font-display: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-body:    'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono:    'Courier New', Courier, monospace;

  --transition: 0.2s ease;
  --ease-premium: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  min-height: 100%;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { overflow-x: hidden; }

/* ── Fundo ── */
.bg-field {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 226, 2, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 226, 2, 0.03) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 20%, #000 40%, transparent 100%);
}

.bg-grain {
  position: fixed;
  inset: 0;
  z-index: 900;
  pointer-events: none;
  opacity: 0.025;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

.bg-vignette {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(120% 100% at 50% 12%, transparent 55%, rgba(2, 3, 10, 0.45) 100%);
}

/* ── Tipografia ── */
h1, h2, h3, h4, .font-display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

p { margin: 0; }

.text-gradient {
  background: linear-gradient(135deg, var(--accent), var(--red));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.text-premium {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.text-muted     { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-green     { color: var(--accent); }
.text-red       { color: var(--red); }
.text-amber     { color: var(--yellow-light); }
.text-gold      { color: var(--accent); }

/* ── Glass panel ── */
.glass {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4),
              inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Linha superior de acento amarelo */
.glass::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    rgba(255, 226, 2, 0.5) 8%,
    transparent 20%,
    transparent 80%,
    rgba(255, 226, 2, 0.3) 93%,
    transparent 100%
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.5;
  pointer-events: none;
}

/* ── Scrollbar ── */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 226, 2, 0.4) transparent;
}
*::-webkit-scrollbar { width: 5px; height: 5px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  border-radius: 10px;
}
*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--accent-light), var(--accent));
}

/* ── Botões ── */
.btn {
  position: relative;
  overflow: hidden;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform var(--transition), box-shadow var(--transition), opacity 0.18s ease;
  color: var(--bg-primary);
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.3) 48%, transparent 66%);
  transform: translateX(-140%);
  pointer-events: none;
}
.btn:hover:not(:disabled)::after { animation: btnShine 0.9s ease; }
@keyframes btnShine { to { transform: translateX(140%); } }

.btn-primary {
  background: var(--grad-primary);
  color: var(--bg-primary);
  box-shadow: 0 4px 15px var(--accent-glow);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 22px rgba(255, 226, 2, 0.45);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--grad-danger);
  color: #fff;
  box-shadow: var(--red-glow);
}
.btn-danger:hover:not(:disabled) {
  box-shadow: 0 6px 22px rgba(255, 77, 77, 0.45);
  transform: translateY(-1px);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn:active { transform: translateY(1px) scale(0.98); }
.btn-block { width: 100%; }

/* ── Inputs ── */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"] {
  background: var(--fill);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.field input::placeholder { color: var(--text-muted); }

.field input:focus {
  border-color: var(--accent);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(255, 226, 2, 0.12);
}

/* ── Toggle switch ── */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  border: 1px solid var(--border);
  transition: var(--transition);
}
.slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.switch input:checked + .slider {
  background: rgba(255, 226, 2, 0.2);
  border-color: var(--accent);
}
.switch input:checked + .slider::before {
  background: var(--accent);
  transform: translateX(18px);
  box-shadow: 0 0 6px var(--accent-glow);
}

/* Versão alternativa (div.switch.on) usada no dashboard */
.switch:not(:has(input)) {
  cursor: pointer;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  border: 1px solid var(--border);
  transition: var(--transition);
}
.switch:not(:has(input))::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.switch.on {
  background: rgba(255, 226, 2, 0.2);
  border-color: var(--accent);
}
.switch.on::after {
  transform: translateX(18px);
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}

/* ── Segmented control ── */
.segmented {
  display: inline-flex;
  background: var(--fill);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.segmented button {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  transition: all var(--transition);
}
.segmented button:not(:last-child) { border-right: 1px solid var(--border); }
.segmented button.active {
  background: var(--accent);
  color: var(--bg-primary);
}

/* ── Badges de status ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 5px 11px;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-idle     { background: rgba(255,255,255,0.06); color: var(--text-muted); border-color: var(--border); }
.badge-live     { background: rgba(255,226,2,0.12); color: var(--accent); border-color: rgba(255,226,2,0.35); }
.badge-analyzing { background: rgba(61,139,255,0.12); color: var(--blue-light); border-color: rgba(61,139,255,0.3); }
.badge-entry    { background: rgba(212,160,23,0.18); color: var(--yellow-light); border-color: rgba(212,160,23,0.4); }
.badge-win      { background: rgba(255,226,2,0.14); color: var(--accent); border-color: rgba(255,226,2,0.4); }
.badge-loss     { background: rgba(255,77,77,0.14); color: var(--red); border-color: rgba(255,77,77,0.35); }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}
.dot-pulse { animation: dotPulse 1.5s ease-in-out infinite; }
@keyframes dotPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* ── Toast ── */
.toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 320px;
}
.toast {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  box-shadow: 0 8px 28px rgba(0,0,0,0.5);
  animation: toastIn 0.25s ease;
  border-left: 3px solid var(--accent);
}
.toast.success { border-left-color: var(--accent); color: var(--accent); }
.toast.error   { border-left-color: var(--red); color: var(--red); }
.toast.warn    { border-left-color: var(--yellow-light); color: var(--yellow-light); }
.toast.info    { border-left-color: var(--blue); color: var(--blue-light); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Utilitários ── */
.flex        { display: flex; }
.flex-col    { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.w-full { width: 100%; }

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(22, 22, 30, 0.3);
  border-top-color: var(--bg-primary);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
