/* ============================================================
   painel-shell.css — Topbar + Sidebar compartilhados.
   - Topbar: full-width, fica POR CIMA da sidebar (tarja atinge o canto).
   - Sidebar: fixa, abaixo do topbar (top: 56px). Colapsa via hamburguer.
   - Modo colapsado: largura 60px, esconde textos, hover mostra tooltip.
   - User box: clicavel, vai pra Minha conta, hover mostra email.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f1f5f9; color: #1e293b; min-height: 100vh;
  /* Topbar 56px no topo + sidebar 232px na esquerda. Conteudo desloca. */
  padding-left: 232px;
  transition: padding-left .18s ease;
}
body.side-collapsed { padding-left: 60px; }

/* ───────── Topbar (full-width, sticky no topo, POR CIMA da sidebar) ───────── */
.pmv-topbar {
  background: #0f172a; color: #f8fafc;
  height: 56px; padding: 0 22px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  /* Tarja atinge o canto esquerdo (cobre o espaco da sidebar) */
  position: sticky; top: 0; z-index: 100;
  margin-left: -232px; padding-left: 22px;
  transition: margin-left .18s ease;
}
body.side-collapsed .pmv-topbar { margin-left: -60px; }

/* Hamburguer no canto esquerdo, antes do logo */
.pmv-hamb {
  width: 36px; height: 36px; border: none; cursor: pointer;
  background: rgba(255,255,255,.06); color: #f8fafc; border-radius: 8px;
  font-size: 18px; display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 36px;
}
.pmv-hamb:hover { background: rgba(255,255,255,.16); }

.pmv-topbar .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 15px;
  text-decoration: none; color: inherit;
  padding: 4px 8px; border-radius: 6px;
}
.pmv-topbar .brand:hover { background: rgba(255,255,255,.06); }
.pmv-topbar .brand .mark-img {
  width: 30px; height: 30px; border-radius: 7px;
  object-fit: cover;
  background: linear-gradient(135deg, #3b82f6 0%, #9002fc 100%);
}
.pmv-topbar .brand small {
  display: block; font-size: 10px; font-weight: 600; color: #94a3b8;
}

/* Switcher TIER (sandbox) */
.pmv-tier-switch {
  display: flex; align-items: center; gap: 8px; margin-left: auto;
  background: rgba(254,243,199,.1); border: 1px dashed #fde68a;
  padding: 5px 8px; border-radius: 10px;
}
.pmv-tier-switch .lbl {
  font-size: 9.5px; color: #fde68a; font-weight: 800;
  letter-spacing: .4px; text-transform: uppercase;
}
.pmv-tier-switch button {
  border: none; background: transparent; color: #cbd5e1;
  font-size: 11.5px; font-weight: 700; padding: 5px 11px;
  border-radius: 6px; cursor: pointer; transition: all .15s;
}
.pmv-tier-switch button:hover { background: rgba(255,255,255,.06); color: #f8fafc; }
.pmv-tier-switch button.on {
  background: #fde68a; color: #92400e;
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
}

/* Wrapper do user — hover/click abre dropdown com Minha Conta + Sair. */
.pmv-user-wrap {
  position: relative; margin-left: auto;
}
.pmv-user {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: #cbd5e1;
  border: none; background: transparent;
  padding: 4px 8px; border-radius: 8px;
  cursor: pointer; font-family: inherit;
  transition: background .15s;
}
/* Hamb e brand sempre alinhados à esquerda */
.pmv-topbar .pmv-hamb,
.pmv-topbar .brand { flex: 0 0 auto; }
.pmv-user:hover,
.pmv-user-wrap:hover .pmv-user,
.pmv-user-wrap.open .pmv-user { background: rgba(255,255,255,.08); }

/* Dropdown menu — abre no hover do wrap OU quando wrap tem .open (toque). */
.pmv-user-menu {
  display: none;
  position: absolute; right: 0; top: 100%;
  min-width: 180px; margin-top: 6px;
  background: #fff; color: #1e293b;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(15,23,42,.22);
  padding: 6px;
  z-index: 200;
}
.pmv-user-wrap:hover .pmv-user-menu,
.pmv-user-wrap.open .pmv-user-menu { display: block; }
/* "Ponte" invisível pra hover não cair entre o avatar e o menu */
.pmv-user-wrap::after {
  content: ''; position: absolute; right: 0; top: 100%;
  width: 100%; height: 10px;
}
.pmv-user-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 7px;
  font-size: 13px; font-weight: 600;
  color: #1e293b; text-decoration: none;
  transition: background .12s, color .12s;
}
.pmv-user-menu-item .ic { font-size: 15px; line-height: 1; }
.pmv-user-menu-item:hover { background: #f1f5f9; }
.pmv-user-menu-item.pmv-user-menu-sair { color: #b91c1c; margin-top: 2px; }
.pmv-user-menu-item.pmv-user-menu-sair:hover { background: #fee2e2; color: #991b1b; }
.pmv-user .badge-tier {
  font-size: 9.5px; font-weight: 800; padding: 3px 8px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .4px;
}
body[data-tier="cliente"] .pmv-user .badge-tier { background: #dbeafe; color: #1e40af; }
body[data-tier="agente"]  .pmv-user .badge-tier { background: #ede9fe; color: #6d28d9; }
body[data-tier="gestor"]  .pmv-user .badge-tier { background: #fef3c7; color: #92400e; }
body[data-tier="admin"]   .pmv-user .badge-tier { background: #fecdd3; color: #9f1239; }
.pmv-user .av {
  width: 30px; height: 30px; border-radius: 50%;
  background: #3b82f6; color: #fff; display: inline-flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 12px;
}
body[data-tier="admin"] .pmv-user .av { background: #9f1239; }

/* Tooltip do user box agora e NATIVO do browser (title="" atributo).
   CSS custom removido pra evitar popup preto.) */

/* ───────── Sidebar — embaixo do topbar, SEMPRE visivel ───────── */
.pmv-side {
  position: fixed; top: 56px; left: 0; bottom: 0; width: 232px;
  z-index: 60; background: #fff; border-right: 1px solid #e2e8f0;
  padding: 14px 12px; display: flex; flex-direction: column;
  gap: 2px; overflow-y: auto;
  transition: width .18s ease;
}
body.side-collapsed .pmv-side { width: 60px; padding: 14px 6px; }

/* Group header CLICAVEL */
.pmv-side .grp-link {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 12px 6px;
  font-size: 11px; font-weight: 800; color: #0f172a;
  text-transform: uppercase; letter-spacing: .7px;
  text-decoration: none;
  margin-top: 8px;
  border-radius: 6px;
  position: relative;
}
.pmv-side .grp-link:first-of-type { margin-top: 0; }
.pmv-side .grp-link:hover { color: #1e40af; background: #f1f5f9; }
.pmv-side .grp-link.active { color: #fff; background: #3b82f6; }

/* ───── Sortable table headers (pmv-table-sort.js) ─────
   <table class="pmv-sortable"> -> THs viram botoes de filtro.
   Setinha ↕ neutro / ▲ asc / ▼ desc. */
table.pmv-sortable th.pmv-sort-th {
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: background-color .12s;
}
table.pmv-sortable th.pmv-sort-th:hover {
  background-color: rgba(144, 2, 252, .06);
}
table.pmv-sortable th.pmv-sort-th .pmv-sort-arrow {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  color: #94a3b8;
  font-weight: 400;
  vertical-align: middle;
  transition: color .12s;
}
table.pmv-sortable th.pmv-sort-th[data-sort-dir] {
  background-color: rgba(144, 2, 252, .08);
}
table.pmv-sortable th.pmv-sort-th[data-sort-dir] .pmv-sort-arrow {
  color: #9002fc;
  font-weight: 700;
}

/* HIGHLIGHT roxo dissolvendo nos titulos dos grupos (PAINEL DO X) —
   disparado quando o usuario clica no titulo do grupo na sidebar.
   Pulsa um glow roxo + fade-out em ~3s. Bordas dissolvem via box-shadow
   grande com blur. Some sozinho. */
.pmv-side .grp-link.pmv-hl {
  animation: pmv-grp-flash 3s ease-out forwards;
  border-radius: 8px;
}
@keyframes pmv-grp-flash {
  0% {
    background-color: rgba(168, 85, 247, 0);
    color: inherit;
    box-shadow: 0 0 0 0 rgba(168, 85, 247, 0);
  }
  18% {
    background-color: rgba(168, 85, 247, .85);
    color: #fff;
    box-shadow: 0 0 22px 12px rgba(168, 85, 247, .65),
                0 0 44px 24px rgba(168, 85, 247, .25);
  }
  60% {
    background-color: rgba(168, 85, 247, .55);
    color: #fff;
    box-shadow: 0 0 32px 18px rgba(168, 85, 247, .35),
                0 0 60px 36px rgba(168, 85, 247, .12);
  }
  100% {
    background-color: rgba(168, 85, 247, 0);
    color: inherit;
    box-shadow: 0 0 60px 40px rgba(168, 85, 247, 0);
  }
}

/* Items normais (Buscar voos, Estoque, etc) */
.pmv-side a:not(.grp-link) {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px 7px 24px;
  color: #64748b; text-decoration: none; font-size: 12.5px; font-weight: 600;
  border-radius: 7px; transition: all .15s;
  position: relative;
}
.pmv-side a:not(.grp-link) .ic {
  flex: 0 0 20px; text-align: center; font-size: 14px;
}
.pmv-side a:not(.grp-link):hover { color: #0f172a; background: #f1f5f9; }
.pmv-side a:not(.grp-link).active {
  color: #fff; background: #3b82f6;
  box-shadow: 0 2px 6px rgba(59,130,246,.3);
}

/* COLLAPSED mode: esconde textos, mostra so icones, centraliza */
body.side-collapsed .pmv-side .grp-link { display: none; }
body.side-collapsed .pmv-side a:not(.grp-link) {
  justify-content: center;
  padding: 11px 0;
}
body.side-collapsed .pmv-side a:not(.grp-link) .tx { display: none; }
body.side-collapsed .pmv-side .foot-tit { display: none; }

/* HOVER TOOLTIP nativo do browser via atributo title="" nos <a>.
   CSS custom (popup preto) removido a pedido do usuario.
   Vantagem: respeita as configuracoes do SO e do navegador, sem
   conflito de z-index ou aparencia estranha. */

/* ───── Modo público (supportOnly): menu enxuto só com as 4 páginas ─────
   Sem títulos de grupo, então os itens ficam alinhados à esquerda (sem o
   recuo de 24px que existe pra encaixar embaixo dos cabeçalhos de grupo). */
.pmv-side .pmv-side-support { display: flex; flex-direction: column; gap: 2px; }
.pmv-side .pmv-side-support a:not(.grp-link) { padding-left: 14px; }
body.side-collapsed .pmv-side .pmv-side-support a:not(.grp-link) { padding-left: 0; }

.pmv-side .foot {
  margin-top: auto; padding-top: 10px; border-top: 1px solid #e2e8f0;
}
.pmv-side .foot-tit {
  font-size: 9.5px; font-weight: 800; color: #94a3b8;
  text-transform: uppercase; letter-spacing: .6px;
  padding: 6px 12px 4px;
}

/* ───────── Visibilidade por tier (cascade) ─────────
   - data-min="cliente" some pra publico (sem login)
   - data-min="agente"  some pra publico/cliente
   - data-min="gestor"  some pra publico/cliente/agente
   - data-min="admin"   some pra publico/cliente/agente/gestor
   Cada bloco aparece só se o body tiver pmv-can-<nivel>. Tier PÚBLICO
   (admin simulando ou anônimo) não tem NENHUM pmv-can-* setado → só
   o bloco Suporte aparece (não tem data-min). */
body:not(.pmv-can-cliente) [data-min="cliente"],
body:not(.pmv-can-agente)  [data-min="agente"],
body:not(.pmv-can-gestor)  [data-min="gestor"],
body:not(.pmv-can-admin)   [data-min="admin"] { display: none !important; }

/* ───────── Dropdown do perfil: itens por tier ─────────
   - PÚBLICO (data-tier="publico"): só LOGAR + CRIAR CONTA.
   - Demais tiers: só Minha Conta + Sair. */
body[data-tier="publico"] .pmv-only-logged { display: none !important; }
body:not([data-tier="publico"]) .pmv-only-publico { display: none !important; }
/* Estilos extras p/ os 2 botões novos do dropdown (mesma base do "Sair"). */
.pmv-user-menu-item.pmv-user-menu-logar { color: #1d4ed8; }
.pmv-user-menu-item.pmv-user-menu-logar:hover { background: #dbeafe; color: #1e40af; }
.pmv-user-menu-item.pmv-user-menu-criar {
  color: #fff; background: #9002fc; margin-top: 4px;
  font-weight: 700; justify-content: center;
}
.pmv-user-menu-item.pmv-user-menu-criar:hover { background: #7a00d6; color: #fff; }

/* ───────── Avatar / badge: cores por tier ─────────
   data-tier='publico' usa cinza (sem identidade). */
body[data-tier="publico"] .pmv-user .badge-tier { background: #f1f5f9; color: #475569; }
body[data-tier="publico"] .pmv-user .av         { background: #94a3b8; }

/* ───────── Sandbox tag fixo ───────── */
.pmv-sb-tag {
  position: fixed; bottom: 14px; right: 14px; z-index: 100;
  background: #fde68a; color: #92400e; font-size: 10.5px; font-weight: 800;
  padding: 6px 11px; border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0,0,0,.12); letter-spacing: .3px;
}
