/* ───────────────────────────────────────────────────────────────────────────
   Onboarding Duolingo-style — 4 etapas guiadas pela arara.
   Usa as CSS vars do tema (caderno.css). Dark e o padrao (:root);
   light e opt-in via #app.light, entao nao ha bloco "body.dark".
   Todas as classes sao prefixadas com .onb- para nao colidir com .btn etc.
   ─────────────────────────────────────────────────────────────────────────── */

.onb-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(120deg, rgba(29,108,240,.18), rgba(6,182,212,.12)), var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  backdrop-filter: blur(2px);
  overflow-y: auto;
}

.onb-overlay.hidden { display: none; }

.onb-container {
  width: 100%;
  max-width: 620px;
}

.onb-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 48px;
  box-shadow: var(--shadowLg);
  position: relative;
}

/* ── Progresso ───────────────────────────────────────────────────────────── */
.onb-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 28px;
}

.onb-dots { display: flex; gap: 8px; }

.onb-dots .onb-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--border2);
  transition: all .3s cubic-bezier(.16,.84,.44,1);
}

.onb-dots .onb-dot.active {
  background: var(--accent);
  box-shadow: 0 4px 12px rgba(29,108,240,.35);
  transform: scale(1.15);
}

.onb-progress-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text2);
}

/* ── Arara ───────────────────────────────────────────────────────────────── */
.onb-mascot { text-align: center; margin-bottom: 24px; }

.onb-mascot-img {
  width: 180px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 12px 20px rgba(13,53,113,.22));
  animation: onb-entrance .6s cubic-bezier(.16,.84,.44,1) both;
}

@keyframes onb-entrance {
  from { opacity: 0; transform: translateY(-20px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.onb-mascot-img.wave   { animation: onb-wave 1s ease-in-out infinite; }
.onb-mascot-img.bounce { animation: onb-bounce .8s ease-in-out infinite; }
.onb-mascot-img.pulse  { animation: onb-pulse 2s ease-in-out infinite; }

@keyframes onb-wave {
  0%,100% { transform: rotate(0); }
  25%     { transform: rotate(10deg); }
  75%     { transform: rotate(-10deg); }
}
@keyframes onb-bounce {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-12px); }
}
@keyframes onb-pulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50%     { transform: scale(1.05); opacity: .95; }
}

/* ── Conteudo (titulo + subtitulo + campo) ──────────────────────────────────── */
.onb-content {
  margin-bottom: 24px;
  animation: onb-stage-in .4s cubic-bezier(.16,.84,.44,1) both;
}
.onb-content.exiting { animation: onb-stage-out .3s cubic-bezier(.16,.84,.44,1) both; }

@keyframes onb-stage-in {
  from { opacity: 0; transform: translateY(20px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes onb-stage-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-16px) scale(.98); }
}

.onb-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  margin: 0 0 8px;
}

.onb-subtitle {
  font-size: 14px;
  font-weight: 400;
  color: var(--text2);
  line-height: 1.6;
  margin: 0 0 20px;
}

/* ── Input / Select ─────────────────────────────────────────────────────────── */
.onb-input, .onb-select {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  font-family: inherit;
  font-weight: 400;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  line-height: 1.4;
  transition: all .2s ease;
  box-sizing: border-box;
}

.onb-input::placeholder { color: var(--text3); font-style: italic; }

.onb-input:focus, .onb-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29,108,240,.18);
}

.onb-input:hover:not(:disabled), .onb-select:hover {
  border-color: var(--border2);
}

.onb-select {
  appearance: none;
  cursor: pointer;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23959AA4' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
}

/* ── Grid de objetivos (Etapa 2) ────────────────────────────────────────────── */
.onb-objectives {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.onb-objective {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px 12px;
  min-height: 140px;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all .3s cubic-bezier(.16,.84,.44,1);
  background: var(--surface2);
  position: relative;
  overflow: hidden;
}

.onb-objective:hover {
  border-color: var(--objetivo-color, var(--accent));
  box-shadow: 0 8px 20px rgba(13,53,113,.18);
  transform: translateY(-4px);
}

.onb-objective.selected {
  border-color: var(--objetivo-color, var(--accent));
  background: color-mix(in srgb, var(--objetivo-color, var(--accent)) 8%, var(--surface2));
}

.onb-objective-icon {
  font-size: 22px;
  margin-bottom: 10px;
  display: flex;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--objetivo-color, var(--accent)) 16%, transparent);
  align-items: center;
  justify-content: center;
  color: var(--objetivo-color, var(--accent));
}

.onb-objective-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.2;
}

.onb-objective-desc {
  font-size: 12px;
  font-weight: 400;
  color: var(--text2);
  line-height: 1.4;
}

.onb-objective-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  background: var(--objetivo-color, var(--accent));
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  transform: scale(0);
  transition: all .3s cubic-bezier(.16,.84,.44,1);
}
.onb-objective.selected .onb-objective-check { opacity: 1; transform: scale(1); }

/* ── Radio (Etapa 4: referral) ──────────────────────────────────────────────── */
.onb-radio-group { display: grid; grid-template-columns: 1fr; gap: 10px; }

.onb-radio {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .2s ease;
  user-select: none;
  position: relative;
  background: var(--surface2);
}

.onb-radio:hover { border-color: var(--accent); }

.onb-radio input[type="radio"] {
  margin-right: 12px;
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
}

.onb-radio.checked {
  border-color: var(--accent);
  background: var(--accentSoft);
}

.onb-radio-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  flex: 1;
}
.onb-radio.checked .onb-radio-label { font-weight: 600; color: var(--accent); }

.onb-radio-extra { margin-top: 8px; }
.onb-radio-extra .onb-input { font-size: 14px; padding: 10px 12px; }
.onb-radio-extra.hidden { display: none; }

/* ── Botoes ─────────────────────────────────────────────────────────────────── */
.onb-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  justify-content: flex-end;
}

.onb-btn-primary, .onb-btn-secondary {
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .2s ease;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.onb-btn-primary {
  background: linear-gradient(125deg, var(--accent3) 0%, var(--accent) 100%);
  color: #fff;
  box-shadow: 0 10px 30px rgba(29,108,240,.3);
}
.onb-btn-primary:hover:not(:disabled) { filter: brightness(110%); box-shadow: 0 12px 35px rgba(29,108,240,.4); }
.onb-btn-primary:active:not(:disabled) { transform: scale(.98); }
.onb-btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.onb-btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 2px solid var(--border);
}
.onb-btn-secondary:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.onb-btn-secondary:active:not(:disabled) { transform: scale(.98); }
.onb-btn-secondary.hidden { display: none; }

/* ── Tablet ─────────────────────────────────────────────────────────────────── */
@media (max-width: 1023px) {
  .onb-card { border-radius: var(--radius-lg); padding: 32px 28px; }
  .onb-mascot-img { width: 150px; }
  .onb-title { font-size: 23px; }
}

/* ── Mobile ─────────────────────────────────────────────────────────────────── */
@media (max-width: 639px) {
  .onb-overlay { padding: 12px; }
  .onb-card { border-radius: var(--radius); padding: 24px 20px; }
  .onb-mascot-img { width: 120px; }
  .onb-mascot { margin-bottom: 16px; }
  .onb-title { font-size: 22px; }
  .onb-subtitle { font-size: 13.5px; }
  .onb-input, .onb-select { font-size: 16px; min-height: 44px; } /* 16px evita zoom iOS */
  .onb-objectives { gap: 10px; }
  .onb-objective { min-height: 130px; padding: 12px 10px; }
  .onb-objective-name { font-size: 13px; }
  .onb-objective-desc { font-size: 11px; }
  .onb-actions { flex-direction: column-reverse; gap: 8px; }
  .onb-btn-primary, .onb-btn-secondary { width: 100%; padding: 12px 16px; font-size: 14px; }
}
