/* ═══ Visual/Gauge Template Styles ═══ */
/* Mobile-first design for calculators with gauges, color-coded categories */

/* ─── Enhanced Result Card ─── */
.visual-active .result {
  padding: 1.5rem;
  border-radius: 1rem;
  text-align: center;
  position: relative;
  overflow: visible;
}

/* ─── Gauge Container ─── */
.gauge-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1rem auto 0.5rem;
  max-width: 280px;
}

.gauge-svg {
  width: 100%;
  max-width: 240px;
  height: auto;
  overflow: visible;
}

/* Gauge arc segments */
.gauge-arc {
  fill: none;
  stroke-width: 18;
  stroke-linecap: butt;
}

/* Needle */
.gauge-needle {
  fill: var(--text, #1e293b);
  transform-origin: 120px 120px;
  transition: transform 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="dark"] .gauge-needle {
  fill: #f1f5f9;
}

.gauge-needle-dot {
  fill: var(--text, #1e293b);
}

[data-theme="dark"] .gauge-needle-dot {
  fill: #f1f5f9;
}

/* Gauge labels */
.gauge-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  margin-top: 0.25rem;
  font-variant-numeric: tabular-nums;
}

.gauge-label {
  font-size: 1rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 2rem;
  display: inline-block;
  margin-top: 0.35rem;
  color: #fff;
  letter-spacing: 0.01em;
}

.gauge-min-max {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 220px;
  font-size: 0.75rem;
  color: var(--gray-500, #6b7280);
  margin-top: -0.25rem;
}

/* ─── Category Breakdown ─── */
.visual-breakdown {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin-top: 1rem;
  text-align: left;
}

.visual-breakdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  background: var(--card-bg, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  font-size: 0.85rem;
  transition: background 0.2s, border-color 0.2s;
}

[data-theme="dark"] .visual-breakdown-item {
  background: var(--card-bg, #1e293b);
  border-color: var(--border, #334155);
}

.visual-breakdown-item.active {
  border-color: var(--accent-color, #2563eb);
  background: var(--accent-bg, rgba(37, 99, 235, 0.08));
  font-weight: 600;
}

.breakdown-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.breakdown-label {
  flex: 1;
}

.breakdown-range {
  color: var(--gray-500, #6b7280);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

/* ─── Progress Bar ─── */
.visual-progress {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--border, #e2e8f0);
  margin-top: 0.75rem;
  overflow: hidden;
  position: relative;
}

.visual-progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.3s;
  min-width: 4px;
}

/* ─── Simple Color Result (no gauge_ranges) ─── */
.visual-result-accent {
  border-left: 4px solid var(--accent-color, #22c55e);
  padding-left: 1rem;
  margin-top: 0.75rem;
  text-align: left;
}

.visual-result-accent.result-good {
  --accent-color: #22c55e;
}

.visual-result-accent.result-warning {
  --accent-color: #eab308;
}

.visual-result-accent.result-bad {
  --accent-color: #ef4444;
}

.visual-result-accent.result-info {
  --accent-color: #3b82f6;
}

/* ─── Responsive ─── */
@media (min-width: 640px) {
  .gauge-container {
    max-width: 320px;
  }

  .gauge-svg {
    max-width: 280px;
  }

  .visual-breakdown {
    grid-template-columns: repeat(2, 1fr);
  }

  .gauge-value {
    font-size: 2.25rem;
  }
}

/* ─── Animations ─── */
@keyframes gauge-appear {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.gauge-container {
  animation: gauge-appear 0.4s ease-out;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .gauge-needle {
    transition: none;
  }
  .visual-progress-fill {
    transition: none;
  }
  .gauge-container {
    animation: none;
  }
}
