/**
 * Compare Page Styles
 * Confronto multi-modello
 */

/* Multi-model tooltip (floating su desktop, sticky-bottom su mobile) */
.compare-tooltip {
  /* position:fixed (viewport-relative) per evitare i bug di mismatch coordinate
     page-vs-viewport che facevano andare il tooltip fuori dalla finestra su mobile */
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: var(--card-bg, #fff);
  color: var(--text-primary, #333);
  border: 1px solid var(--border-color, #ddd);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.5;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 160px;
  max-width: min(360px, calc(100vw - 16px));
  transition: opacity 0.15s;
}
[data-theme="dark"] .compare-tooltip {
  background: #2a2a2a;
  color: #e0e0e0;
  border-color: #444;
}
.compare-tooltip__title {
  font-weight: 600;
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-color, #eee);
  font-size: 11px;
  opacity: 0.7;
}
[data-theme="dark"] .compare-tooltip__title {
  border-bottom-color: #444;
}
.compare-tooltip__rows {
  display: flex;
  flex-direction: column;
}
.compare-tooltip__row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 1px 0;
}
.compare-tooltip__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.compare-tooltip__label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.compare-tooltip__val {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Bottom-sheet variant — applicata da JS su mobile (pointer:coarse).
   Pattern industria (TradingView/Strava/Apple Health/Yr.no): pannello pinned
   sopra il bottom-nav, layout flex-wrap orizzontale, mai più fuori viewport. */
.compare-tooltip--bottom {
  left: 6px !important;
  right: 6px !important;
  top: auto !important;
  bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  max-width: none;
  min-width: 0;
  border-radius: 14px;
  padding: 10px 14px 12px;
  box-shadow: 0 -2px 16px rgba(0,0,0,0.22);
  animation: compare-tooltip-slide 0.18s cubic-bezier(.2,.7,.2,1);
}
[data-theme="dark"] .compare-tooltip--bottom {
  box-shadow: 0 -2px 16px rgba(0,0,0,0.5);
}
@keyframes compare-tooltip-slide {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.compare-tooltip--bottom .compare-tooltip__title {
  border-bottom: none;
  font-size: 12px;
  opacity: 0.85;
  margin-bottom: 6px;
  padding-bottom: 0;
}
.compare-tooltip--bottom .compare-tooltip__rows {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0 -2px;
}
.compare-tooltip--bottom .compare-tooltip__row {
  flex: 0 1 auto;
  padding: 0;
  font-size: 12px;
  min-width: 0;
}
.compare-tooltip--bottom .compare-tooltip__label {
  flex: 0 1 auto;
  max-width: 110px;
  margin-right: 2px;
}
.compare-tooltip--bottom .compare-tooltip__divider {
  margin: 6px -6px 4px;
}
.compare-tooltip--bottom .compare-tooltip__anomaly {
  font-size: 11.5px;
  padding-top: 2px;
}

/* Hero card compact variant */
.hero-card--compare {
  padding-bottom: var(--spacing-sm);
  position: relative;
}
.hero-card--compare .hero-card__header {
  margin-bottom: var(--spacing-xs);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

/* Kebab menu (azioni: CSV/PNG/Share/Reset) */
.kebab-menu {
  position: relative;
  flex-shrink: 0;
}

.kebab-menu__btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  padding: 0;
}

.kebab-menu__btn:hover {
  background: var(--bg-secondary, #f5f5f5);
}

.kebab-menu__btn[aria-expanded="true"] {
  background: var(--bg-secondary, #f5f5f5);
  color: var(--primary, #1a73e8);
}

.kebab-menu__dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  min-width: 200px;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  z-index: 100;
  overflow: hidden;
  padding: 4px 0;
}

[data-theme="dark"] .kebab-menu__dropdown {
  background: #2a2a2a;
  border-color: #444;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}

.kebab-menu__dropdown[hidden] {
  display: none;
}

.kebab-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 14px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-primary, #333);
  font-family: inherit;
  min-height: 40px;
}

[data-theme="dark"] .kebab-menu__item {
  color: #e0e0e0;
}

.kebab-menu__item:hover {
  background: var(--bg-secondary, #f5f5f5);
}

[data-theme="dark"] .kebab-menu__item:hover {
  background: rgba(255,255,255,0.06);
}

.kebab-menu__icon {
  display: inline-block;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  font-size: 0.95rem;
}

.kebab-menu__item--danger {
  color: #c5392a;
}
[data-theme="dark"] .kebab-menu__item--danger {
  color: #ff7c6e;
}

.kebab-menu__sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* Toast (clipboard, errori export) */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,0.88);
  color: #fff;
  padding: 10px 18px;
  border-radius: 24px;
  font-size: 0.88rem;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  max-width: calc(100vw - 32px);
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast--error {
  background: rgba(197, 57, 42, 0.95);
}

/* Reset zoom bar */
.reset-zoom-bar {
  display: flex;
  justify-content: center;
  padding: 4px var(--spacing-md) 10px;
  max-width: 700px;
  margin: 0 auto;
}

.reset-zoom-btn {
  padding: 6px 14px;
  border-radius: 18px;
  border: 1.5px solid var(--primary, #1a73e8);
  background: var(--bg-primary);
  color: var(--primary, #1a73e8);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.reset-zoom-btn:hover {
  background: var(--primary, #1a73e8);
  color: #fff;
}

/* Model status chips */
.model-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 var(--spacing-md);
  margin-bottom: var(--spacing-md);
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.model-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  min-height: 32px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1.5px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-secondary);
}

/* Chip cliccabile (modelli disponibili) */
.model-chip--clickable {
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, opacity 0.15s, border-color 0.15s, transform 0.05s;
}

.model-chip--clickable:hover {
  background: var(--bg-secondary, #f5f5f5);
}

.model-chip--clickable:active {
  transform: scale(0.97);
}

/* Stato OFF (utente ha disattivato il modello) */
.model-chip--off {
  opacity: 0.42;
  background: var(--bg-secondary, #f5f5f5);
}

.model-chip--off .model-chip__dot {
  background: var(--text-hint) !important;
  position: relative;
}

.model-chip--off .model-chip__dot::after {
  content: '';
  position: absolute;
  inset: -3px -1px;
  border-top: 1.5px solid var(--text-hint);
  transform: rotate(-45deg);
  transform-origin: center;
  pointer-events: none;
}

[data-theme="dark"] .model-chip--off {
  background: rgba(255,255,255,0.04);
}

.model-chip__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.model-chip--ok .model-chip__dot {
  background: #34a853;
}

/* Quando il chip è cliccabile, il dot prende il colore del modello (override inline) */
.model-chip--ok.model-chip--clickable .model-chip__dot {
  background: var(--chip-color, #34a853);
}

.model-chip--unavailable {
  opacity: 0.45;
}

.model-chip--unavailable .model-chip__dot {
  background: var(--text-hint);
}

.model-chip--loading .model-chip__dot {
  background: var(--text-hint);
  animation: chip-pulse 1s infinite;
}

@keyframes chip-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Detail level toggle (Sintesi / Avanzato) — riusa pattern compare-toggle */
.detail-toggle {
  display: flex;
  justify-content: center;
  gap: 0;
  padding: 0 var(--spacing-md);
  margin-bottom: 8px;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.detail-toggle__btn {
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.detail-toggle__btn:first-child {
  border-radius: 20px 0 0 20px;
  border-right: none;
}

.detail-toggle__btn:last-child {
  border-radius: 0 20px 20px 0;
}

.detail-toggle__btn--active {
  background: var(--primary, #1a73e8);
  color: #fff;
  border-color: var(--primary, #1a73e8);
}

.detail-toggle__btn:not(.detail-toggle__btn--active):hover {
  background: var(--bg-secondary, #f5f5f5);
}

/* Banner one-time "nuova vista Sintesi" */
.detail-hint {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-hint);
  padding: 4px var(--spacing-md) 8px;
  max-width: 700px;
  margin: 0 auto;
}

.detail-hint__close {
  background: none;
  border: none;
  color: var(--text-hint);
  cursor: pointer;
  font-size: 1rem;
  padding: 0 4px;
  margin-left: 6px;
  line-height: 1;
}

/* Info icon accanto al titolo dei chart complessi */
.section-card__title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
}

.section-card__title-row .section-card__title {
  margin: 0;
}

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: serif;
  font-style: italic;
  line-height: 1;
  padding: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.info-icon:hover {
  background: var(--bg-secondary, #f5f5f5);
  border-color: var(--primary, #1a73e8);
  color: var(--primary, #1a73e8);
}

/* Info modal (HTML dialog nativo) */
.info-modal {
  border: none;
  border-radius: 12px;
  padding: 0;
  max-width: 560px;
  width: calc(100% - 32px);
  max-height: 80vh;
  background: var(--card-bg, #fff);
  color: var(--text-primary, #333);
  box-shadow: 0 10px 32px rgba(0,0,0,0.2);
  /* Forza centramento — alcuni browser mobile non rispettano la UA stylesheet
     di <dialog>:modal e ancorano top-left */
  inset: 0;
  margin: auto;
}

[data-theme="dark"] .info-modal {
  background: #2a2a2a;
  color: #e0e0e0;
}

.info-modal::backdrop {
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(2px);
}

.info-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.info-modal__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.info-modal__close {
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: 6px;
}

.info-modal__close:hover {
  background: var(--bg-secondary, #f5f5f5);
}

.info-modal__body {
  padding: 16px 20px 20px;
  font-size: 0.92rem;
  line-height: 1.55;
  overflow-y: auto;
  max-height: calc(80vh - 60px);
}

.info-modal__body h4 {
  margin: 18px 0 6px;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.info-modal__body h4:first-child {
  margin-top: 0;
}

.info-modal__body p {
  margin: 0 0 8px;
  color: var(--text-secondary);
}

.info-modal__legend {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.82rem;
  margin-right: 4px;
  font-weight: 500;
}

.info-modal__legend--climate {
  background: rgba(180, 83, 9, 0.14);
  color: #b45309;
  border: 1px solid rgba(180, 83, 9, 0.45);
}

[data-theme="dark"] .info-modal__legend--climate {
  background: rgba(251, 191, 36, 0.16);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.55);
}

.info-modal__legend--blend {
  background: #22222220;
  color: #222;
  border: 1px solid #555;
}

[data-theme="dark"] .info-modal__legend--blend {
  background: #f5f5f520;
  color: #f5f5f5;
  border-color: #ddd;
}

/* Banner anomalia stagionale (sopra chart Temperatura) */
.anomaly-banner {
  display: none;
  text-align: center;
  font-size: 0.85rem;
  padding: 8px 12px;
  margin: 0 0 10px;
  border-radius: 8px;
  font-weight: 500;
  line-height: 1.35;
}

.anomaly-banner--show {
  display: block;
}

.anomaly-banner__icon {
  margin-right: 6px;
}

.anomaly-banner--warm {
  background: rgba(234, 67, 53, 0.12);
  color: #c5392a;
  border: 1px solid rgba(234, 67, 53, 0.35);
}

.anomaly-banner--cold {
  background: rgba(26, 115, 232, 0.12);
  color: #1559b8;
  border: 1px solid rgba(26, 115, 232, 0.35);
}

.anomaly-banner--norm {
  background: rgba(52, 168, 83, 0.10);
  color: #2a8a44;
  border: 1px solid rgba(52, 168, 83, 0.30);
  font-weight: 500;
}

[data-theme="dark"] .anomaly-banner--warm {
  background: rgba(234, 67, 53, 0.18);
  color: #ff7c6e;
}

[data-theme="dark"] .anomaly-banner--cold {
  background: rgba(100, 165, 255, 0.18);
  color: #84b8ff;
}

[data-theme="dark"] .anomaly-banner--norm {
  background: rgba(100, 200, 130, 0.15);
  color: #7ed498;
}

/* Tooltip: righe extra anomalia climatica */
.compare-tooltip__divider {
  margin: 5px -4px 4px;
  border-top: 1px dashed var(--border-color, #ddd);
}

[data-theme="dark"] .compare-tooltip__divider {
  border-top-color: #444;
}

.compare-tooltip__anomaly {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 1px 0;
  font-size: 11px;
}

.compare-tooltip__anomaly-label {
  flex: 1;
  opacity: 0.75;
}

.compare-tooltip__anomaly-val {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.compare-tooltip__anomaly-val--warm { color: #ea4335; }
.compare-tooltip__anomaly-val--cold { color: #1a73e8; }
.compare-tooltip__anomaly-val--norm { color: var(--text-secondary); }

/* Compare mode toggle */
.compare-toggle {
  display: flex;
  justify-content: center;
  gap: 0;
  padding: 0 var(--spacing-md);
  margin-bottom: 8px;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.compare-toggle__btn {
  padding: 6px 16px;
  font-size: 0.82rem;
  font-weight: 500;
  border: 1.5px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.compare-toggle__btn:first-child {
  border-radius: 20px 0 0 20px;
  border-right: none;
}

.compare-toggle__btn:last-child {
  border-radius: 0 20px 20px 0;
}

.compare-toggle__btn--active {
  background: var(--primary, #1a73e8);
  color: #fff;
  border-color: var(--primary, #1a73e8);
}

.compare-toggle__btn:not(.compare-toggle__btn--active):hover {
  background: var(--bg-secondary, #f5f5f5);
}

.compare-run-info {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-hint);
  padding: 0 var(--spacing-md);
  margin-bottom: var(--spacing-md);
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  min-height: 1.2em;
}

/* Model chip run label */
.model-chip__run {
  font-size: 0.7rem;
  opacity: 0.7;
  margin-left: 2px;
}

/* View mode tabs (Deterministico / Bande / Spaghetti) */
.view-tabs {
  display: flex;
  justify-content: center;
  gap: 0;
  padding: 0 var(--spacing-md);
  margin-bottom: 8px;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.view-tab__btn {
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.view-tab__btn:first-child {
  border-radius: 20px 0 0 20px;
  border-right: none;
}

.view-tab__btn:last-child {
  border-radius: 0 20px 20px 0;
}

.view-tab__btn:not(:first-child):not(:last-child) {
  border-right: none;
}

.view-tab__btn--active {
  background: var(--primary, #1a73e8);
  color: #fff;
  border-color: var(--primary, #1a73e8);
}

.view-tab__btn:not(.view-tab__btn--active):hover {
  background: var(--bg-secondary, #f5f5f5);
}

/* Ensemble model selector (shown for bands/spaghetti) */
.ens-model-selector {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 var(--spacing-md);
  margin-bottom: 10px;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.ens-model-btn {
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 500;
  border-radius: 16px;
  border: 1.5px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.ens-model-btn--active {
  background: var(--primary, #1a73e8);
  color: #fff;
  border-color: var(--primary, #1a73e8);
}

.ens-model-btn:not(.ens-model-btn--active):hover {
  background: var(--bg-secondary, #f5f5f5);
}

/* Chart containers */
.chart-container {
  position: relative;
  height: 320px;
  margin-bottom: 8px;
  overflow: hidden;
}

/* WC-3: Mini-map range navigator (pattern Highcharts stock chart / ECharts
   dataZoom). Strisia 56px sotto il chart Temperatura con la serie Blend
   compressa + finestra draggable per zoom/pan globale. */
.chart-navigator {
  position: relative;
  height: 56px;
  margin: 4px 0 12px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-secondary, #f5f5f5);
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;  /* gestures gestite manualmente lato JS */
  display: none;        /* nasconde finché il chart non è renderizzato */
}
[data-theme="dark"] .chart-navigator {
  background: rgba(255,255,255,0.04);
}
.chart-navigator--ready {
  display: block;
}
.chart-navigator > canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}
.chart-navigator__shade {
  position: absolute;
  top: 0; bottom: 0;
  background: rgba(0,0,0,0.18);
  pointer-events: none;
  transition: left 0.08s, right 0.08s, width 0.08s;
}
[data-theme="dark"] .chart-navigator__shade {
  background: rgba(0,0,0,0.45);
}
.chart-navigator__shade--left { left: 0; width: 0; }
.chart-navigator__shade--right { right: 0; width: 0; }
.chart-navigator__window {
  position: absolute;
  top: 0; bottom: 0;
  background: transparent;
  border: 1.5px solid var(--primary, #1a73e8);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25);
  cursor: grab;
  transition: left 0.08s, width 0.08s;
}
.chart-navigator__window:active { cursor: grabbing; }
.chart-navigator__handle {
  position: absolute;
  top: -1px; bottom: -1px;
  width: 10px;
  background: var(--primary, #1a73e8);
  cursor: ew-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}
.chart-navigator__handle::after {
  content: '';
  width: 1px;
  height: 50%;
  background: rgba(255,255,255,0.85);
}
.chart-navigator__handle--start { left: -5px; border-radius: 4px 0 0 4px; }
.chart-navigator__handle--end   { right: -5px; border-radius: 0 4px 4px 0; }
/* Tap target invisibile per dita su mobile (12 → 24px hit area) */
.chart-navigator__handle::before {
  content: '';
  position: absolute;
  top: -8px; bottom: -8px;
  left: -8px; right: -8px;
}

/* Bottone "fit-to-content" floating overlay sul chart (pattern TradingView/
   Mapbox/Apple Maps). Visibile solo quando il body ha la classe `.compare-zoomed`
   (settata da _toggleResetZoomBar quando almeno un chart è in stato zoomed). */
.chart-zoom-reset {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.94);
  color: var(--primary, #1a73e8);
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s, background 0.15s, box-shadow 0.15s;
  animation: chart-zoom-reset-pop 0.18s cubic-bezier(.2,.7,.2,1);
}
.chart-zoom-reset:hover {
  transform: scale(1.08);
  background: #fff;
  box-shadow: 0 3px 12px rgba(0,0,0,0.25);
}
.chart-zoom-reset:active {
  transform: scale(0.95);
}
.chart-zoom-reset > svg {
  display: block;
}

[data-theme="dark"] .chart-zoom-reset {
  background: rgba(40,40,40,0.92);
  color: #84b8ff;
}
[data-theme="dark"] .chart-zoom-reset:hover {
  background: #2a2a2a;
}

body.compare-zoomed .chart-zoom-reset {
  display: inline-flex;
}

@keyframes chart-zoom-reset-pop {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.chart-container > canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  /* Hammer.js (dipendenza di chartjs-plugin-zoom v2 per pinch mobile) imposta
     `touch-action: none` programmaticamente sul canvas, che blocca anche lo
     scroll verticale della pagina. Override con `pan-y !important`: il
     browser gestisce solo lo scroll Y, lascia pinch/pan-X al plugin. */
  touch-action: pan-y !important;
}

.chart-container--small {
  height: 200px;
}

/* Concordance badge */
.concordance {
  text-align: center;
  font-size: 0.82rem;
  margin: -4px 0 8px;
}

.concordance__badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 500;
}

.concordance__badge--high {
  background: rgba(52, 168, 83, 0.15);
  color: #34a853;
}

.concordance__badge--medium {
  background: rgba(251, 188, 4, 0.15);
  color: #f9a825;
}

.concordance__badge--low {
  background: rgba(234, 67, 53, 0.15);
  color: #ea4335;
}

/* Daily comparison table */
.daily-compare-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.daily-compare {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.daily-compare th {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 2px solid var(--border);
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
}

.daily-compare td {
  padding: 6px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.daily-compare td.unavailable {
  color: var(--text-hint);
}

/* Colored model header dot in table */
.daily-compare .th-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

.daily-compare td svg { vertical-align: middle; margin: -2px 1px 0; }

/* Back link */
.compare-back {
  text-align: center;
  padding: var(--spacing-md) 0;
  max-width: 700px;
  margin: 0 auto;
}

.compare-back a {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.9rem;
}

.compare-back a:hover {
  text-decoration: underline;
}
