/* ============================================================
   REALIO — Onboarding & Swipe Tutorial
   ============================================================
   Standalone styles, loaded BEFORE app.css. Brand-consistent
   with main app: ink black + coral red + warm cream.
*/

/* ============================================================
   ROOT CONTAINER (replaces #appRoot during onboarding)
   ============================================================ */
.ob-root {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: var(--bg, #FAFAF7);
  display: flex;
  flex-direction: column;
  font-family: var(--sans, -apple-system, sans-serif);
  color: var(--ink, #1A1A1A);
  overflow: hidden;
  /* iOS safe areas */
  padding-top: env(safe-area-inset-top, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.ob-root * { box-sizing: border-box; }

/* ============================================================
   HEADER (back + progress)
   ============================================================ */
.ob-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px 6px;
  flex-shrink: 0;
}
.ob-back {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  flex-shrink: 0;
  margin-left: -8px;
  -webkit-tap-highlight-color: transparent;
}
.ob-back:active { background: rgba(0,0,0,0.06); }
.ob-back svg { width: 22px; height: 22px; stroke: var(--ink, #1A1A1A); stroke-width: 2; }
.ob-back.hidden { visibility: hidden; }

.ob-progress-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ob-progress-label {
  font-size: 12px;
  color: var(--ink-soft, #6B6B6B);
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.ob-progress {
  flex: 1;
  height: 4px;
  background: #EBEAE4;
  border-radius: 100px;
  overflow: hidden;
}
.ob-progress-fill {
  height: 100%;
  background: var(--accent, #F87829);
  border-radius: 100px;
  transition: width 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ============================================================
   SCROLL AREA + STEPS
   ============================================================ */
.ob-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
}
.ob-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 24px;
  animation: obStepIn 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes obStepIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   STEP 1 — WELCOME
   ============================================================ */
.ob-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 0 30px;
}
.ob-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
}
.ob-brand-logo-full {
  display: block;
  width: auto;
  height: 44px;
  max-width: 80%;
  object-fit: contain;
}

.ob-illustration {
  width: 230px;
  height: 230px;
  background: radial-gradient(circle at 50% 40%, #ffffff 0%, #F5F3EC 65%, #EDE9DD 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 36px;
  position: relative;
  box-shadow: 0 8px 40px rgba(26,26,26,0.06);
}
.ob-illustration::before {
  /* Subtle outer glow */
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, transparent 60%, rgba(214,59,47,0.08) 100%);
  pointer-events: none;
}
.ob-illustration svg {
  width: 180px;
  height: 180px;
  position: relative;
}

/* Robot eye animation — subtle blink + glow pulse */
@keyframes obEyeBlink {
  0%, 92%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.1); }
}
@keyframes obEyeGlow {
  0%, 100% { filter: brightness(1) drop-shadow(0 0 3px #6FC3F7); }
  50% { filter: brightness(1.18) drop-shadow(0 0 8px #6FC3F7); }
}
.ob-robot-eye {
  transform-origin: center;
  animation: obEyeBlink 4.5s ease-in-out infinite, obEyeGlow 2.6s ease-in-out infinite;
}
.ob-robot-antenna {
  transform-origin: bottom center;
  animation: obAntennaWobble 3.5s ease-in-out infinite;
}
@keyframes obAntennaWobble {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}
.ob-robot-body {
  animation: obFloat 4s ease-in-out infinite;
  transform-origin: center;
}
@keyframes obFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.ob-title {
  font-family: var(--serif, Georgia);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 14px;
  max-width: 320px;
}
.ob-title em {
  font-style: italic;
  color: var(--accent, #F87829);
}
.ob-sub {
  font-size: 16px;
  color: var(--ink-soft, #6B6B6B);
  line-height: 1.5;
  max-width: 320px;
  margin: 0 auto;
}

/* ============================================================
   STEP 2 — FILTER
   ============================================================ */
.ob-step-2 {
  padding-top: 16px;
}
.ob-step-2 .ob-title {
  text-align: left;
  font-size: 30px;
  margin-bottom: 8px;
  max-width: none;
}
.ob-step-2 .ob-sub {
  text-align: left;
  font-size: 14.5px;
  margin: 0 0 28px 0;
  max-width: none;
}

.ob-section {
  margin-bottom: 26px;
}
.ob-section-title {
  font-family: var(--serif, Georgia);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin-bottom: 12px;
  color: var(--ink, #1A1A1A);
}

/* Country grid */
.ob-country-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.ob-country-chip {
  background: white;
  border: 1.5px solid var(--line, #EBEAE4);
  border-radius: 14px;
  padding: 14px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.ob-country-chip:active { transform: scale(0.97); }
.ob-country-chip.selected {
  border-color: var(--accent, #F87829);
  background: var(--accent, #F87829);
  color: white;
}
.ob-country-flag {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}
.ob-country-info {
  flex: 1;
  min-width: 0;
}
.ob-country-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ob-country-count {
  font-size: 11px;
  opacity: 0.6;
  margin-top: 1px;
}
.ob-country-chip.any {
  grid-column: 1 / -1;
  justify-content: center;
}

/* Budget chips */
.ob-budget-chips {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.ob-budget-chip {
  background: white;
  border: 1.5px solid var(--line, #EBEAE4);
  border-radius: 100px;
  padding: 11px 8px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  text-align: center;
}
.ob-budget-chip:active { transform: scale(0.96); }
.ob-budget-chip.selected {
  background: var(--accent, #F87829);
  color: white;
  border-color: var(--accent, #F87829);
}

/* Budget range slider (visual indicator) */
.ob-budget-slider-wrap {
  margin-top: 6px;
  padding: 4px 0;
}
.ob-budget-track {
  position: relative;
  height: 6px;
  background: #EBEAE4;
  border-radius: 100px;
  margin: 18px 0 10px;
}
.ob-budget-fill {
  position: absolute;
  height: 100%;
  background: var(--accent, #F87829);
  border-radius: 100px;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ob-budget-thumb {
  position: absolute;
  top: 50%;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--accent, #F87829);
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 8px rgba(248,120,41,0.25);
  transition: left 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ob-budget-thumb.start { left: 0; }
.ob-budget-thumb.end { left: 100%; }
.ob-budget-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-soft, #6B6B6B);
  font-variant-numeric: tabular-nums;
}

/* Purpose segmented */
.ob-purpose-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.ob-purpose-chip {
  background: white;
  border: 1.5px solid var(--line, #EBEAE4);
  border-radius: 14px;
  padding: 16px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.ob-purpose-chip:active { transform: scale(0.97); }
.ob-purpose-chip.selected {
  border-color: var(--accent, #F87829);
  background: var(--accent, #F87829);
  color: white;
}
.ob-purpose-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ob-purpose-chip.selected .ob-purpose-icon {
  background: rgba(255,255,255,0.15);
}
.ob-purpose-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }
.ob-purpose-label {
  font-size: 14px;
  font-weight: 600;
}

/* ============================================================
   FOOTER (CTA + skip / secondary)
   ============================================================ */
.ob-footer {
  flex-shrink: 0;
  padding: 16px 24px calc(20px + env(safe-area-inset-bottom, 0));
  background: var(--bg, #FAFAF7);
  border-top: 1px solid transparent;
  position: relative;
}
.ob-footer::before {
  /* Gradient fade so content scrolling under feels natural */
  content: '';
  position: absolute;
  top: -28px; left: 0; right: 0;
  height: 28px;
  background: linear-gradient(to top, var(--bg, #FAFAF7) 0%, transparent 100%);
  pointer-events: none;
}
.ob-cta {
  width: 100%;
  background: var(--accent, #F87829);
  color: white;
  border: none;
  padding: 17px 20px;
  border-radius: 100px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: -0.005em;
  box-shadow: 0 4px 16px rgba(248, 120, 41, 0.25);
}
.ob-cta:active { transform: scale(0.985); box-shadow: 0 2px 8px rgba(248, 120, 41, 0.2); }
.ob-cta:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}
.ob-cta-secondary {
  display: block;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--accent, #F87829);
  cursor: pointer;
  padding: 14px 20px 4px;
  margin: 0 auto;
  font-weight: 600;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.ob-cta-secondary svg {
  width: 14px;
  height: 14px;
  display: inline-block;
  vertical-align: -2px;
  margin-right: 4px;
  fill: var(--accent, #F87829);
}
.ob-skip {
  display: block;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink-soft, #6B6B6B);
  cursor: pointer;
  padding: 12px 16px 4px;
  margin: 0 auto;
  font-weight: 500;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.ob-skip:active { color: var(--ink, #1A1A1A); }

/* ============================================================
   SWIPE TUTORIAL OVERLAY
   ============================================================ */
.swipe-hint {
  position: absolute;
  inset: 0;
  z-index: 100;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26,26,26,0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: swipeHintFadeIn 0.3s ease-out;
  cursor: pointer;
}
@keyframes swipeHintFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.swipe-hint.hide {
  animation: swipeHintFadeOut 0.3s ease-out forwards;
}
@keyframes swipeHintFadeOut {
  to { opacity: 0; pointer-events: none; }
}

.swipe-hint-inner {
  position: relative;
  width: 280px;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.swipe-hint-card {
  position: absolute;
  width: 160px;
  height: 200px;
  background: white;
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
  animation: swipeDemo 3.6s ease-in-out infinite;
  overflow: hidden;
}
.swipe-hint-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 60%;
  background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.5));
}
.swipe-hint-card-img {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, #d8b67e 0%, #94774f 60%, #4a3a26 100%);
}

@keyframes swipeDemo {
  0%   { transform: translateX(0) rotate(0); }
  15%  { transform: translateX(-72px) rotate(-12deg); }
  30%  { transform: translateX(0) rotate(0); }
  50%  { transform: translateX(0) rotate(0); }
  65%  { transform: translateX(72px) rotate(12deg); }
  80%  { transform: translateX(0) rotate(0); }
  100% { transform: translateX(0) rotate(0); }
}

.swipe-hint-icon {
  position: absolute;
  top: 50%;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-50%);
  font-size: 26px;
  font-weight: 700;
  font-family: -apple-system, sans-serif;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
.swipe-hint-icon.left {
  left: 12px;
  background: white;
  color: var(--accent, #F87829);
  animation: swipeIconLeft 3.6s ease-in-out infinite;
}
.swipe-hint-icon.right {
  right: 12px;
  background: white;
  color: var(--green, #2F7D5B);
  animation: swipeIconRight 3.6s ease-in-out infinite;
}
@keyframes swipeIconLeft {
  0%, 12%, 30%, 100% { opacity: 0.45; transform: translateY(-50%) scale(1); }
  15% { opacity: 1; transform: translateY(-50%) scale(1.18); }
}
@keyframes swipeIconRight {
  0%, 62%, 80%, 100% { opacity: 0.45; transform: translateY(-50%) scale(1); }
  65% { opacity: 1; transform: translateY(-50%) scale(1.18); }
}

.swipe-hint-label {
  position: absolute;
  bottom: -50px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.swipe-hint-label small {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.7;
  font-weight: 400;
}

/* Smaller phones — tighter layout */
@media (max-height: 700px) {
  .ob-illustration { width: 180px; height: 180px; margin-bottom: 24px; }
  .ob-illustration svg { width: 140px; height: 140px; }
  .ob-title { font-size: 28px; }
  .ob-welcome { padding: 0 0 16px; }
  .ob-brand { margin-bottom: 18px; }
}
