/* ============================================================
   Utilities Bunker — Roth IRA Calculator (v2.1)
   File: /assets/css/modules/calculators/financialcalculators/roth-ira-calculator.v2.1.css
   Purpose:
   - Tool-only layout and presentation for Roth IRA Calculator
   - Keeps all custom styling local to this tool
   - Mobile-first, accessible, UB-CERT aligned
   ============================================================ */

:root{
  --roth-radius: 16px;
  --roth-gap: 14px;
  --roth-soft: rgba(0,0,0,.06);
  --roth-accent-a: rgba(255,116,38,.92);
  --roth-accent-b: rgba(249,58,19,.92);
  --roth-contrib: linear-gradient(90deg, rgba(255,116,38,.95), rgba(249,58,19,.88));
  --roth-growth: linear-gradient(90deg, rgba(0,112,187,.95), rgba(96,165,250,.92));
}

/* Main hero split */
.ub-roth-hero{
  display:grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: var(--roth-gap);
}

@media (max-width: 980px){
  .ub-roth-hero{
    grid-template-columns: 1fr;
  }
}

/* Summary dashboard panel */
.ub-roth-panel{
  background:
    radial-gradient(circle at top right, rgba(249,58,19,.12), transparent 32%),
    linear-gradient(180deg, var(--ub-surface-1), var(--ub-surface-2));
  border: 1px solid var(--ub-border);
  border-radius: var(--roth-radius);
  padding: 14px;
  min-width: 0;
}

.ub-roth-panel-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap: 12px;
  flex-wrap:wrap;
}

.ub-roth-eyebrow{
  display:inline-block;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ub-muted);
}

/* KPI tiles */
.ub-kpis{
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
  justify-content:flex-end;
}

.ub-kpi{
  min-width: 120px;
  padding: 9px 10px;
  border-radius: 14px;
  border: 1px solid var(--ub-border);
  background: var(--ub-card-bg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}

.ub-kpi .k{
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ub-muted);
}

.ub-kpi .v{
  margin-top: 3px;
  font-family: var(--ub-mono);
  font-weight: 950;
  font-size: 14px;
  line-height: 1.25;
  overflow-wrap:anywhere;
}

/* Composition bar */
.ub-roth-progress-wrap{
  margin-top: 14px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--ub-border);
  background: var(--ub-card-bg);
}

.ub-roth-progress-meta{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap: 10px;
  flex-wrap:wrap;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 900;
  color: var(--ub-muted);
}

.ub-roth-progress{
  position:relative;
  display:flex;
  width:100%;
  min-height: 18px;
  overflow:hidden;
  border-radius: 999px;
  border: 1px solid var(--ub-border);
  background: var(--ub-surface-3);
}

.ub-roth-progress-bar{
  min-width: 0;
  transition: width 180ms ease;
}

.ub-roth-progress-bar--contrib{
  background: var(--roth-contrib);
}

.ub-roth-progress-bar--growth{
  background: var(--roth-growth);
}

.ub-roth-legend{
  display:flex;
  gap: 14px;
  flex-wrap:wrap;
  align-items:center;
  margin-top: 8px;
  color: var(--ub-muted);
  font-size: 12px;
  font-weight: 800;
}

.ub-swatch{
  display:inline-block;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: -1px;
  border: 1px solid rgba(0,0,0,.12);
}

.ub-swatch--contrib{
  background: linear-gradient(135deg, rgba(255,116,38,.95), rgba(249,58,19,.88));
}

.ub-swatch--growth{
  background: linear-gradient(135deg, rgba(0,112,187,.95), rgba(96,165,250,.92));
}

html.ub-theme-dark .ub-swatch{
  border-color: rgba(255,255,255,.14);
}

/* Stat cards */
.ub-stat{
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--ub-border);
  background: var(--ub-card-bg);
  min-width: 0;
}

.ub-stat-label{
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ub-muted);
}

.ub-stat-value{
  margin-top: 4px;
  font-family: var(--ub-mono);
  font-size: clamp(15px, 1rem + .15vw, 18px);
  font-weight: 950;
  line-height: 1.25;
  overflow-wrap:anywhere;
}

/* Input row normalization */
.ub-field .ub-inputrow{
  display:block !important;
}

.ub-field .ub-inputrow > input,
.ub-field .ub-inputrow > select{
  display:block !important;
  width:100% !important;
}

.ub-field .ub-inputrow > select{
  margin-top: 6px;
}

/* Help / validation */
.hint{
  margin-top: 6px;
  font-size: 12px;
  color: var(--ub-muted);
}

.ub-inline-error{
  margin-top: 6px;
  font-size: 12px;
  color: var(--ub-danger);
  font-weight: 800;
  min-height: 16px;
}

/* Work output */
.ub-work{
  font-family: var(--ub-mono);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap:anywhere;
}

/* Table wrapper safety */
.ub-table-wrap{
  width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  border-radius: 14px;
}

.ub-table td,
.ub-table th{
  white-space: nowrap;
}

.ub-table td:first-child,
.ub-table th:first-child{
  white-space: normal;
}

/* Details polish */
.ub-collapsible summary{
  cursor:pointer;
  font-weight: 950;
  min-height: 44px;
  display:flex;
  align-items:center;
}

.ub-collapsible summary:focus{
  outline:none;
  box-shadow: 0 0 0 4px var(--ub-focus);
  border-radius: 12px;
}

/* Rail helper */
.ub-btn--block{
  width:100%;
}

/* Smooth output wrapping */
#outNote,
#mixLabel,
#kpiProjected,
#kpiContrib,
#kpiGrowth,
#kpiReal,
#outProjected,
#outContributions,
#outGrowth,
#outReal,
#outYears,
#outMonthlyRule,
#outAnnualContrib,
#outReturn{
  overflow-wrap:anywhere;
  word-break:break-word;
}

/* Container behavior */
.ub-cq{
  container-type:inline-size;
}

@container (max-width: 680px){
  .ub-roth-panel-top{
    flex-direction:column;
    align-items:stretch;
  }

  .ub-kpis{
    justify-content:flex-start;
  }
}

/* Dark theme tuning */
html.ub-theme-dark .ub-roth-panel{
  background:
    radial-gradient(circle at top right, rgba(249,58,19,.15), transparent 32%),
    linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.02));
}

html.ub-theme-dark .ub-roth-progress-wrap,
html.ub-theme-dark .ub-stat,
html.ub-theme-dark .ub-kpi{
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}

/* Small-screen polish */
@media (max-width: 640px){
  .ub-kpi{
    min-width: calc(50% - 4px);
    flex: 1 1 calc(50% - 4px);
  }

  .ub-roth-progress-meta{
    align-items:flex-start;
  }

  .ub-stat{
    padding: 11px;
  }
}

@media (max-width: 480px){
  .ub-kpi{
    min-width: 100%;
    flex: 1 1 100%;
  }

  .ub-roth-panel,
  .ub-card{
    min-width: 0;
  }

  .ub-roth-legend{
    gap: 10px;
  }

  .ub-table td,
  .ub-table th{
    font-size: 12px;
  }
}

/* Reduced motion respect */
@media (prefers-reduced-motion: reduce){
  .ub-roth-progress-bar{
    transition: none;
  }
}