/* ============================================================
   FileWall — Open Layout Onboarding
   ============================================================ */

:root {
  /* Brand */
  --primary: #29ABE2;
  --primary-hover: #2952C2;
  --primary-light: rgba(55, 103, 234, 0.06);
  --secondary: #5F78A3;
  --neutral: #74777F;

  /* Surface */
  --bg: #FCFDFE;
  /* very subtle background tone */
  --surface: #FFFFFF;
  --border: #E5E7EB;
  --border-focus: var(--primary);

  /* Text */
  --text-main: #111827;
  --text-secondary: #4B5563;
  --text-muted: #9CA3AF;

  /* Misc */
  --radius-pill: 999px;
  --radius-md: 8px;
  --transition: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', 'Manrope', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-main);
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
}

/* ─── BACKGROUND CONFIG ─── */
.hero-section,
.success-screen {
  background-image: url('bgd.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.hero-section::before,
.success-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.75);
  /* <-- Tweak '0.4' here. Lower = more image, Higher = whiter */
  z-index: 0;
}

/* ─── HERO SECTION ─── */
.hero-section {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg);
  overflow: hidden;
  transition: opacity 350ms ease;
  z-index: 20;
}

.hero-section.fade-out {
  opacity: 0;
  pointer-events: none;
}

.onboarding-layout {
  display: none;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 500ms ease;
}

.onboarding-layout.fade-in {
  opacity: 1;
}

/* Background Elements */
.hero-bg-elements {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: float 10s ease-in-out infinite;
}

.blob-1 {
  width: 300px;
  height: 300px;
  background: var(--primary-light);
  top: -100px;
  left: -100px;
}

.blob-2 {
  width: 250px;
  height: 250px;
  background: rgba(95, 120, 163, 0.1);
  bottom: 0;
  right: 0;
  animation-delay: -5s;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-20px);
  }
}

/* Hero Content */
.hero-content {
  position: relative;
  z-index: 1;
  max-width: 720px;
  text-align: center;
  padding: 0 24px;
  animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-icon {
  height: 56px;
  width: auto;
  margin-bottom: 24px;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 16px;
}

.hero-title .highlight {
  color: var(--primary);
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin: 0 auto 40px;
  max-width: 600px;
  line-height: 1.6;
}

.success-screen .hero-subtitle {
  margin-bottom: 0; /* Clear boundary natively for tight line rhythms */
}

.hero-cta {
  font-size: 1.125rem;
  padding: 16px 40px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(55, 103, 234, 0.2);
  transition: all 300ms ease;
  font-weight: 600;
}

.hero-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(55, 103, 234, 0.3);
}

.hero-cta-subtext {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 16px;
  font-weight: 500;
}

/* ─── LAYOUT ─── */

/* ─── LEFT SIDEBAR (STEPPER) ─── */
.stepper-sidebar {
  width: 280px;
  min-width: 240px;
  border-right: 1px solid var(--border);
  padding: 48px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg);
  z-index: 10;
}

.brand-logo {
  max-height: 42px;
  width: auto;
  display: block;
}

.vertical-stepper {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 32px;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.step-marker {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #F3F4F6;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all var(--transition);
  position: relative;
}

/* Active ring state like the screenshot */
.step-item.active .step-marker {
  background: var(--primary);
  color: #fff;
}

.step-item.active .step-marker::before {
  content: '';
  position: absolute;
  top: -5px;
  right: -5px;
  bottom: -5px;
  left: -5px;
  border: 2px solid var(--primary);
  border-radius: 50%;
  animation: pulseIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes pulseIn {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Completed filled state */
.step-item.completed .step-marker {
  background: #EBF1FF;
  /* Lighter primary tint */
  color: var(--primary);
}

.step-line {
  width: 2px;
  height: 48px;
  background: #F3F4F6;
  margin: 8px 0;
  transition: background var(--transition);
}

.step-item.completed .step-line {
  background: #EBF1FF;
}

/* ─── MAIN CONTENT ─── */
.onboarding-main {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 64px;
  /* Centering vertical logic is handled by form height/flex */
}

#surveyForm,
.success-container {
  width: 100%;
  max-width: 800px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.steps-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.step {
  position: absolute;
  width: 100%;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transform: translateX(24px);
  transition: opacity 250ms ease, transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.step.active {
  position: relative;
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transform: translateX(0);
}

.step.exit-left {
  transform: translateX(-24px);
}

.step.exit-right {
  transform: translateX(24px);
}

/* Step Typography */
.question-title {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 24px;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.question-subtext {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-top: -12px;
  margin-bottom: 32px;
}

/* ─── PILL OPTIONS UI ─── */
.options-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 16px;
  max-width: 600px;
  margin: 0 auto;
}

.pill-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 200ms ease;
  user-select: none;
}

.pill-label:hover {
  border-color: #D1D5DB;
  color: var(--text-main);
  background: #F9FAFB;
}

.pill-label:active {
  transform: scale(0.98);
}

/* Native CSS state check (requires standard browsers) */
.pill-label:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-hover);
}

.pill-label input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* ─── INPUT STACK (STEP 1) ─── */
.input-stack {
  max-width: 400px;
  margin: 0 auto;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

input[type="email"],
input[type="text"],
select {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--text-main);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition);
}

input[type="email"]:focus,
input[type="text"]:focus,
select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(55, 103, 234, 0.1);
}

input[type="email"]::placeholder,
input[type="text"]::placeholder {
  color: var(--text-muted);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* ─── FOOTER & BUTTONS ─── */
.onboarding-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 32px 0 48px;
}

.btn {
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 12px 28px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 200ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  outline: none;
}

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

.btn-primary {
  background: var(--primary);
  color: #fff;
  margin-left: auto;
  /* Push to right if alone */
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  /* Optional soft shadow */
  box-shadow: 0 4px 14px rgba(55, 103, 234, 0.25);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: #F3F4F6;
  color: var(--text-main);
}

.spinner {
  width: 18px;
  height: 18px;
  animation: spin 0.8s linear infinite;
}

.spinner circle {
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  stroke-dasharray: 42;
  stroke-dashoffset: 14;
  stroke-linecap: round;
}

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

/* ─── SUCCESS SCREEN ─── */
.success-screen {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 10;
}

.success-screen.fade-in {
  animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.success-content {
  position: relative;
  z-index: 10;
  max-width: 800px;
  padding: 0 24px;
}
/* ─── REFERRAL SECTION (MINIMAL) ─── */
.referral-section.minimal {
  margin-top: 20px;
  opacity: 0;
  animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: 0.2s; 
  display: flex;
  flex-direction: column;
  align-items: center;
}

.referral-divider {
  width: 64px;
  height: 1px;
  background-color: rgba(116, 119, 127, 0.25);
  border: none;
  margin: 0 auto 20px;
}

.referral-hint {
  font-size: 0.875rem; 
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-align: center;
  font-weight: 400;
}

.referral-actions-minimal {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
}

.icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid rgba(116, 119, 127, 0.2);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 250ms ease;
  padding: 0;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  transition: color 250ms ease;
}

.icon-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  border-color: var(--primary);
  color: var(--primary);
}

.icon-btn:hover svg {
  color: var(--primary);
}

.tooltip-wrapper {
  position: relative;
  display: inline-flex;
}

.tooltip-text {
  position: absolute;
  top: -36px;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--text-main);
  color: #fff;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 6px;
  opacity: 0;
  visibility: hidden;
  transition: all 200ms ease;
  pointer-events: none;
  white-space: nowrap;
}

.tooltip-text::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 4px 4px 0;
  border-style: solid;
  border-color: var(--text-main) transparent transparent transparent;
}

.tooltip-text.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ─── CONDITIONAL SECTION ─── */
.conditional-wrapper {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 300ms ease, opacity 300ms ease, margin-top 300ms ease;
  margin-top: 0;
  overflow: hidden;
  width: 100%;
}

.conditional-wrapper.open {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 48px;
}

#otherInputWrapper.open {
  margin-top: 24px;
}

.conditional-inner {
  min-height: 0;
}

.question-subtitle {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.options-small {
  gap: 10px;
}

.options-small .pill-label {
  padding: 10px 20px;
  font-size: 0.875rem;
}

.other-input-field {
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.input-with-counter {
  position: relative;
  width: 100%;
}

.input-with-counter input {
  padding-right: 50px !important;
}

.char-counter {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: var(--text-muted);
  pointer-events: none;
  font-weight: 500;
  transition: color var(--transition);
}

.char-counter.limit-reached {
  color: #EF4444;
}

/* ─── FOOTER ─── */
.site-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 24px 32px;
  background: transparent;
  /* <-- Changed from var(--bg). Use rgba(252, 253, 254, 0.5) if you want it semi-visible instead of fully transparent! */
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: opacity 400ms ease;
  z-index: 50;
}

.site-footer.fade-out {
  opacity: 0;
  pointer-events: none;
}

.mt-4 {
  margin-top: 16px;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 800px) {

  .hero-section,
  .success-screen {
    background-image: url('bgm.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

  }

  .hero-title {
    font-size: 2.5rem;
  }

  .hero-subtitle {
    font-size: 1.125rem;
  }

  body {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
  }

  .hero-section,
  .success-screen {
    align-items: center;
    padding: 32px 20px 100px;
    /* Pads 100px bottom clearing the absolute footer perfectly */
    height: auto;
    min-height: 100vh;
  }

  .hero-content {
    margin-top: 0;
  }

  .onboarding-layout {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    justify-content: flex-start;
    padding: 0;
  }

  .stepper-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 60px 20px 20px;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 100;
    flex: none;
  }

  /* Rotate stepper to horizontal */
  .vertical-stepper {
    flex-direction: row;
    justify-content: center;
    margin-top: 42px;
  }

  .step-item {
    flex-direction: row;
  }

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

  /* Only display line connecting steps horizontally */
  .step-line {
    width: 3vw;
    height: 2px;
    margin: 0 4px;
    /* minimal separation horizontally */
  }

  .onboarding-main {
    padding: 12px 20px 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    flex: 1;
  }

  .steps-wrapper {
    align-items: stretch;
    padding-top: 0;
    width: 100%;
  }

  .question-title {
    margin-bottom: 20px;
  }

  .question-subtext {
    margin-bottom: 24px;
  }

  .step-footer {
    margin-top: 28px;
    margin-bottom: 0;
  }

  .step {
    position: relative;
    /* Reset absolute so container scales on mobile scroll */
  }

  .step:not(.active) {
    display: none;
  }

  /* Footer Mobile */
  .site-footer {
    padding: 32px 20px 24px;
  }

  .question-title {
    font-size: 1.5rem;
  }
}