/* -------------------------
   1) Reset / Box Model
------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* -------------------------
   2) Base / Document
------------------------- */
html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, segoe UI, roboto, Arial, sans-serif;
  line-height: 1.5;
  background-color: #f8fafc;
  color: #1e293b;
}

/* -------------------------
   3) Typography
------------------------- */
h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -0.3px;
}

/* Keep focus-visible rule valid*/
:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.35);
  outline-offset: 3px;
  border-radius: 6px;
}

/* -------------------------
   4) Page Layout
------------------------- */
main {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 16px;
}

/* layout wrapper (used by HTML) */
.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px;

  /* Important: prevent the fixed progress bar from covering content */
  padding-top: 84px; /* adjust if needed */
}

/* Page header card */
.page-header {
  background-color: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

.page-header p {
  color: #475569;
}

.page-header ul {
  list-style: none;
  padding-left: 0;
  margin: 12px 0 0;
}

.page-header li {
  position: relative;
  padding-left: 22px;
  margin: 6px 0;
}

.page-header li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #3b82f6;
}

/* -------------------------
   5) Form Shell
------------------------- */
.form {
  padding: 20px;
  background-color: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

/* Form sections */
.form__section {
  padding: 28px;
  margin-top: 28px;
  border-top: 1px solid #eef2f7;
  scroll-margin-top: 96px;
}

.form__section:first-of-type {
  margin-top: 0;
}

.form__section h2 {
  margin-bottom: 12px;
}

.form__section p {
  margin-bottom: 16px;
}

/* Active section highlight (driven by JS) */
.form__section--active {
  border-left: 4px solid #3b82f6;
  padding-left: 24px;
  background: linear-gradient(to right, rgba(59, 130, 246, 0.06), transparent 60%);
  border-radius: 10px;
}

/* Section header text */
.form__section-header {
  margin-bottom: 14px;
}

.form__section-title {
  margin: 0 0 8px;
}

.form__section-intro {
  margin: 0;
  color: #475569;
}

/* -------------------------
   6) Fieldsets / Legends (BEM)
------------------------- */
.form__fieldset {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px;
  background: #fafafa;
}

.form__legend {
  font-weight: 700;
  color: #111827;
  padding: 0 6px;
}

/* -------------------------
   7) Groups / Labels / Text
------------------------- */
.form__group {
  display: block;
  margin-top: 14px;
  margin-bottom: 18px;
}

.form__label {
  margin-bottom: 6px;
  display: block;
}

.form__prompt {
  margin: 0 0 10px;
  font-weight: 600;
  color: #111827;
}

.form__hint,
.form__context {
  margin: 10px 0;
  color: #475569;
}

.form__helper {
  margin: 0;
}

.form__notice {
  margin-top: 8px;
}

/* -------------------------
   8) Inputs / Controls
------------------------- */
.form__input,
.form__textarea {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  display: block;
  width: 100%;
  max-width: 520px;
}

.form__input:focus,
.form__textarea:focus {
  border-color: #3b82f6;

  /* Keep current look (no visible ring) while valid */
  box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.15);

  outline: none;
}

/* Global textarea behavior (autosize system depends on this feel) */
textarea {
  width: 100%;
  min-height: 44px; /* small starting size */
  height: 44px;     /* forces compact default height */
  padding: 10px 12px;
  font-size: 16px;
  line-height: 1.4;
  box-sizing: border-box;
  overflow: hidden;
  resize: none;
}

/* Radios/checkboxes */
.form__radio,
.form__checkbox {
  accent-color: #3b82f6;
  width: 16px;
  height: 16px;
}

/* Select */
.form__select {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  display: block;
  width: 100%;
  max-width: 520px;
  background-color: #fff;
}

.form__select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
  outline: none;
}

/* -------------------------
   9) Options Lists / Option Rows
------------------------- */
.form__options {
  list-style: none;
  padding: 0;
  margin: 12px 0;
  display: block;
}

.form__options > li {
  margin: 0 0 10px;
}

/* Used by some sections to display 2-column options */
.form__options--grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form__option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.form__option:hover {
  background-color: #e5e7eb;
}

/* NOTE: :has() requires modern browsers. Keeping because it’s in working build. */
.form__option:has(input:checked) {
  background-color: #eff6ff;
}

/* Legacy list class (kept for compatibility) */
.form-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Maintenance section overrides (kept) */
#maintenance-support .form__options {
  display: block;
}

#maintenance-support .form__options > li {
  margin-bottom: 12px;
}

#maintenance-support .form__notice {
  margin-top: 6px;
}

/* -------------------------
   10) Buttons
------------------------- */
.form__button {
  display: inline-block;
  background-color: #111827;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 14px 20px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.form__button:hover {
  background-color: #1f2937;

  /* Keep your current look (no visible hover shadow) while valid */
  box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.15);
}

.form__button:active {
  transform: translateY(1px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}

/* -------------------------
   11) Savebar (Sticky bottom)
------------------------- */
.savebar {
  position: sticky;
  bottom: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-top: 1px solid #e5e7eb;
}

.savebar__inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.savebar__text {
  margin: 0;
  color: #111827;
  font-size: 0.95rem;
}

.savebar__actions {
  display: flex;
  gap: 10px;
}

.savebar__button {
  border: 1px solid #111827;
  background: #111827;
  color: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
  cursor: pointer;
}

.savebar__button--ghost {
  background: transparent;
  color: #111827;
}

/* -------------------------
   12) Progress Bar (Fixed top)
------------------------- */
.progressbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  background: rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.progressbar__inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 10px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.progressbar__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: baseline;
  color: #111827;
  font-size: 0.95rem;
}

.progressbar__section,
.progressbar__saved {
  color: #475569;
}

.progressbar__track {
  grid-column: 1 / -1;
  height: 8px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.progressbar__fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: #3b82f6;
  transition: width 0.2s ease;
}

/* Legacy ID rule (kept) */
#progressbar-fill {
  transition: width 0.3s ease;
}

.progressbar__actions {
  display: flex;
  gap: 10px;
}

.progressbar__button {
  display: inline-block;
  background-color: #111827;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.progressbar__button:hover {
  background-color: #1f2937;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.15);
}

.progressbar__button:active {
  transform: translateY(1px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}

.progressbar__button--ghost {
  background: transparent;
  color: #374151;
  border: 1px solid #d1d5db;
}

.progressbar__button--ghost:hover {
  background-color: #f9fafb;
  border-color: #9ca3af;
  box-shadow: none;
}

.progressbar__button--ghost:active {
  transform: translateY(1px);
}

/* -------------------------
   13) Utilities / Visibility
------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* JS toggles */
.form__textarea--hidden {
  display: none;
}

.form__notice--hidden {
  display: none;
}

.form__group--hidden {
  display: none;
}

/* NOTE: Keeping behavior consistent with current build:
   This class existed but used an invalid value. Setting to 'none'
   can change visible labels. If WANT it to hide labels, change
   to display: none. For now it's kept non-impactful. */
.form__label--hidden {
  display: block;
  height: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

/* -------------------------
   14) Responsive / Media Queries
------------------------- */
@media (max-width: 520px) {
  .progressbar__inner {
    grid-template-columns: 1fr;
  }

  .progressbar__actions {
    justify-content: stretch;
  }

  .progressbar__button {
    width: 100%;
  }

  .savebar__inner {
    flex-direction: column;
    align-items: stretch;
  }

  .savebar__actions {
    justify-content: stretch;
  }

  .savebar__button {
    width: 100%;
  }
}

@media (min-width: 720px) {
  #timeline .form__options,
  #budget .form__options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 18px;
  }
}