/**
 * styles-indicadores.css — primitivas visuais compartilhadas dos dashboards
 * de indicadores (filtros, cards de seção, donut, tooltip, estado vazio).
 *
 * Os valores aqui são exatamente os mesmos que hoje vivem no <style> inline
 * de indicadores.html — este arquivo é a versão canônica, criada junto com
 * indicadores-pos-vendas.html. indicadores.html continua com a própria cópia
 * inline (intocada de propósito: migrá-la pra cá é uma etapa isolada e
 * testável, não pode vir de carona numa entrega de feature nova).
 *
 * Depende das variáveis de tema já definidas em styles-home.css
 * (--color-bg-secondary, --color-text-light, --color-text-secondary,
 * --color-text-muted), então precisa ser carregado DEPOIS dele.
 */

/* ── Filter Strip ──────────────────────────────────── */
.indic-filter-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--color-bg-secondary);
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 12px;
}
.indic-filter-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.indic-filter-field label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: rgba(148, 163, 184, .45);
}
.indic-filter-field input,
.indic-filter-field select {
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 7px;
  color: var(--color-text-light);
  font-size: 12.5px;
  padding: 5px 10px;
  min-width: 140px;
  height: 32px; /* mesma trava do select/toggle abaixo — <input type="month"> tem mínimo nativo próprio também */
  font-family: inherit;
  box-sizing: border-box;
}
.indic-filter-field select { min-width: 160px; }
.indic-filter-sep {
  width: 1px;
  height: 28px;
  background: rgba(255, 255, 255, .08);
  margin: 0 4px;
}
.indic-filter-actions { display: flex; gap: 8px; margin-left: auto; }

/* ── Multi-select "Administradora" ─────────────────── */
.indic-multiselect { position: relative; }
.indic-multiselect-toggle {
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 7px;
  color: var(--color-text-light);
  font-size: 12.5px;
  padding: 5px 10px;
  min-width: 160px;
  height: 32px; /* idêntico a .indic-filter-field select */
  box-sizing: border-box;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  text-align: left;
}
.indic-multiselect-toggle:hover { border-color: rgba(255, 255, 255, .18); }
.indic-multiselect-toggle svg {
  flex-shrink: 0;
  color: rgba(148, 163, 184, .6);
  transition: transform .15s ease;
}
.indic-multiselect.is-open .indic-multiselect-toggle svg { transform: rotate(180deg); }
.indic-multiselect-toggle span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.indic-multiselect-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: max-content;
  min-width: 220px;
  /* Nunca deixa o painel (ancorado pela direita, mais largo que o botão)
     vazar pra fora da viewport à esquerda em telas estreitas. */
  max-width: min(260px, calc(100vw - 24px));
  max-height: 280px;
  overflow-y: auto;
  /* Explícito (não só implícito via overflow-y) — sem isso, a regra da
     especificação CSS que força overflow-x a virar "auto" quando só
     overflow-y é declarado abria uma barra de rolagem horizontal. */
  overflow-x: hidden;
  box-sizing: border-box;
  background: var(--color-bg-secondary);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .4);
  padding: 6px;
  z-index: 30;
}
.indic-multiselect-panel[hidden] { display: none; }
.indic-multiselect-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, .85);
  cursor: pointer;
}
.indic-multiselect-option:hover { background: rgba(255, 255, 255, .06); }
.indic-multiselect-option input[type="checkbox"] {
  accent-color: #00d4ff;
  cursor: pointer;
  flex-shrink: 0; /* só o texto deve encolher, nunca o checkbox */
  width: 14px;
  height: 14px;
}
.indic-multiselect-option span {
  flex: 1 1 auto;
  min-width: 0; /* permite o texto encolher abaixo do conteúdo intrínseco */
  overflow-wrap: break-word;
}
.indic-multiselect-option--all { font-weight: 700; }
.indic-multiselect-sep {
  height: 1px;
  background: rgba(255, 255, 255, .08);
  margin: 4px 2px;
}

/* ── Escopo / botões ───────────────────────────────── */
.indic-scope-tag {
  display: none;
  align-items: center;
  padding: 3px 10px;
  background: rgba(0, 212, 255, .08);
  border: 1px solid rgba(0, 212, 255, .2);
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  color: rgba(0, 212, 255, .8);
  white-space: nowrap;
}
.indic-btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  padding: 5px 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .18s, border-color .18s;
}
.indic-btn--ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, .1);
  color: var(--color-text-secondary);
}
.indic-btn--ghost:hover { background: rgba(255, 255, 255, .05); }
.indic-btn--primary {
  background: rgba(0, 212, 255, .12);
  border-color: rgba(0, 212, 255, .3);
  color: #00d4ff;
}
.indic-btn--primary:hover { background: rgba(0, 212, 255, .2); }

/* ── Header meta ───────────────────────────────────── */
.indic-head-meta { display: flex; align-items: center; gap: 8px; }
.indic-last-update { font-size: 11px; color: rgba(148, 163, 184, .4); }

/* ── Seção genérica (card interno) ────────────────── */
.indic-section { padding: 20px 22px; margin-bottom: 12px; }
.indic-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.indic-section-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.indic-section-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--color-text-secondary);
}
.indic-section-desc { font-size: 11px; color: var(--color-text-muted); }
.indic-badge-datasource {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: rgba(248, 196, 80, .6);
  background: rgba(248, 196, 80, .07);
  border: 1px solid rgba(248, 196, 80, .18);
  border-radius: 20px;
  padding: 2px 8px;
  flex-shrink: 0;
  white-space: nowrap;
}
/* Variante de aviso do badge acima — mesmo formato, só o texto muda por
   fora (ver renderTicketMedioConsultora() em script-indicadores-pos-vendas.js).
   Cor levemente mais quente que o badge neutro, sem virar um vermelho de
   erro: é uma informação, não uma falha. */
.indic-badge-datasource--aviso {
  color: rgba(255, 165, 2, .85);
  background: rgba(255, 165, 2, .1);
  border-color: rgba(255, 165, 2, .25);
}

/* ── Ticket Médio (barras horizontais) ─────────────── */
/* Portado literalmente de indicadores.html (.indic-ticket-*), que ainda
   mantém a própria cópia inline — migrá-la pra cá é uma etapa isolada,
   não feita agora pra não mexer numa página em produção sem necessidade. */
.indic-ticket-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 13px;
}
.indic-ticket-row:last-child { margin-bottom: 0; }
.indic-ticket-name {
  width: 80px;
  font-size: 12px;
  color: var(--color-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}
.indic-ticket-bar-track {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, .05);
  border-radius: 99px;
  overflow: hidden;
}
.indic-ticket-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #6366f1, #a78bfa);
  width: 0%;
  transition: width .9s cubic-bezier(.22, 1, .36, 1);
}
.indic-ticket-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-light);
  white-space: nowrap;
  min-width: 105px;
  text-align: right;
  flex-shrink: 0;
}

/* ── Estado vazio ──────────────────────────────────── */
.indic-empty {
  font-size: 11.5px;
  color: var(--color-text-muted);
  font-style: italic;
  padding: 16px 0;
  text-align: center;
}

/* ── Donut ─────────────────────────────────────────── */
.indic-donut-wrap {
  display: flex;
  gap: 20px;
  align-items: center;
}
.indic-donut-svg { flex-shrink: 0; }
.indic-donut-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  max-height: 180px;
  overflow-y: auto;
}
.indic-donut-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.indic-donut-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.indic-donut-name {
  font-size: 11.5px;
  color: var(--color-text-secondary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.indic-donut-count {
  font-size: 10.5px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}
.indic-donut-pct {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--color-text-light);
  flex-shrink: 0;
  min-width: 38px;
  text-align: right;
}

/* Telas estreitas: donut e legenda empilhados. Lado a lado, a legenda
   sobra com ~120px e nomes longos (ex.: "OK - RETORNOU PARA O VENDEDOR")
   viram reticências — empilhado ela recebe a largura inteira do card. */
@media (max-width: 560px) {
  .indic-donut-wrap {
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }
  .indic-donut-legend {
    width: 100%;
    flex: none;
    max-height: none;
  }
}

/* ── Tooltip Premium ──────────────────────────────── */
.indic-tooltip {
  position: fixed;
  z-index: 9999;
  background: rgba(5, 12, 30, .97);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 12px;
  padding: 12px 15px;
  font-family: 'Inter', system-ui, sans-serif;
  pointer-events: none;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .65), 0 0 0 1px rgba(0, 212, 255, .06);
  transition: opacity .12s ease;
  min-width: 178px;
  max-width: 254px;
}
.indic-tip-title {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, .95);
  margin-bottom: 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.indic-tip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 3.5px 0;
}
.indic-tip-label {
  font-size: 11px;
  color: rgba(148, 163, 184, .6);
  white-space: nowrap;
}
.indic-tip-val {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, .9);
  text-align: right;
}
.indic-tip-sep {
  height: 1px;
  background: rgba(255, 255, 255, .06);
  margin: 5px 0;
}
