/* =====================================================================
   WOW — camada visual global (carregada depois do style.css)
   Movimento, luz e acabamento para todas as páginas, sem mexer em cada uma.
   ===================================================================== */

:root {
  --wow-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --wow-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --wow-glow-a: 124, 48, 255;   /* roxo */
  --wow-glow-b: 0, 207, 255;    /* ciano */
  --wow-glow-c: 255, 61, 170;   /* magenta */
}

/* ---------- Base: letras mais nítidas, seleção, foco, scrollbar ---------- */
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

::selection { background: rgba(var(--wow-glow-a), 0.45); color: #fff; }

:focus-visible {
  outline: 2px solid rgba(var(--wow-glow-b), 0.85);
  outline-offset: 2px;
  border-radius: 6px;
}

html { scrollbar-width: thin; scrollbar-color: rgba(var(--wow-glow-a), 0.35) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(var(--wow-glow-a), 0.45), rgba(var(--wow-glow-b), 0.35));
  border-radius: 999px; border: 3px solid transparent; background-clip: padding-box;
}

/* ---------- Entrada de página: os blocos aparecem em cascata ---------- */
@keyframes wowRise {
  from { opacity: 0; transform: translateY(16px) scale(0.985); filter: blur(4px); }
  to   { opacity: 1; transform: none; filter: none; }
}

/* A camada .wow-page não tem caixa própria: o layout de <main> fica igual */
.wow-page { display: contents; }

/* Se a página tem vários blocos, animam-se eles; se tem um só invólucro, animam-se os filhos dele.
   "backwards" garante que, no fim, não fica nenhum transform (as janelas fixas continuam no sítio). */
.wow-page > :not(:only-child),
.wow-page > :only-child > * {
  animation: wowRise 0.6s var(--wow-ease) backwards;
}
.wow-page > :nth-child(2), .wow-page > :only-child > :nth-child(2) { animation-delay: 0.06s; }
.wow-page > :nth-child(3), .wow-page > :only-child > :nth-child(3) { animation-delay: 0.12s; }
.wow-page > :nth-child(4), .wow-page > :only-child > :nth-child(4) { animation-delay: 0.18s; }
.wow-page > :nth-child(5), .wow-page > :only-child > :nth-child(5) { animation-delay: 0.24s; }
.wow-page > :nth-child(6), .wow-page > :only-child > :nth-child(6) { animation-delay: 0.30s; }
.wow-page > :nth-child(n+7), .wow-page > :only-child > :nth-child(n+7) { animation-delay: 0.36s; }

/* Janelas e avisos não entram em cascata */
.wow-page .modal, .wow-page .toast { animation-delay: 0s; }

/* ---------- Cartões: luz que segue o rato + contorno que acende ---------- */
.card, .hm-card, .rg-card, .pa-card, .role-card,
.hm-stat, .pm-stat, .adm-stat, .gr-stat, .rg-stat, .rx-stat, .wk-stat, .ca-stat, .eq-stat {
  isolation: isolate;
  transition: border-color 0.35s var(--wow-ease), box-shadow 0.35s var(--wow-ease), transform 0.35s var(--wow-ease);
}
.card, .hm-card {
  border-color: rgba(255, 255, 255, 0.075);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 0 0 1px rgba(0, 0, 0, 0.25),
    0 18px 40px -18px rgba(0, 0, 0, 0.75);
}

.wow-spot::before,
.wow-spot::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s var(--wow-ease);
}
/* luz suave por trás do conteúdo */
.wow-spot::before {
  z-index: -1;
  background: radial-gradient(520px circle at var(--mx, 50%) var(--my, 50%), rgba(var(--wow-glow-a), 0.13), transparent 42%);
}
/* contorno de 1px que brilha perto do rato */
.wow-spot::after {
  padding: 1px;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgba(var(--wow-glow-b), 0.75), rgba(var(--wow-glow-a), 0.35) 40%, transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.wow-spot.is-lit::before, .wow-spot.is-lit::after { opacity: 1; }

/* cartões clicáveis levantam um pouco */
a.card:hover, .pa-card:hover, .role-card:hover, button.hm-card:hover, a.hm-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 24px 50px -20px rgba(var(--wow-glow-a), 0.45), 0 0 0 1px rgba(var(--wow-glow-a), 0.25);
}

/* ---------- Botões: brilho que passa + resposta ao clique ---------- */
.btn-primary {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.25s var(--wow-spring), box-shadow 0.3s var(--wow-ease), filter 0.3s var(--wow-ease) !important;
}
.btn-primary::after {
  content: '';
  position: absolute; top: 0; bottom: 0; left: -60%; width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  pointer-events: none;
  z-index: 1;
}
.btn-primary:hover:not(:disabled)::after { animation: wowShine 0.85s var(--wow-ease); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 10px 30px -8px rgba(var(--wow-glow-a), 0.7) !important; filter: brightness(1.08); }
@keyframes wowShine { to { left: 120%; } }

.btn-primary:active:not(:disabled), .btn-secondary:active:not(:disabled), .nav-btn:active, .nav-hub-card:active, .bn-item:active {
  transform: scale(0.97) !important;
  transition-duration: 0.08s !important;
}

/* ---------- Menu lateral ---------- */
.topbar {
  background:
    radial-gradient(120% 40% at 0% 0%, rgba(var(--wow-glow-a), 0.16), transparent 60%),
    radial-gradient(120% 30% at 100% 100%, rgba(var(--wow-glow-b), 0.08), transparent 60%),
    rgba(5, 6, 12, 0.7) !important;
  border-right: 1px solid transparent !important;
  border-image: linear-gradient(180deg, rgba(var(--wow-glow-a), 0.5), rgba(var(--wow-glow-b), 0.15) 50%, rgba(var(--wow-glow-c), 0.25)) 1 !important;
  backdrop-filter: blur(18px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(18px) saturate(160%) !important;
}

.topbar .logo {
  filter: drop-shadow(0 0 14px rgba(var(--wow-glow-a), 0.55));
  transition: filter 0.4s var(--wow-ease), transform 0.5s var(--wow-spring);
}
.topbar .logo-area:hover .logo { transform: rotate(-4deg) scale(1.06); filter: drop-shadow(0 0 22px rgba(var(--wow-glow-b), 0.7)); }

.topbar .nav-btn,
.topbar .nav-hub-card {
  position: relative;
  transition: background 0.25s var(--wow-ease), color 0.25s var(--wow-ease), padding 0.3s var(--wow-ease), transform 0.2s var(--wow-ease) !important;
}
.topbar .nav-btn:hover,
.topbar .nav-hub-card:hover {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.015)) !important;
  padding-left: 1.1rem !important;
}

.topbar .nav-btn.active,
.topbar .nav-hub-card.active {
  border-left: none !important;
  padding-left: 1.1rem !important;
  background: linear-gradient(90deg, rgba(var(--wow-glow-a), 0.38) 0%, rgba(var(--wow-glow-a), 0.1) 55%, transparent 100%) !important;
  box-shadow: inset 0 0 0 1px rgba(var(--wow-glow-a), 0.25), 0 8px 24px -12px rgba(var(--wow-glow-a), 0.8) !important;
  text-shadow: 0 0 18px rgba(var(--wow-glow-b), 0.35);
}
/* barra de luz à esquerda do item ativo */
.topbar .nav-btn.active::after,
.topbar .nav-hub-card.active::after {
  content: '';
  position: absolute; left: 0; top: 22%; bottom: 22%; width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, rgb(var(--wow-glow-b)), rgb(var(--wow-glow-a)));
  box-shadow: 0 0 12px rgba(var(--wow-glow-b), 0.9), 0 0 24px rgba(var(--wow-glow-a), 0.6);
  animation: wowBar 0.45s var(--wow-spring);
}
@keyframes wowBar { from { transform: scaleY(0); opacity: 0; } to { transform: scaleY(1); opacity: 1; } }

.topbar .nav-hub-heading {
  background: linear-gradient(90deg, rgba(240, 240, 245, 0.45), rgba(var(--wow-glow-a), 0.6));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

/* ---------- Telemóvel: barra de cima e barra de baixo ---------- */
@media (max-width: 768px) {
  .sb-mobile-bar {
    background: rgba(6, 7, 14, 0.72) !important;
    backdrop-filter: blur(18px) saturate(160%) !important;
    -webkit-backdrop-filter: blur(18px) saturate(160%) !important;
    border-bottom: 1px solid rgba(var(--wow-glow-a), 0.22) !important;
  }

  .bottom-nav {
    left: 0.6rem; right: 0.6rem;
    bottom: calc(0.5rem + env(safe-area-inset-bottom));
    padding: 0.3rem;
    border-radius: 22px;
    background: rgba(10, 11, 22, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 40px -10px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(var(--wow-glow-a), 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(20px) saturate(170%); -webkit-backdrop-filter: blur(20px) saturate(170%);
  }
  .bn-item { border-radius: 16px; transition: color 0.25s var(--wow-ease), background 0.3s var(--wow-ease); }
  .bn-item span { transition: transform 0.35s var(--wow-spring), filter 0.3s var(--wow-ease); }
  .bn-item.is-active {
    background: linear-gradient(180deg, rgba(var(--wow-glow-a), 0.32), rgba(var(--wow-glow-a), 0.12));
    box-shadow: inset 0 0 0 1px rgba(var(--wow-glow-a), 0.3), 0 6px 18px -8px rgba(var(--wow-glow-a), 0.9);
  }
  .bn-item.is-active span { transform: translateY(-2px) scale(1.12); filter: drop-shadow(0 0 8px rgba(var(--wow-glow-b), 0.6)); }

  /* a barra flutua, por isso o conteúdo e a gaveta ganham um pouco mais de espaço */
  :root { --bn-h: calc(72px + env(safe-area-inset-bottom)); }
  main { padding-bottom: calc(90px + env(safe-area-inset-bottom)) !important; }
  .chat-panel { bottom: calc(76px + env(safe-area-inset-bottom)) !important; }
}

/* ---------- Janelas (modais) com entrada suave ---------- */
.modal { backdrop-filter: blur(8px) saturate(120%); -webkit-backdrop-filter: blur(8px) saturate(120%); }
.modal > * { animation: wowPop 0.45s var(--wow-spring) backwards; }
@keyframes wowPop { from { opacity: 0; transform: translateY(12px) scale(0.96); } to { opacity: 1; transform: none; } }

/* ---------- Quem pediu menos movimento no sistema ---------- */
@media (prefers-reduced-motion: reduce) {
  .wow-page > *, .wow-page > :only-child > *, .modal > *,
  .topbar .nav-btn.active::after, .topbar .nav-hub-card.active::after,
  .btn-primary:hover::after { animation: none !important; }
  .wow-spot::before, .wow-spot::after { display: none; }
}

/* =====================================================================
   PESQUISA RÁPIDA (Ctrl+K) — CommandPalette.jsx
   ===================================================================== */
.cp-trigger {
  display: flex; align-items: center; gap: 0.55rem;
  width: 100%; margin: 0 0 0.75rem; padding: 0.55rem 0.7rem;
  border-radius: 12px; cursor: pointer; flex-shrink: 0;
  font: inherit; font-size: 0.78rem; color: rgba(240, 240, 245, 0.55); text-align: left;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025));
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: border-color 0.25s var(--wow-ease), color 0.25s var(--wow-ease), box-shadow 0.3s var(--wow-ease);
}
.cp-trigger:hover {
  color: #fff; border-color: rgba(var(--wow-glow-a), 0.55);
  box-shadow: 0 0 0 3px rgba(var(--wow-glow-a), 0.15), 0 8px 24px -12px rgba(var(--wow-glow-a), 0.9);
}
.cp-trigger-text { flex: 1; }
.cp-trigger kbd, .cp-foot kbd, .cp-esc {
  font-family: var(--font-body); font-size: 0.66rem; font-weight: 600; line-height: 1;
  padding: 0.25rem 0.4rem; border-radius: 6px; color: rgba(240, 240, 245, 0.75);
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom-width: 2px;
}
.cp-mob-btn { display: none; }

@media (max-width: 768px) {
  .topbar .cp-trigger { display: none; }
  .cp-mob-btn {
    display: flex; align-items: center; justify-content: center;
    width: 2.35rem; height: 2.35rem; margin-left: auto; flex-shrink: 0;
    border-radius: 12px; font-size: 1rem; cursor: pointer;
    background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1);
  }
  .cp-mob-btn + .sb-mob-avatar { margin-left: 0.5rem; }
}

/* janela */
.cp-overlay {
  position: fixed; inset: 0; z-index: 1060;
  display: flex; justify-content: center; align-items: flex-start;
  padding: min(14vh, 140px) 1rem 1rem;
  background: rgba(3, 3, 10, 0.55);
  backdrop-filter: blur(10px) saturate(130%); -webkit-backdrop-filter: blur(10px) saturate(130%);
  animation: cpFade 0.2s ease;
}
@keyframes cpFade { from { opacity: 0; } to { opacity: 1; } }

.cp {
  position: relative;
  width: min(640px, 100%); max-height: min(70vh, 560px);
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: 20px;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(var(--wow-glow-a), 0.18), transparent 60%),
    radial-gradient(100% 50% at 100% 100%, rgba(var(--wow-glow-b), 0.1), transparent 60%),
    rgba(12, 13, 28, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 0 0 1px rgba(var(--wow-glow-a), 0.25),
    0 30px 80px -20px rgba(0, 0, 0, 0.9),
    0 0 80px -20px rgba(var(--wow-glow-a), 0.55);
  animation: cpIn 0.35s var(--wow-spring);
}
/* linha de luz no topo */
.cp::before {
  content: ''; position: absolute; top: 0; left: 10%; right: 10%; height: 1px;
  background: linear-gradient(90deg, transparent, rgb(var(--wow-glow-b)), rgb(var(--wow-glow-a)), transparent);
  box-shadow: 0 0 12px rgba(var(--wow-glow-b), 0.8);
}
@keyframes cpIn { from { opacity: 0; transform: translateY(-10px) scale(0.97); } to { opacity: 1; transform: none; } }

.cp-search {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1rem 1.1rem; border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.cp-search-icon { font-size: 1.05rem; opacity: 0.8; }
/* !important: os campos do site têm moldura e fundo próprios */
.cp-search input {
  flex: 1; min-width: 0; width: auto !important; min-height: 0 !important; height: auto !important;
  background: none !important; border: none !important; outline: none !important; box-shadow: none !important;
  color: #fff; font: inherit; font-size: 1.05rem; padding: 0.2rem 0 !important; margin: 0 !important; border-radius: 0 !important;
}
.cp-search input::placeholder { color: rgba(240, 240, 245, 0.38); }
.cp-search input:focus-visible { outline: none; }
.cp-esc { cursor: pointer; }

.cp-list { flex: 1; overflow-y: auto; padding: 0.4rem 0.5rem 0.6rem; overscroll-behavior: contain; }
.cp-group-title {
  margin: 0.65rem 0.65rem 0.3rem; font-size: 0.64rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.14em; color: rgba(240, 240, 245, 0.38);
}
.cp-item {
  position: relative; display: flex; align-items: center; gap: 0.75rem;
  width: 100%; padding: 0.55rem 0.65rem; border-radius: 12px;
  background: none !important; border: 1px solid transparent !important; box-shadow: none !important;
  color: rgba(240, 240, 245, 0.85); transform: none !important; min-height: 0 !important;
  font: inherit; text-align: left; cursor: pointer; justify-content: flex-start !important;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.cp-item.is-active {
  background: linear-gradient(90deg, rgba(var(--wow-glow-a), 0.3), rgba(var(--wow-glow-a), 0.08)) !important;
  border-color: rgba(var(--wow-glow-a), 0.35) !important;
  color: #fff;
}
.cp-item.is-active::before {
  content: ''; position: absolute; left: -1px; top: 25%; bottom: 25%; width: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, rgb(var(--wow-glow-b)), rgb(var(--wow-glow-a)));
  box-shadow: 0 0 10px rgba(var(--wow-glow-b), 0.9);
}
.cp-item-icon {
  width: 2.1rem; height: 2.1rem; flex-shrink: 0; border-radius: 10px; overflow: hidden;
  display: flex; align-items: center; justify-content: center; font-size: 1.05rem;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.08);
}
.cp-item-icon img { width: 100%; height: 100%; object-fit: cover; }
.cp-item.is-active .cp-item-icon { border-color: rgba(var(--wow-glow-b), 0.45); box-shadow: 0 0 14px -4px rgba(var(--wow-glow-b), 0.8); }
.cp-item-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cp-item-text strong { font-size: 0.88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-item-text small { font-size: 0.74rem; color: rgba(240, 240, 245, 0.45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-item mark { background: none; color: rgb(var(--wow-glow-b)); text-shadow: 0 0 12px rgba(var(--wow-glow-b), 0.6); }
.cp-item-go { opacity: 0; font-size: 0.85rem; color: rgba(240, 240, 245, 0.6); transform: translateX(-4px); transition: opacity 0.15s ease, transform 0.2s var(--wow-ease); }
.cp-item.is-active .cp-item-go { opacity: 1; transform: none; }

.cp-empty { padding: 2.2rem 1rem; text-align: center; color: rgba(240, 240, 245, 0.5); }
.cp-empty span { display: block; font-size: 2rem; margin-bottom: 0.5rem; animation: cpSpin 2.5s linear infinite; }
@keyframes cpSpin { to { transform: rotate(360deg); } }

.cp-foot {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 0.6rem 1rem; font-size: 0.7rem; color: rgba(240, 240, 245, 0.45);
  border-top: 1px solid rgba(255, 255, 255, 0.07); background: rgba(0, 0, 0, 0.2);
}
.cp-foot kbd { margin-right: 0.2rem; }
.cp-foot-brand { margin-left: auto; font-family: var(--font-head); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(var(--wow-glow-a), 0.85); }

@media (max-width: 768px) {
  .cp-overlay { padding: calc(0.75rem + env(safe-area-inset-top)) 0.6rem 0.6rem; }
  .cp { max-height: calc(100dvh - 1.5rem - env(safe-area-inset-top)); }
  .cp-search input { font-size: 16px; } /* evita o zoom do iPhone */
  .cp-foot { display: none; }
  .cp-item { padding: 0.7rem 0.65rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cp-overlay, .cp, .cp-empty span { animation: none !important; }
}
