/**
 * Calculator Design System
 * Modern fintech aesthetic matching portfolio overview
 *
 * Design tokens:
 * - Primary: #3245ff (blue)
 * - Secondary: #bc52ee (purple)
 * - Accent: #06b6d4 (cyan)
 * - Border radius: 20px/--radius-2xl (cards), 16px/--radius-xl (tiles), 8px/--radius-md (inputs/buttons)
 * - Shadows: soft with low opacity (0.06-0.12)
 */

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes calcFadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes calcTooltipFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes calcPulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* ==========================================================================
   Premium Cards
   ========================================================================== */

.calc-premium-card {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--color-primary-light) 100%);
  border-radius: var(--radius-2xl);
  padding: 28px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  animation: calcFadeInUp 0.5s ease-out backwards;
}

.calc-premium-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--color-gradient);
}

/* Staggered animation delays */
.calc-premium-card:nth-child(1) { animation-delay: 0s; }
.calc-premium-card:nth-child(2) { animation-delay: 0.1s; }
.calc-premium-card:nth-child(3) { animation-delay: 0.15s; }
.calc-premium-card:nth-child(4) { animation-delay: 0.2s; }

/* Results card gets hover effect */
.calc-premium-card.calc-results-card {
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.calc-premium-card.calc-results-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* Input card - no hover effect (per user decision) */
.calc-premium-card.calc-input-card {
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

/* Spacing between card children (grids, inputs, chip groups) */
.calc-premium-card.calc-input-card > * + * {
  margin-top: 20px;
}

.calc-premium-card.calc-input-card > .calc-card-title + * {
  margin-top: 0; /* Title already has margin-bottom */
}

/* Tips card variant */
.calc-premium-card.calc-tips-card {
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-tertiary) 100%);
}

.calc-premium-card.calc-tips-card::before {
  background: var(--color-gradient-reverse);
}

/* Card title */
.calc-card-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 20px 0;
  letter-spacing: -0.02em;
}

/* ==========================================================================
   Input Fields
   ========================================================================== */

.calc-input-group {
  position: relative;
  /* No margin - spacing handled by grid gap */
}

.calc-input-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.calc-input-label .info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-muted);
  color: var(--text-muted);
  font-size: 12px;
  cursor: help;
  transition: all 0.2s ease;
}

.calc-input-label .info-icon:hover {
  background: var(--color-primary);
  color: var(--text-inverse);
}

.calc-input-field {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  font-size: 16px;
  color: var(--text-primary);
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.calc-input-field:hover {
  border-color: var(--border-secondary);
}

.calc-input-field:focus {
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
  outline: none;
}

.calc-input-field::placeholder {
  color: var(--text-tertiary);
}

/* Input with suffix (%, years, etc.) */
.calc-input-wrapper {
  position: relative;
}

.calc-input-suffix {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  pointer-events: none;
}

.calc-input-wrapper .calc-input-field {
  padding-right: 48px;
}

/* Input hint text - positioned absolutely to not affect alignment */
.calc-input-grid:has(.calc-input-hint) {
  padding-bottom: 22px; /* Reserve space for hint when any input has one */
}

.calc-input-hint {
  position: absolute;
  bottom: -22px; /* Position below the input, in the grid's padding */
  left: 0;
  right: 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* Input grid layout */
.calc-input-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  align-items: end; /* Align items at bottom - inputs line up, labels above */
}

@media (max-width: 600px) {
  .calc-input-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Chip/Toggle Buttons
   ========================================================================== */

.calc-chip-group {
  margin-top: 20px;
}

.calc-chip-group-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.calc-chip-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.calc-chip {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-primary);
  background: var(--bg-primary);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.calc-chip:hover {
  border-color: var(--border-secondary);
  background: var(--bg-secondary);
}

.calc-chip.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 600;
}

.calc-chip:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring-strong);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.calc-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--color-gradient);
  color: var(--text-inverse);
  padding: 14px 28px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-primary);
  transition: all 0.2s ease;
}

.calc-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-primary);
}

.calc-btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-primary-sm);
}

.calc-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-primary);
  color: var(--color-primary);
  padding: 14px 28px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  border: 2px solid var(--color-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.calc-btn-secondary:hover {
  background: var(--color-primary-light);
}

.calc-btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  color: var(--text-muted);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.calc-btn-ghost:hover {
  background: var(--bg-tertiary);
  color: var(--color-primary);
}

/* ==========================================================================
   Result Display - Hero
   ========================================================================== */

.calc-result-hero {
  text-align: center;
  padding: 32px 24px;
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--color-primary-light) 100%);
  border-radius: var(--radius-2xl);
  margin-bottom: 24px;
}

.calc-result-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.calc-result-value {
  font-size: 42px;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

@media (max-width: 480px) {
  .calc-result-value {
    font-size: 32px;
  }
}

.calc-result-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Positive/negative variants */
.calc-result-value.positive {
  color: var(--color-success);
}

.calc-result-value.negative {
  color: var(--color-error);
}

/* ==========================================================================
   Stats Grid
   ========================================================================== */

.calc-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

@media (max-width: 480px) {
  .calc-stats-grid {
    grid-template-columns: 1fr;
  }
}

.calc-stat-tile {
  padding: 18px 20px;
  background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--bg-secondary) 100%);
  border-radius: var(--radius-xl);
  transition: all 0.2s ease;
}

.calc-stat-tile:hover {
  background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary-light) 100%);
  transform: translateY(-1px);
}

.calc-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.calc-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.01em;
}

.calc-stat-value.secondary {
  color: var(--color-secondary);
}

.calc-stat-value.positive {
  color: var(--color-success);
}

.calc-stat-value.negative {
  color: var(--color-error);
}

/* ==========================================================================
   Chart Container
   ========================================================================== */

.calc-chart-container {
  position: relative;
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  padding: 20px;
  margin-top: 8px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  box-sizing: border-box;
  overflow: hidden;
  max-width: 100%;
}

.calc-chart-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.calc-chart-svg {
  display: block;
  width: 100%;
  filter: var(--shadow-xs);
}

/* Chart legend */
.calc-chart-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px 24px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-primary);
}

.calc-chart-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.calc-chart-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-xs);
}

.calc-chart-legend-dot.primary {
  background: var(--color-primary);
}

.calc-chart-legend-dot.secondary {
  background: var(--color-secondary);
}

/* ==========================================================================
   Modern Chart (Premium Fintech Style)
   ========================================================================== */

.calc-modern-chart {
  position: relative;
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-primary);
  box-sizing: border-box;
  overflow: hidden;
  max-width: 100%;
}

.calc-modern-chart .calc-chart-svg {
  display: block;
  width: 100%;
  height: auto;
}

/* Modern legend below chart */
.calc-chart-legend-modern {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-primary);
}

.calc-legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.calc-legend-dot {
  width: 14px;
  height: 14px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.calc-legend-text {
  white-space: nowrap;
}

.calc-legend-line {
  width: 24px;
  height: 3px;
  border-radius: var(--radius-xs);
  flex-shrink: 0;
}

.calc-legend-line.calc-legend-dashed {
  background: transparent !important;
  border-top-width: 3px;
  border-top-style: dashed;
  border-top-color: inherit;
  height: 0;
}

/* Floating tooltip for chart */
.calc-chart-tooltip-floating {
  position: absolute;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-primary);
  z-index: 100;
  pointer-events: none;
  animation: calcTooltipFadeIn 0.15s ease;
  min-width: 180px;
}

.calc-chart-tooltip-floating .tooltip-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-primary);
}

.calc-chart-tooltip-floating .tooltip-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.calc-chart-tooltip-floating .tooltip-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-xs);
  flex-shrink: 0;
}

.calc-chart-tooltip-floating .tooltip-label {
  font-size: 13px;
  color: var(--text-muted);
  flex: 1;
}

.calc-chart-tooltip-floating .tooltip-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.calc-chart-tooltip-floating .tooltip-value.positive {
  color: var(--color-success);
}

.calc-chart-tooltip-floating .tooltip-value.negative {
  color: var(--color-error);
}

/* ==========================================================================
   Tooltip
   ========================================================================== */

.calc-tooltip {
  position: absolute;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-primary);
  z-index: 100;
  pointer-events: none;
  animation: calcTooltipFadeIn 0.15s ease;
  min-width: 140px;
}

.calc-tooltip-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 4px 0;
}

.calc-tooltip-row:first-child {
  padding-top: 0;
}

.calc-tooltip-row:last-child {
  padding-bottom: 0;
}

.calc-tooltip-label {
  font-size: 13px;
  color: var(--text-muted);
}

.calc-tooltip-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.calc-tooltip-value.primary {
  color: var(--color-primary);
}

.calc-tooltip-value.secondary {
  color: var(--color-secondary);
}

/* ==========================================================================
   Tips & FAQ
   ========================================================================== */

.calc-tips-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.calc-tip-card {
  padding: 16px 18px;
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-primary);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.calc-tip-card:hover {
  border-color: var(--border-secondary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.calc-faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.calc-faq-item {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-primary);
  overflow: hidden;
  transition: all 0.2s ease;
}

.calc-faq-item:hover {
  border-color: var(--border-secondary);
}

.calc-faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  cursor: pointer;
  user-select: none;
}

.calc-faq-question-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.calc-faq-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 600;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.calc-faq-item.open .calc-faq-toggle {
  background: var(--color-primary);
  color: var(--text-inverse);
}

.calc-faq-answer {
  padding: 0 18px 16px 18px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* ==========================================================================
   Details Table
   ========================================================================== */

.calc-details-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  background: transparent;
  border: 2px dashed var(--border-primary);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 16px;
}

.calc-details-toggle:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.calc-details-table-wrapper {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.calc-details-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.calc-details-table thead {
  background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--bg-secondary) 100%);
}

.calc-details-table th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.calc-details-table td {
  padding: 12px 16px;
  color: var(--text-secondary);
  border-top: 1px solid var(--bg-tertiary);
}

.calc-details-table tbody tr:hover {
  background: var(--bg-secondary);
}

.calc-details-table td.highlight {
  color: var(--color-primary);
  font-weight: 600;
}

/* ==========================================================================
   Collapsible Section
   ========================================================================== */

.calc-collapsible-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--color-info-bg) 0%, var(--color-primary-light) 100%);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  margin-bottom: 20px;
}

.calc-collapsible-trigger:hover {
  background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary-light) 100%);
}

.calc-collapsible-trigger.expanded {
  background: linear-gradient(135deg, #3245ff 0%, #5b6aff 100%);
  color: white;
}

.calc-collapsible-icon {
  font-size: 18px;
  transition: transform 0.2s ease;
}

.calc-collapsible-trigger.expanded .calc-collapsible-icon {
  transform: rotate(45deg);
}

.calc-collapsible-content {
  animation: calcFadeInUp 0.3s ease;
  margin-top: 16px;
}

/* Toggle Button (simple +/- toggle) */
.calc-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--color-info-bg) 0%, var(--color-primary-light) 100%);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.calc-toggle-btn:hover {
  background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary-light) 100%);
}

/* Select dropdown */
.calc-select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  font-size: 15px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

.calc-select:focus {
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
  outline: none;
}

/* Checkbox label */
.calc-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
}

.calc-checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

/* Comparison Box (for scenario comparison) */
.calc-comparison-box {
  padding: 20px;
  background: linear-gradient(135deg, var(--color-info-bg) 0%, var(--color-info-border) 100%);
  border-radius: var(--radius-xl);
  border: 2px solid var(--color-info);
  margin-bottom: 20px;
  animation: calcFadeInUp 0.3s ease;
}

.calc-comparison-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-info-text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.calc-comparison-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-info);
  letter-spacing: -0.02em;
}

.calc-comparison-diff {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 500;
}

.calc-comparison-diff .positive {
  color: var(--color-success);
}

.calc-comparison-diff .negative {
  color: var(--color-error);
}

/* ==========================================================================
   Section Titles
   ========================================================================== */

.calc-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 16px 0;
  letter-spacing: -0.01em;
}

.calc-section-subtitle {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 20px 0 8px 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ==========================================================================
   Calculator Layout (3-column)
   ========================================================================== */

.calc-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.calc-layout-inputs {
  display: flex;
  flex-direction: column;
  gap: 20px; /* Space between input cards */
}

.calc-layout-divider {
  display: none;
}

@media (min-width: 1300px) {
  .calc-layout {
    flex-direction: row;
    flex-wrap: wrap; /* Allow wrapping for share footer */
    align-items: flex-start;
    gap: 24px;
  }

  .calc-layout-inputs {
    flex: 0 0 340px;
    max-width: 400px;
  }

  .calc-layout-results {
    flex: 1;
    min-width: 480px;
    max-width: 700px;
  }

  .calc-layout-tips {
    flex: 0 0 300px;
    max-width: 360px;
  }

  .calc-layout-divider {
    display: block;
    width: 1px;
    align-self: stretch;
    background: linear-gradient(180deg, var(--border-primary) 0%, var(--border-secondary) 50%, var(--border-primary) 100%);
    border-radius: 1px;
    opacity: 0.8;
  }

  .calc-share-footer {
    flex: 0 0 100%; /* Full width, forces to new row */
    margin-top: -12px; /* Reduce gap from layout */
  }
}

/* Tablet layout */
@media (min-width: 768px) and (max-width: 1299px) {
  .calc-layout {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    grid-template-rows: auto auto auto; /* Added row for share footer */
    gap: 24px;
  }

  .calc-layout-inputs {
    grid-column: 1;
    grid-row: 1;
  }

  .calc-layout-results {
    grid-column: 2;
    grid-row: 1 / 3;
  }

  .calc-layout-tips {
    grid-column: 1;
    grid-row: 2;
  }

  .calc-share-footer {
    grid-column: 1 / -1; /* Span all columns */
    grid-row: 3;
    margin-top: -12px; /* Reduce gap from layout */
  }
}

/* ==========================================================================
   Share Buttons Enhancement
   ========================================================================== */

.calc-share-footer {
  width: 100%;
  padding: 8px 0;
  display: flex;
  justify-content: center;
}

/* Error message */
.calc-error-message {
  padding: 12px 16px;
  background: var(--color-error-bg);
  border: 1px solid var(--color-error-border);
  border-radius: var(--radius-md);
  color: var(--color-error);
  font-size: 14px;
  margin-bottom: 16px;
}

/* Highlight stat (e.g., interest saved) */
.calc-highlight-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--color-success-bg) 0%, var(--color-success-border) 100%);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}

.calc-highlight-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-success-text);
}

.calc-highlight-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-success);
}

.calc-highlight-value.positive {
  color: var(--color-success);
}

.calc-share-section {
  padding: 20px;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--color-primary-light) 100%);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-primary);
}

.calc-share-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

/* ==========================================================================
   CTA Enhancement
   ========================================================================== */

.calc-cta-card {
  padding: 24px;
  background: var(--color-gradient);
  border-radius: var(--radius-xl);
  color: var(--text-inverse);
  text-align: center;
  margin-bottom: 24px;
}

.calc-cta-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.calc-cta-text {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 16px;
}

.calc-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--bg-primary);
  color: var(--color-primary);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.calc-cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ==========================================================================
   Loading / Skeleton States
   ========================================================================== */

.calc-skeleton {
  background: linear-gradient(90deg, var(--bg-muted) 25%, var(--bg-tertiary) 50%, var(--bg-muted) 75%);
  background-size: 200% 100%;
  animation: calcPulse 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

.calc-skeleton-text {
  height: 16px;
  margin-bottom: 8px;
}

.calc-skeleton-text.large {
  height: 42px;
  width: 200px;
  margin: 0 auto;
}

/* ==========================================================================
   Debt Payoff Calculator Specific Styles
   ========================================================================== */

.calc-strategy-selector {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.calc-strategy-selector .calc-chip-group {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  padding: 16px 24px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.calc-debt-row {
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  padding: 16px;
  margin-bottom: 16px;
  transition: all 0.2s ease;
}

.calc-debt-row:hover {
  border-color: var(--border-secondary);
  box-shadow: var(--shadow-sm);
}

.calc-debt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.calc-debt-name-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  padding: 4px 0;
}

.calc-debt-name-input:focus {
  outline: none;
  border-bottom: 2px solid var(--color-primary);
}

.calc-debt-remove-btn {
  background: var(--color-error);
  color: white;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.calc-debt-remove-btn:hover {
  background: var(--color-error);
  transform: scale(1.1);
}

.calc-debt-fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.calc-debt-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calc-debt-field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.calc-debt-field input {
  padding: 10px 12px;
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-md);
  font-size: 14px;
  transition: all 0.2s ease;
}

.calc-debt-field input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}

.calc-btn-add {
  width: 100%;
  padding: 14px;
  margin-top: 8px;
  background: linear-gradient(135deg, #3245ff 0%, #5b6aff 100%);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-primary);
}

.calc-btn-add:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-primary);
}

/* User Data Badge - shows when calculator uses portfolio data */
.calc-user-data-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--color-success-bg) 0%, var(--color-success-border) 100%);
  border: 1px solid var(--color-success-border);
  border-radius: var(--radius-2xl);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-success-text);
}

.calc-user-data-icon {
  font-size: 14px;
  font-weight: 700;
}

.calc-debt-comparison {
  margin-top: 24px;
  padding: 20px;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--color-primary-light) 100%);
  border-radius: var(--radius-xl);
}

.calc-comparison-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.calc-comparison-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
}

.calc-comparison-item.highlight {
  background: linear-gradient(135deg, var(--color-success-bg) 0%, var(--color-success-border) 100%);
}

.calc-comparison-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.calc-comparison-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.calc-debt-schedule {
  margin-top: 24px;
}

.calc-schedule-legend {
  display: flex;
  gap: 20px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 16px;
}

.calc-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-primary);
}

.calc-details-table td.paid-off {
  color: var(--color-success);
  font-weight: 600;
}

.calc-details-table td.target-debt {
  background: linear-gradient(135deg, var(--color-warning-bg) 0%, var(--color-warning-border) 100%);
  font-weight: 600;
  position: relative;
}

.calc-legend-line {
  width: 20px;
  height: 2px;
  border-radius: var(--radius-xs);
}

.calc-no-data {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

@media (max-width: 768px) {
  .calc-debt-fields {
    grid-template-columns: 1fr;
  }

  .calc-comparison-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Budget Calculator Specific Styles
   ========================================================================== */

.calc-budget-comparison {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}

.calc-budget-category {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  border-radius: var(--radius-xl);
  padding: 20px;
  border-left: 4px solid;
  transition: all 0.2s ease;
}

.calc-budget-category:hover {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  transform: translateX(2px);
}

.calc-budget-category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.calc-budget-category-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.calc-budget-status {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.calc-budget-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-primary);
}

.calc-budget-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.calc-budget-label {
  font-size: 13px;
  color: var(--text-muted);
}

.calc-budget-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.calc-budget-details {
  margin-top: 20px;
  padding: 20px;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--color-primary-light) 100%);
  border-radius: var(--radius-xl);
  animation: calcFadeInUp 0.3s ease-out;
}

.calc-budget-adjustments {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.calc-adjustment-tip {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.5;
}

.calc-adjustment-tip.warning {
  background: linear-gradient(135deg, var(--color-warning-bg) 0%, var(--color-warning-border) 100%);
  color: var(--color-warning-text);
  border-left: 3px solid var(--color-warning);
}

.calc-adjustment-tip.success {
  background: linear-gradient(135deg, var(--color-success-bg) 0%, var(--color-success-border) 100%);
  color: var(--color-success-text);
  border-left: 3px solid var(--color-success);
}

/* ==========================================================================
   Emergency Fund Calculator Specific Styles
   ========================================================================== */

/* Checkbox group */
.calc-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
  padding: 16px;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--color-primary-light) 100%);
  border-radius: var(--radius-lg);
}

/* Highlight box */
.calc-highlight-box {
  padding: 20px;
  border-radius: var(--radius-xl);
  margin-top: 16px;
  animation: calcFadeInUp 0.3s ease-out;
}

.calc-highlight-box.positive {
  background: linear-gradient(135deg, var(--color-success-bg) 0%, var(--color-success-border) 100%);
  border: 2px solid var(--color-success);
}

.calc-highlight-box.warning {
  background: linear-gradient(135deg, var(--color-warning-bg) 0%, var(--color-warning-border) 100%);
  border: 2px solid var(--color-warning);
}

.calc-highlight-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-success-text);
}

.calc-highlight-box.warning .calc-highlight-title {
  color: var(--color-warning-text);
}

/* Timeline */
.calc-timeline-container {
  margin-top: 16px;
}

.calc-timeline-track {
  position: relative;
  height: 60px;
  background: var(--bg-muted);
  border-radius: 30px;
  margin: 20px 0 40px;
}

.calc-timeline-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, #3245ff 0%, #5b6aff 100%);
  border-radius: 30px;
  transition: width 0.5s ease;
}

.calc-timeline-milestone {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  z-index: 2;
}

.calc-timeline-marker {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 3px solid var(--border-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.calc-timeline-milestone.achieved .calc-timeline-marker {
  background: linear-gradient(135deg, var(--color-success) 0%, var(--color-success-border) 100%);
  border-color: var(--color-success);
  color: white;
}

.calc-timeline-milestone.active .calc-timeline-marker {
  transform: scale(1.2);
  box-shadow: var(--shadow-primary-sm);
  border-color: var(--color-primary);
}

.calc-timeline-percentage {
  position: absolute;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.calc-timeline-details {
  margin-top: 16px;
  animation: calcFadeInUp 0.3s ease-out;
}

.calc-timeline-detail-card {
  padding: 20px;
  background: linear-gradient(135deg, var(--color-info-bg) 0%, var(--color-info-border) 100%);
  border-radius: var(--radius-xl);
  border: 2px solid var(--color-info);
}

.calc-timeline-detail-card h5 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-info-text);
}

.calc-timeline-detail-amount {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.calc-timeline-detail-status {
  font-size: 14px;
  color: var(--text-muted);
}

.calc-timeline-detail-status.achieved {
  color: var(--color-success);
  font-weight: 600;
}

.calc-timeline-date {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-info);
  margin-top: 4px;
}

.calc-timeline-months {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==========================================================================
   Comparison Cards (Growth vs Dividend, etc.)
   ========================================================================== */

.calc-comparison-cards-container {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.calc-comparison-card {
  border-radius: var(--radius-xl);
  padding: 16px;
  flex: 1;
  min-width: 200px;
}

.calc-comparison-card-title {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.calc-comparison-card-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
}

.calc-comparison-card-row--bordered {
  border-bottom: 1px solid var(--border-primary);
}

.calc-comparison-card-label {
  color: var(--text-muted);
}

.calc-comparison-card-value {
  font-weight: 700;
  color: var(--text-secondary);
}

/* Hero Result Variants */
.calc-result-hero--gradient {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--color-primary-light) 100%);
  padding: 20px;
  border-radius: var(--radius-xl);
  text-align: center;
  margin-bottom: 20px;
}

.calc-result-hero-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.calc-result-hero-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: -0.02em;
}

/* Details Toggle - Full Width Variant */
.calc-details-toggle--full-width {
  margin-top: 20px;
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--bg-tertiary) 100%);
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  color: var(--color-primary);
  width: 100%;
  transition: all 0.2s ease;
}

.calc-details-toggle--full-width:hover {
  border-color: var(--color-primary);
  background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary-light) 100%);
}
