/* ============================================================
   ChamaSofia — chat/css/app-shell.css (V2, Fase 1)
   Componentes da casca: sidebar (desktop), topbar, bottom-nav
   (mobile). Não redefine paleta — usa --sofia-* e --shell-* de
   tokens.css e brand-tokens.css. Isolado: nenhuma página existente
   carrega este arquivo ainda.
   ============================================================ */

.shell {
  min-height: 100dvh;
  background-image:
    radial-gradient(circle at 78% 12%, rgba(139,92,246,.12), transparent 34%),
    radial-gradient(circle at 28% 92%, rgba(212,162,78,.055), transparent 30%),
    linear-gradient(180deg, rgba(13,10,20,.90), rgba(13,10,20,.96)),
    url('../assets-v2/backgrounds/fundo-app-cosmico-altar-lunar.jpg');
  background-position: center, center, center, right bottom;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
  background-color: var(--sofia-bg, #0D0A14);
  color: var(--sofia-text-on-dark, #F5F3FF);
}

.shell-corpo {
  display: flex;
  min-height: 100dvh;
}

/* ---------- sidebar (desktop) ---------- */
.shell-sidebar {
  width: var(--shell-sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 1.6rem 1.2rem;
  border-right: var(--shell-card-border);
  z-index: var(--shell-z-sidebar);
  overflow-y: auto;
}

.shell-marca {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .4rem .3rem 1.6rem;
  text-decoration: none;
  color: inherit;
}
.shell-marca-simbolo {
  width: 40px; height: 40px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  border-radius: 50%;
  overflow: hidden;
}
.shell-marca-simbolo img { width: 100%; height: 100%; object-fit: cover; }
.shell-marca-texto {
  font-family: var(--sofia-font-display, 'Cormorant Garamond', serif);
  font-size: 1.4rem; line-height: 1.1;
}
.shell-marca-texto strong { color: var(--sofia-gold-400, #D4A24E); font-weight: 600; }

.shell-nav {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  flex: 1;
}
.shell-nav-item {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .7rem .9rem;
  border-radius: 12px;
  text-decoration: none;
  color: var(--sofia-text-muted-on-dark, #C4B5FD);
  font-size: .92rem;
  transition: background .2s, color .2s;
}
.shell-nav-item:hover {
  background: rgba(139,92,246,.10);
  color: var(--sofia-text-on-dark, #F5F3FF);
}
.shell-nav-item.ativo {
  background: rgba(139,92,246,.16);
  border: 1px solid var(--sofia-line-violet, rgba(139,92,246,.3));
  color: var(--sofia-text-on-dark, #F5F3FF);
  font-weight: 600;
}
.shell-nav-icone {
  width: 22px; height: 22px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; line-height: 1;
}
.shell-nav-icone img { width: 100%; height: 100%; object-fit: contain; }

.shell-nav-badge {
  margin-left: auto;
  min-width: 1.45rem;
  height: 1.45rem;
  padding: 0 .35rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--sofia-violet-500, #8B5CF6);
  color: #fff;
  border: 1px solid rgba(255,255,255,.18);
  font-size: .7rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 3px rgba(139,92,246,.10);
}
.shell-nav-badge[hidden] { display: none; }

.shell-nav-secao-titulo {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--sofia-text-muted-on-dark, #C4B5FD); opacity: .6;
  padding: 1rem .9rem .3rem;
}

.shell-sidebar-decor {
  margin-top: 1rem;
  opacity: .55;
  text-align: center;
  font-size: 1.6rem;
  user-select: none;
}

/* ---------- topbar ---------- */
.shell-principal {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.shell-topbar {
  position: sticky;
  top: 0;
  z-index: var(--shell-z-topbar);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .8rem;
  padding: 1rem var(--shell-gap);
  min-height: var(--shell-topbar-height);
  /* achado testando ao vivo: sem fundo, o título "Início" ficava por cima
     do primeiro card ao rolar a página — sticky sem opacidade própria deixa
     o conteúdo por baixo "vazar" através do texto. Mesmo tratamento do
     .shell-bottom-nav (blur + fundo semitransparente), pro topo e o rodapé
     combinarem visualmente. */
  background: rgba(13,10,20,.82);
  backdrop-filter: blur(10px);
  border-bottom: var(--shell-card-border);
}

.shell-chamas-badge {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem .9rem;
  border-radius: 999px;
  background: rgba(212,162,78,.14);
  border: 1px solid var(--sofia-line-gold, rgba(212,162,78,.45));
  font-weight: 700;
  font-size: .88rem;
  color: var(--sofia-gold-300, #E5C27B);
  text-decoration: none;
}
.shell-chamas-badge .n { color: var(--sofia-text-on-dark, #F5F3FF); }

.shell-avatar-botao {
  width: 48px; height: 48px; border-radius: 50%;
  border: 2px solid var(--sofia-line-gold, rgba(212,162,78,.45));
  overflow: hidden; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(139,92,246,.1);
  font-size: 1.3rem;
  text-decoration: none; color: inherit;
}
.shell-avatar-botao img { width: 100%; height: 100%; object-fit: cover; }

.shell-conteudo {
  flex: 1;
  padding: 0 var(--shell-gap) 3rem;
  max-width: var(--shell-content-max-width);
  width: 100%;
  margin: 0 auto;
}

/* ---------- bottom-nav (mobile) ---------- */
.shell-bottom-nav {
  display: none;
}

@media (max-width: 900px) {
  .shell-sidebar { display: none; }
  .shell-corpo { flex-direction: column; }
  .shell-conteudo { padding-bottom: calc(var(--shell-bottom-nav-height) + 1.5rem); }

  .shell-bottom-nav {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    min-height: var(--shell-bottom-nav-height);
    height: calc(var(--shell-bottom-nav-height) + env(safe-area-inset-bottom, 0px));
    z-index: var(--shell-z-bottom-nav);
    background: rgba(13,10,20,.92);
    backdrop-filter: blur(10px);
    border-top: var(--shell-card-border);
    padding: 0 .4rem env(safe-area-inset-bottom, 0px);
  }
  .shell-bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .2rem;
    text-decoration: none;
    color: var(--sofia-text-muted-on-dark, #C4B5FD);
    font-size: .68rem;
    /* reset pro botão "Mais" (os outros 4 itens continuam <a>) ficar
       visualmente idêntico aos links — sem isso herda borda/fundo/fonte
       padrão do navegador pra <button> */
    background: none;
    border: none;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
  }
  .shell-bottom-nav-item.ativo {
    color: var(--sofia-gold-400, #D4A24E);
  }
  .shell-bottom-nav-icone {
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; line-height: 1;
  }
  .shell-bottom-nav-icone img { width: 100%; height: 100%; object-fit: contain; }
}

@media (max-width: 430px) {
  .shell-topbar { min-height: 64px; padding: .7rem 1rem; }
  .shell-conteudo { padding-left: 1rem; padding-right: 1rem; }
  .shell-card { padding: 1rem; border-radius: 16px; }
  .shell-bottom-nav-item { min-width: 0; }
  .shell-bottom-nav-item > span:last-child { max-width: 68px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ---------- card genérico da casca (base pra Fase 2) ---------- */
.shell-card {
  background: var(--shell-card-bg);
  border: var(--shell-card-border);
  border-radius: var(--shell-card-radius);
  padding: 1.4rem;
}

/* Título de card ("🃏 Carta do dia", "🌀 Sua Jornada" etc.) — achado testando
   ao vivo: era um <strong> puro, sem nenhum tratamento (inline, cor branca
   igual ao corpo, margem zero grudando no conteúdo de baixo). Sem isso os
   cards pareciam remendo: nenhuma hierarquia separando "isto é o título"
   de "isto é o conteúdo". Estiliza pela POSIÇÃO (primeiro <strong> filho
   direto do card), então nenhum HTML precisou mudar — cobre os 6 cards da
   Home de uma vez e qualquer card futuro que siga o mesmo padrão. */
.shell-card > strong:first-child {
  display: block;
  font-family: var(--sofia-font-display, 'Cormorant Garamond', serif);
  font-weight: 600;
  font-size: 1.08rem;
  color: var(--sofia-gold-300, #E5C27B);
  letter-spacing: .01em;
  margin-bottom: .7rem;
}

/* ---------- componente Avatar (foto -> emoji + moldura) ----------
   A moldura é SOBREPOSTA por CSS, nunca fundida na foto: o manifesto V2 exige
   isso pra que trocar de moldura não obrigue a reprocessar a imagem de ninguém,
   e pra que a mesma foto sirva a qualquer moldura. Por isso ela vive numa
   camada própria, maior que o retrato e sem capturar clique. */
.avatar-v2 {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: var(--avatar-v2-tamanho, 96px);
  height: var(--avatar-v2-tamanho, 96px);
}
.avatar-v2-retrato {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
  background: rgba(139,92,246,.14);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--avatar-v2-tamanho, 96px) * .45);
  line-height: 1;
  overflow: hidden;
}
img.avatar-v2-retrato { display: block; }
/* sem moldura, um aro discreto pra foto não ficar solta sobre o fundo */
.avatar-v2:not(.tem-moldura) .avatar-v2-retrato {
  border: 2px solid var(--sofia-line-gold, rgba(212,162,78,.45));
}
.avatar-v2-moldura {
  position: absolute;
  /* a arte da moldura tem margem interna própria: estourar ~16% deixa o aro
     ao redor do retrato em vez de cobrir o rosto */
  inset: -16%;
  width: 132%;
  height: 132%;
  pointer-events: none;
  user-select: none;
}

/* ---------- barra de progresso (dado real, nunca imagem) ---------- */
.shell-barra {
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
  margin: .6rem 0 .3rem;
}
.shell-barra-preenchida {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--sofia-violet-500, #8B5CF6), var(--sofia-gold-400, #D4A24E));
  transition: width .6s ease;
}

/* ---------- ações rápidas ---------- */
.shell-acoes { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.1rem; }
.shell-acao {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .6rem 1rem;
  border-radius: 999px;
  border: var(--shell-card-border);
  background: rgba(139,92,246,.08);
  color: var(--sofia-text-on-dark, #F5F3FF);
  text-decoration: none;
  font-size: .84rem;
  transition: background .2s, border-color .2s;
}
.shell-acao:hover {
  background: rgba(139,92,246,.16);
  border-color: var(--sofia-line-violet, rgba(139,92,246,.3));
}
.shell-acao-icone { width: 18px; height: 18px; object-fit: contain; }

/* ---------- menu "Mais" (bottom-sheet mobile) ----------
   Sem isso, no mobile Jornadas/Livro/Tarô/Mapa Astral/Numerologia/
   Biblioteca/Carteira/Perfil ficariam sem nenhum caminho pra chegar
   lá — só cabem 4 destinos fixos no rodapé (ver app-shell.js). */
.shell-mais { position: fixed; inset: 0; z-index: var(--shell-z-modal); }
.shell-mais[hidden] { display: none; }
.shell-mais-fundo {
  position: absolute; inset: 0;
  background: rgba(13,10,20,.72);
  backdrop-filter: blur(2px);
}
.shell-mais-painel {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: min(70vh, 560px);
  overflow-y: auto;
  background: var(--sofia-cosmic-950, #0D0A14);
  border-top: var(--shell-card-border);
  border-radius: 20px 20px 0 0;
  padding: .6rem 1rem calc(1.2rem + env(safe-area-inset-bottom, 0px));
  animation: shellMaisSubir .22s ease-out;
}
@media (prefers-reduced-motion: reduce) {
  .shell-mais-painel { animation: none; }
}
@keyframes shellMaisSubir {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.shell-mais-alca {
  width: 36px; height: 4px; border-radius: 999px;
  background: rgba(255,255,255,.18);
  margin: .5rem auto .8rem;
}
.shell-mais-nav { display: flex; flex-direction: column; gap: .2rem; }
.shell-mais-item {
  display: flex; align-items: center; gap: .8rem;
  padding: .7rem .5rem;
  border-radius: 12px;
  text-decoration: none;
  color: var(--sofia-text-on-dark, #F5F3FF);
  font-size: .92rem;
}
.shell-mais-item:hover, .shell-mais-item:focus-visible {
  background: rgba(139,92,246,.10);
}
/* trava o scroll do fundo enquanto a folha está aberta */
body.shell-mais-aberto { overflow: hidden; }
@media (min-width: 901px) {
  /* na sidebar desktop todos os itens já ficam visíveis; "Mais" só existe no mobile */
  .shell-mais { display: none !important; }
}


/* onboarding leve de produto — uma vez por conta */
.shell-onboarding-produto{position:fixed;inset:0;z-index:1200;display:grid;place-items:center;padding:1rem}
.shell-onboarding-produto[hidden]{display:none}.shell-onboarding-fundo{position:absolute;inset:0;background:rgba(7,5,12,.82);backdrop-filter:blur(7px)}
.shell-onboarding-painel{position:relative;width:min(520px,100%);max-height:calc(100vh - 2rem);overflow:auto;padding:1.2rem;border:1px solid rgba(196,181,253,.22);border-radius:22px;background:linear-gradient(160deg,#171221,#100c19);box-shadow:0 24px 80px rgba(0,0,0,.42);color:var(--sofia-text-on-dark,#F5F3FF)}
.shell-onboarding-topo{display:flex;align-items:center;justify-content:space-between;gap:1rem}.shell-onboarding-kicker{font-size:.68rem;letter-spacing:.13em;color:var(--sofia-gold-300,#E5C27B);font-weight:700}.shell-onboarding-pular{border:0;background:transparent;color:var(--sofia-text-muted-on-dark,#C4B5FD);padding:.5rem;cursor:pointer}
.shell-onboarding-progresso{display:flex;gap:.35rem;margin:1rem 0}.shell-onboarding-progresso span{width:24px;height:4px;border-radius:999px;background:rgba(196,181,253,.16)}.shell-onboarding-progresso span.ativo{background:var(--sofia-gold-400,#D4A24E)}
.shell-onboarding-conteudo{padding:.8rem 0 1rem}.shell-onboarding-icone{font-size:2rem}.shell-onboarding-conteudo h2{font-family:var(--sofia-font-display,serif);font-size:2rem;line-height:1.05;margin:.55rem 0}.shell-onboarding-conteudo p{color:var(--sofia-text-muted-on-dark,#C4B5FD);line-height:1.65;margin:.5rem 0 1rem}
.shell-onboarding-link{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:.7rem 1rem;border-radius:999px;background:rgba(139,92,246,.16);border:1px solid rgba(196,181,253,.25);color:var(--sofia-text-on-dark,#F5F3FF);text-decoration:none;font-weight:600}.shell-onboarding-mini{display:grid;gap:.2rem;padding:.8rem .9rem;border-radius:14px;background:rgba(212,162,78,.08);border:1px solid rgba(212,162,78,.2)}
.shell-onboarding-mini strong{color:var(--sofia-gold-300,#E5C27B)}.shell-onboarding-mini span{font-size:.8rem;color:var(--sofia-text-muted-on-dark,#C4B5FD)}.shell-onboarding-acoes{display:flex;justify-content:flex-end;gap:.6rem;flex-wrap:wrap;border-top:1px solid rgba(196,181,253,.12);padding-top:1rem}.shell-onboarding-acoes button{min-height:44px;padding:.7rem 1rem;border-radius:999px;font:inherit;cursor:pointer}
.shell-onboarding-voltar{background:transparent;border:1px solid rgba(196,181,253,.2);color:var(--sofia-text-muted-on-dark,#C4B5FD)}.shell-onboarding-avancar{border:0;background:linear-gradient(135deg,#8B5CF6,#4C1D95);color:#fff;font-weight:700}.shell-onboarding-aberto{overflow:hidden}
@media(max-width:520px){.shell-onboarding-produto{padding:.7rem}.shell-onboarding-painel{padding:1rem;border-radius:18px}.shell-onboarding-conteudo h2{font-size:1.7rem}.shell-onboarding-acoes{display:grid;grid-template-columns:1fr}.shell-onboarding-acoes button{width:100%}}
@media(prefers-reduced-motion:reduce){.shell-onboarding-painel{scroll-behavior:auto}}
