:root {
  --primary: #3b82f6; /* Sky Blue */
  --primary-rgb: 59, 130, 246;
  --accent: #f59e0b; /* Sunny Gold/Amber */
  --accent-rgb: 245, 158, 11;
  --surface-border: rgba(59, 130, 246, 0.08);
  --surface-border-hover: rgba(59, 130, 246, 0.3);
  --gradient-main: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 50%, #1e3a8a 100%);
  --gradient-hover: linear-gradient(135deg, #2563eb 0%, #1e40af 50%, #172554 100%);
  --gradient-glow: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(30, 58, 138, 0.15) 100%);
  --shadow-glow: 0 20px 40px -15px rgba(59, 130, 246, 0.2), 0 0 0 1px rgba(59, 130, 246, 0.06);
  --bg-dots: rgba(59, 130, 246, 0.02);
}

/* Budget Totals Display Box */
.budget-totals {
  background: rgba(0, 0, 0, 0.015);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.total-cost-display {
  text-align: center;
  margin-bottom: 1.5rem;
  border-bottom: 1px dashed var(--surface-border);
  padding-bottom: 1rem;
}

.total-cost-label {
  display: block;
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.total-cost-val {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 7vw, 3rem);
  font-weight: 800;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  overflow-wrap: break-word;
  word-break: break-word;
}

.sub-cost-display {
  display: flex;
  flex-direction: column;
}

.sub-cost-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.sub-cost-val {
  font-family: var(--font-heading);
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  font-weight: 700;
  color: var(--text-primary);
  word-break: break-word;
}

/* Donut Chart Visualizer */
.chart-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin-top: 1rem;
}

@media (max-width: 480px) {
  .chart-container {
    flex-direction: column;
    gap: 1.5rem;
  }
}

.chart-wrapper {
  position: relative;
  width: 160px;
  height: 160px;
  flex-shrink: 0;
}

#donut-chart {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg); /* Start from 12 o'clock */
}

.chart-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  width: 70%;
  height: 70%;
  background: var(--bg-color);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: inset 0 0 5px rgba(0,0,0,0.1);
  border: 1px solid var(--surface-border);
}

.center-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.center-val {
  font-family: var(--font-heading);
  font-size: clamp(0.9rem, 3vw, 1.1rem);
  font-weight: 700;
  color: var(--text-primary);
  word-break: break-all;
}

/* Legends */
.chart-legend {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex-grow: 1;
  min-width: 0;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.03);
  gap: 0.5rem;
}

.legend-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-name {
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.legend-val {
  font-weight: 600;
  color: var(--text-primary);
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Custom print layout overrides */
@media print {
  .chart-center {
    background: white !important;
    box-shadow: none !important;
    border: none !important;
  }
}

/* Calculate Summary Update Pulse Animation */
@keyframes calculatePulse {
  0% {
    transform: scale(1);
    box-shadow: var(--shadow-md);
  }
  50% {
    transform: scale(1.025);
    box-shadow: 0 20px 35px rgba(231, 19, 20, 0.15), 0 0 15px rgba(231, 19, 20, 0.1);
    border-color: rgba(231, 19, 20, 0.35);
  }
  100% {
    transform: scale(1);
    box-shadow: var(--shadow-md);
  }
}

.pulse-animation {
  animation: calculatePulse 0.5s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}
