/* Shell de navegação compartilhado (sidebar desktop + bottom nav mobile) */

:root {
  --app-topbar-h: 56px; /* altura da top bar mobile (a bottom nav foi removida — virou ☰ no topo) */
}

.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
  background: var(--color-cream); /* base sólida do design system */
}

/* ══════════════════════════════════════════════════════════════
   CAMADA DA MARCA — fixa, embaixo de tudo, em DUAS sub-camadas:
   ::before = o "ciclo de cor" (linear translúcido) que DESLIZA;
   ::after  = os orbs estáticos (radiais) POR CIMA dele.
   Sidebar / lista do chat / bottom nav são "janelas" translúcidas para ESTA
   camada (não animam sozinhos), então tudo se move em sincronia. Cards e
   botões são opacos → intactos.

   ⚠️ Performance (2026-07-28): o deslize é animado por TRANSFORM (composto na
   GPU), NÃO por background-position — que não é compositável e forçava um
   REPAINT da viewport inteira a cada frame. Isso custava ~100%+ de CPU em
   máquina SEM GPU (software rendering) e ~13% mesmo COM GPU, em toda página.
   Além disso, a animação só roda se a usuária NÃO pediu "menos movimento"
   (prefers-reduced-motion) — que é também o escape em ambiente sem GPU: ligue
   "reduzir animações" no SO → fundo estático, CPU ~0.
   ══════════════════════════════════════════════════════════════ */
@keyframes rgcFundo {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-180vh); }
}
/* Sub-camada que desliza: o wash linear. Mais alta que a viewport (280vh) e
   movida por transform — a fatia visível muda sem repintar os gradientes. */
.app-shell::before {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: 280vh;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(165deg,
    rgba(221, 177, 247, 0.24) 0%,
    rgba(255, 110, 31, 0.13) 34%,
    rgba(180, 181, 54, 0.13) 66%,
    rgba(132, 153, 183, 0.16) 100%);
  transform: translateY(0);
}
/* Orbs estáticos, POR CIMA do wash (mesma ordem visual de antes: radiais sobre o linear). */
.app-shell::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 900px at 34% 6%,  rgba(221, 177, 247, 0.30), transparent 60%),
    radial-gradient(780px 780px at 90% 84%, rgba(255, 110, 31, 0.18), transparent 58%),
    radial-gradient(680px 680px at 62% 48%, rgba(180, 181, 54, 0.12), transparent 60%);
}
/* Só anima quem NÃO pediu menos movimento (acessibilidade + escape sem-GPU).
   will-change aqui dentro: só promove a camada de composição quando de fato anima. */
@media (prefers-reduced-motion: no-preference) {
  .app-shell::before {
    will-change: transform;
    animation: rgcFundo 22s ease-in-out infinite;
  }
}
/* Conteúdo e sidebar ficam acima da camada (que continua visível pelas transparências). */
.app-sidebar,
.app-main { position: relative; z-index: 1; }

/* ── Sidebar (desktop) ── */
.app-sidebar {
  width: 248px;
  flex-shrink: 0;
  /* Janela para a MESMA camada animada: véu leve + saturação do que está atrás,
     pra o ciclo de cor aparecer no painel sem precisar tingir o conteúdo. */
  background: rgba(255, 255, 255, 0.32);
  -webkit-backdrop-filter: saturate(1.8);
  backdrop-filter: saturate(1.8);
  border-right: 1px solid rgba(221, 177, 247, 0.30);
  padding: 26px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;                 /* os filhos gerenciam o próprio scroll (ver .app-nav) */
}

/* Zona rolável do menu: só a lista de navegação rola; logo (topo) e criar/rodapé (base) ficam
   fixos, pra o avatar + "Sair" nunca sumirem quando o menu passa da altura da tela. */
.app-nav {
  flex: 1 1 auto;
  min-height: 0;                    /* sem isto o flex-item não encolhe e o overflow não ativa */
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Logo colorido + estrelas verdes animadas */
.app-logo {
  display: flex;
  justify-content: center;
  padding: 4px 8px 26px;
  cursor: pointer;
}

/* Itens de navegação */
.app-navitem {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: background 0.15s;
}
.app-navitem svg { color: var(--color-text-muted); }
.app-navitem:hover { background: rgba(255, 255, 255, 0.7); }
.app-navitem.active {
  background: var(--color-orange-light);
  color: var(--color-orange);
  font-weight: 700;
}
.app-navitem.active svg { color: var(--color-orange); }

/* Botão "Criar encontro" (primário laranja) */
.app-criar-btn {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--color-orange);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  padding: 13px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-btn-primary);
  transition: opacity 0.15s;
}
.app-criar-btn:hover { opacity: 0.92; }

/* Rodapé: avatar + nome + sair */
/* Rodapé da sidebar: card branco pra destacar do wash animado atrás. */
.app-rodape {
  /* `auto` não gera folga aqui (o .app-nav é flex:1 e come o espaço livre) — sem um valor
     explícito o rodapé fica só com o gap de 4px da sidebar e cola no "Criar encontro",
     que tem 16px acima. O 14px + gap iguala os dois lados do botão. */
  margin-top: 14px;
  background: #fff;
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
}
.app-user {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s;
}
.app-user:hover { background: var(--color-cream); }
.app-user-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-user-sub { font-size: 12px; color: var(--color-text-muted); }
.app-sair {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 10px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  /* Já passou por muted → secondary e continuava sumindo no rodapé. Agora usa a cor de perigo,
     coerente com o "Sair da conta" do perfil (.btn-danger-outline). */
  color: var(--color-danger);
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.15s;
}
.app-sair:hover { background: rgba(232, 71, 63, 0.08); }

/* ══════ Alternador de contexto App / Admin ══════ */
.ctx-switch { display: flex; gap: 4px; background: var(--color-cream); border-radius: 12px; padding: 4px; margin-bottom: 10px; flex-shrink: 0; }
.ctx-tab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; background: none; cursor: pointer; border-radius: 9px; padding: 8px;
  font-family: var(--font-body); font-size: 12px; font-weight: 600; color: var(--color-text-muted);
}
.ctx-tab.on { background: #fff; color: var(--color-orange); font-weight: 700; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06); }
.ctx-tab-admin.on { background: var(--color-orange); color: #fff; box-shadow: 0 2px 10px rgba(255, 110, 31, 0.4); }
.ctx-badge { background: var(--color-orange); color: #fff; font-size: 9px; font-weight: 700; border-radius: 50px; padding: 1px 6px; }

/* Badge crítico (denúncias) */
.nav-badge.critico { background: var(--color-danger); }

/* ══════ Card "Hoje" — central de tarefas (contexto Admin) ══════ */
.app-hoje { background: rgba(246, 242, 227, 0.08); border: 1px solid rgba(246, 242, 227, 0.12); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
.app-hoje-lbl { font-size: 10px; font-weight: 700; color: #b4b536; letter-spacing: 0.1em; margin-bottom: 8px; }
.app-hoje-stats { display: flex; gap: 8px; }
.app-hoje-stat { flex: 1; text-align: left; background: none; border: none; cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.app-hoje-stat:hover { background: rgba(246, 242, 227, 0.07); }
.app-hoje-num { font-family: var(--font-display); font-size: 19px; font-weight: 700; color: #f6f2e3; line-height: 1; }
.app-hoje-cap { font-size: 9px; color: rgba(246, 242, 227, 0.6); margin-top: 3px; }

/* ══════ Modo Admin — sidebar/drawer escura ══════ */
.app-sidebar.admin {
  background: #2b2318; -webkit-backdrop-filter: none; backdrop-filter: none;
  border-right-color: rgba(246, 242, 227, 0.10);
}
.app-sidebar.admin .ctx-switch { background: rgba(246, 242, 227, 0.12); }
.app-sidebar.admin .ctx-tab { color: rgba(246, 242, 227, 0.55); }
.app-sidebar.admin .app-navitem { color: rgba(246, 242, 227, 0.8); }
.app-sidebar.admin .app-navitem svg { color: rgba(246, 242, 227, 0.55); }
.app-sidebar.admin .app-navitem:hover { background: rgba(246, 242, 227, 0.08); }
.app-sidebar.admin .app-navitem.active { background: rgba(255, 110, 31, 0.18); color: #ff9a5f; font-weight: 700; }
.app-sidebar.admin .app-navitem.active svg { color: var(--color-orange); }
.app-sidebar.admin .app-rodape { background: rgba(246, 242, 227, 0.08); }
.app-sidebar.admin .app-user:hover { background: rgba(246, 242, 227, 0.06); }
.app-sidebar.admin .app-user-name { color: #f6f2e3; }
.app-sidebar.admin .app-user-sub { color: rgba(246, 242, 227, 0.55); }
.app-sidebar.admin .app-user-admin .avatar { box-shadow: 0 0 0 2px #2b2318, 0 0 0 4px var(--color-orange); }
.app-sidebar.admin .app-voltar { color: rgba(246, 242, 227, 0.8); }
.app-sidebar.admin .app-voltar:hover { background: rgba(246, 242, 227, 0.08); }

/* ── Conteúdo ── */
.app-main {
  flex: 1;
  min-width: 0;
}

/* ── Painel de notificações (sininho) ── */
.notif-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.12);
  z-index: 300;
}
.notif-panel {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 360px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  background: #fff;
  border-radius: var(--radius-modal);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  z-index: 301;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}
.notif-head-acts {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.notif-x {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 16px;
  line-height: 1;
  padding: 4px;
  border-radius: 8px;
}
.notif-x:hover { background: rgba(132, 153, 183, 0.12); color: var(--color-text); }
.notif-marcar {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-orange);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-body);
  white-space: nowrap;
}
.notif-list { overflow-y: auto; }
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 13px 18px;
  background: none;
  border: none;
  border-bottom: 1px solid rgba(132, 153, 183, 0.10);
  cursor: pointer;
  font-family: var(--font-body);
  transition: background 0.15s;
}
.notif-item:hover { background: var(--color-cream); }
.notif-item.nao-lida { background: var(--color-orange-light); }
.notif-item.nao-lida:hover { background: #ffe9dc; }
.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-orange);
  margin-top: 6px;
  flex-shrink: 0;
}
.notif-titulo { display: block; font-family: var(--font-display); font-size: 14px; font-weight: 700; color: var(--color-text); }
.notif-msg { display: block; font-size: 13px; color: var(--color-text-secondary); margin-top: 2px; line-height: 1.4; }
.notif-time { display: block; font-size: 11px; color: var(--color-text-muted); margin-top: 4px; }

/* ── Top bar só no mobile (☰ + logo + avatar). Substituiu a bottom-nav. ── */
.app-topbar { display: none; }

/* Backdrop do drawer — só aparece no mobile (o botão Menu não existe no desktop, então
   menuAberto nunca fica true lá; mesmo assim escondemos por segurança). */
.app-drawer-backdrop { display: none; }

@media (max-width: 820px) {
  /* A sidebar VIRA drawer: sai da tela e desliza com `.aberto`. Não é `display:none` — é o
     mesmo elemento, a mesma lista, só reposicionado. */
  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100dvh;
    width: 82%;
    max-width: 300px;
    z-index: 345;                    /* acima da bottom nav (200); abrir notificações fecha o drawer */
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    /* Como folha por cima do conteúdo, o véu translúcido de desktop deixaria a página vazar por
       trás — aqui é quase opaco, sem o backdrop-filter (não há o que saturar atrás dele). */
    background: #faf7ee;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: 6px 0 28px rgba(43, 35, 24, 0.18);
    overflow-y: auto;               /* lista alta rola dentro do drawer */
  }
  .app-sidebar.aberto { transform: translateX(0); }

  .app-drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 344;                   /* logo abaixo do drawer */
    background: rgba(43, 35, 24, 0.4);
  }

  /* Top bar fixa no topo; o conteúdo desce abaixo dela. */
  .app-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 200;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  }
  .app-main { padding-bottom: 0; }

  /* No chat com sala aberta, a barra vira tela cheia (esconde a top bar). */
  body.sala-aberta .app-topbar { display: none; }

  /* Painel de notificações vira uma folha no topo, acima da bottom nav. */
  .notif-panel {
    top: 8px;
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
    max-height: calc(100vh - 16px - var(--app-topbar-h));
  }
}

/* ── Top bar mobile (elementos) ── */
.app-topbar-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  background: var(--color-cream);
  cursor: pointer;
  flex-shrink: 0;
}
.app-topbar-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 9999px;
  background: var(--color-orange);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  border: 2px solid #fff;
}
.app-topbar-logo {
  height: 24px;
  width: auto;
  cursor: pointer;
}
.app-topbar-avatar {
  margin-left: auto;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Submenu do Admin (AppLayout) ── */
.app-navgrupo { display: flex; flex-direction: column; }

/* Seta que gira ao abrir. margin-left:auto empurra pra direita, depois do badge. */
.app-navseta {
  margin-left: auto;
  flex-shrink: 0;
  transition: transform .18s;
}
.app-navseta.aberto { transform: rotate(90deg); }

.app-subnav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 2px 30px;         /* alinha sob o texto do item pai, não sob o ícone */
  padding-left: 10px;
  border-left: 1.5px solid rgba(221, 177, 247, 0.45);
}
.app-subnavitem {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  background: none;
  border: none;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--color-text-secondary);
  text-align: left;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.app-subnavitem:hover { background: rgba(255, 255, 255, 0.7); }
.app-subnavitem.active {
  background: var(--color-orange-light);
  color: #d45800;
  font-weight: 600;
}
.app-subnavitem .nav-badge { margin-left: auto; }

/* Convite de push (opt-in) — barra no topo do conteúdo até a usuária decidir. */
.push-convite {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 16px;
  padding: 12px 16px;
  background: var(--color-lavender-light);
  border: 1px solid rgba(221, 177, 247, 0.5);
  border-radius: var(--radius-card);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}
.push-convite-info {
  background: #fff;
  border-color: rgba(132, 153, 183, 0.25);
}
.push-convite-txt {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--color-text-secondary);
}
.push-convite-acts {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.push-convite .btn {
  padding: 9px 18px;
  font-size: 13px;
}
.push-convite-x {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 15px;
  padding: 4px 8px;
}
@media (max-width: 640px) {
  .push-convite { flex-direction: column; align-items: stretch; }
  .push-convite-acts .btn { flex: 1; }
}

/* ── Popup de ficha da usuária (admin clica em qualquer avatar) ── */
.perfil-pop-backdrop { position: fixed; inset: 0; background: rgba(43,35,24,0.42); display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; z-index: 1300; overflow-y: auto; }
.perfil-pop { position: relative; background: var(--color-surface); border-radius: 20px; box-shadow: 0 20px 60px rgba(0,0,0,0.28); width: 100%; max-width: 440px; padding: 24px; }
.perfil-pop-x { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border-radius: 50%; background: var(--color-cream); border: none; color: var(--color-slate); font-size: 14px; cursor: pointer; }
.perfil-pop-vazio { padding: 32px; text-align: center; color: var(--color-text-muted); }
.perfil-pop-topo { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.perfil-pop-nome { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--color-text); margin: 0; word-break: break-word; }
.perfil-pop-social { font-size: 13px; color: var(--color-text-secondary); margin-top: 2px; }
.perfil-pop-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.perfil-pop-dados { border-top: 1px solid rgba(132,153,183,0.15); padding-top: 12px; }
.perfil-pop-lin { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 14px; }
.perfil-pop-lbl { color: var(--color-text-muted); flex-shrink: 0; }
.perfil-pop-val { color: var(--color-text); font-weight: 500; text-align: right; word-break: break-word; }
.perfil-pop-stats { display: flex; gap: 10px; margin-top: 16px; }
.perfil-pop-stat { flex: 1; background: var(--color-cream); border-radius: 14px; padding: 12px; text-align: center; }
.perfil-pop-stat-num { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--color-text); }
.perfil-pop-stat-lbl { font-size: 11px; color: var(--color-text-muted); margin-top: 2px; }

/* Conjunto popup + painel deslizante (ficha de compras/eventos da usuária ao clicar em "encontros"). */
.perfil-pop-conjunto { display: flex; align-items: flex-start; }
.perfil-pop-conjunto > .perfil-pop { flex: 0 0 auto; width: 440px; max-width: 92vw; }
.perfil-pop-stat-btn { border: none; cursor: pointer; font: inherit; transition: background .15s ease, box-shadow .15s ease; }
.perfil-pop-stat-btn:hover { background: #fff3ec; box-shadow: 0 2px 10px rgba(255,110,31,0.16); }
.perfil-pop-stat-btn.on { background: #fff3ec; box-shadow: inset 0 0 0 1.5px var(--color-orange); }
.perfil-pop-stat-btn .perfil-pop-stat-lbl { color: var(--color-orange); font-weight: 700; }

.perfil-pop-painel {
    width: 0; opacity: 0; overflow: hidden; align-self: stretch;
    background: var(--color-surface); border-radius: 0 20px 20px 0;
    box-shadow: 0 20px 60px rgba(0,0,0,0.28);
    transition: width .34s cubic-bezier(.4,0,.2,1), opacity .3s ease, margin-left .34s cubic-bezier(.4,0,.2,1);
}
.perfil-pop-painel.aberto { width: min(460px, 92vw); opacity: 1; margin-left: 10px; }
.perfil-pop-painel-inner { width: min(460px, 92vw); padding: 22px; max-height: calc(100vh - 96px); overflow-y: auto; }

/* Telas estreitas: o painel abre ABAIXO do popup (desliza em altura em vez de largura). */
@media (max-width: 900px) {
    .perfil-pop-conjunto { flex-direction: column; align-items: stretch; }
    .perfil-pop-conjunto > .perfil-pop { width: 100%; max-width: 440px; }
    .perfil-pop-painel {
        width: auto !important; max-height: 0; margin-left: 0 !important;
        border-radius: 0 0 20px 20px;
        transition: max-height .34s cubic-bezier(.4,0,.2,1), opacity .3s ease;
    }
    .perfil-pop-painel.aberto { max-height: 78vh; }
    .perfil-pop-painel-inner { width: auto; }
}
