/* === explorer (#12) === */
/* Arquivo próprio da feature (incluído pelo stylesheet_link_tag :app) para
   minimizar conflito de merge com a #11 — não mover para application.css. */

.explorer-builder {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.explorer-series-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.explorer-series-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--sig-surface);
  border: 1px solid var(--sig-border);
  border-radius: var(--sig-radius-control);
  transition: border-color 0.15s ease;
}

.explorer-series-row:hover {
  border-color: var(--sig-accent-strong);
}

.explorer-series-row .sig-field {
  flex: 1 1 160px;
}

.explorer-series-row .explorer-field--sensor {
  flex: 2 1 240px;
}

.explorer-controls {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid var(--sig-border);
}

.explorer-controls > .sig-field {
  flex: 0 1 auto;
  min-width: 180px;
}

.explorer-controls > .sig-button,
.explorer-controls > input[type="submit"] {
  height: 38px;
  padding: 0 20px;
  font-weight: 700;
  white-space: nowrap;
}

/* Inline hint within the label — no extra vertical space */
.explorer-hint-inline {
  font-size: 11px;
  font-weight: 500;
  color: var(--sig-text-faint);
  font-style: italic;
}

/* Section divider between séries and fórmulas */
.explorer-section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0;
}

.explorer-section-divider::before,
.explorer-section-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--sig-border);
}

.explorer-section-divider > span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--sig-text-muted);
  white-space: nowrap;
}

/* Formula rows — same card style as series rows */
.explorer-formula-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  background: var(--sig-surface);
  border: 1px solid var(--sig-border);
  border-radius: var(--sig-radius-control);
  transition: border-color 0.15s ease;
}

.explorer-formula-row:hover {
  border-color: var(--sig-accent-strong);
}

.explorer-formula-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.explorer-errors ul {
  margin: 0;
  padding-left: 18px;
  color: var(--sig-danger, #b3261e);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.explorer-empty {
  padding: 32px 0;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--sig-text-faint);
}

.explorer-chart {
  width: 100%;
  height: 380px;
}

.explorer-stats {
  display: grid;
  /* nº de colunas = séries plotadas (a view seta --explorer-stat-cols). */
  grid-template-columns: repeat(var(--explorer-stat-cols, 4), minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.explorer-grid-bottom {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

/* Buckets table */
.explorer-buckets-table {
  font-size: 13px;
}

.explorer-table-cap-notice {
  font-size: 12px;
  font-weight: 500;
  color: var(--sig-text-muted);
  margin: 0 0 10px;
  font-style: italic;
}

.explorer-table-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 14px 0 4px;
  border-top: 1px solid var(--sig-border);
  margin-top: 12px;
}

.explorer-table-page-info {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--sig-text-muted);
  min-width: 120px;
  text-align: center;
}

.explorer-stat-card {
  background: var(--sig-card);
  border: 1px solid var(--sig-border);
  border-radius: var(--sig-radius-card);
  padding: 14px 16px;
  box-shadow: var(--sig-shadow-card);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.explorer-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sig-shadow-raised);
}

.explorer-stat-title {
  margin: 0 0 10px;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--sig-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.explorer-stat-unit {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--sig-surface);
  border: 1px solid var(--sig-border);
  color: var(--sig-text-muted);
}

.explorer-stat-grid {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 12.5px;
}

.explorer-stat-grid dt {
  font-weight: 600;
  color: var(--sig-text-muted);
}

.explorer-stat-grid dd {
  margin: 0;
  color: var(--sig-text);
  font-variant-numeric: tabular-nums;
}

/* Histórico de exportações (EXPL-11): botões de export, link do histórico e
   badges de estado sobre o .sig-badge base. */
.explorer-export-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.explorer-history-link {
  margin: 10px 2px;
  font-size: 12px;
}

.explorer-history-link a {
  font-weight: 700;
  color: var(--sig-accent-strong);
  text-decoration: none;
}

.explorer-history-link a:hover {
  text-decoration: underline;
}

/* Consultas salvas (EXPL-14/15): salvar em linha e itens como linhas de lista
   (nome à esquerda, excluir à direita) — classes eram fantasmas. */
.explorer-save-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 10px 0 14px;
}

.explorer-save-form input[name="name"] {
  flex: 1 1 220px;
  max-width: 340px;
}

.explorer-export-error {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--sig-alarm);
}

.explorer-export-badge--done {
  background: var(--sig-accent);
  color: var(--sig-card);
}

.explorer-export-badge--failed {
  background: var(--sig-alarm);
  color: var(--sig-card);
}

/* Anotacoes na janela (EXPL-20/21) */
.explorer-annotation-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.explorer-annotation-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  padding: 12px 14px;
  background: var(--sig-surface);
  border: 1px solid var(--sig-border);
  border-radius: var(--sig-radius-control);
  transition: border-color 0.15s ease;
}

.explorer-annotation-item:hover {
  border-color: var(--sig-accent-strong);
}

.explorer-annotation-sensor {
  font-weight: 700;
  color: var(--sig-text);
}

.explorer-annotation-window {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--sig-text-muted);
}

.explorer-annotation-body {
  flex-basis: 100%;
  font-size: 13px;
  color: var(--sig-text);
}

.explorer-annotation-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--sig-border);
}

.explorer-annotation-form .sig-field {
  flex: 1 1 140px;
  min-width: 0;
}

/* Saved query items */
.explorer-saved-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--sig-surface);
  border: 1px solid var(--sig-border);
  border-radius: var(--sig-radius-control);
  transition: border-color 0.15s ease;
}

.explorer-saved-item:hover {
  border-color: var(--sig-accent-strong);
}

.explorer-saved-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Metric items */
.explorer-metric-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.explorer-metric-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 10px 14px;
  background: var(--sig-surface);
  border: 1px solid var(--sig-border);
  border-radius: var(--sig-radius-control);
  transition: border-color 0.15s ease;
}

.explorer-metric-item:hover {
  border-color: var(--sig-accent-strong);
}

.explorer-metric-name {
  font-weight: 700;
  font-size: 13px;
}

.explorer-metric-aliases {
  font-size: 11.5px;
  color: var(--sig-text-muted);
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--sig-card);
  border: 1px solid var(--sig-border);
}

/* Filtro integrado de sensores */
.explorer-filter-input {
  border-radius: var(--sig-radius-control);
  background: var(--sig-surface);
  border: 1px solid var(--sig-border);
  transition: border-color 0.15s ease;
}

.explorer-filter-input:focus {
  border-color: var(--sig-accent-strong);
  background: var(--sig-card);
}
