/* Calculator styles: savings */

/* =========================================================================
   SAVINGS & COMPOUND GROWTH CALCULATOR - Wizard Layout
   ========================================================================= */

/* ── Wizard step fields spacing ── */
.savings-wizard__step-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.savings-section {
  gap: 12px;
}

.savings-section .vareoncalc-field-row {
  margin: 0;
}

.savings-section--apy {
  gap: 4px;
  border-style: dashed;
  border-color: color-mix(in srgb, var(--sc-panel-border, #d1d5db) 60%, transparent);
  background: var(--sc-panel-bg, #f9fafb);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.85em;
  opacity: 0.88;
}

.savings-section--apy[hidden] {
  display: none !important;
}

.savings-wizard__restart {
  margin-top: 16px;
}

/* ── Compact APY converter (Step 2) ── */
.savings-wizard__label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}

.savings-wizard__inline-label {
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
  margin-bottom: 0 !important;
  min-width: 0;
}

.savings-wizard__apy-toggle {
  border: 1px solid var(--sc-panel-border, #d1d5db);
  background: var(--sc-card-bg, #ffffff);
  color: var(--sc-muted-text, #6b7280);
  border-radius: 999px;
  padding: 2px 8px;
  min-height: 24px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.15px;
  line-height: 1.1;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.savings-wizard__apy-toggle:hover {
  border-color: var(--sc-accent, #2563eb);
  color: var(--sc-card-text, #111827);
}

.savings-wizard__apy-toggle:focus-visible {
  outline: 2px solid var(--sc-accent, #2563eb);
  outline-offset: 2px;
}

.savings-wizard__apy-toggle.is-active {
  border-color: var(--sc-accent, #2563eb);
  background: color-mix(in srgb, var(--sc-accent, #2563eb) 12%, var(--sc-card-bg, #ffffff));
  color: var(--sc-card-text, #111827);
}

.savings-wizard__apy-field {
  margin-top: 0;
  margin-bottom: 0;
}

.savings-wizard__apy-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 0.92em;
  color: var(--sc-muted-text, #6b7280);
}

.savings-wizard__apy-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.savings-wizard__apy-row .vareoncalc-input {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

.savings-wizard__apy-row .vareoncalc-input-adorned input,
.savings-wizard__apy-row input.vareoncalc-input {
  height: 34px;
  min-height: 34px;
  padding-top: 4px;
  padding-bottom: 4px;
  font-size: 13px;
}

.vareoncalc-apy-converter__btn {
  border: 1px solid var(--sc-accent, #2563eb);
  background: var(--sc-accent, #2563eb);
  color: var(--sc-accent-text, #ffffff);
  border-radius: 6px;
  padding: 6px 10px;
  min-height: 34px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s ease;
}

#apy-apply {
  margin-bottom: 14px;
}

.vareoncalc-apy-converter__btn:hover {
  opacity: 0.88;
}

/* ── Results Panel (inside wizard results) ── */
.vareoncalc-savings-results {
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, var(--sc-panel-bg, #f8fafc) 0%, var(--sc-card-bg, #ffffff) 100%);
  border: 1px solid var(--sc-panel-border, #e5e7eb);
  border-radius: 12px;
  padding: var(--sc-card-padding);
  gap: 20px;
}

/* ── Hero: Total Balance ── */
.vareoncalc-savings-hero {
  text-align: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--sc-panel-border, #e5e7eb);
}

.vareoncalc-savings-total {
  font-size: 2.75rem;
  font-weight: 800;
  color: var(--sc-card-text, #111827);
  line-height: 1.1;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.vareoncalc-savings-subtitle {
  font-size: 13px;
  color: var(--sc-muted-text, #6b7280);
}

.vareoncalc-savings-real {
  font-size: 12px;
  color: var(--sc-muted-text, #6b7280);
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  background: var(--sc-panel-bg, #f9fafb);
  border: 1px solid var(--sc-panel-border, #e5e7eb);
  border-radius: 20px;
  padding: 4px 12px;
}

.vareoncalc-savings-real__label {
  color: var(--sc-muted-text, #6b7280);
}

.vareoncalc-savings-real__value {
  font-weight: 600;
  color: var(--sc-card-text, #374151);
}

/* ── Composition Breakdown ── */
.vareoncalc-savings-breakdown {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.vareoncalc-composition-bar {
  display: flex;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--sc-panel-border, #e5e7eb);
}

.vareoncalc-composition-bar__fill--principal {
  background: var(--vareoncalc-chart-principal, #3b82f6);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 5px 0 0 5px;
}

.vareoncalc-composition-bar__fill--interest {
  background: var(--vareoncalc-chart-interest, #10b981);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 0 5px 5px 0;
}

.vareoncalc-breakdown-metrics {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.vareoncalc-breakdown-metric {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.vareoncalc-breakdown-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}

.vareoncalc-breakdown-dot--principal {
  background: var(--vareoncalc-chart-principal, #3b82f6);
}

.vareoncalc-breakdown-dot--interest {
  background: var(--vareoncalc-chart-interest, #10b981);
}

.vareoncalc-breakdown-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.vareoncalc-breakdown-label {
  font-size: 11px;
  color: var(--sc-muted-text, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.2;
}

.vareoncalc-breakdown-value {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--sc-card-text, #111827);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vareoncalc-breakdown-metric--interest .vareoncalc-breakdown-value {
  color: var(--vareoncalc-chart-interest, #10b981);
}

/* ── Growth Pill ── */
.vareoncalc-growth-pill {
  display: inline-flex;
  align-items: center;
  align-self: center;
  gap: 6px;
  background: color-mix(in srgb, var(--vareoncalc-chart-interest, #10b981) 10%, transparent);
  color: var(--vareoncalc-chart-interest, #10b981);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
}

.vareoncalc-growth-pill__arrow {
  font-weight: 700;
  font-size: 14px;
}

.vareoncalc-growth-pill__label {
  font-weight: 400;
  opacity: 0.85;
}

/* ── Chart Section ── */
.vareoncalc-savings-chart-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--sc-panel-border, #e5e7eb);
}

.vareoncalc-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.vareoncalc-chart-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--sc-muted-text, #6b7280);
}

.vareoncalc-chart-legend {
  display: flex;
  gap: 14px;
  font-size: 11px;
}

.vareoncalc-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--sc-muted-text, #6b7280);
}

.vareoncalc-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.vareoncalc-legend-principal .vareoncalc-legend-dot {
  background: var(--vareoncalc-chart-principal, #3b82f6);
}

.vareoncalc-legend-interest .vareoncalc-legend-dot {
  background: var(--vareoncalc-chart-interest, #10b981);
}

.vareoncalc-savings-chart {
  width: 100%;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.vareoncalc-growth-svg {
  width: 100%;
  height: auto;
  max-height: 220px;
}

/* Chart areas */
.vareoncalc-area-principal {
  opacity: 0.9;
}

.vareoncalc-area-interest {
  opacity: 0.85;
}

.vareoncalc-line-principal,
.vareoncalc-line-interest {
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Chart gridlines */
.vareoncalc-chart-gridline {
  stroke: var(--sc-panel-border, #e5e7eb);
  stroke-width: 0.5;
  stroke-dasharray: 4 3;
}

/* Y-axis labels */
.vareoncalc-chart-ylabel {
  font-size: 9px;
  fill: var(--sc-muted-text, #9ca3af);
  text-anchor: end;
}

/* Chart labels */
.vareoncalc-chart-label {
  font-size: 10px;
  fill: var(--sc-muted-text, #9ca3af);
  text-anchor: middle;
}

.vareoncalc-chart-axis-label {
  font-size: 9px;
  fill: var(--sc-muted-text, #9ca3af);
  text-anchor: middle;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Chart hover elements ── */
.vareoncalc-chart-crosshair {
  stroke: var(--sc-muted-text, #9ca3af);
  stroke-width: 1;
  stroke-dasharray: 4 3;
  pointer-events: none;
}

.vareoncalc-chart-dot--principal {
  fill: var(--vareoncalc-chart-principal, #3b82f6);
  stroke: var(--sc-card-bg, #ffffff);
  stroke-width: 2;
  pointer-events: none;
}

.vareoncalc-chart-dot--total {
  fill: var(--vareoncalc-chart-interest, #10b981);
  stroke: var(--sc-card-bg, #ffffff);
  stroke-width: 2;
  pointer-events: none;
}

.vareoncalc-chart-overlay {
  cursor: crosshair;
}

/* ── Chart tooltip ── */
.vareoncalc-chart-tooltip {
  position: absolute;
  background: var(--sc-card-bg, #ffffff);
  border: 1px solid var(--sc-panel-border, #e5e7eb);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.6;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  pointer-events: none;
  z-index: 10;
  white-space: nowrap;
  display: none;
}

.vareoncalc-chart-tooltip__year {
  font-weight: 600;
  color: var(--sc-card-text, #111827);
  margin-bottom: 4px;
  font-size: 13px;
}

.vareoncalc-chart-tooltip__row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vareoncalc-chart-tooltip__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.vareoncalc-chart-tooltip__dot--principal {
  background: var(--vareoncalc-chart-principal, #3b82f6);
}

.vareoncalc-chart-tooltip__dot--interest {
  background: var(--vareoncalc-chart-interest, #10b981);
}

.vareoncalc-chart-tooltip__label {
  color: var(--sc-muted-text, #6b7280);
  min-width: 70px;
}

.vareoncalc-chart-tooltip__value {
  font-weight: 600;
  color: var(--sc-card-text, #111827);
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .vareoncalc-savings-total {
    font-size: 2rem;
  }

  .vareoncalc-breakdown-metrics {
    flex-direction: column;
    gap: 10px;
  }

  .vareoncalc-breakdown-metric {
    flex: none;
  }

  .vareoncalc-savings-results {
    padding: 16px;
    gap: 16px;
  }
}

/* ── Dark Theme Overrides ── */
.vareoncalc-root[data-theme="dark"] .vareoncalc-savings-results,
.vareoncalc-root.theme-dark .vareoncalc-savings-results {
  background: linear-gradient(135deg, var(--sc-panel-bg, #1b2435) 0%, var(--sc-card-bg, #1f2937) 100%);
  border-color: var(--sc-panel-border, #324154);
}

.vareoncalc-root[data-theme="dark"] .savings-section--apy,
.vareoncalc-root.theme-dark .savings-section--apy {
  border-color: color-mix(in srgb, var(--sc-panel-border, #324154) 60%, transparent);
  background: var(--sc-panel-bg, #1b2435);
}

.vareoncalc-root[data-theme="dark"] .savings-wizard__apy-toggle,
.vareoncalc-root.theme-dark .savings-wizard__apy-toggle {
  background: var(--sc-panel-bg, #1b2435);
  border-color: var(--sc-panel-border, #324154);
  color: var(--sc-muted-text, #9ca3af);
}

.vareoncalc-root[data-theme="dark"] .savings-wizard__apy-toggle.is-active,
.vareoncalc-root.theme-dark .savings-wizard__apy-toggle.is-active {
  border-color: var(--sc-accent, #60a5fa);
  background: rgba(37, 99, 235, 0.22);
  color: var(--sc-card-text, #f9fafb);
}

.vareoncalc-root[data-theme="dark"] .vareoncalc-savings-real,
.vareoncalc-root.theme-dark .vareoncalc-savings-real {
  background: var(--sc-panel-bg, #1b2435);
  border-color: var(--sc-panel-border, #324154);
}

.vareoncalc-root[data-theme="dark"] .vareoncalc-composition-bar,
.vareoncalc-root.theme-dark .vareoncalc-composition-bar {
  background: var(--sc-panel-border, #324154);
}

.vareoncalc-root[data-theme="dark"] .vareoncalc-chart-gridline,
.vareoncalc-root.theme-dark .vareoncalc-chart-gridline {
  stroke: var(--sc-panel-border, #324154);
}

.vareoncalc-root[data-theme="dark"] .vareoncalc-chart-label,
.vareoncalc-root[data-theme="dark"] .vareoncalc-chart-axis-label,
.vareoncalc-root[data-theme="dark"] .vareoncalc-chart-ylabel,
.vareoncalc-root.theme-dark .vareoncalc-chart-label,
.vareoncalc-root.theme-dark .vareoncalc-chart-axis-label,
.vareoncalc-root.theme-dark .vareoncalc-chart-ylabel {
  fill: var(--sc-muted-text, #9ca3af);
}

.vareoncalc-root[data-theme="dark"] .vareoncalc-chart-tooltip,
.vareoncalc-root.theme-dark .vareoncalc-chart-tooltip {
  background: var(--sc-card-bg, #1f2937);
  border-color: var(--sc-panel-border, #324154);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.vareoncalc-root[data-theme="dark"] .vareoncalc-chart-dot--principal,
.vareoncalc-root.theme-dark .vareoncalc-chart-dot--principal,
.vareoncalc-root[data-theme="dark"] .vareoncalc-chart-dot--total,
.vareoncalc-root.theme-dark .vareoncalc-chart-dot--total {
  stroke: var(--sc-card-bg, #1f2937);
}

@media (max-width: 410px) {
  .savings-wizard__label-row {
    flex-direction: column;
    align-items: stretch;
  }

  .savings-wizard__apy-toggle {
    align-self: flex-start;
  }

  .savings-wizard__apy-row {
    flex-direction: column;
    align-items: stretch;
  }

  .vareoncalc-savings-results {
    padding: 14px;
    gap: 14px;
  }

  .savings-section--contribution-growth,
  .savings-section--contribution-growth .vareoncalc-field,
  .savings-section--contribution-growth label,
  .savings-section--contribution-growth .vareoncalc-mobile-shift-label {
    min-width: 0;
    max-width: 100%;
  }

  .savings-section--contribution-growth label {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.35;
  }
}

@media (max-width: 360px) {
  .vareoncalc-savings-total {
    font-size: 1.8rem;
  }

  .vareoncalc-savings-results {
    padding: 12px;
  }
}

@container vareoncalc (max-width: 410px) {
  .savings-wizard__label-row {
    flex-direction: column;
    align-items: stretch;
  }

  .savings-wizard__apy-toggle {
    align-self: flex-start;
  }

  .savings-wizard__apy-row {
    flex-direction: column;
    align-items: stretch;
  }

  .vareoncalc-savings-results {
    padding: 14px;
    gap: 14px;
  }

  .savings-section--contribution-growth,
  .savings-section--contribution-growth .vareoncalc-field,
  .savings-section--contribution-growth label,
  .savings-section--contribution-growth .vareoncalc-mobile-shift-label {
    min-width: 0;
    max-width: 100%;
  }

  .savings-section--contribution-growth label {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.35;
  }
}

@container vareoncalc (max-width: 360px) {
  .vareoncalc-savings-total {
    font-size: 1.8rem;
  }

  .vareoncalc-savings-results {
    padding: 12px;
  }
}
