/**
 * Ilk acilis onboarding overlay'i. Mevcut token sistemine (style.css :root)
 * tamamen bagli — burada hicbir renk hardcode edilmez (kind renkleri haric,
 * onlar da mevcut app genelinde zaten tema-bagimsiz sabitler).
 */

@property --onboarding-ring-pct {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

.aots-onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  background: transparent;
  color: #0c1222;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  opacity: 0;
  transition: opacity 0.18s cubic-bezier(0.22, 1, 0.36, 1);
  --onboarding-scrim: #f3f5f7;
}

.aots-onboarding-overlay.is-visible {
  opacity: 1;
}

.aots-onboarding-overlay[hidden] {
  display: none !important;
}

html[data-theme='dark'] .aots-onboarding-overlay {
  --onboarding-scrim: #06080d;
  color: #e9eef5;
}

/* ── Spotlight: gercek arka plani "kapatan" katman — bir hedef
   gosterildiginde, box-shadow spread'i o pencerenin DISINDA her yeri
   kaplar, pencerenin ICI seffaf kalir ve altindaki gercek uygulama
   (or. alt tab-bar) oldugu gibi gorunur. ────────────────────────────── */

.aots-ob-spotlight {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border-radius: 999px;
  box-shadow: 0 0 0 9999px var(--onboarding-scrim);
  pointer-events: none;
  transition:
    top 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    left 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    width 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    border-radius 0.3s ease;
}

@media (prefers-reduced-motion: reduce) {
  .aots-ob-spotlight {
    transition: none;
  }
}

/* ── Spotlight penceresinde gorunen gercek tab-bar ogesine vurgu ─────
   Bu class GERCEK uygulama elemanina (or. #tabBarQuickTrack) gecici
   olarak eklenir — onboarding kapaninca/sahne degisince kaldirilir. ── */

.aots-ob-target-highlight {
  position: relative;
  z-index: 2;
}

.aots-ob-target-highlight::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: inherit;
  border: 2px solid var(--primary);
  box-shadow: 0 0 0 4px var(--primary-weak);
  pointer-events: none;
  animation:
    aots-ob-target-ring-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both,
    aots-ob-target-pulse 2.4s ease-in-out 0.4s infinite;
}

.aots-ob-target-highlight.aots-ob-target-highlight--circle::after {
  inset: -6px;
}

@keyframes aots-ob-target-ring-in {
  0% { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Yavas ve sakin bir "nefes" — dikkat cekmeli ama rahatsiz etmemeli. */
@keyframes aots-ob-target-pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--primary-weak); }
  50% { box-shadow: 0 0 0 9px color-mix(in srgb, var(--primary) 12%, transparent); }
}

@media (prefers-reduced-motion: reduce) {
  .aots-ob-target-highlight::after {
    animation: none;
    opacity: 1;
    transform: none;
    box-shadow: 0 0 0 5px var(--primary-weak);
  }
}

.aots-ob-chrome {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

/* ── Üst bar: ilerleme noktaları + atla ───────────────────────────── */

.aots-ob-topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 8px;
}

.aots-ob-progress {
  display: flex;
  align-items: center;
  gap: 6px;
}

.aots-ob-progress-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  transition: width 0.22s ease, background 0.22s ease;
}

.aots-ob-progress-dot.is-active {
  width: 18px;
  background: var(--primary-grad);
}

.aots-ob-progress-dot.is-done {
  background: var(--primary);
  opacity: 0.55;
}

.aots-ob-skip {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 10px 12px;
  min-height: 44px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.aots-ob-skip:hover,
.aots-ob-skip:focus-visible {
  color: var(--text);
}

.aots-ob-skip:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Sahnealanı ───────────────────────────────────────────────────── */

.aots-ob-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.aots-ob-scene {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 8px 24px 24px;
  opacity: 0;
  pointer-events: none;
}

.aots-ob-scene.is-active {
  opacity: 1;
  pointer-events: auto;
}

.aots-ob-heading {
  margin: 0;
  font-size: clamp(1.25rem, 5vw, 1.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: center;
  max-width: 340px;
}

.aots-ob-subtext {
  margin: -8px 0 0;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
  max-width: 320px;
}

.aots-ob-visual {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: min(42vh, 300px);
}

/* ── Reveal zone: spotlight penceresi + coachmark karti icin yer acan
   GORUNMEZ bosluk. Kendi icerigi yoktur; sadece CTA'yi (bottom) ya da
   topbar'i (top) o bolgenin disina iter. ────────────────────────────── */

.aots-ob-reveal-zone {
  flex-shrink: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
  transition: height 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-reduced-motion: reduce) {
  .aots-ob-reveal-zone {
    transition: none;
  }
}

/* ── Coachmark (FeatureHint): gercek bir UI elemanini isaret eden,
   ucu (pointer) hedefe bakan kucuk aciklama karti. ─────────────────── */

.aots-ob-coach {
  position: fixed;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(320px, calc(100vw - 24px));
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-solid);
  box-shadow: var(--shadow-lg);
  opacity: 0;
}

.aots-ob-coach[hidden] {
  display: none !important;
}

.aots-ob-coach-icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--primary-weak);
  color: var(--primary);
}

.aots-ob-coach-icon[hidden] {
  display: none;
}

.aots-ob-coach-icon svg {
  width: 19px;
  height: 19px;
}

.aots-ob-coach-text {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

/* Ucu: 45° dondurulmus kare — kartla ayni yuzey/kenarlik, bu yuzden
   konusma balonu kuyrugu gibi kusursuz birlesir. */
.aots-ob-coach-pointer {
  position: absolute;
  width: 13px;
  height: 13px;
  margin-left: -6.5px;
  background: var(--surface-solid);
  transform: rotate(45deg);
}

.aots-ob-coach:not(.aots-ob-coach--up) .aots-ob-coach-pointer {
  bottom: -7px;
  border-right: 1.5px solid var(--border);
  border-bottom: 1.5px solid var(--border);
  border-bottom-right-radius: 3px;
}

.aots-ob-coach--up .aots-ob-coach-pointer {
  top: -7px;
  border-left: 1.5px solid var(--border);
  border-top: 1.5px solid var(--border);
  border-top-left-radius: 3px;
}

@media (max-width: 359px) {
  .aots-ob-coach {
    padding: 10px 12px;
    gap: 8px;
  }

  .aots-ob-coach-icon {
    width: 30px;
    height: 30px;
  }
}

/* ── Alt CTA ───────────────────────────────────────────────────────── */

.aots-ob-nav {
  flex-shrink: 0;
  padding: 8px 20px calc(18px + env(safe-area-inset-bottom, 0px));
}

.aots-ob-cta {
  width: 100%;
  min-height: 50px;
}

.aots-ob-cta:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ── Sahne içi mini component'ler (mevcut sınıfları görsel olarak
   taklit eden, sadeleştirilmiş onboarding-özel bileşenler) ─────────── */

.ob-card {
  width: 100%;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-solid);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ob-time-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.ob-time-pill {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  font-weight: 700;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.ob-status-row {
  display: flex;
  justify-content: center;
}

.ob-alarm-stack {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 190px;
}

.ob-alarm-beatb {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.ob-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 260px;
  text-align: left;
}

.ob-endpoint-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-top: 6px;
}

.ob-endpoint-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: transparent;
}

.ob-endpoint-dot.is-filled {
  background: var(--primary);
}

.ob-endpoint-line {
  width: 2px;
  flex: 1;
  min-height: 18px;
  background: var(--border);
}

.ob-itinerary-card {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm);
}

.ob-itinerary-card.is-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-weak);
}

.ob-itinerary-meta {
  font-size: 1rem;
  font-weight: 800;
}

.ob-itinerary-sub {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}

.ob-itinerary-badges {
  display: flex;
  gap: 4px;
}

.ob-mini-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}

.ob-mini-badge.walk {
  background: color-mix(in srgb, #16a34a 16%, transparent);
  color: #16a34a;
}

.ob-mini-badge.tram {
  background: color-mix(in srgb, #9333ea 16%, transparent);
  color: #9333ea;
}

.ob-mini-badge.bus {
  background: var(--primary-weak);
  color: var(--primary);
}

.ob-badge-row {
  display: flex;
  gap: 8px;
  pointer-events: none;
}

/* ── Araç takip sahnesi ───────────────────────────────────────────── */

.ob-track-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
}

.ob-track-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  width: 100%;
}

.ob-track-list .route-row {
  pointer-events: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.ob-track-list .route-row.is-picked {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-weak);
  background: var(--surface);
}

.ob-track-confirm {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

/* ── Harita sahnesi ────────────────────────────────────────────────── */

.aots-ob-map-canvas {
  width: 100%;
  height: min(42vh, 300px);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-3);
  position: relative;
}

/* Leaflet'in kendi kontrol/atıf katmanları onboarding'de gereksiz. */
.aots-ob-map-canvas .leaflet-control-container,
.aots-ob-map-canvas .leaflet-control-attribution {
  display: none;
}

/* ── FLIP ghost katmanı (motion.js tarafından oluşturulur) ──────────── */

.aots-ob-ghost {
  will-change: transform, opacity, clip-path;
}

/* ── Final sahne — tek istisna spring overshoot ──────────────────────── */

.aots-ob-final-logo {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  box-shadow: 0 14px 36px rgba(13, 148, 136, 0.24);
}

/* ── Reused component'lerin onboarding-scope küçültülmüş varyantları ── */

/* job.html'de ring `.job-pulse-ring-wrap` (flex-shrink:0) icinde duruyor;
   burada dogrudan bir kolon-flex konteynerin cocugu oldugu icin kendi
   flex-shrink:0'ini kendisi tasimali — yoksa dikeyde ezilip elips olur. */
.aots-onboarding-overlay .job-pulse-ring {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  background: conic-gradient(var(--primary) var(--onboarding-ring-pct), var(--surface-3) 0);
}

.aots-onboarding-overlay .job-pulse-num {
  font-size: 0.9375rem;
}

.aots-onboarding-overlay .bus-chip {
  width: 108px;
  min-height: 88px;
}

/* ── Reduced motion / düşük performans modu ──────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .aots-onboarding-overlay,
  .aots-ob-scene,
  .aots-ob-progress-dot {
    transition-duration: 0.01ms !important;
  }
}

.aots-onboarding-overlay.is-reduced .aots-ob-ghost {
  display: none;
}

/* ── Küçük ekranlar ────────────────────────────────────────────────── */

@media (max-width: 359px) {
  .aots-ob-heading {
    font-size: 1.125rem;
  }

  .aots-ob-visual,
  .aots-ob-map-canvas {
    min-height: min(38vh, 260px);
  }
}
