/* ================================================================
   ADS ANALYZER — style.css
   Tema escuro/claro em tons de cinza (estilo Claude.ai)
   Todas as cores via variáveis CSS — fácil de customizar
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Mono:wght@300;400;500&display=swap');

/* ----------------------------------------------------------------
   VARIÁVEIS — TEMA ESCURO (padrão)
---------------------------------------------------------------- */
.ads-analyzer,
.ads-analyzer.theme-dark {
  --bg:           #1a1a1a;
  --bg-deep:      #111111;
  --surface:      #212121;
  --surface2:     #2a2a2a;
  --surface3:     #333333;
  --border:       #3a3a3a;
  --border-soft:  rgba(255,255,255,0.06);
  --text:         #ececec;
  --text-muted:   #888888;
  --text-faint:   #555555;
  --accent:       #b4b4b4;
  --accent-soft:  rgba(180,180,180,0.1);

  --green:        #4caf87;
  --green-soft:   rgba(76,175,135,0.12);
  --yellow:       #d4a843;
  --yellow-soft:  rgba(212,168,67,0.12);
  --red:          #c0505a;
  --red-soft:     rgba(192,80,90,0.12);
  --blue:         #6b9fd4;

  --shadow:       0 2px 12px rgba(0,0,0,0.4);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.5);
}

/* ----------------------------------------------------------------
   VARIÁVEIS — TEMA CLARO
---------------------------------------------------------------- */
.ads-analyzer.theme-light {
  --bg:           #f5f5f4;
  --bg-deep:      #eeeeec;
  --surface:      #ffffff;
  --surface2:     #f0f0ee;
  --surface3:     #e8e8e6;
  --border:       #ddddd9;
  --border-soft:  rgba(0,0,0,0.06);
  --text:         #1a1a1a;
  --text-muted:   #777777;
  --text-faint:   #aaaaaa;
  --accent:       #555555;
  --accent-soft:  rgba(0,0,0,0.06);

  --shadow:       0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg:    0 8px 24px rgba(0,0,0,0.12);
}

/* ----------------------------------------------------------------
   BASE
---------------------------------------------------------------- */
.ads-analyzer * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.ads-analyzer {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  border-radius: 12px;
  overflow: hidden;
  transition: background 0.3s, color 0.3s;
  line-height: 1.5;
  position: relative; /* necessário para tooltip absoluto */
}

/* ----------------------------------------------------------------
   HEADER
---------------------------------------------------------------- */
.aa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.aa-logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 1px;
  color: var(--text);
}

.aa-logo span { color: var(--text-muted); }

.aa-header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.aa-theme-toggle {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: background 0.2s;
}

.aa-theme-toggle:hover { background: var(--surface3); }

.aa-user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.aa-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface3);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 11px;
  color: var(--text);
}

/* ----------------------------------------------------------------
   TABS
---------------------------------------------------------------- */
.aa-tabs {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.aa-tabs::-webkit-scrollbar { display: none; }

.aa-tab {
  padding: 13px 20px;
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}

.aa-tab:hover { color: var(--text); }

.aa-tab.active {
  color: var(--text);
  border-bottom-color: var(--text-muted);
}

/* ----------------------------------------------------------------
   MAIN / PANELS
---------------------------------------------------------------- */
.aa-main { padding: 24px 28px; }

.aa-panel { display: none; }
.aa-panel.active { display: block; }

/* ----------------------------------------------------------------
   UPLOAD GRID
---------------------------------------------------------------- */
.aa-upload-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.aa-upload-card {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}

.aa-upload-card:hover {
  border-color: var(--text-muted);
  background: var(--surface2);
}

.aa-platform-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.aa-icon-meta   { background: rgba(24,119,242,0.15); }
.aa-icon-google { background: rgba(212,168,67,0.12); }
.aa-icon-tiktok { background: rgba(255,255,255,0.06); border: 1px solid var(--border); }

.aa-upload-label {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 13px;
}

.aa-upload-btn {
  padding: 7px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.aa-upload-btn:hover {
  background: var(--surface3);
  border-color: var(--text-muted);
}

.aa-upload-hint {
  font-size: 10px;
  color: var(--text-faint);
  line-height: 1.4;
}

.aa-uploaded-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--green-soft);
  border: 1px solid rgba(76,175,135,0.25);
  border-radius: 20px;
  font-size: 10px;
  color: var(--green);
}

.aa-reupload-link {
  margin-left: 4px;
  color: var(--text-faint);
  text-decoration: underline;
  cursor: pointer;
  font-size: 9px;
  transition: color 0.15s;
}

.aa-reupload-link:hover {
  color: var(--text-muted);
}

/* ----------------------------------------------------------------
   FILTER BAR
---------------------------------------------------------------- */
.aa-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.aa-select {
  padding: 7px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text);
  cursor: pointer;
  appearance: none;
}

.aa-date-chips {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.aa-date-chip {
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
}

.aa-date-chip.active,
.aa-date-chip:hover {
  border-color: var(--text-muted);
  color: var(--text);
  background: var(--surface2);
}

/* ----------------------------------------------------------------
   SUMMARY CARDS
---------------------------------------------------------------- */
.aa-summary-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.aa-empty-summary {
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px;
  color: var(--text-faint);
  font-size: 12px;
}

.aa-summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  position: relative;
  overflow: hidden;
  animation: aa-fade-up 0.4s ease both;
}

.aa-summary-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
}

.aa-summary-card.sc-green::after  { background: var(--green); }
.aa-summary-card.sc-yellow::after { background: var(--yellow); }
.aa-summary-card.sc-red::after    { background: var(--red); }
.aa-summary-card.sc-blue::after   { background: var(--blue); }
.aa-summary-card.sc-gray::after   { background: var(--border); }

.aa-summary-label {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.aa-summary-value {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 24px;
  line-height: 1;
  margin-bottom: 6px;
}

.aa-summary-delta {
  font-size: 10px;
  color: var(--text-faint);
}

/* ----------------------------------------------------------------
   TOOLTIP — ícone "?" e balão
---------------------------------------------------------------- */
.aa-metric-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface3);
  border: 1px solid var(--border);
  font-size: 9px;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  color: var(--text-muted);
  cursor: help;
  flex-shrink: 0;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
  vertical-align: middle;
}

.aa-metric-help:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--text-muted);
}

.aa-tooltip {
  position: absolute;
  z-index: 200;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 13px;
  font-size: 11px;
  color: var(--text);
  line-height: 1.5;
  max-width: 260px;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-50%) translateY(-100%);
  transition: opacity 0.15s ease;
  box-shadow: var(--shadow-lg);
}

.aa-tooltip.visible {
  opacity: 1;
}

/* ----------------------------------------------------------------
   SECTION TITLE
---------------------------------------------------------------- */
.aa-section-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.aa-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ----------------------------------------------------------------
   HEATMAP TABLE
---------------------------------------------------------------- */
.aa-heatmap-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 24px;
}

.aa-heatmap-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.aa-controls-label {
  font-size: 10px;
  color: var(--text-faint);
  margin-right: 4px;
}

.aa-metric-pill {
  padding: 5px 13px;
  border-radius: 20px;
  font-size: 10px;
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all 0.2s;
}

.aa-metric-pill:hover { border-color: var(--text-muted); color: var(--text); }

.aa-metric-pill.active {
  background: var(--surface3);
  border-color: var(--text-muted);
  color: var(--text);
}

.aa-table-scroll { overflow-x: auto; }

.aa-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.aa-table th {
  padding: 10px 14px;
  text-align: left;
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  white-space: nowrap;
}

.aa-table th.audience-col { text-align: center; }

.aa-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}

.aa-table tr:last-child td { border-bottom: none; }
.aa-table tr:hover td { background: var(--accent-soft); }
.aa-table td.audience-cell { text-align: center; }

.aa-empty-cell {
  text-align: center;
  padding: 40px;
  color: var(--text-faint);
}

.aa-creative-name {
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aa-platform-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
}

.aa-platform-tag.meta   { background: rgba(24,119,242,0.12);  color: #6b9fd4; }
.aa-platform-tag.google { background: rgba(212,168,67,0.12);  color: var(--yellow); }
.aa-platform-tag.tiktok { background: rgba(0,220,200,0.10);   color: #00dcc8; }

.aa-cell-metric {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* dots */
.aa-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.aa-dot.green  { background: var(--green);  box-shadow: 0 0 5px var(--green); }
.aa-dot.yellow { background: var(--yellow); box-shadow: 0 0 5px var(--yellow); }
.aa-dot.red    { background: var(--red);    box-shadow: 0 0 5px var(--red); }

/* score bar */
.aa-score-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.aa-bar-bg {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  max-width: 54px;
}

.aa-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* ----------------------------------------------------------------
   INSIGHTS GRID — 3 colunas
---------------------------------------------------------------- */
.aa-insights-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
}

/* 3 colunas quando temos o card do meio (piores) */
.aa-insights-3col {
  grid-template-columns: 1fr 1fr 1fr;
}

.aa-insight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}

/* Card dos piores com borda vermelha discreta */
.aa-insight-worst {
  border-color: rgba(192,80,90,0.3);
}

.aa-insight-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.aa-insight-icon {
  font-size: 18px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  border-radius: 8px;
}

.aa-insight-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 12px;
}

.aa-insight-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 11px;
  gap: 8px;
}

.aa-insight-item:last-child { border-bottom: none; }

.aa-insight-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.aa-insight-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}

.aa-rank {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.aa-rank.gold   { background: rgba(212,168,67,0.15);  color: var(--yellow); }
.aa-rank.silver { background: rgba(180,180,180,0.12); color: #aaa; }
.aa-rank.bronze { background: rgba(180,120,60,0.12);  color: #c8895a; }

/* Rank do card "piores" — tom vermelho */
.aa-rank-worst {
  background: rgba(192,80,90,0.15);
  color: var(--red);
}

.aa-empty-insight {
  text-align: center;
  padding: 20px;
  color: var(--text-faint);
  font-size: 11px;
}

/* ----------------------------------------------------------------
   CLAUDE BAR
---------------------------------------------------------------- */
.aa-claude-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.aa-claude-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.aa-claude-orb {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface3);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.aa-claude-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 3px;
}

.aa-claude-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.aa-claude-btn {
  padding: 10px 22px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.aa-claude-btn:hover {
  background: var(--surface3);
  border-color: var(--text-muted);
}

.aa-claude-output {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 22px;
  font-size: 13px;
  line-height: 1.8;
  margin-bottom: 16px;
}

.aa-claude-output strong { color: var(--text); }

/* ----------------------------------------------------------------
   SETTINGS
---------------------------------------------------------------- */
.aa-settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}

.aa-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  gap: 12px;
}

.aa-theme-toggle-big {
  padding: 8px 18px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}

.aa-theme-toggle-big:hover {
  background: var(--surface3);
  border-color: var(--text-muted);
}

.aa-settings-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.aa-threshold-row {
  display: grid;
  grid-template-columns: 120px 1fr 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 12px;
}

.aa-threshold-row:last-child { border-bottom: none; }

.aa-threshold-label {
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.aa-threshold-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.aa-threshold-input {
  width: 72px;
  padding: 6px 9px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text);
  -webkit-text-fill-color: var(--text);
  opacity: 1;
}
.ads-analyzer.theme-dark .aa-threshold-input {
  background: #2e2e2e;
  color: #ececec;
  -webkit-text-fill-color: #ececec;
  border-color: #505050;
}
.aa-threshold-input:focus {
  outline: none;
  border-color: var(--text-muted);
}

.aa-save-btn {
  margin-top: 16px;
  padding: 9px 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}

.aa-save-btn:hover { background: var(--surface3); border-color: var(--text-muted); }

.aa-save-msg {
  margin-left: 12px;
  font-size: 11px;
  color: var(--green);
}

/* ----------------------------------------------------------------
   GLOSSÁRIO DE MÉTRICAS
---------------------------------------------------------------- */
.aa-glossary {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.aa-glossary-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-soft);
}

.aa-glossary-item:last-child { border-bottom: none; }

.aa-glossary-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.aa-glossary-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.5px;
  color: var(--text);
  flex-shrink: 0;
}

.aa-glossary-name {
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 12px;
  color: var(--text);
}

.aa-glossary-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.7;
}

.aa-glossary-desc strong { color: var(--text); }

/* ----------------------------------------------------------------
   HISTORY LIST
---------------------------------------------------------------- */
.aa-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  gap: 12px;
}

.aa-history-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.aa-history-load {
  padding: 6px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: 'Syne', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.aa-history-load:hover { background: var(--surface3); border-color: var(--text-muted); }

/* ----------------------------------------------------------------
   LEGEND
---------------------------------------------------------------- */
.aa-legend {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 28px 20px;
  font-size: 10px;
  color: var(--text-faint);
  flex-wrap: wrap;
  border-top: 1px solid var(--border-soft);
}

/* ----------------------------------------------------------------
   LOADING STATE
---------------------------------------------------------------- */
.aa-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 16px 0;
}

.aa-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--text-muted);
  border-radius: 50%;
  animation: aa-spin 0.7s linear infinite;
}

/* ----------------------------------------------------------------
   LOGIN NOTICE
---------------------------------------------------------------- */
.ads-analyzer-login-notice {
  padding: 24px;
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.ads-analyzer-login-notice a {
  color: var(--text);
  text-decoration: underline;
}

/* ----------------------------------------------------------------
   ANIMATIONS
---------------------------------------------------------------- */
@keyframes aa-fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes aa-spin {
  to { transform: rotate(360deg); }
}


/* ----------------------------------------------------------------
   BENCHMARK LINE nos summary cards
---------------------------------------------------------------- */
.aa-bench-line {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  margin-top: 6px;
  gap: 4px;
}

/* ----------------------------------------------------------------
   SCORE BADGE 0–100
---------------------------------------------------------------- */
.aa-score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: 2px 7px;
  border-radius: 5px;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
}
.aa-score-badge.sc-green  { background: var(--green-soft);  color: var(--green);  border: 1px solid rgba(76,175,135,0.25); }
.aa-score-badge.sc-yellow { background: var(--yellow-soft); color: var(--yellow); border: 1px solid rgba(212,168,67,0.25); }
.aa-score-badge.sc-red    { background: var(--red-soft);    color: var(--red);    border: 1px solid rgba(192,80,90,0.25);  }

/* ----------------------------------------------------------------
   ALERTAS DE AÇÃO
---------------------------------------------------------------- */
.aa-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 8px;
  font-size: 12px;
  line-height: 1.5;
  background: var(--surface);
}
.aa-alert-success { border-left: 3px solid var(--green);  background: var(--green-soft);  }
.aa-alert-danger  { border-left: 3px solid var(--red);    background: var(--red-soft);    }
.aa-alert-warning { border-left: 3px solid var(--yellow); background: var(--yellow-soft); }
.aa-alert-icon    { font-size: 16px; flex-shrink: 0; line-height: 1.4; }
.aa-alert-body    { display: flex; flex-wrap: wrap; gap: 4px; align-items: baseline; }
.aa-alert-action  { font-family: 'Syne', sans-serif; font-weight: 700; }
.aa-alert-name    { font-weight: 600; }
.aa-alert-reason  { color: var(--text-muted); font-size: 11px; }

/* ----------------------------------------------------------------
   DIAGNÓSTICO AUTOMÁTICO
---------------------------------------------------------------- */
.aa-diagnosis-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 0;
  margin-bottom: 24px;
}
.aa-diagnosis-line {
  display: flex;
  gap: 14px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 12px;
  line-height: 1.7;
  align-items: flex-start;
}
.aa-diagnosis-line:last-child { border-bottom: none; }
.aa-diagnosis-icon { font-size: 17px; flex-shrink: 0; margin-top: 1px; }
.aa-diagnosis-text { color: var(--text-muted); }
.aa-diagnosis-text strong { color: var(--text); }

/* ----------------------------------------------------------------
   DELTA — comparação de períodos
---------------------------------------------------------------- */
.aa-delta {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
}
.aa-delta-green { color: var(--green); background: var(--green-soft); }
.aa-delta-red   { color: var(--red);   background: var(--red-soft);   }

/* ----------------------------------------------------------------
   COMPARAÇÃO DE PERÍODOS
---------------------------------------------------------------- */
.aa-compare-header {
  margin-bottom: 28px;
}
.aa-compare-intro {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.6;
}
.aa-compare-uploads {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
}
.aa-compare-slot {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 20px;
}
.aa-compare-slot-label {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.aa-compare-name-input {
  width: 100%;
  padding: 7px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 12px;
  color: var(--text);
  -webkit-text-fill-color: var(--text);
  margin-bottom: 12px;
}
.ads-analyzer.theme-dark .aa-compare-name-input {
  background: #2e2e2e;
  color: #ececec;
  -webkit-text-fill-color: #ececec;
  border-color: #505050;
}
.aa-compare-name-input:focus { outline: none; border-color: var(--text-muted); }
.aa-compare-upload-area {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.aa-compare-hint {
  font-size: 10px;
  color: var(--text-faint);
}
.aa-compare-vs {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 13px;
  color: var(--text-faint);
  text-align: center;
  letter-spacing: 1px;
}
.aa-compare-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 24px;
}
.aa-compare-summary-header {
  display: grid;
  grid-template-columns: 160px 1fr 1fr 1fr;
  padding: 10px 18px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.aa-compare-row {
  display: grid;
  grid-template-columns: 160px 1fr 1fr 1fr;
  padding: 11px 18px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 12px;
  align-items: center;
}
.aa-compare-row:last-child { border-bottom: none; }
.aa-compare-row:hover { background: var(--accent-soft); }
.aa-compare-metric-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 11px;
  color: var(--text-muted);
}
.aa-compare-col-label { font-size: 10px; }
.aa-compare-val { font-family: 'DM Mono', monospace; }
.aa-compare-tag {
  display: inline-block;
  font-size: 9px;
  padding: 1px 5px;
  background: var(--surface3);
  border-radius: 3px;
  color: var(--text-faint);
  margin-left: 4px;
  vertical-align: middle;
}

/* ----------------------------------------------------------------
   LANGUAGE TOGGLE
---------------------------------------------------------------- */
.aa-lang-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.5px;
}
.aa-lang-opt {
  color: var(--text-faint);
  cursor: pointer;
  transition: color 0.2s;
  padding: 2px 3px;
  border-radius: 3px;
}
.aa-lang-opt:hover  { color: var(--text-muted); }
.aa-lang-opt.active { color: var(--text); }
.aa-lang-sep        { color: var(--border); font-size: 10px; }
.aa-lang-toggle-big {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 14px;
}

/* ----------------------------------------------------------------
   CURRENCY SELECTOR
---------------------------------------------------------------- */
.aa-currency-selector {
  display: flex;
  gap: 6px;
}
.aa-currency-btn {
  padding: 5px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.aa-currency-btn:hover  { border-color: var(--text-muted); color: var(--text); }
.aa-currency-btn.active {
  background: var(--surface3);
  border-color: var(--text-muted);
  color: var(--text);
}

/* ----------------------------------------------------------------
   PRESET GRID
---------------------------------------------------------------- */
.aa-preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.aa-preset-btn {
  padding: 10px 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  line-height: 1.3;
}
.aa-preset-btn:hover  { border-color: var(--text-muted); color: var(--text); background: var(--surface3); }
.aa-preset-btn.active {
  background: var(--accent-soft);
  border-color: var(--text-muted);
  color: var(--text);
}
.aa-preset-custom { grid-column: 1 / -1; }
.aa-preset-desc {
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.6;
  min-height: 18px;
  padding: 4px 0 8px;
}

/* ----------------------------------------------------------------
   COMPARE — source tabs
---------------------------------------------------------------- */
.aa-compare-source-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.aa-compare-src-btn {
  padding: 4px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.aa-compare-src-btn:hover  { color: var(--text); border-color: var(--text-muted); }
.aa-compare-src-btn.active { color: var(--text); background: var(--surface3); border-color: var(--text-muted); }
.aa-compare-history-area { margin-bottom: 8px; }
.aa-compare-history-area .aa-select { width: 100%; font-size: 11px; }

/* ----------------------------------------------------------------
   SETTINGS ROW — layout flex
---------------------------------------------------------------- */
.aa-setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ----------------------------------------------------------------
   SETTINGS — dois cards lado a lado
---------------------------------------------------------------- */
.aa-settings-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: stretch;
  margin-bottom: 0;
}
.aa-settings-two-col > div {
  display: flex;
  flex-direction: column;
}
.aa-settings-two-col > div .aa-settings-card {
  flex: 1;
  margin-bottom: 0;
}
.aa-settings-two-col .aa-section-title { margin-top: 0; }
.aa-preset-select-full {
  width: 100%;
  margin-top: 4px;
}

/* ----------------------------------------------------------------
   CURRENCY BUTTONS — fix hover isolado
---------------------------------------------------------------- */
.aa-currency-selector {
  display: flex;
  gap: 6px;
}
.aa-currency-btn {
  padding: 5px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  /* Isolamento: cada botão responde só ao próprio hover */
  isolation: isolate;
}
.aa-currency-btn:hover {
  border-color: var(--text-muted);
  color: var(--text);
  background: var(--surface3);
}
.aa-currency-btn.active {
  background: var(--surface3);
  border-color: var(--text-muted);
  color: var(--text);
}
/* Garante que o :hover NÃO cascateia para irmãos */
.aa-currency-selector:hover .aa-currency-btn:not(:hover) {
  border-color: var(--border);
  color: var(--text-muted);
  background: var(--surface2);
}
/* Preserva o active mesmo quando irmão está em hover */
.aa-currency-selector:hover .aa-currency-btn.active:not(:hover) {
  border-color: var(--text-muted);
  color: var(--text);
  background: var(--surface3);
}

/* ----------------------------------------------------------------
   COMPARE CHART
---------------------------------------------------------------- */
.aa-compare-chart-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 12px 8px;
  margin: 12px 0 24px;
  overflow: hidden;
}
.aa-compare-chart-wrap canvas {
  width: 100%;
  display: block;
}
.aa-compare-chart-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.aa-chart-metric-btn {
  padding: 4px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.aa-chart-metric-btn:hover  { color: var(--text); border-color: var(--text-muted); }
.aa-chart-metric-btn.active {
  background: var(--surface3);
  border-color: var(--text-muted);
  color: var(--text);
}
.aa-chart-legend-a {
  color: #6b9fd4;
  font-size: 11px;
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  margin-left: 8px;
}
.aa-chart-legend-b {
  color: #4caf87;
  font-size: 11px;
  font-family: 'Syne', sans-serif;
  font-weight: 600;
}

/* ----------------------------------------------------------------
   EXCHANGE RATES INFO
---------------------------------------------------------------- */
#aa-exchange-rates-info {
  min-height: 16px;
  line-height: 1.4;
}
/* ----------------------------------------------------------------
   RESPONSIVE
---------------------------------------------------------------- */
@media (max-width: 960px) {
  .aa-insights-3col { grid-template-columns: 1fr 1fr; }
  .aa-insights-3col .aa-insight-worst { grid-column: 1 / -1; }
}

@media (max-width: 768px) {
  .aa-main { padding: 16px; }
  .aa-header { padding: 14px 16px; }
  .aa-upload-grid { grid-template-columns: 1fr; }
  .aa-summary-row { grid-template-columns: repeat(2, 1fr); }
  .aa-insights-grid { grid-template-columns: 1fr; }
  .aa-insights-3col { grid-template-columns: 1fr; }
  .aa-insights-3col .aa-insight-worst { grid-column: auto; }
  .aa-claude-bar { flex-direction: column; align-items: flex-start; }
  .aa-legend { padding: 12px 16px 16px; }
  .aa-compare-uploads { grid-template-columns: 1fr; }
  .aa-compare-vs { display: none; }
  .aa-compare-summary-header,
  .aa-compare-row { grid-template-columns: 120px 1fr 1fr 1fr; font-size: 10px; }
  .aa-preset-grid { grid-template-columns: repeat(2, 1fr); }
  .aa-preset-custom { grid-column: 1 / -1; }
  .aa-currency-selector { flex-wrap: wrap; }
  .aa-setting-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .aa-settings-two-col { grid-template-columns: 1fr; }
}
