/* ============================================
   FACEBOOK NATIVE LEAD FORM — EXACT REPLICA
   Zero dependencies. Maximum speed.
   ============================================ */

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

:root {
  --fb-blue: #1877F2;
  --fb-blue-hover: #166FE5;
  --fb-bg: #f0f2f5;
  --fb-card: #ffffff;
  --fb-text: #1c1e21;
  --fb-text-secondary: #65676b;
  --fb-text-tertiary: #8a8d91;
  --fb-border: #dddfe2;
  --fb-input-border: #ccd0d5;
  --fb-option-bg: #e4e6eb;
  --fb-option-selected: #d4e4ff;
  --fb-option-selected-border: #1877F2;
  --fb-radius-card: 16px;
  --fb-radius-btn: 24px;
  --fb-radius-option: 24px;
  --fb-radius-input: 8px;
  --fb-progress-bg: #dadde1;
  --fb-progress-fill: #1877F2;
  --fb-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --transition-speed: 0.35s;
  --transition-ease: cubic-bezier(0.32, 0.72, 0, 1);
}

html {
  font-family: var(--fb-font);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100%;
  overflow: hidden;
}

body {
  background: #000;
  color: var(--fb-text);
  height: 100%;
  overflow: hidden;
  position: relative;
}

/* ========== BLURRED BACKGROUND ========== */
.bg-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: 
    radial-gradient(ellipse at 30% 20%, rgba(120,100,60,0.5) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 60%, rgba(80,70,50,0.4) 0%, transparent 50%),
    linear-gradient(180deg, 
      #5a4e38 0%, 
      #4a4030 20%, 
      #3d3528 40%, 
      #332d22 60%, 
      #2a241c 80%, 
      #1e1a14 100%);
  background-size: cover;
  filter: blur(12px) brightness(0.8);
  transform: scale(1.1);
}

/* ========== STEP TRANSITIONS ========== */
.step {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Slide transitions */
  transform: translateX(100%);
  opacity: 0;
  visibility: hidden;
  transition: 
    transform var(--transition-speed) var(--transition-ease),
    opacity var(--transition-speed) var(--transition-ease),
    visibility 0s linear var(--transition-speed);
  will-change: transform, opacity;
}

.step.active {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  transition: 
    transform var(--transition-speed) var(--transition-ease),
    opacity var(--transition-speed) var(--transition-ease),
    visibility 0s linear 0s;
}

/* Going back — slide from left */
.step.exit-right {
  transform: translateX(100%);
  opacity: 0;
}

.step.exit-left {
  transform: translateX(-30%);
  opacity: 0.5;
}

/* First step starts visible without slide */
.step.no-transition {
  transition: none !important;
}

/* ========== TOP BAR ========== */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  flex-shrink: 0;
}

.top-bar-spacer { width: 40px; }

.close-btn, .back-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.4);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}

.close-btn:active, .back-btn:active {
  background: rgba(0,0,0,0.6);
}

/* ========== HERO BANNER ========== */
.hero-banner {
  width: 100%;
  height: 48px;
  position: relative;
  flex-shrink: 0;
}

/* ========== CARDS ========== */
.card {
  background: var(--fb-card);
  margin: 0 12px;
  border-radius: var(--fb-radius-card);
  padding: 20px;
  position: relative;
  z-index: 2;
}

.card-top {
  text-align: center;
  padding-top: 32px;
  margin-top: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  padding-bottom: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.card-badge {
  width: 56px;
  height: 56px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.badge-icon {
  width: 48px;
  height: 48px;
}

.badge-icon svg { width: 100%; height: 100%; }

.card-label {
  font-size: 13px;
  color: var(--fb-text-secondary);
  margin-bottom: 4px;
}

.card-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--fb-text);
  margin-bottom: 8px;
}

.card-subtitle {
  font-size: 14px;
  color: var(--fb-text-secondary);
  line-height: 1.4;
}

/* ========== FORM CARD (STEP 1) ========== */
.card-form {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  margin-top: 0;
  padding-top: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.form-heading {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 20px;
  color: var(--fb-text);
}

.form-heading-sub {
  font-weight: 700;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  width: 100%;
  padding: 14px 20px;
  border-radius: var(--fb-radius-option);
  border: none;
  background: var(--fb-option-bg);
  font-family: var(--fb-font);
  font-size: 15px;
  font-weight: 500;
  color: var(--fb-text);
  cursor: pointer;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s, box-shadow 0.12s;
  user-select: none;
}

.option-btn:active {
  background: #d8dadf;
}

.option-btn.selected {
  background: var(--fb-option-selected);
  box-shadow: inset 0 0 0 2px var(--fb-option-selected-border);
  color: var(--fb-blue);
  font-weight: 600;
}

/* ========== CONTACT CARD (STEP 2) ========== */
.card-contact {
  margin-top: 0;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.contact-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.contact-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--fb-text);
}

.info-icon {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.contact-desc {
  font-size: 14px;
  color: var(--fb-text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
}

.form-fields {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--fb-text-secondary);
  margin-bottom: 6px;
}

.field-input {
  width: 100%;
  padding: 12px 0;
  border: none;
  border-bottom: 1px solid var(--fb-input-border);
  font-family: var(--fb-font);
  font-size: 16px;
  color: var(--fb-text);
  background: transparent;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  border-radius: 0;
}

.field-input:focus {
  border-bottom-color: var(--fb-blue);
}

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

/* Phone row */
.phone-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--fb-input-border);
}

.phone-row .field-input {
  border-bottom: none;
}

.country-code {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding: 12px 0;
  cursor: pointer;
}

.flag-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--fb-text);
}

.code-text {
  font-size: 15px;
  color: var(--fb-text);
  margin-left: 2px;
}

.phone-input {
  flex: 1;
  min-width: 0;
}

/* Select */
.select-wrap {
  position: relative;
}

.field-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 28px;
  cursor: pointer;
}

.select-chevron {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* Date input styling */
input[type="date"] {
  -webkit-appearance: none;
}

input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
}

/* ========== CONFIRM CARD (STEP 3) ========== */
.card-confirm {
  margin-top: 0;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.confirm-badge {
  margin-bottom: 8px;
}

.confirm-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--fb-text);
  margin-bottom: 12px;
}

.confirm-text {
  font-size: 15px;
  color: var(--fb-text);
  line-height: 1.5;
  text-align: left;
  margin-bottom: 16px;
}

.confirm-divider {
  height: 1px;
  background: var(--fb-border);
  margin-bottom: 16px;
}

.confirm-success {
  font-size: 14px;
  color: var(--fb-text-secondary);
  text-align: left;
}

.spacer-grow {
  flex: 1;
}

/* ========== BOTTOM BAR ========== */
.bottom-bar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  background: var(--fb-card);
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  flex-shrink: 0;
  margin-top: auto;
}

.progress-track {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.progress-segment {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--fb-progress-bg);
  transition: background 0.3s;
}

.progress-segment.filled {
  background: var(--fb-progress-fill);
}

.continue-btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--fb-radius-btn);
  border: none;
  background: var(--fb-blue);
  color: #fff;
  font-family: var(--fb-font);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
}

.continue-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.continue-btn:not(:disabled):active {
  background: var(--fb-blue-hover);
}

/* ========== SPINNER ========== */
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner.hidden {
  display: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========== CALL CTA (STEP 3) ========== */
.bottom-bar-call {
  background: transparent;
  padding-top: 0;
}

.bottom-bar-call .progress-track { display: none; }

.next-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border-radius: var(--fb-radius-btn);
  border: none;
  background: var(--fb-blue);
  color: #fff;
  font-family: var(--fb-font);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
  letter-spacing: 0.3px;
}

.next-btn:active {
  background: var(--fb-blue-hover);
}

.next-btn svg {
  width: 18px;
  height: 18px;
}

.meta-note {
  font-size: 12px;
  color: var(--fb-text-tertiary);
  text-align: center;
  margin-top: 10px;
  line-height: 1.4;
}

/* ========== CARD ENTRANCE ========== */
@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0.7; }
  to { transform: translateY(0); opacity: 1; }
}

.step.active .card {
  animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ========== RESPONSIVE ========== */
@media (min-width: 480px) {
  .step {
    max-width: 420px;
    margin: 0 auto;
    left: 0;
    right: 0;
  }
}

@media (min-height: 800px) {
  .hero-banner {
    height: 72px;
  }
}

/* Prevent zoom on input focus on iOS */
@supports (-webkit-touch-callout: none) {
  .field-input, .field-select {
    font-size: 16px !important;
  }
}
