/* ==========================================================================
   EMA RADAR PRO - DESIGN SYSTEM & STYLESHEET
   Dark Glassmorphism, Neon Accents, Ultra-Crisp Financial Typography
   ========================================================================== */

:root {
  /* Paleta Base */
  --bg-primary: #080b11;
  --bg-secondary: #0d131f;
  --bg-card: rgba(16, 24, 40, 0.75);
  --bg-card-hover: rgba(22, 33, 56, 0.85);
  --bg-elevated: #162032;
  --bg-glass: rgba(18, 26, 44, 0.65);

  /* Linhas e Bordas */
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-highlight: rgba(255, 255, 255, 0.15);
  --border-focus: rgba(99, 102, 241, 0.5);

  /* Cores de Trading e Indicadores */
  --bullish: #10b981;          /* Verde Esmeralda Neon */
  --bullish-glow: rgba(16, 185, 129, 0.35);
  --bullish-bg: rgba(16, 185, 129, 0.12);
  
  --bearish: #f43f5e;          /* Vermelho Coral Neon */
  --bearish-glow: rgba(244, 63, 94, 0.35);
  --bearish-bg: rgba(244, 63, 94, 0.12);

  --gold: #f59e0b;             /* Âmbar / Dourado (Gatilhos e EMA 8) */
  --gold-glow: rgba(245, 158, 11, 0.35);
  --gold-bg: rgba(245, 158, 11, 0.14);

  --cyan: #06b6d4;             /* Ciano Elétrico */
  --cyan-glow: rgba(6, 182, 212, 0.35);
  --cyan-bg: rgba(6, 182, 212, 0.12);

  --purple: #a855f7;           /* EMA 50 */
  --blue-ema: #38bdf8;         /* EMA 21 */

  /* Tipografia & Contrastes */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-disabled: #475569;

  /* Fontes */
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Sombras & Efeitos */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --glass-blur: blur(14px);
  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body.dark-theme {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Efeitos Luminosos de Fundo */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
}
.bg-glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #3b82f6, transparent);
  top: -150px;
  left: -100px;
}
.bg-glow-2 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #10b981, transparent);
  bottom: 50px;
  right: -100px;
}
.bg-glow-3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, #8b5cf6, transparent);
  top: 40%;
  left: 45%;
  opacity: 0.2;
}

/* ==========================================================================
   HEADER DA APLICAÇÃO
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8, 11, 17, 0.85);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-subtle);
  padding: 14px 28px;
}

.header-container {
  max-width: 1540px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.4);
}

.brand-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.brand-title span {
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--bullish);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background-color: var(--bullish);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--bullish);
  animation: pulse-glow 1.6s infinite ease-in-out;
}

@keyframes pulse-glow {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 12px var(--bullish); }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 1px;
}

.header-metrics {
  display: flex;
  align-items: center;
  gap: 20px;
}

.market-clock-card {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 8px 14px;
  gap: 14px;
}

.clock-item {
  display: flex;
  flex-direction: column;
}

.clock-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.clock-time {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.clock-divider {
  width: 1px;
  height: 24px;
  background: var(--border-subtle);
}

.auto-refresh-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-refresh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.btn-refresh:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.5);
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.btn-refresh:active {
  transform: translateY(0);
}

.btn-refresh.loading i {
  animation: spin 1s infinite linear;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.refresh-countdown {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  position: relative;
  overflow: hidden;
}

.countdown-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  width: 100%;
  transition: width 1s linear;
}

/* ==========================================================================
   LAYOUT PRINCIPAL
   ========================================================================== */
.main-layout {
  max-width: 1540px;
  margin: 0 auto;
  padding: 24px 28px 60px 28px;
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   PAINEL DE CONTROLOS (DROPDOWNS & PARÂMETROS)
   ========================================================================== */
.controls-panel {
  background: var(--bg-glass);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 18px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.controls-container {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 20px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
}

.control-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.02em;
}

.select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.custom-select {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 10px 34px 10px 14px;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 500;
  appearance: none;
  cursor: pointer;
  transition: var(--transition);
}

.custom-select:hover {
  border-color: var(--border-highlight);
  background: var(--bg-elevated);
}

.custom-select:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.select-arrow {
  position: absolute;
  right: 12px;
  font-size: 0.72rem;
  color: var(--text-muted);
  pointer-events: none;
}

/* Pill selector para EMA 8 vs EMA 9 */
.pill-selector {
  display: flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 3px;
  gap: 4px;
}

.pill-btn {
  flex: 1;
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 7px 14px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.pill-btn:hover {
  color: var(--text-primary);
}

.pill-btn.active {
  background: var(--gold);
  color: #0f172a;
  box-shadow: 0 2px 8px var(--gold-glow);
}

.fixed-indicator-badge {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--blue-ema);
  padding: 9px 16px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Pesquisa */
.search-group {
  flex: 1;
  min-width: 220px;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.search-wrapper input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 10px 38px 10px 38px;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.86rem;
  transition: var(--transition);
}

.search-wrapper input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.btn-clear-search {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
}

.btn-clear-search:hover {
  color: var(--text-primary);
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   CARDS DE RESUMO (KPIs)
   ========================================================================== */
.summary-cards-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}

.kpi-card:hover {
  border-color: var(--border-highlight);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.highlight-card {
  border-color: rgba(245, 158, 11, 0.35);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(16, 24, 40, 0.75));
}

.kpi-icon-wrap {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.gold-glow {
  background: var(--gold-bg);
  color: var(--gold);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.orange-glow {
  background: rgba(249, 115, 22, 0.15);
  color: #f97316;
  border: 1px solid rgba(249, 115, 22, 0.3);
}

.emerald-glow {
  background: var(--bullish-bg);
  color: var(--bullish);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.cyan-glow {
  background: var(--cyan-bg);
  color: var(--cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.kpi-content {
  flex: 1;
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.kpi-value-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 3px;
}

.kpi-main-val {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.kpi-badge {
  padding: 3px 8px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.2);
  color: var(--gold);
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.pulse-badge {
  animation: pulse-border 2s infinite ease-in-out;
}

@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.kpi-sub-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sentiment-vals {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.05rem;
}

.sentiment-sep {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.sentiment-percent {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--bullish);
}

.sentiment-progress-bar {
  width: 100%;
  height: 5px;
  background: var(--bearish);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 6px;
}

.sentiment-progress-fill {
  height: 100%;
  background: var(--bullish);
  transition: width 0.4s ease;
}

/* ==========================================================================
   TABELA E FILTROS
   ========================================================================== */
.table-section {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.table-header-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  gap: 14px;
  background: rgba(13, 19, 31, 0.4);
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 7px 12px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.filter-tab:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-highlight);
}

.filter-tab.active {
  background: #1e293b;
  color: #fff;
  border-color: #4f46e5;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

.tab-count {
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 6px;
  border-radius: 12px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
}

.filter-tab.active .tab-count {
  background: #4f46e5;
  color: #fff;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.scan-timestamp {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-highlight);
}

/* Estrutura da Tabela */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.scanner-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.scanner-table thead {
  background: rgba(13, 19, 31, 0.8);
  border-bottom: 1px solid var(--border-subtle);
}

.scanner-table th {
  padding: 12px 16px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
  user-select: none;
}

.scanner-table th.sortable {
  cursor: pointer;
  transition: var(--transition);
}

.scanner-table th.sortable:hover {
  color: var(--text-primary);
}

.scanner-table th.sortable.active {
  color: #38bdf8;
}

.scanner-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: var(--transition);
  cursor: pointer;
}

.scanner-table tbody tr:hover {
  background: rgba(30, 41, 59, 0.45);
}

.scanner-table tbody tr.row-imminent {
  background: rgba(245, 158, 11, 0.04);
}

.scanner-table tbody tr.row-imminent:hover {
  background: rgba(245, 158, 11, 0.09);
}

.scanner-table td {
  padding: 14px 16px;
  font-size: 0.84rem;
  vertical-align: middle;
  white-space: nowrap;
}

/* Colunas específicas */
.col-rank {
  width: 45px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 0.78rem;
}

.ticker-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ticker-symbol-wrap {
  display: flex;
  flex-direction: column;
}

.ticker-symbol {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ticker-country-flag {
  font-size: 0.75rem;
}

.ticker-name {
  font-size: 0.72rem;
  color: var(--text-muted);
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.price-cell {
  font-family: var(--font-mono);
  font-weight: 600;
  display: flex;
  flex-direction: column;
}

.current-price {
  font-size: 0.92rem;
  color: var(--text-primary);
}

.price-change {
  font-size: 0.72rem;
  font-weight: 600;
}

.text-bullish { color: var(--bullish); }
.text-bearish { color: var(--bearish); }
.text-warning { color: var(--gold); }
.text-gold { color: #fbbf24; }
.text-cyan { color: var(--cyan); }

.emas-cell {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ema-fast-val {
  color: var(--gold);
  font-weight: 600;
}

.ema-slow-val {
  color: var(--blue-ema);
  font-weight: 600;
}

.ema-divider {
  color: var(--text-disabled);
}

/* Célula de Proximidade (com Barra Visual) */
.diff-cell {
  min-width: 170px;
}

.diff-value-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.diff-pct-text {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.88rem;
}

.diff-status-sub {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
}

.diff-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.diff-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.bar-imminent {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

.bar-approaching {
  background: linear-gradient(90deg, #38bdf8, #818cf8);
}

.bar-normal {
  background: #475569;
}

/* Badges de Estado */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.74rem;
  font-weight: 600;
}

.badge-bullish {
  background: var(--bullish-bg);
  color: var(--bullish);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-bearish {
  background: var(--bearish-bg);
  color: var(--bearish);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.badge-imminent {
  background: rgba(245, 158, 11, 0.18);
  color: var(--gold);
  border: 1px solid rgba(245, 158, 11, 0.45);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

.badge-crossed-up {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(5, 150, 105, 0.15));
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.5);
  font-weight: 700;
}

.badge-crossed-down {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.25), rgba(225, 29, 72, 0.15));
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.5);
  font-weight: 700;
}

/* RSI */
.rsi-badge {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-block;
}

.rsi-neutral {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.rsi-oversold {
  background: var(--bullish-bg);
  color: var(--bullish);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.rsi-overbought {
  background: var(--bearish-bg);
  color: var(--bearish);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

/* ==========================================================================
   PÁGINA DE LOGIN
   ========================================================================== */
.login-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 20%, rgba(37, 99, 235, 0.15), transparent 45%),
    radial-gradient(circle at 80% 70%, rgba(6, 182, 212, 0.12), transparent 45%),
    var(--bg-primary);
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-highlight);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.login-logo {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
}

.login-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
}

.login-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.login-form {
  display: flex;
  flex-direction: column;
}

.login-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.login-label i {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.login-input {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.92rem;
  margin-bottom: 18px;
  transition: var(--transition);
  width: 100%;
}

.login-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.login-button {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  border: none;
  border-radius: 10px;
  padding: 13px 18px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 4px;
}

.login-button:hover {
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
  transform: translateY(-1px);
}

.login-error {
  background: var(--bearish-bg);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fb7185;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 20px;
}

.login-footer {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.73rem;
  color: var(--text-disabled);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.5;
}

/* Bloco de sessão no cabeçalho */
.session-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
}

.session-user {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 7px;
}

.session-user i {
  color: var(--cyan);
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 0.85rem;
  transition: var(--transition);
}

.btn-logout:hover {
  color: var(--bearish);
  background: var(--bearish-bg);
}

/* Beta (volatilidade face ao mercado) */
.beta-badge {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-block;
}

.beta-low {
  background: var(--cyan-bg);
  color: var(--cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.beta-mid {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.beta-high {
  background: var(--gold-bg);
  color: var(--gold);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.beta-na {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-disabled);
}

/* Tendência de Fundo */
.trend-bg-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
}

.bg-approved {
  background: rgba(6, 182, 212, 0.12);
  color: var(--cyan);
  border: 1px solid rgba(6, 182, 212, 0.25);
}

.bg-rejected {
  color: var(--text-disabled);
}

/* Botão de Ver Gráfico */
.btn-view-chart {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: #818cf8;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-view-chart:hover {
  background: #4f46e5;
  color: #fff;
  border-color: #4f46e5;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

/* Estado Vazio e Spinner */
.loading-state, .empty-search-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  gap: 14px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ==========================================================================
   MODAL DO GRÁFICO DE VELAS E EMAs
   ========================================================================== */
.chart-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.chart-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 7, 13, 0.82);
  backdrop-filter: blur(8px);
}

.modal-dialog {
  position: relative;
  width: 92%;
  max-width: 1180px;
  max-height: 90vh;
  background: #0d131f;
  border: 1px solid var(--border-highlight);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-pop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-pop {
  from { transform: scale(0.96) translateY(10px); }
  to { transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(16, 24, 40, 0.8);
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.modal-badge-symbol {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 800;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  color: #fff;
  padding: 8px 14px;
  border-radius: 10px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}

.modal-meta-row {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.badge-change {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
}

.badge-change.positive { background: var(--bullish-bg); color: var(--bullish); }
.badge-change.negative { background: var(--bearish-bg); color: var(--bearish); }

.modal-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.legend-color.gold { background: var(--gold); }
.legend-color.blue { background: var(--blue-ema); }
.legend-color.purple { background: var(--purple); }

.chart-timeframe-toggle {
  display: flex;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 2px;
}

.tf-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.tf-btn.active {
  background: #2563eb;
  color: #fff;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 6px;
  transition: var(--transition);
}

.btn-close-modal:hover {
  color: #fff;
}

.modal-body {
  padding: 20px;
  background: #080b11;
  position: relative;
  flex: 1;
  min-height: 480px;
  overflow-y: auto;
}

.chart-container-wrap {
  position: relative;
  width: 100%;
  height: 480px;
}

#candlestick-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

.chart-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 11, 17, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  z-index: 10;
}

.chart-loading-overlay.hidden {
  display: none;
}

.chart-tooltip {
  position: absolute;
  display: none;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-highlight);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-primary);
  pointer-events: none;
  box-shadow: var(--shadow-md);
  z-index: 20;
}

/* Alinhamento Técnico (por baixo do gráfico no modal) */
.buy-analysis {
  margin-top: 20px;
  padding: 18px 20px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
}

.buy-analysis-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.buy-analysis-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.buy-analysis-title i {
  color: var(--cyan);
}

.buy-score-gauge {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 160px;
}

.buy-score-track {
  flex: 1;
  height: 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.buy-score-fill {
  height: 100%;
  border-radius: 4px;
  width: 50%;
  transition: width 0.4s ease, background 0.4s ease;
  background: var(--text-disabled);
}

.buy-score-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}

.buy-verdict {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  margin-bottom: 16px;
}

.buy-verdict-icon {
  font-size: 1.4rem;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.buy-verdict-label {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.buy-verdict-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.buy-verdict.tier-strong-buy .buy-verdict-icon { background: var(--bullish-bg); color: var(--bullish); }
.buy-verdict.tier-buy .buy-verdict-icon { background: var(--cyan-bg); color: var(--cyan); }
.buy-verdict.tier-neutral .buy-verdict-icon { background: var(--gold-bg); color: var(--gold); }
.buy-verdict.tier-caution .buy-verdict-icon { background: rgba(245, 158, 11, 0.18); color: var(--gold); }
.buy-verdict.tier-avoid .buy-verdict-icon { background: var(--bearish-bg); color: var(--bearish); }

.buy-criteria-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.buy-criterion {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
}

.buy-criterion i {
  margin-top: 2px;
  font-size: 0.9rem;
}

.buy-criterion-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.buy-criterion-detail {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}

.buy-criterion.pass i { color: var(--bullish); }
.buy-criterion.warn i { color: var(--gold); }
.buy-criterion.fail i { color: var(--bearish); }

.buy-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 16px;
  font-size: 0.74rem;
  color: var(--text-disabled);
  line-height: 1.5;
}

.buy-disclaimer i {
  margin-top: 2px;
  color: var(--gold);
}

.modal-footer {
  padding: 14px 24px;
  background: rgba(16, 24, 40, 0.8);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-stats {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}

.toast {
  background: #1e293b;
  color: #fff;
  border: 1px solid var(--border-highlight);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.success { border-color: var(--bullish); }
.toast.info { border-color: #38bdf8; }
.toast.warning { border-color: var(--gold); }

@keyframes toast-in {
  from { transform: translateX(50px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   RESPONSIVIDADE
   ========================================================================== */
@media (max-width: 900px) {
  .header-container {
    flex-direction: column;
    align-items: flex-start;
  }
  .header-metrics {
    width: 100%;
    justify-content: space-between;
  }
  .controls-container {
    flex-direction: column;
  }
  .control-group, .search-group {
    width: 100%;
  }
}
