/* ============================================================================
   ClimaX Professional Dashboard — shared styles
   Used by agrometeo-dashboard, agrometeo-analytics, agrometeo-stations.
   ============================================================================ */

/* --- Última actualización banner --- */
.climax-lastupdate-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.climax-lastupdate-banner .pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--verde);
  box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7);
  animation: climax-pulse 2s infinite;
}
@keyframes climax-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(46, 204, 113, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}
.climax-lastupdate-banner strong {
  color: var(--text);
  font-weight: 600;
}
.climax-lastupdate-banner .refresh-btn {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.74rem;
}
.climax-lastupdate-banner .refresh-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* --- Chart container with professional chrome --- */
.climax-chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  position: relative;
}
.climax-chart-header {
  display: flex;
  align-items: center;
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.climax-chart-header h3 {
  font-size: 0.92rem;
  margin: 0;
  flex: 0 0 auto;
}
.climax-chart-header .chart-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: 4px;
}
.climax-chart-body {
  width: 100%;
  height: 320px;
  padding: 0;
}
.climax-chart-body.tall { height: 420px; }
.climax-chart-body.short { height: 220px; }

/* --- Flag badges --- */
.climax-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.climax-flag-warm    { background: rgba(231, 76, 60, 0.15);  color: #e74c3c; }
.climax-flag-cold    { background: rgba(52, 152, 219, 0.15); color: #3498db; }
.climax-flag-wet     { background: rgba(41, 128, 185, 0.15); color: #2980b9; }
.climax-flag-dry     { background: rgba(230, 126, 34, 0.15); color: #e67e22; }
.climax-flag-anomaly { background: rgba(155, 89, 182, 0.15); color: #9b59b6; }
.climax-flag-normal  { background: rgba(46, 204, 113, 0.10); color: #2ecc71; }
.climax-flag-unknown { background: rgba(136, 146, 164, 0.10); color: #8892a4; }

/* --- Presets toolbar --- */
.climax-presets button:hover { transform: translateY(-1px); }
.climax-presets button { transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease; }

/* --- Grid.js dark theme override --- */
.gridjs-wrapper { border: none !important; box-shadow: none !important; }
.gridjs-table { background: var(--surface) !important; }
.gridjs-th, .gridjs-td { background: var(--surface) !important; color: var(--text) !important; border-color: var(--border) !important; }
.gridjs-th-content { color: var(--text-muted) !important; font-weight: 600; }
.gridjs-tr:hover > .gridjs-td { background: rgba(74, 144, 217, 0.08) !important; }
.gridjs-pagination { color: var(--text-muted) !important; padding: 8px 12px !important; }
.gridjs-pagination .gridjs-currentPage { background: var(--accent) !important; color: #fff !important; border-radius: 6px; padding: 2px 8px !important; }
.gridjs-search-input { background: var(--surface2) !important; border: 1px solid var(--border) !important; color: var(--text) !important; padding: 6px 10px !important; border-radius: 6px !important; }

/* --- Sparkline inline in table cells --- */
.climax-sparkline {
  display: inline-block;
  vertical-align: middle;
}
.climax-sparkline path {
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Heat-cell (conditional color background) --- */
.climax-heat-cell {
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 500;
  text-align: center;
  min-width: 44px;
  display: inline-block;
}

/* ============================================================================
   Source provenance badges (climax-source-badge.js)
   Surfaces the data_source per row so customers see "live govt feed" vs
   "Open-Meteo daily" vs "ERA5 reanalysis" vs "demo" at a glance. Trust
   friction was the #1 blocker called out in the strategic doc; this is
   the single highest-leverage UI fix to close it.
   ============================================================================ */
.climax-src-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
  vertical-align: middle;
  cursor: help;          /* signals "hover for details" */
  user-select: none;
}
.climax-src-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 6px;
  display: inline-block;
}
.climax-src-verde {
  background: rgba(46, 204, 113, 0.12);
  color: var(--verde);
  border-color: rgba(46, 204, 113, 0.3);
}
.climax-src-accent {
  background: rgba(74, 144, 217, 0.12);
  color: var(--accent);
  border-color: rgba(74, 144, 217, 0.3);
}
.climax-src-indigo {
  background: rgba(120, 130, 200, 0.12);
  color: #8a93d4;
  border-color: rgba(120, 130, 200, 0.3);
}
.climax-src-amarillo {
  background: rgba(241, 196, 15, 0.12);
  color: var(--amarillo);
  border-color: rgba(241, 196, 15, 0.3);
}
.climax-src-gray {
  background: rgba(160, 170, 191, 0.10);
  color: var(--text-muted);
  border-color: rgba(160, 170, 191, 0.25);
}

/* Legend — shown in dashboard headers / data-catalog page */
.climax-src-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.78rem;
}
.climax-src-legend-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.climax-src-legend-desc {
  color: var(--text-muted);
  font-size: 0.74rem;
}
