/* -------------------------------------------------------------------------- */
/* UK MORTGAGE CALCULATOR — STYLESHEET                                        */
/* -------------------------------------------------------------------------- */

:root {
  /* Color Palette - Financial Navy & Emerald */
  --primary-navy: #0f172a;
  --navy-light: #1e293b;
  --accent-emerald: #059669;
  --accent-emerald-hover: #047857;
  --accent-light-bg: #ecfdf5;
  --accent-border: #a7f3d0;
  
  --chart-principal-color: #2563eb; /* Royal Blue */
  --chart-interest-color: #f59e0b;  /* Warm Amber */

  --text-dark: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-input: #f1f5f9;
  --bg-input-focus: #ffffff;
  
  --border-color: #e2e8f0;
  --border-color-hover: #cbd5e1;
  --focus-ring: rgba(5, 150, 105, 0.25);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Reset & Base Settings */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-dark);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Utility Containers */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Header */
.site-header {
  background-color: var(--primary-navy);
  color: #ffffff;
  padding: 1rem 0;
  border-bottom: 1px solid var(--navy-light);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: #ffffff;
}

.logo svg {
  color: var(--accent-emerald);
}

.badge {
  background-color: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
}

/* Intro Section */
.main-content {
  flex: 1;
  padding-top: 1.75rem;
  padding-bottom: 2.5rem;
}

.intro-section {
  text-align: center;
  max-width: 750px;
  margin: 0 auto 2rem auto;
}

.intro-section h1 {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--primary-navy);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.intro-text {
  font-size: 0.98rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Main Calculator Card (Two-column layout) */
.calculator-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  display: grid;
  grid-template-columns: 1fr;
  overflow: hidden;
}

@media (min-width: 900px) {
  .calculator-card {
    grid-template-columns: 1.1fr 0.9fr;
  }
}

/* Left Column - Inputs */
.calculator-inputs {
  padding: 2.25rem;
  background-color: #ffffff;
}

.form-group {
  margin-bottom: 1.5rem;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.45rem;
}

.input-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--navy-light);
}

/* Segmented Control (Repayment Type) */
.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background-color: var(--bg-input);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  gap: 0.25rem;
}

.segment-option {
  cursor: pointer;
  position: relative;
}

.segment-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segment-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 0.75rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all 0.18s ease;
  user-select: none;
}

.segment-option input:checked + .segment-pill {
  background-color: #ffffff;
  color: var(--accent-emerald);
  box-shadow: var(--shadow-sm);
}

.segment-option input:focus-visible + .segment-pill {
  outline: 2px solid var(--accent-emerald);
}

/* Unit Toggle Switch (% / £) */
.unit-toggle-group {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background-color: var(--bg-input);
  padding: 0.2rem;
  border-radius: var(--radius-sm);
}

.toggle-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-right: 0.2rem;
  padding-left: 0.2rem;
}

.unit-btn {
  border: none;
  background: transparent;
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.unit-btn.active {
  background-color: var(--accent-emerald);
  color: #ffffff;
}

/* Form Inputs & Input Wrappers */
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix, .input-suffix {
  position: absolute;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}

.input-prefix {
  left: 0.9rem;
}

.input-suffix {
  right: 0.9rem;
}

.input-wrapper input[type="number"] {
  width: 100%;
  padding: 0.75rem 0.9rem;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary-navy);
  background-color: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
  -moz-appearance: textfield;
}

.input-wrapper input[type="number"]::-webkit-outer-spin-button,
.input-wrapper input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.input-wrapper.currency-wrapper input[type="number"] {
  padding-left: 2.4rem;
  padding-right: 0.9rem;
}

.input-wrapper.percent-wrapper input[type="number"] {
  padding-left: 0.9rem;
  padding-right: 2.4rem;
}

.input-wrapper input[type="number"]:focus {
  outline: none;
  background-color: var(--bg-input-focus);
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.input-helper {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.input-helper strong {
  color: var(--primary-navy);
}

/* Slider Controls */
.term-display {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-navy);
}

.term-display input {
  width: 55px;
  padding: 0.25rem 0.4rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--primary-navy);
  background-color: var(--bg-input);
}

.term-display input:focus {
  outline: none;
  border-color: var(--accent-emerald);
  background-color: #ffffff;
}

.slider-wrapper {
  margin-top: 0.6rem;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: #cbd5e1;
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-emerald);
  border: 3px solid #ffffff;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  background: var(--accent-emerald-hover);
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-emerald);
  border: 3px solid #ffffff;
  box-shadow: var(--shadow-md);
  cursor: pointer;
}

.slider-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-light);
  margin-top: 0.35rem;
  font-weight: 500;
}

/* Left Column Callout Box (Loan Amount & LTV) */
.inputs-summary-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.1rem;
  margin-top: 1.75rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-navy);
  margin-top: 0.1rem;
}

.highlight-badge {
  color: var(--accent-emerald);
}


/* Right Column - Results */
.calculator-results {
  background-color: var(--primary-navy);
  color: #ffffff;
  padding: 2.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.results-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 1.25rem;
  letter-spacing: -0.01em;
}

/* Headline Monthly Payment Card */
.headline-payment-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.03) 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-md);
}

.headline-label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-emerald);
}

.headline-amount-wrapper {
  display: flex;
  align-items: baseline;
  justify-content: center;
  margin: 0.3rem 0;
}

.headline-currency {
  font-size: 2.2rem;
  font-weight: 800;
  color: #ffffff;
  margin-right: 0.15rem;
}

.headline-amount {
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1;
  color: #ffffff;
  letter-spacing: -0.03em;
}

.headline-subtext {
  font-size: 0.82rem;
  color: var(--text-light);
}

/* Interest-only Note */
.interest-only-note {
  background-color: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: #fef3c7;
  line-height: 1.45;
  margin-bottom: 1.25rem;
}

.interest-only-note svg {
  flex-shrink: 0;
  color: #f59e0b;
  margin-top: 0.1rem;
}

.interest-only-note strong {
  color: #ffffff;
}

/* Supporting Breakdown Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
}

.stat-card-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-light);
  margin-bottom: 0.2rem;
}

.stat-card-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
}

/* SVG Chart Section */
.chart-container {
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  margin-bottom: 1.5rem;
}

.chart-header h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chart-content {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.chart-visual {
  flex-shrink: 0;
}

.chart-bg {
  stroke: rgba(255, 255, 255, 0.1);
}

.chart-principal {
  stroke: var(--chart-principal-color);
  transition: stroke-dasharray 0.4s ease, stroke-dashoffset 0.4s ease;
}

.chart-interest {
  stroke: var(--chart-interest-color);
  transition: stroke-dasharray 0.4s ease, stroke-dashoffset 0.4s ease;
}

.chart-center-title {
  font-size: 9px;
  font-weight: 700;
  fill: var(--text-light);
  letter-spacing: 1px;
}

.chart-center-percent {
  font-size: 18px;
  font-weight: 800;
  fill: #ffffff;
}

.chart-legend {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.color-principal {
  background-color: var(--chart-principal-color);
}

.color-interest {
  background-color: var(--chart-interest-color);
}

.legend-text {
  display: flex;
  flex-direction: column;
}

.legend-title {
  font-size: 0.73rem;
  color: var(--text-light);
}

.legend-val {
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
}

/* Disclaimer */
.calculator-disclaimer {
  font-size: 0.72rem;
  color: var(--text-light);
  opacity: 0.8;
  line-height: 1.4;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 0.85rem;
}

/* Site Footer */
.site-footer {
  margin-top: auto;
  background-color: var(--primary-navy);
  border-top: 1px solid var(--navy-light);
  color: var(--text-light);
  font-size: 0.8rem;
  padding: 1.25rem 0;
  text-align: center;
}

/* Mobile Responsive Adjustments */
@media (max-width: 899px) {
  .calculator-inputs, .calculator-results {
    padding: 1.5rem;
  }
  
  .intro-section h1 {
    font-size: 1.5rem;
  }

  .headline-amount {
    font-size: 2.6rem;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .chart-content {
    flex-direction: column;
    text-align: center;
  }

  .legend-item {
    justify-content: center;
  }
}
