/* ════════════════════════════════════════════════════════
   Economia Widgets BR — estilo minimalista (Nubank-inspired)
   ════════════════════════════════════════════════════════ */

:root {
  --ew-bg:         #ffffff;
  --ew-bg2:        #f7f7f8;
  --ew-border:     #e8e8eb;
  --ew-text:       #1a1a1a;
  --ew-muted:      #8a8a9a;
  --ew-up:         #00a86b;
  --ew-up-bg:      #e6f7f1;
  --ew-down:       #e53935;
  --ew-down-bg:    #fdecea;
  --ew-accent:     #8000ff;
  --ew-radius:     12px;
  --ew-font:       -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ew-mono:       "SF Mono", "Fira Code", "Courier New", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ew-bg:      #1a1a1f;
    --ew-bg2:     #25252d;
    --ew-border:  #333340;
    --ew-text:    #f0f0f5;
    --ew-muted:   #6b6b80;
    --ew-up-bg:   #0d2e1f;
    --ew-down-bg: #2e0d0d;
  }
}

/* ── Base ─────────────────────────────────────────────── */
.ew-widget {
  background: var(--ew-bg);
  border: 1px solid var(--ew-border);
  border-radius: var(--ew-radius);
  padding: 20px 22px 16px;
  font-family: var(--ew-font);
  color: var(--ew-text);
  max-width: 360px;
  box-shadow: 0 2px 12px rgba(0,0,0,.05);
  position: relative;
  /* altura igual via flexbox — funciona quando o Elementor estica a coluna */
  display: flex;
  flex-direction: column;
  height: 100%;
}

.ew-widget * { box-sizing: border-box; }

/* câmbio full-width: sem max-width */
.ew-widget.ew-cambio {
  max-width: 100%;
}

/* ── Label ────────────────────────────────────────────── */
.ew-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--ew-muted);
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* ── Valor principal ──────────────────────────────────── */
.ew-value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}
.ew-unit {
  font-size: 14px;
  font-weight: 400;
  color: var(--ew-muted);
}

/* ── Badges ───────────────────────────────────────────── */
.ew-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.ew-badge.ew-up   { color: var(--ew-up);   background: var(--ew-up-bg); }
.ew-badge.ew-down { color: var(--ew-down); background: var(--ew-down-bg); }
.ew-badge.ew-sm   { font-size: 11px; padding: 3px 8px; }

.ew-up-text   { color: var(--ew-up); }
.ew-down-text { color: var(--ew-down); }

/* ── Footer — sempre no final do widget via flex ──────── */
.ew-footer {
  margin-top: auto;
  padding-top: 14px;
  font-size: 10px;
  color: var(--ew-muted);
}

/* ── Sparkline ────────────────────────────────────────── */
.ew-sparkline-wrap {
  margin: 12px 0 4px;
  height: 40px;
}
.ew-sparkline {
  width: 100%;
  height: 40px;
  display: block;
}

/* ── Câmbio — mobile: coluna (padrão) ────────────────── */
.ew-cambio-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 4px;
  flex: 1;
}
.ew-cambio-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--ew-border);
}
.ew-cambio-row:last-child { border-bottom: none; }
.ew-cambio-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ew-muted);
  flex: 1;
}
.ew-flag { font-size: 18px; line-height: 1; }
.ew-cambio-price {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
  margin-right: 8px;
}

/* ── Câmbio — desktop: linha horizontal ───────────────── */
@media (min-width: 768px) {
  .ew-cambio {
    padding: 18px 28px;
  }
  .ew-cambio-list {
    flex-direction: row;
    align-items: stretch;
    gap: 0;
  }
  .ew-cambio-row {
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 5px;
    padding: 4px 24px 4px 0;
    border-bottom: none;
    border-right: 1px solid var(--ew-border);
  }
  .ew-cambio-row:last-child {
    border-right: none;
    padding-right: 0;
  }
  .ew-cambio-name {
    font-size: 12px;
    gap: 5px;
  }
  .ew-cambio-price {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
  }
}

/* ── Ações ────────────────────────────────────────────── */
.ew-acoes-col { margin-bottom: 12px; }
.ew-acoes-head {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  margin-bottom: 8px;
}
.ew-acoes-divider {
  height: 1px;
  background: var(--ew-border);
  margin: 12px 0;
}
.ew-acoes-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  border-bottom: 1px solid var(--ew-border);
}
.ew-acoes-row:last-child { border-bottom: none; }
.ew-acoes-ticker {
  font-size: 12px;
  font-weight: 700;
  font-family: var(--ew-mono);
  min-width: 50px;
  color: var(--ew-accent);
}
.ew-acoes-name {
  font-size: 11px;
  color: var(--ew-muted);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ew-acoes-price {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-right: 4px;
}

/* ── Tabela genérica (inflação, juros, commodities) ───── */
.ew-table { margin-top: 6px; flex: 1; }
.ew-table-head {
  display: flex;
  gap: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ew-muted);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--ew-border);
  margin-bottom: 2px;
}
.ew-table-head span:first-child { flex: 1; }
.ew-table-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--ew-border);
  font-size: 13px;
}
.ew-table-row:last-child { border-bottom: none; }
.ew-table-row span:first-child { flex: 1; }
.ew-table-name {
  font-weight: 500;
  display: flex;
  flex-direction: column;
}
.ew-table-name small {
  font-size: 10px;
  color: var(--ew-muted);
  font-weight: 400;
}
.ew-highlight {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ew-accent);
}

/* ── Notices ──────────────────────────────────────────── */
.ew-notice {
  background: var(--ew-bg2);
  border: 1px dashed var(--ew-border);
  border-radius: var(--ew-radius);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--ew-muted);
  font-family: var(--ew-font);
}
.ew-notice a { color: var(--ew-accent); }
.ew-note {
  font-size: 12px;
  color: var(--ew-muted);
  line-height: 1.6;
}
.ew-note code { font-size: 11px; }
