/* ============================================================
   PENSION CALCULATOR — CUSTOM STYLES
   Mobile-first, layered on top of Tailwind CSS
   ============================================================ */

/* Base */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  background-color: #f8fafc;
}

/* ============================================================
   HERO GRADIENT
   ============================================================ */
.hero-gradient {
  background: linear-gradient(135deg, #3730a3 0%, #4338ca 40%, #4f46e5 70%, #6366f1 100%);
  position: relative;
  overflow: hidden;
}

.hero-gradient::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -10%;
  width: 60%;
  height: 200%;
  background: radial-gradient(ellipse, rgba(255,255,255,0.06) 0%, transparent 70%);
  pointer-events: none;
}

/* ============================================================
   CARD
   ============================================================ */
.card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px 0 rgba(0,0,0,0.05), 0 1px 2px -1px rgba(0,0,0,0.05);
}

@media (min-width: 640px) {
  .card {
    padding: 2rem;
  }
}

/* ============================================================
   STEP HEADER
   ============================================================ */
.step-header {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
}

.step-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  background: linear-gradient(135deg, #4338ca, #6366f1);
  color: white;
  font-size: 0.8125rem;
  font-weight: 700;
  border-radius: 0.5rem;
  flex-shrink: 0;
  margin-top: 0.125rem;
  box-shadow: 0 2px 4px rgba(67,56,202,0.3);
}

.step-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}

.step-sub {
  font-size: 0.8125rem;
  color: #64748b;
  margin-top: 0.125rem;
}

/* ============================================================
   FORM FIELDS
   ============================================================ */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.field-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #1e293b;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.375rem;
  line-height: 1.4;
}

.field-label em {
  font-style: italic;
  font-weight: 400;
}

.field-hint {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 0.25rem;
}

/* Input with £ prefix */
.input-wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid #cbd5e1;
  border-radius: 0.625rem;
  background: #ffffff;
  transition: border-color 0.15s, box-shadow 0.15s;
  overflow: hidden;
}

.input-wrap:focus-within {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

.input-prefix {
  padding: 0 0.875rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #64748b;
  background: #f8fafc;
  border-right: 1.5px solid #e2e8f0;
  align-self: stretch;
  display: flex;
  align-items: center;
  user-select: none;
}

.field-input {
  flex: 1;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #0f172a;
  background: transparent;
  border: none;
  outline: none;
  min-width: 0;
  -moz-appearance: textfield;
}

.field-input::-webkit-outer-spin-button,
.field-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.field-input::placeholder {
  color: #cbd5e1;
  font-weight: 400;
}

/* Select */
.field-select {
  width: 100%;
  padding: 0.625rem 2.5rem 0.625rem 0.875rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #0f172a;
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2364748b'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
  background-size: 1.125rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 0.625rem;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field-select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

/* ============================================================
   BADGES
   ============================================================ */
.badge-required {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  letter-spacing: 0.02em;
}

.badge-optional {
  font-size: 0.6875rem;
  font-weight: 500;
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
}

/* ============================================================
   HELP BOX
   ============================================================ */
.help-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #6366f1;
  border-radius: 0 0.5rem 0.5rem 0;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  color: #475569;
  margin-top: 0.25rem;
}

.help-title {
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.375rem;
  font-size: 0.75rem;
}

.help-list {
  list-style: none;
  padding: 0;
  margin: 0;
  space-y: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.3125rem;
}

.help-list li {
  padding-left: 1rem;
  position: relative;
  line-height: 1.5;
}

.help-list li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: #6366f1;
  font-weight: 700;
}

/* ============================================================
   RADIO GROUP (MPAA)
   ============================================================ */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 0.625rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.radio-option:hover {
  border-color: #a5b4fc;
  background: #f0f0ff;
}

.radio-option:has(.radio-input:checked) {
  border-color: #6366f1;
  background: #eef2ff;
}

.radio-input {
  width: 1rem;
  height: 1rem;
  accent-color: #6366f1;
  flex-shrink: 0;
  margin-top: 0.125rem;
  cursor: pointer;
}

.radio-inner {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.radio-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #1e293b;
}

.radio-desc {
  font-size: 0.75rem;
  color: #64748b;
}

/* ============================================================
   ALERT / WARNING BOXES
   ============================================================ */
.alert-amber {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.75rem 1rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 0.625rem;
  font-size: 0.8125rem;
  color: #92400e;
}

/* ============================================================
   CARRY FORWARD YEAR CARDS
   ============================================================ */
.cf-year-card {
  border: 1.5px solid #e2e8f0;
  border-radius: 0.875rem;
  overflow: hidden;
  background: #ffffff;
}

.cf-year-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.cf-year-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #4338ca;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.cf-year-body {
  padding: 1rem;
}

.cf-member-toggle {}

.cf-member-btn {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: 0.5rem;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}

.cf-btn-yes {
  background: #dcfce7;
  border-color: #86efac;
  color: #14532d;
}

.cf-btn-no {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #7f1d1d;
}

.cf-btn-inactive {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #64748b;
}

.cf-btn-inactive:hover {
  background: #e2e8f0;
}

/* Carry forward unused badges */
.cf-unused-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  white-space: nowrap;
}

.cf-badge-available {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.cf-badge-zero {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.cf-badge-none {
  background: #f1f5f9;
  color: #94a3b8;
  border: 1px solid #e2e8f0;
}

/* ============================================================
   RESULTS PANEL
   ============================================================ */
.results-section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  margin-bottom: 0.5rem;
}

.results-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 0;
  gap: 0.5rem;
}

.results-label {
  font-size: 0.8125rem;
  color: #64748b;
  flex: 1;
  min-width: 0;
}

.results-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  flex-shrink: 0;
}

.highlight-blue {
  background: #eef2ff;
  border-radius: 0.5rem;
  padding: 0.375rem 0.625rem !important;
  margin-top: 0.25rem;
}

.highlight-green {
  background: #f0fdf4;
  border-radius: 0.5rem;
  padding: 0.375rem 0.625rem !important;
  margin-top: 0.25rem;
}

.divider {
  border: none;
  border-top: 1px solid #f1f5f9;
  margin: 0;
}

/* ============================================================
   SCROLLBAR STYLING (webkit)
   ============================================================ */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ============================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================ */
@media (max-width: 640px) {
  .card {
    border-radius: 0.875rem;
    padding: 1.25rem;
  }

  .cf-year-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .radio-option {
    padding: 0.625rem 0.875rem;
  }
}

@media (min-width: 1024px) {
  /* On desktop, results panel has nice max height and scrolls within */
  .lg\:sticky {
    position: sticky;
  }
}

/* ============================================================
   FOCUS VISIBLE (accessibility)
   ============================================================ */
:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  header,
  .hero-gradient {
    background: #1e3a8a !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .lg\:sticky {
    position: static !important;
  }
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card {
  animation: fadeIn 0.2s ease-out;
}

/* Result values transition */
.results-value {
  transition: color 0.2s ease;
}
