/* 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 ÚNICA DA MARCA — uma só animação, fixa, embaixo de tudo.
   Os orbs ficam parados e só o ciclo de cor (translúcido) desliza,
   preservando o creme como base. 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.
   ══════════════════════════════════════════════════════════════ */
@keyframes rgcFundo {
  0%, 100% { background-position: 0% 0%, 0% 0%, 0% 0%, 50% 0%; }
  50%      { background-position: 0% 0%, 0% 0%, 0% 0%, 50% 100%; }
}
.app-shell::before {
  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%),
    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%);
  background-size: auto, auto, auto, 100% 280%;
  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); }

/* ── 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; }
}
