/* ==========================================================================
   ONBOARDING / TUTORIAL - Painel RDF Flora Vendedoras
   Módulo isolado. Tudo prefixado com .ob- pra não conflitar com o resto.
   Mobile-first. Visual nível Meta/Google/Duolingo.
   ========================================================================== */

/* ====== OVERLAY / BACKDROP ====== */
.ob-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(24, 10, 32, 0.62);
  -webkit-backdrop-filter: blur(6px) saturate(140%);
  backdrop-filter: blur(6px) saturate(140%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms cubic-bezier(0.22, 1, 0.36, 1);
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.ob-overlay.ob-open {
  opacity: 1;
  pointer-events: auto;
}

/* ====== CARD PRINCIPAL ====== */
.ob-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: calc(100dvh - 32px);
  background: #ffffff;
  border-radius: 24px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 24px 60px -12px rgba(40, 10, 60, 0.45),
    0 8px 24px -8px rgba(60, 20, 80, 0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(24px) scale(0.96);
  opacity: 0;
  transition:
    transform 420ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 300ms ease-out;
}
.ob-overlay.ob-open .ob-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* ====== TOP BAR (progresso + pular) ====== */
.ob-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px 8px;
}

.ob-progress {
  flex: 1;
  display: flex;
  gap: 6px;
  align-items: center;
  height: 6px;
}
.ob-progress-dot {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(136, 82, 157, 0.14);
  position: relative;
  overflow: hidden;
  transition: background 240ms ease;
}
.ob-progress-dot.ob-done {
  background: linear-gradient(90deg, #b061d0 0%, #88529d 100%);
}
.ob-progress-dot.ob-active {
  background: rgba(136, 82, 157, 0.14);
}
.ob-progress-dot.ob-active::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #b061d0 0%, #88529d 100%);
  transform-origin: left center;
  animation: ob-fill 520ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes ob-fill {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

.ob-skip {
  background: none;
  border: 0;
  color: #8a7a92;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 10px;
  margin: -6px -10px -6px 0;
  cursor: pointer;
  border-radius: 8px;
  font-family: inherit;
  letter-spacing: 0.01em;
  transition: color 160ms ease, background 160ms ease;
}
.ob-skip:hover { color: #623474; background: rgba(136, 82, 157, 0.06); }
.ob-skip:focus-visible {
  outline: 2px solid #88529d;
  outline-offset: 2px;
}

/* ====== HERO (emoji + decorações) ====== */
.ob-hero {
  position: relative;
  height: 200px;
  margin: 4px 22px 0;
  border-radius: 20px;
  background:
    radial-gradient(120% 100% at 20% 10%, rgba(176, 97, 208, 0.25) 0%, rgba(176, 97, 208, 0) 55%),
    radial-gradient(120% 100% at 85% 90%, rgba(129, 215, 66, 0.18) 0%, rgba(129, 215, 66, 0) 55%),
    linear-gradient(160deg, #fbf5ff 0%, #fff5f5 55%, #f4fff0 100%);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  isolation: isolate;
}
.ob-hero::before,
.ob-hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(18px);
  z-index: 0;
  pointer-events: none;
}
.ob-hero::before {
  width: 140px; height: 140px;
  top: -30px; left: -20px;
  background: rgba(176, 97, 208, 0.32);
  animation: ob-float-a 9s ease-in-out infinite;
}
.ob-hero::after {
  width: 160px; height: 160px;
  bottom: -40px; right: -30px;
  background: rgba(136, 82, 157, 0.22);
  animation: ob-float-b 11s ease-in-out infinite;
}
@keyframes ob-float-a {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(14px, 12px) scale(1.08); }
}
@keyframes ob-float-b {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-16px, -10px) scale(1.12); }
}

.ob-emoji {
  position: relative;
  z-index: 2;
  font-size: 96px;
  line-height: 1;
  filter: drop-shadow(0 10px 20px rgba(60, 20, 80, 0.18));
  transform-origin: 50% 70%;
  will-change: transform, opacity;
}
.ob-emoji.ob-pop {
  animation: ob-pop 680ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes ob-pop {
  0%   { opacity: 0; transform: scale(0.5) translateY(12px) rotate(-6deg); }
  55%  { opacity: 1; transform: scale(1.12) translateY(-4px) rotate(2deg); }
  80%  { transform: scale(0.98) translateY(0) rotate(-1deg); }
  100% { transform: scale(1) translateY(0) rotate(0deg); }
}

/* Confetes sutis no slide final */
.ob-confetti {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  display: none;
}
.ob-hero.ob-final .ob-confetti { display: block; }
.ob-confetti span {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  opacity: 0;
  animation: ob-confetti-fall 2.4s linear infinite;
}
.ob-confetti span:nth-child(1) { left: 10%; background: #b061d0; animation-delay: 0.00s; }
.ob-confetti span:nth-child(2) { left: 25%; background: #81d742; animation-delay: 0.35s; }
.ob-confetti span:nth-child(3) { left: 40%; background: #f3b6d8; animation-delay: 0.70s; }
.ob-confetti span:nth-child(4) { left: 55%; background: #88529d; animation-delay: 1.05s; }
.ob-confetti span:nth-child(5) { left: 70%; background: #ffd36b; animation-delay: 0.18s; }
.ob-confetti span:nth-child(6) { left: 85%; background: #b061d0; animation-delay: 0.52s; }
@keyframes ob-confetti-fall {
  0%   { transform: translateY(-20px) rotate(0deg);   opacity: 0; }
  10%  { opacity: 1; }
  100% { transform: translateY(220px) rotate(420deg); opacity: 0; }
}

/* ====== CONTEÚDO (título + texto) ====== */
.ob-viewport {
  position: relative;
  padding: 18px 22px 4px;
  overflow: hidden;
}
.ob-slide {
  will-change: transform, opacity;
}
.ob-slide.ob-anim-in-right  { animation: ob-in-right  360ms cubic-bezier(0.22, 1, 0.36, 1) both; }
.ob-slide.ob-anim-in-left   { animation: ob-in-left   360ms cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes ob-in-right {
  from { opacity: 0; transform: translateX(28px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes ob-in-left {
  from { opacity: 0; transform: translateX(-28px); }
  to   { opacity: 1; transform: translateX(0); }
}

.ob-counter {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #88529d;
  background: rgba(136, 82, 157, 0.1);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.ob-title {
  font-size: 26px;
  line-height: 1.15;
  font-weight: 800;
  color: #3d1f4e;
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}
.ob-text {
  font-size: 16px;
  line-height: 1.55;
  color: #4a3b52;
  margin: 0;
}
.ob-text strong {
  color: #3d1f4e;
  font-weight: 700;
}

/* ====== FOOTER (botões) ====== */
.ob-footer {
  display: flex;
  gap: 10px;
  padding: 20px 22px 22px;
  margin-top: auto;
  align-items: center;
}
.ob-btn {
  appearance: none;
  border: 0;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 13px 20px;
  border-radius: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition:
    transform 120ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 160ms ease,
    background 180ms ease,
    color 180ms ease,
    opacity 180ms ease;
  white-space: nowrap;
}
.ob-btn:focus-visible {
  outline: 3px solid rgba(136, 82, 157, 0.4);
  outline-offset: 2px;
}

.ob-btn-back {
  background: transparent;
  color: #6d3f80;
  padding: 13px 14px;
}
.ob-btn-back:hover { background: rgba(136, 82, 157, 0.08); }
.ob-btn-back[hidden] { display: none; }

.ob-btn-next {
  flex: 1;
  background: linear-gradient(135deg, #b061d0 0%, #88529d 55%, #6d3f80 100%);
  color: #fff;
  box-shadow:
    0 10px 20px -8px rgba(136, 82, 157, 0.55),
    0 2px 6px -2px rgba(136, 82, 157, 0.4),
    0 1px 0 rgba(255, 255, 255, 0.25) inset;
}
.ob-btn-next:hover {
  box-shadow:
    0 14px 26px -8px rgba(136, 82, 157, 0.65),
    0 4px 10px -2px rgba(136, 82, 157, 0.5),
    0 1px 0 rgba(255, 255, 255, 0.3) inset;
}
.ob-btn-next:active { transform: scale(0.98); }

.ob-btn-finish {
  background: linear-gradient(135deg, #81d742 0%, #6bc232 60%, #4fa325 100%);
  box-shadow:
    0 10px 20px -8px rgba(107, 194, 50, 0.55),
    0 2px 6px -2px rgba(107, 194, 50, 0.4),
    0 1px 0 rgba(255, 255, 255, 0.25) inset;
}
.ob-btn-finish:hover {
  box-shadow:
    0 14px 26px -8px rgba(107, 194, 50, 0.65),
    0 4px 10px -2px rgba(107, 194, 50, 0.55),
    0 1px 0 rgba(255, 255, 255, 0.3) inset;
}

.ob-btn-arrow {
  display: inline-block;
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}
.ob-btn-next:hover .ob-btn-arrow { transform: translateX(3px); }

/* ====== RESPONSIVO ====== */
@media (max-width: 380px) {
  .ob-card { border-radius: 20px; }
  .ob-topbar { padding: 14px 16px 6px; }
  .ob-hero { height: 170px; margin: 4px 16px 0; }
  .ob-emoji { font-size: 82px; }
  .ob-viewport { padding: 14px 16px 2px; }
  .ob-title { font-size: 23px; }
  .ob-text { font-size: 15px; }
  .ob-footer { padding: 16px 16px 18px; }
  .ob-btn { padding: 12px 16px; font-size: 14px; }
}

@media (min-height: 720px) and (min-width: 420px) {
  .ob-hero { height: 220px; }
  .ob-emoji { font-size: 108px; }
}

@media (min-width: 520px) {
  .ob-card { max-width: 500px; border-radius: 28px; }
  .ob-topbar { padding: 22px 28px 10px; }
  .ob-hero { margin: 6px 28px 0; }
  .ob-viewport { padding: 22px 28px 6px; }
  .ob-title { font-size: 28px; }
  .ob-text { font-size: 17px; }
  .ob-footer { padding: 22px 28px 26px; }
}

/* Safe-area iOS (notch) */
@supports (padding: env(safe-area-inset-bottom)) {
  .ob-card {
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
}

/* Respeita reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .ob-overlay,
  .ob-card,
  .ob-emoji,
  .ob-slide,
  .ob-hero::before,
  .ob-hero::after,
  .ob-confetti span,
  .ob-progress-dot.ob-active::after {
    animation: none !important;
    transition: none !important;
  }
  .ob-overlay { opacity: 1; }
  .ob-card { transform: none; opacity: 1; }
}

/* Impede scroll do body enquanto overlay aberto */
body.ob-lock { overflow: hidden !important; }
