@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --surface-bg: #ffffff;
  --surface-card: #f8fafc;
  --surface-elevated: #ffffff;
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --card-radius: 24px;
  --shadow-soft: 0 4px 24px rgba(15, 23, 42, 0.06);
  --shadow-strong: 0 8px 40px rgba(15, 23, 42, 0.08);
  --shadow-focus: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--background-gradient);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.4s ease;
}

/* Form Shell */
.form-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 5vw, 64px) clamp(16px, 5vw, 48px);
}

.form-panel {
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  gap: clamp(24px, 4vw, 32px);
  padding: clamp(32px, 5vw, 48px);
  border-radius: var(--card-radius);
  background: var(--surface-elevated);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-strong);
}

/* Form Header */
.form-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}

.form-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.form-badge {
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border: 1px solid #a7f3d0;
  color: #047857;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Progress Steps */
.flow-progress {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.progress-step {
  position: relative;
  padding: 16px 12px;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  background: var(--surface-card);
  text-align: center;
  color: var(--text-muted);
  transition: all 0.3s ease;
}

.progress-step span {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--border-light);
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.progress-step p {
  font-size: 0.85rem;
  font-weight: 500;
}

.progress-step.is-active {
  border-color: var(--primary-color);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.04) 0%, rgba(99, 102, 241, 0.08) 100%);
  color: var(--text-primary);
}

.progress-step.is-active span {
  background: var(--primary-color);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.progress-step.is-complete {
  border-color: #10b981;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.04) 0%, rgba(16, 185, 129, 0.08) 100%);
  color: var(--text-primary);
}

.progress-step.is-complete span {
  background: #10b981;
  color: #fff;
}

/* Flow Cards */
.flow-stack {
  display: flex;
  flex-direction: column;
}

.flow-card {
  display: none;
  flex-direction: column;
  gap: 20px;
  padding: clamp(24px, 4vw, 32px);
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--surface-card);
}

.flow-card.is-active {
  display: flex;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.flow-card.success-card {
  text-align: center;
  align-items: center;
  gap: 24px;
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border-color: #a7f3d0;
}

/* Card Head */
.card-head .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.75rem;
  color: var(--primary-color);
  font-weight: 600;
  margin-bottom: 8px;
}

.card-head h2 {
  font-size: clamp(1.4rem, 3vw, 1.75rem);
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
  line-height: 1.3;
}

.support-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Form Fields */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.field input {
  width: 100%;
  border-radius: 12px;
  border: 1.5px solid var(--border-color);
  background: var(--surface-elevated);
  padding: 14px 16px;
  font-size: 1rem;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.field input::placeholder {
  color: var(--text-muted);
}

.field input:hover {
  border-color: #cbd5e1;
}

.field input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: var(--shadow-focus);
}

/* Phone Field */
.phone-field {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 12px;
  border: 1.5px solid var(--border-color);
  background: var(--surface-elevated);
  padding: 0 16px;
  transition: all 0.2s ease;
}

.phone-field:hover {
  border-color: #cbd5e1;
}

.phone-field:focus-within {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-focus);
}

.phone-field span {
  color: var(--text-secondary);
  font-weight: 600;
  padding-right: 12px;
  border-right: 1px solid var(--border-light);
}

.phone-field input {
  border: none;
  padding: 14px 0;
  background: transparent;
  flex: 1;
}

.phone-field input:focus {
  box-shadow: none;
}

/* Field Feedback */
.field-feedback {
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.field-feedback.is-visible {
  opacity: 1;
  color: var(--error-color);
}

/* Choice Pills */
.choice-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.choice-pill {
  flex: 1;
  min-width: 120px;
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 24px;
  background: var(--surface-elevated);
  color: var(--text-primary);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.choice-pill:hover {
  border-color: var(--primary-color);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.04) 0%, rgba(99, 102, 241, 0.08) 100%);
}

.choice-pill.active {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: #fff;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.25);
}

/* Notice Box */
.notice {
  border-radius: 16px;
  padding: 20px;
  border: 1px solid #fecaca;
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  color: #991b1b;
  text-align: left;
}

.notice h3 {
  font-size: 1rem;
  margin-bottom: 8px;
  font-weight: 600;
}

.notice p {
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Primary Button */
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--primary-color);
  border: none;
  color: #fff;
  border-radius: 14px;
  padding: 16px 32px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 8px;
}

.primary-button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.primary-button:not([disabled]):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
  background: var(--primary-hover);
}

.primary-button:not([disabled]):active {
  transform: translateY(0);
}

.spinner {
  display: none;
}

/* Success Card */
.success-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  border: 2px solid #6ee7b7;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #059669;
}

.summary-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  text-align: left;
  padding: 20px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 16px;
  border: 1px solid #d1fae5;
}

.summary-grid > div {
  padding: 12px;
}

.summary-grid span {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.summary-grid strong {
  font-size: 1rem;
  color: var(--text-primary);
}

.summary-grid [data-summary="limit"].is-hidden {
  display: none;
}

/* Success Actions */
.success-actions {
  width: 100%;
  display: flex;
  justify-content: center;
}

.ghost-button {
  padding: 12px 28px;
  border-radius: 12px;
  border: 1.5px solid var(--border-color);
  background: var(--surface-elevated);
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.ghost-button:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.04) 0%, rgba(99, 102, 241, 0.08) 100%);
}

/* Legal Text */
.legal-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
  margin-top: 8px;
}

.legal-link {
  color: var(--primary-color);
  text-decoration: none;
}

.legal-link:hover {
  text-decoration: underline;
}

/* Form Footer */
.form-footer {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
  margin-top: 8px;
}

.form-footer p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8rem;
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: var(--primary-color);
}

.footer-links span {
  color: var(--text-muted);
  font-size: 0.6rem;
}

/* Card Head H1 */
.card-head h1 {
  font-size: clamp(1.4rem, 3vw, 1.75rem);
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
  line-height: 1.3;
}

/* Responsive */
@media (max-width: 720px) {
  .form-panel {
    padding: 28px 24px;
    gap: 24px;
  }

  .flow-card {
    padding: 24px 20px;
  }

  .flow-progress {
    gap: 8px;
  }

  .progress-step {
    padding: 12px 8px;
  }

  .progress-step span {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }

  .progress-step p {
    font-size: 0.75rem;
  }
}

@media (max-width: 560px) {
  .form-shell {
    padding: 16px;
    align-items: flex-start;
  }

  .form-panel {
    padding: 24px 20px;
    border-radius: 20px;
  }

  .form-head {
    flex-direction: row;
    justify-content: center;
  }

  .choice-group {
    flex-direction: column;
  }

  .choice-pill {
    text-align: center;
  }

  .phone-field {
    flex-direction: row;
  }

  .primary-button {
    width: 100%;
  }

  .card-head h2 {
    font-size: 1.25rem;
  }
}
