/* ==========================================================================
   Reset, Variables & Base – Mobile-first responsive foundation
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Breakpoints (use in media queries only; CSS vars for reference) */
  --bp-sm: 360px;
  --bp-md: 480px;
  --bp-lg: 768px;
  --bp-xl: 1024px;
  --bp-xxl: 1200px;

  /* Spacing scale – consistent across breakpoints */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 2.5rem;
  --space-3xl: 3rem;

  /* Touch target minimum (WCAG / Apple HIG) */
  --touch-min: 44px;

  /* Safe area for notched devices */
  --safe-top: env(safe-area-inset-top, 0);
  --safe-right: env(safe-area-inset-right, 0);
  --safe-bottom: env(safe-area-inset-bottom, 0);
  --safe-left: env(safe-area-inset-left, 0);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Montserrat', sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #fff;
  overflow-x: hidden;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  padding-left: calc(20px + var(--safe-left));
  padding-right: calc(20px + var(--safe-right));
}

/* Navigation */
.navbar {
  background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
}

.navbar__logo img {
  height: 40px;
  width: auto;
}

.navbar__links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.navbar__menu {
  display: flex;
  list-style: none;
  gap: 20px;
}

.navbar__menu a {
  text-decoration: none;
  color: #333;
  font-weight: 500;
  transition: color 0.3s;
}

.navbar__menu a:hover {
  color: #11998e;
}

.navbar__cta {
  background: #11998e;
  color: white;
  padding: 10px 20px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.3s;
}

.navbar__cta:hover {
  background: #0d7a72;
}

/* Mobile Menu */
.hamburger {
  display: none;
  flex-direction: column;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
}

.hamburger__bar {
  width: 25px;
  height: 3px;
  background: #333;
  margin: 3px 0;
  transition: 0.3s;
}

.mobile-menu {
  display: none;
  position: fixed;
  top: 70px;
  left: 0;
  width: 100%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  z-index: 999;
}

.mobile-menu ul {
  list-style: none;
  padding: 20px;
}

.mobile-menu ul li {
  margin: 10px 0;
}

.mobile-menu a {
  text-decoration: none;
  color: #333;
  font-weight: 500;
}

.menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 998;
}

/* Hero Section – fluid typography and responsive padding */
.hero-section {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  color: white;
  padding: clamp(1.5rem, 5vw, 5rem) 0 clamp(1.5rem, 4vw, 2.5rem);
  padding-top: calc(clamp(1.5rem, 5vw, 5rem) + var(--safe-top));
  padding-bottom: calc(clamp(1.5rem, 4vw, 2.5rem) + var(--safe-bottom));
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.hero-content {
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
  transition: all 0.3s ease-in-out;
}

.hero-section.step-mode .hero-content,
.hero-section.step-mode .hero-stars-image,
.hero-section.step-mode h1,
.hero-section.step-mode > .container > p {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-20px);
}

.hero-stars-image,
.hero-section h1,
.hero-section > .container > p {
  transition: all 0.3s ease-in-out;
}

.hero-stars-image {
  width: clamp(56px, 12vw, 80px);
  height: auto;
  margin-bottom: clamp(0.75rem, 3vw, 1.25rem);
}

.hero-section h1 {
  font-size: clamp(1.5rem, 4.5vw + 0.5rem, 2.5rem);
  font-weight: 700;
  margin-bottom: clamp(0.75rem, 2vw, 1.25rem);
  line-height: 1.2;
  padding: 0 0.25rem;
}

.hero-section p {
  font-size: clamp(0.9375rem, 1.5vw + 0.5rem, 1.2rem);
  margin-bottom: clamp(1.25rem, 4vw, 2.5rem);
  opacity: 0.9;
  padding: 0 0.5rem;
  line-height: 1.5;
}

/* Hero Form */
.hero-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 400px;
  margin: 0 auto;
}

.loan-select-wrapper {
  position: relative;
  width: 100%;
}

.loan-select {
  width: 100%;
  padding: clamp(14px, 3vw, 16px) 50px clamp(14px, 3vw, 16px) clamp(16px, 4vw, 20px);
  min-height: var(--touch-min);
  font-size: clamp(1rem, 2.5vw, 1.125rem);
  font-weight: 600;
  color: #1f2937;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(249, 250, 251, 0.9));
  border: 2px solid rgba(0, 0, 0, 0.08);
  border-radius: clamp(12px, 3vw, 16px);
  appearance: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.06),
    0 2px 8px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  margin: clamp(0.75rem, 2vw, 0.75rem) 0;
  -webkit-tap-highlight-color: transparent;
}

.loan-select:focus {
  outline: none;
  border-color: #11998e;
  box-shadow:
    0 8px 32px rgba(17, 153, 142, 0.15),
    0 4px 16px rgba(17, 153, 142, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transform: translateY(-2px);
}

.loan-select:hover {
  border-color: rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.08),
    0 3px 12px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* Custom dropdown arrow */
.loan-select-wrapper::after {
  content: '';
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #6b7280;
  pointer-events: none;
  transition: all 0.3s ease;
}

.loan-select:focus + .loan-select-wrapper::after,
.loan-select:hover + .loan-select-wrapper::after {
  border-top-color: #11998e;
  transform: translateY(-50%) scale(1.1);
}

.btn {
  background: #28a745;
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s;
  width: 100%;
}

.btn:hover {
  background: #0d7a72;
}

/* Multi-step Form – responsive padding and width */
.multi-step-wrapper {
  margin-top: clamp(1.5rem, 4vw, 2.5rem);
  position: relative;
  width: 100%;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  /* background: radial-gradient(circle at top left,
              rgba(255, 255, 255, 0.96),
              rgba(255, 255, 255, 0.88)); */
  /* border-radius: 32px; */
  box-shadow:
    0 40px 90px rgba(15, 23, 42, 0.28);
  padding: clamp(1.75rem, 4vw, 2.5rem) clamp(1.75rem, 4vw, 2.75rem);
  overflow: hidden;
}

/* Linear progress bar (full-form style) */
.container-progress {
  width: 100%;
  /* margin: 0 0 clamp(1rem, 3vw, 1.5rem) 0; */
  display: flex;
  justify-content: center;
  border: 5px solid;
  border-radius: 20px;
}

#progress-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

#progress-bar {
  /* Start at first-step progress so the bar is always visible,
     JS (updateProgressIndicator) will overwrite this on init */
  width: 8%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  transition: width 0.3s ease;
}

.step {
  display: none;
  background: transparent;
  border-radius: 0;
  padding: clamp(1.25rem, 5vw, 2.25rem) 0 0 0;
  box-shadow: none;
  border: none;
  max-width: min(500px, 100%);
  width: 100%;
  margin: 0 auto;
  opacity: 0;
  transform: translateY(40px) scale(0.92);
  transition: all 0.5s cubic-bezier(0.23, 1, 0.320, 1);
  position: relative;
  overflow: hidden;
}

.step::before {
  content: none;
}

.step.active {
  display: block !important;
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
}

.step.exiting-forward {
  opacity: 0;
  transform: translateX(-120%) scale(0.9);
}

.step.exiting-backward {
  opacity: 0;
  transform: translateX(120%) scale(0.9);
}

.step-inner {
  text-align: center;
  position: relative;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 28px;
  padding: clamp(2rem, 4vw, 2.75rem) clamp(2rem, 4vw, 2.75rem);
  box-shadow:
    0 18px 50px rgba(15, 23, 42, 0.16);
}

.step-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* padding-bottom: clamp(0.75rem, 2.5vw, 1.25rem); */
  /* border-bottom: 1px solid rgba(0, 0, 0, 0.05); */
  gap: 0.5rem;
}

.step-back-btn {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(249, 250, 251, 0.8));
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: clamp(10px, 2.5vw, 12px) clamp(14px, 3vw, 18px);
  min-height: var(--touch-min);
  color: #6b7280;
  font-size: clamp(0.8125rem, 1.5vw, 14px);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  -webkit-tap-highlight-color: transparent;
}

.step-back-btn:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 1), rgba(249, 250, 251, 0.9));
  border-color: rgba(0, 0, 0, 0.12);
  color: #374151;
  transform: translateX(-3px) translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.step-back-btn:active {
  transform: translateX(-2px) translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.step-back-btn i {
  font-size: 14px;
  transition: transform 0.2s ease;
}

.step-back-btn:hover i {
  transform: translateX(-2px);
}

.step-title {
  font-size: clamp(1rem, 2.5vw, 1.125rem);
  font-weight: 600;
  color: #1f2937;
  text-align: center;
  flex: 1;
  line-height: 1.3;
  padding: 0 0.25rem;
  word-break: break-word;
}

.step-actions {
  display: flex;
  gap: clamp(8px, 2vw, 12px);
  justify-content: center;
  align-items: stretch;
  margin-top: clamp(1rem, 2.5vw, 1.25rem);
  flex-wrap: wrap;
}

.step-actions .step-back-btn,
.step-actions .step-btn {
  flex: 1 1 auto;
  min-width: min(140px, 45%);
  min-height: var(--touch-min);
  height: auto;
  padding: 12px 16px;
}

/* Form layout utilities – stack on small screens */
.form-row {
  display: flex;
  gap: clamp(12px, 2.5vw, 16px);
  /* margin-bottom: clamp(0.75rem, 2vw, 1.25rem); */
  flex-wrap: wrap;
}

.form-group {
  flex: 1 1 auto;
  min-width: 0;
}

.form-group label {
  display: block;
  /* margin-bottom: 8px; */
  font-weight: 600;
  color: #374151;
  font-size: clamp(0.8125rem, 1.5vw, 14px);
}

/* Safety note styling */
.safety-note {
  background: linear-gradient(145deg, rgba(17, 153, 142, 0.1), rgba(56, 239, 125, 0.1));
  border: 1px solid rgba(17, 153, 142, 0.2);
  border-radius: clamp(8px, 2vw, 12px);
  padding: clamp(12px, 2.5vw, 16px) clamp(14px, 3vw, 20px);
  margin: clamp(0.75rem, 2vw, 1rem) 0;
  text-align: center;
}

.safety-note p {
  margin: 0;
  font-size: clamp(0.8125rem, 1.5vw, 14px);
  color: #1f2937;
  line-height: 1.4;
}

.safety-note strong {
  color: #11998e;
}

/* Employment details */
.employment-details {
  margin-top: clamp(1rem, 2vw, 1.25rem);
}

.step-label {
  /* margin-bottom: clamp(0.5rem, 1.5vw, 1.25rem); */
  font-size: clamp(0.9375rem, 2vw, 1.1rem);
  font-weight: 600;
  color: #333;
  display: block;
  text-align: left;
}

.step-input {
  width: 100%;
  padding: clamp(14px, 3vw, 16px);
  min-height: var(--touch-min);
  border: 2px solid #e1e5e9;
  border-radius: clamp(8px, 2vw, 12px);
  font-size: clamp(16px, 2.5vw, 1rem);
  margin: clamp(0.75rem, 2vw, 0.75rem) 0;
  transition: border-color 0.3s;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

/* Prevent zoom on focus in iOS for inputs with font-size >= 16px */
.step-input:focus {
  outline: none;
  border-color: #11998e;
}

.step-input.error {
  border-color: #dc3545;
  background-color: #fff5f5;
}

.error-message {
  color: #dc3545;
  font-size: 0.875rem;
  margin-top: 5px;
  font-weight: 500;
  animation: slideInError 0.3s ease-out;
}

@keyframes slideInError {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step-btn {
  background: #11998e;
  color: white;
  border: none;
  padding: clamp(12px, 2.5vw, 14px) clamp(16px, 4vw, 24px);
  min-height: var(--touch-min);
  border-radius: clamp(8px, 2vw, 12px);
  font-size: clamp(0.9375rem, 2vw, 1rem);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.step-btn:hover {
  background: #0d7a72;
}

.step-btn:active {
  transform: scale(0.98);
}

.step-btn:disabled,
.step-btn.loading {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

.step-btn.loading {
  position: relative;
}

.step-btn.loading::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-image {
  width: 50px;
  height: 50px;
}

/* Footer */
footer {
  background: #f8f9fa;
  padding: 40px 0 20px;
  margin-top: 60px;
}

.footer-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-logo img {
  height: 40px;
  width: auto;
}

.footer-nav ul {
  display: flex;
  list-style: none;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-nav a {
  text-decoration: none;
  color: #666;
  font-size: 0.9rem;
  transition: color 0.3s;
}

.footer-nav a:hover {
  color: #11998e;
}

/* Footer legal links (step form) */
.footer-legal-links {
  text-align: center;
  margin-top: 2rem;
}

.footer-legal-links a {
  color: #ffffff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: opacity 0.2s ease, color 0.2s ease;
  margin: 0 12px;
}

.footer-legal-links a:hover {
  opacity: 0.85;
}

.copyright {
  text-align: center;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #e1e5e9;
  color: #666;
  font-size: 0.9rem;
}

/* Screen Reader Only */
.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;
}

/* Legal Pages Styles */
.legal-hero {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  color: white;
  padding: 60px 0;
  text-align: center;
}

.legal-hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.legal-hero p {
  font-size: 1.1rem;
  opacity: 0.9;
}

.legal-section {
  padding: 60px 0;
  background: #fff;
}

.legal-section h2 {
  color: #333;
  font-size: 1.5rem;
  font-weight: 600;
  margin: 30px 0 15px 0;
}

.legal-section p,
.legal-section li {
  line-height: 1.7;
  color: #555;
  margin-bottom: 15px;
}

.legal-section ul,
.legal-section ol {
  margin-left: 20px;
  margin-bottom: 20px;
}

.legal-section li {
  margin-bottom: 8px;
}

.legal-section a {
  color: #11998e;
  text-decoration: none;
}

.legal-section a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Responsive Design – Mobile-first overrides
   ========================================================================== */

/* Tablet and down */
@media (max-width: 768px) {
  .container {
    padding-left: calc(16px + var(--safe-left));
    padding-right: calc(16px + var(--safe-right));
  }

  .hamburger {
    display: flex;
  }

  .navbar__links {
    display: none;
  }

  .form-row {
    flex-direction: column;
    gap: 12px;
  }

  .form-group {
    min-width: 100%;
  }

  .legal-hero h1 {
    font-size: clamp(1.5rem, 5vw, 2rem);
  }

  .legal-section {
    padding: clamp(2rem, 6vw, 2.5rem) 0;
  }

  .footer-container {
    flex-direction: column;
    text-align: center;
  }

  .footer-nav ul {
    justify-content: center;
    gap: 1rem;
  }

  .step-actions {
    flex-direction: row;
    width: 100%;
  }

  .step-actions .step-back-btn,
  .step-actions .step-btn {
    min-width: 0;
    flex: 1;
  }

  .footer-legal-links {
    margin-top: clamp(1.25rem, 4vw, 2rem);
    padding: 0 0.5rem;
  }

  .footer-legal-links a {
    display: inline-block;
    margin: 0.25rem 0.5rem;
    font-size: clamp(0.8125rem, 2vw, 14px);
  }
}

/* Small phones */
@media (max-width: 480px) {
  .container {
    padding-left: calc(12px + var(--safe-left));
    padding-right: calc(12px + var(--safe-right));
  }

  .multi-step-wrapper {
    padding: clamp(0.75rem, 3vw, 1rem) clamp(0.75rem, 2.5vw, 1rem);
    border-radius: 16px;
  }

  .step {
    padding: clamp(1rem, 4vw, 1.25rem) clamp(1rem, 3vw, 1.25rem);
  }

  .step-navigation {
    flex-wrap: wrap;
    justify-content: center;
  }

  .step-navigation .step-back-btn {
    order: -1;
    width: 100%;
    margin-bottom: 0.5rem;
  }

  .step-title {
    width: 100%;
    order: 0;
  }

  .step-actions {
    flex-direction: column;
    width: 100%;
  }

  .step-actions .step-back-btn,
  .step-actions .step-btn {
    width: 100%;
    min-width: 100%;
    justify-content: center;
  }

  .loading-image {
    width: 40px;
    height: 40px;
  }

  .copyright {
    margin-top: 1.5rem;
    padding-top: 1rem;
    font-size: clamp(0.8125rem, 2vw, 0.9rem);
    padding-left: var(--safe-left);
    padding-right: var(--safe-right);
  }
}

/* Extra small (e.g. iPhone SE, narrow devices) */
@media (max-width: 360px) {
  html {
    font-size: 15px;
  }

  .container {
    padding-left: calc(10px + var(--safe-left));
    padding-right: calc(10px + var(--safe-right));
  }

  .step-progress {
    gap: 2px;
  }

  .step-line {
    width: 10px;
    min-width: 8px;
  }

  .step-actions .step-back-btn,
  .step-actions .step-btn {
    padding: 12px 10px;
    font-size: 0.875rem;
  }
}

/* Landscape phones – reduce vertical padding to show more content */
@media (max-width: 768px) and (orientation: landscape) {
  .hero-section {
    padding-top: clamp(1rem, 3vw, 1.5rem);
    padding-bottom: clamp(1rem, 3vw, 1.5rem);
  }

  .multi-step-wrapper {
    margin-top: 0.75rem;
  }

  .step-progress {
    margin-bottom: 0.75rem;
  }

  .step {
    padding: 1rem 1.25rem;
  }
}