/* Gerado por split de app/static/css/estilo_ph3a.css (fundação da reorganização de CSS, 03/08/2026). Ver app/utils/css_manifest.py pra ordem de carregamento. */

/* ============================================================
   SIDEBAR
   ============================================================ */

.ph3a-sidebar {
  width: var(--sidebar-width);
  background: var(--ph3a-sidebar-bg);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  /* iOS Safari: viewport dinâmico respeita safe areas (notch + home bar),
     evita scroll passando atrás. Browser antigo cai no 100vh acima. */
  height: 100dvh;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow-y: auto;
  overflow-x: hidden;
  /* iOS Safari: momentum scroll (rolagem fluida) — sem isso, scroll
     fica "travado/pulando" em sidebars longas no iPhone PWA. */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
  transition: transform var(--transition);
}

/* Quando bottom tabbar visível (PWA standalone mobile), sidebar termina
   antes do tabbar pra última opção do menu não ficar atrás. 64px (altura
   tabbar) + safe-area-inset-bottom + 8px de respiro. */
@media (max-width: 991.98px) and (display-mode: standalone) {
  .ph3a-sidebar {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
}
body.ph3a-pwa-standalone .ph3a-sidebar {
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

.ph3a-sidebar::-webkit-scrollbar {
  width: 4px;
}

.ph3a-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.ph3a-sidebar::-webkit-scrollbar-thumb {
  background-color: #334155;
  border-radius: 2px;
}

/* Logo area */
.sidebar-logo {
  padding: 0 0 0 15px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--topbar-height);
}

.sidebar-logo-icon {
  width: 38px;
  height: 38px;
  background: var(--ph3a-accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
  color: white;
  flex-shrink: 0;
  letter-spacing: -1px;
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
}

.sidebar-logo-text .brand {
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1;
  letter-spacing: 1px;
}

.sidebar-logo-text .tagline {
  font-size: 10px;
  color: #94a3b8;
  font-weight: 400;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* ── Busca no menu lateral (Paulo 17/05/2026) ─────────────────────────────── */
.sidebar-busca {
  position: relative;
  margin: 4px 12px 6px;
}
.sidebar-busca input {
  width: 100%;
  padding: 7px 30px 7px 32px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  background: rgba(255,255,255,.06);
  color: #e2e8f0;
  font-size: 12.5px;
  outline: none;
  transition: border-color .15s, background .15s;
}
.sidebar-busca input::placeholder { color: #94a3b8; }
.sidebar-busca input:focus {
  border-color: #ef5929;
  background: rgba(255,255,255,.10);
}
.sidebar-busca-icon {
  position: absolute; left: 11px; top: 50%;
  transform: translateY(-50%);
  color: #94a3b8; font-size: 11px; pointer-events: none;
}
.sidebar-busca-clear {
  position: absolute; right: 9px; top: 50%;
  transform: translateY(-50%);
  color: #94a3b8; font-size: 11px;
  cursor: pointer; display: none;
  padding: 4px;
}
.sidebar-busca.ativo .sidebar-busca-clear { display: inline-block; }
.sidebar-busca-clear:hover { color: #ef5929; }
/* Mensagem "nenhum item" — só aparece quando filtro ativo + 0 resultados */
.sidebar-busca-vazio {
  display: none;
  margin: 8px 16px;
  padding: 10px 12px;
  background: rgba(255,255,255,.04);
  border: 1px dashed rgba(255,255,255,.12);
  border-radius: 8px;
  font-size: 11.5px;
  color: #94a3b8;
  text-align: center;
}
.sidebar-busca-vazio.ativo { display: block; }
.sidebar-busca-vazio .termo { color: #ef5929; font-weight: 700; }
/* Highlight do termo nos itens do menu */
.ph3a-nav mark.sb-hl {
  background: rgba(254, 240, 138, .35);
  color: inherit;
  padding: 0;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(253, 224, 71, .4);
}
/* Sidebar colapsada — esconde a busca (não cabe com 60px de largura) */
.ph3a-sidebar.colapsada .sidebar-busca,
.ph3a-sidebar.colapsada .sidebar-busca-vazio { display: none; }

/* Nav section label — destaque laranja PH3A com separador visível.
   Paulo 22/05/2026: pedido pra cada seção ficar bem expressiva pra
   facilitar identificar onde começa cada bloco. */
.nav-section-label {
  padding: 18px 24px 8px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: #ef5929;
  margin-top: 10px;
  border-top: 1.5px solid rgba(239, 89, 41, 0.25);
}
.ph3a-nav > .nav-section-label:first-of-type {
  border-top: none;
  margin-top: 0;
}

/* Nav items */
.ph3a-nav {
  flex: 1;
  padding: 8px 0;
}

.nav-item-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  margin: 2px 10px;
  width: calc(100% - 20px);
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  transition: all var(--transition);
  position: relative;
  white-space: nowrap;
  cursor: pointer;
  /* Isolation contém efeitos do `::before` da barra lateral 'active' (linha
     azul) — sem isso, position:absolute do pseudo-elemento podia vazar pra
     o link vizinho quando 2 itens compartilham o mesmo stacking context.
     Paulo 18/05/2026 (#42): "clique em agenda, contatos marca também".
     Defesa em camadas — também ajuda hover/transição não bleed pra sibling. */
  isolation: isolate;
}

.nav-item-link:hover {
  background: var(--ph3a-sidebar-hover);
  color: #e2e8f0;
  text-decoration: none;
}

.nav-item-link.active {
  background: var(--ph3a-primary);
  color: #ffffff;
}

.nav-item-link .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

/* "Recentes" (sidebar) — links de cockpits visitados, com título podendo ser
   longo ("João Silva da Costa - PH3A Tecnologia da Informação"). Truncar
   ellipsis preserva layout. Paulo 12/05/2026. */
.ph3a-recente-link {
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 24px;
  min-width: 0;
}
.ph3a-recente-link .ph3a-recente-titulo {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}
.ph3a-recente-link .nav-icon {
  font-size: 12px;
  width: 18px;
  height: 18px;
  opacity: .75;
}

/* ── Nav dropdown (submenu na sidebar) ───────────────────────── */
.nav-dropdown { position: relative; }

.nav-dropdown-menu {
  display: none;
  flex-direction: column;
  background: rgba(0,0,0,.18);
}
.nav-dropdown.open .nav-dropdown-menu { display: flex; }

.nav-dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px 9px 34px;
  margin: 2px 10px;
  width: calc(100% - 20px);
  border-radius: 8px;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  position: relative;
}
.nav-dropdown-menu a:hover { background: var(--ph3a-sidebar-hover); color: #e2e8f0; }
.nav-dropdown-menu a.active { color: #fff; background: var(--ph3a-primary); }

.nav-dropdown-toggle .nav-chevron {
  margin-left: auto;
  font-size: 11px;
  transition: transform .2s;
}
.nav-dropdown.open .nav-chevron { transform: rotate(180deg); }

.nav-item-link .nav-badge {
  margin-left: auto;
  background: var(--ph3a-accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  line-height: 1.4;
}

/* ── Sub-menu ─────────────────────────────────────────────────────────────── */
.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 24px;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  transition: all var(--transition);
  user-select: none;
}
.nav-group-toggle:hover { background: var(--ph3a-sidebar-hover); color: #e2e8f0; }
.nav-group-toggle .nav-chevron {
  margin-left: auto;
  font-size: 11px;
  transition: transform .2s ease;
  color: #64748b;
}
.nav-group-toggle.open .nav-chevron { transform: rotate(90deg); }
.nav-sub-items {
  overflow: hidden;
  max-height: 0;
  transition: max-height .25s ease;
}
.nav-sub-items.open { max-height: 500px; }

/* ── Sub-sub-menu (3º nível: ex: E-mail Marketing) ───────────────────────── */
.nav-sub-group-toggle {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px 7px 36px;
  font-size: 12px; font-weight: 600; color: #94a3b8;
  cursor: pointer; border-radius: 8px; user-select: none;
  transition: all var(--transition); position: relative;
}
.nav-sub-group-toggle:hover { background: var(--ph3a-sidebar-hover); color: #e2e8f0; }
.nav-sub-group-toggle.open  { color: #cbd5e1; }
.nav-sub-chevron { margin-left: auto; font-size: 10px; color: #64748b; transition: transform .2s ease; }
.nav-sub-group-toggle.open .nav-sub-chevron { transform: rotate(90deg); }
.nav-sub-sub-items { overflow: hidden; max-height: 0; transition: max-height .25s ease; }
.nav-sub-sub-items.open { max-height: 300px; }
.nav-sub-sub-link {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 12px 6px 52px;
  font-size: 11.5px; font-weight: 500; color: #64748b;
  border-radius: 8px; text-decoration: none; transition: all var(--transition);
}
.nav-sub-sub-link:hover { background: var(--ph3a-sidebar-hover); color: #e2e8f0; text-decoration: none; }
.nav-sub-sub-link.active { color: #fff; background: rgba(255,255,255,.06); }
.nav-sub-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 24px 9px 52px;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
  text-decoration: none;
}
.nav-sub-link::before {
  content: '';
  position: absolute;
  left: 34px;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #475569;
  transition: background var(--transition);
}
.nav-sub-link:hover { background: var(--ph3a-sidebar-hover); color: #e2e8f0; text-decoration: none; }
.nav-sub-link:hover::before, .nav-sub-link.active::before { background: var(--ph3a-accent); }
.nav-sub-link.active { color: #fff; background: rgba(255,255,255,.06); }

/* Sidebar footer */
.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ph3a-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user-info .user-name {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  line-height: 1.2;
}

.sidebar-user-info .user-role {
  font-size: 11px;
  color: #64748b;
  line-height: 1.2;
}


