/* ==========================================================================
   onboarding.css — Release 12 "Acolhimento".
   Camada de onboarding do Portal do Paciente (ver public/js/onboarding.js).
   Reaproveita as variáveis --p-* do tema Pastel Sereno (patient.css); tudo
   aqui é sobreposição (overlays/sheets/botão), sem tocar no layout base.
   ========================================================================== */

:root {
  --onb-leaf: #9ec89a;
  --onb-teal: #3e7d76;
}

/* trava de scroll durante o wizard de chegada */
body.onb-lock { overflow: hidden; }

/* ---- Orbe da Centelha (reutilizado em vários pontos) -------------------- */
.onb-orb {
  width: 44px; height: 44px; margin: 0 auto; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fffaf0, #e7c67f);
  box-shadow: 0 0 22px rgba(217, 171, 82, .5); position: relative; flex: none;
}
.onb-orb::after {
  content: '✦'; position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; color: var(--p-gold-deep); font-size: 18px;
}

/* ---- Botões --------------------------------------------------------------*/
.onb-btn {
  font-family: var(--p-font); border: none; cursor: pointer;
  background: var(--p-gold); color: #fff; padding: 12px 22px; border-radius: 999px;
  font-size: 15px; box-shadow: 0 6px 18px rgba(217, 171, 82, .4); transition: background .2s, transform .1s;
}
.onb-btn:hover { background: var(--p-gold-deep); }
.onb-btn:active { transform: translateY(1px); }
.onb-btn.ghost { background: transparent; color: var(--p-text-muted); box-shadow: none; border: 1px solid var(--p-glass-border); }
.onb-btn.teal { background: var(--onb-teal); box-shadow: 0 6px 18px rgba(62, 125, 118, .35); }
.onb-btn.small { padding: 8px 15px; font-size: 13px; }
.onb-never { font-size: 12.5px; color: var(--p-text-muted); text-decoration: underline dotted; cursor: pointer; }

/* ==========================================================================
   1) Chegada — wizard "A Semente" (tela cheia)
   ========================================================================== */
.onb-welcome {
  position: fixed; inset: 0; z-index: 4000;
  background: linear-gradient(160deg, #faf4e8, #f2e6cf);
  display: flex; align-items: stretch; justify-content: center;
}
.onb-wiz {
  width: 100%; max-width: 460px; display: flex; flex-direction: column;
  padding: max(28px, env(safe-area-inset-top)) 26px 26px; text-align: center;
}
.onb-wiz .onb-skip { align-self: flex-end; font-size: 13px; color: var(--p-text-muted); text-decoration: underline dotted; cursor: pointer; }
.onb-wiz .onb-body { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 16px; }
.onb-wiz h2 { font-size: 24px; font-weight: 600; line-height: 1.3; color: var(--p-text); margin: 0; }
.onb-wiz .onb-lead { font-size: 15px; color: var(--p-text-muted); line-height: 1.6; max-width: 300px; margin: 0; }
.onb-dots { display: flex; gap: 7px; justify-content: center; margin: 16px 0 12px; }
.onb-dots i { width: 8px; height: 8px; border-radius: 50%; background: #e2d5b8; transition: .3s; }
.onb-dots i.on { background: var(--p-gold); width: 22px; border-radius: 6px; }
.onb-nav { display: flex; gap: 10px; justify-content: center; }
.onb-opts { display: flex; flex-direction: column; gap: 10px; align-items: center; margin-top: 6px; }

/* chips "o que trouxe você" */
.onb-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 320px; }
.onb-chip {
  padding: 10px 14px; border-radius: 999px; background: var(--p-glass);
  border: 1px solid var(--p-glass-border); font-size: 13px; color: var(--p-text); cursor: pointer; transition: .15s;
}
.onb-chip.sel { background: var(--p-violet); color: #fff; border-color: var(--p-violet); }

/* animação da semente */
.onb-seedstage { height: 120px; display: flex; align-items: flex-end; justify-content: center; }
.onb-stem { stroke: #7ca877; stroke-width: 4; stroke-linecap: round; fill: none; stroke-dasharray: 70; stroke-dashoffset: 70; }
.onb-grow .onb-stem { animation: onb-grow 1.6s .3s forwards ease-out; }
@keyframes onb-grow { to { stroke-dashoffset: 0; } }
.onb-sleaf { fill: var(--onb-leaf); transform-origin: bottom center; transform: scale(0); }
.onb-grow .onb-l1 { animation: onb-pop .5s 1.5s forwards cubic-bezier(.34, 1.56, .64, 1); }
.onb-grow .onb-l2 { animation: onb-pop .5s 1.8s forwards cubic-bezier(.34, 1.56, .64, 1); }
@keyframes onb-pop { to { transform: scale(1); } }

/* estágios de crescimento (passo 3) */
.onb-stages { display: flex; align-items: flex-end; gap: 16px; justify-content: center; }
.onb-st { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; color: var(--p-text-muted); }
.onb-arrowg { color: #cbb98e; font-size: 16px; padding-bottom: 24px; }

/* ==========================================================================
   2) Guia por tela — convite (coachmark) e compartilhamento (mesma casca)
   ========================================================================== */
.onb-invite {
  position: fixed; inset: 0; z-index: 3500; background: rgba(63, 58, 82, .45);
  display: flex; align-items: flex-end; justify-content: center; padding: 0 16px calc(var(--p-tabbar-h) + 24px);
}
.onb-invite-card {
  background: var(--p-glass); border-radius: var(--p-radius); padding: 22px 20px; text-align: center;
  box-shadow: var(--p-shadow-glass); width: 100%; max-width: 460px; animation: onb-rise .3s ease;
}
@keyframes onb-rise { from { transform: translateY(18px); opacity: .4; } to { transform: none; opacity: 1; } }
.onb-invite-card h3 { font-size: 18px; font-weight: 600; color: var(--p-text); margin: 12px 0 4px; }
.onb-invite-card p { font-size: 13.5px; color: var(--p-text-muted); line-height: 1.5; margin: 0; }

/* ==========================================================================
   3) Ajuda contextual — botão ✦ + bottom sheet
   ========================================================================== */
.onb-help-btn {
  width: 36px; height: 36px; border-radius: 50%; border: none; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #fffaf0, #e7c67f); color: #8a6a2a;
  font-size: 15px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 12px rgba(217, 171, 82, .5); font-family: Georgia, serif;
}
.onb-help-btn.pulse { animation: onb-pulse 2s infinite; }
@keyframes onb-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(217, 171, 82, .45); }
  50% { box-shadow: 0 0 20px rgba(217, 171, 82, .9); }
}

.onb-sheet-backdrop { position: fixed; inset: 0; z-index: 3600; background: rgba(63, 58, 82, .4); opacity: 0; transition: opacity .3s; }
.onb-sheet-backdrop.open { opacity: 1; }
.onb-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 3601; margin: 0 auto; max-width: 520px;
  max-height: 86%; overflow-y: auto; background: var(--p-glass);
  border-radius: 22px 22px 0 0; padding: 18px 20px calc(26px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 30px rgba(63, 58, 82, .18); transform: translateY(105%); transition: transform .3s;
}
.onb-sheet.open { transform: translateY(0); }
.onb-grab { width: 44px; height: 4px; border-radius: 4px; background: #e2d5b8; margin: 0 auto 12px; }
.onb-sheet-close { position: absolute; top: 12px; right: 16px; cursor: pointer; color: var(--p-text-muted); font-size: 18px; }
/* Release 12.3.2 — o cabeçalho do sheet ficava desalinhado (título empurrado
   para a direita, pior no telemóvel): .onb-orb tem `margin: 0 auto` para os
   sítios onde aparece centrado, e dentro de um flex row essa margem
   automática engolia o espaço livre. Aqui a margem é zerada, o bloco de
   texto passa a esticar (flex:1) e reservamos espaço à direita para o ✕. */
.onb-sheet-head {
  display: flex; gap: 12px; align-items: center;
  margin-bottom: 8px; padding-right: 30px;
}
.onb-sheet-head .onb-orb { margin: 0; }
.onb-sheet-headtext { flex: 1; min-width: 0; }
.onb-sheet-head h3 {
  font-size: 16.5px; font-weight: 600; color: var(--p-text); margin: 0;
  line-height: 1.25; overflow-wrap: anywhere;
}
.onb-sheet-sub { font-size: 12px; color: var(--p-text-muted); margin: 2px 0 0; }
.onb-hrows { }
.onb-hrow { display: flex; gap: 11px; align-items: flex-start; padding: 10px 2px; border-bottom: 1px dashed var(--p-glass-border); }
.onb-hrow:last-child { border-bottom: none; }
.onb-hi {
  flex: none; width: 32px; height: 32px; border-radius: 10px;
  background: var(--p-ink-2); display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: var(--p-gold-deep);
}
.onb-htext { flex: 1; min-width: 0; }
.onb-hrow b { font-size: 13.5px; font-weight: 600; color: var(--p-text); display: block; }
.onb-hx { font-size: 12px; color: var(--p-text-muted); line-height: 1.45; display: block; margin-top: 2px; }
.onb-hx b { display: inline; font-weight: 600; color: var(--p-text); }
.onb-hx [data-link] { color: var(--p-violet); text-decoration: underline dotted; cursor: pointer; }
.onb-sheet-foot { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* respeita quem prefere menos movimento */
@media (prefers-reduced-motion: reduce) {
  .onb-grow .onb-stem, .onb-grow .onb-l1, .onb-grow .onb-l2 { animation: none; }
  .onb-stem { stroke-dashoffset: 0; } .onb-sleaf { transform: scale(1); }
  .onb-help-btn.pulse { animation: none; }
  .onb-invite-card { animation: none; }
}

/* ==========================================================================
   Tour das abas — hotfix 25/07 (ver public/js/tabbarTour.js). Escurece a
   tela inteira e "fura" um buraco de destaque sobre o botão da vez, com uma
   legenda ao lado. Disparado pelo link "Ver tour das abas" no sheet de
   ajuda (.onb-sheet-foot) — não aparece sozinho. z-index acima do wizard de
   chegada (4000) para nunca ficar escondido atrás dele.
   ========================================================================== */
.tbt-veil { position: fixed; inset: 0; z-index: 4200; opacity: 0; pointer-events: none; transition: opacity .3s ease; }
.tbt-veil.on { opacity: 1; pointer-events: auto; }
.tbt-hole {
  position: fixed; border-radius: 20px; box-shadow: 0 0 0 2000px rgba(20, 14, 34, .68);
  transition: all .35s cubic-bezier(.4,0,.2,1);
}
.tbt-tip {
  position: fixed; background: var(--p-glass, #fff); border-radius: 16px; padding: 14px 15px;
  box-shadow: 0 14px 40px rgba(90,70,120,.22); transition: all .35s cubic-bezier(.4,0,.2,1);
}
.tbt-step-label {
  font-size: 9.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--p-gold-deep); margin-bottom: 4px;
}
.tbt-tip h4 { margin: 0 0 4px; font-size: 14px; color: var(--p-text); }
.tbt-tip p { margin: 0 0 10px; font-size: 12px; color: var(--p-text-muted); line-height: 1.5; }
.tbt-tip-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tbt-dots { display: flex; gap: 4px; }
.tbt-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--p-glass-border); }
.tbt-dot.on { background: var(--p-gold-deep); }
.tbt-btns { display: flex; gap: 6px; }
.tbt-btn { border: none; font-size: 11.5px; font-weight: 700; padding: 7px 12px; border-radius: 20px; cursor: pointer; font-family: inherit; }
.tbt-btn.skip { background: none; color: var(--p-text-muted); }
.tbt-btn.next {
  background: linear-gradient(135deg, #d9ab52 0%, #8474ad 100%); color: #fff;
}
@media (prefers-reduced-motion: reduce) {
  .tbt-hole, .tbt-tip { transition: none; }
}


/* Release 12.3.2 — telemóvel: menos aperto no cabeçalho da ajuda. */
@media (max-width: 420px) {
  .onb-sheet { padding-left: 16px; padding-right: 16px; }
  .onb-sheet-head { gap: 10px; padding-right: 26px; }
  .onb-sheet-head h3 { font-size: 15.5px; }
  .onb-sheet-head .onb-orb { width: 34px !important; height: 34px !important; }
  .onb-sheet-head .onb-orb::after { font-size: 15px; }
}
