/* =========================================================
   PIVOT - tabella esplorativa + export Excel button
   ========================================================= */

.pivot-section {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 16px 20px;
  margin-top: 16px;
}

.pivot-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.pivot-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent-dark);
}

.pivot-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.pivot-controls {
  display: flex;
  gap: 16px;
  align-items: flex-end;   /* tutti allineati in basso */
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.pivot-dimensions {
  flex: 1;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  position: relative;      /* riferimento per l'hint assoluto */
}

.pivot-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* Hint "max 4": fuori dal flusso, sotto al dropdown. Cosi' NON aggiunge
   altezza alla colonna (che resta = label + dropdown) e non sfasa
   l'allineamento a fondo dei bottoni. */
.pivot-hint {
  position: absolute;
  top: 100%;
  left: 2px;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-light);
}

/* Bottone export */
.pivot-export-btn {
  background: var(--accent-primary);
  color: var(--on-accent);
  border: none;
  border-radius: 6px;
  padding: 0 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.pivot-export-btn:hover {
  background: var(--accent-dark);
}
.pivot-export-btn:active {
  background: var(--accent-darker);
}

/* Stato loading del bottone export */
.pivot-export-btn.is-loading {
  background: var(--accent-dark);
  cursor: wait;
  position: relative;
  padding-right: 42px;
  pointer-events: none;
}
.pivot-export-btn.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 16px;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: var(--on-accent);
  border-radius: 50%;
  animation: cai-spin 0.8s linear infinite;
}

/* Bottone "Aggiorna tabella" — azione secondaria (outline verde). */
.pivot-refresh-btn {
  background: var(--bg-card);
  color: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  border-radius: 6px;
  padding: 0 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  font-family: inherit;     /* toglie il font "di sistema" del bottone grezzo */
}
.pivot-refresh-btn:hover {
  background: var(--accent-bg-light);
}
.pivot-refresh-btn:active {
  background: var(--accent-primary);
  color: var(--on-accent);
}

/* =========================================================
   ALLINEAMENTO BARRA CONTROLLI
   Dropdown e bottoni alla STESSA altezza (42px): con align-items:flex-end
   della .pivot-controls combaciano sopra e sotto. L'altezza del trigger del
   dropdown Dash (Radix UI) va forzata con !important, come gia' fai nella
   sidebar su button[role="combobox"].
   ========================================================= */
.pivot-refresh-btn,
.pivot-export-btn {
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pivot-dimensions button[role="combobox"],
.pivot-dimensions .Select-control,
.pivot-dimensions [class*="control"] {
  min-height: 42px !important;
  height: 42px !important;
}