/* ==========================================================================
   AXIONMESK — App Nav (estilo Binance)
   Barra inferior 5 abas + painel "Mais" com grade colorida.
   ========================================================================== */

/* ==========================================================================
   1) BARRA INFERIOR
   ========================================================================== */
#bottomNav.bottom-nav {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 1000 !important;
  display: flex !important;
  align-items: stretch !important;
  justify-content: space-between !important;
  height: calc(62px + env(safe-area-inset-bottom, 0px)) !important;
  padding: 0 4px env(safe-area-inset-bottom, 0px) !important;
  margin: 0 !important;
  background: rgba(11, 13, 18, .96) !important;
  backdrop-filter: blur(22px) saturate(1.3) !important;
  -webkit-backdrop-filter: blur(22px) saturate(1.3) !important;
  border-top: 1px solid rgba(255, 255, 255, .07) !important;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, .45) !important;
  overflow: visible !important;
}

/* Indicador luminoso que desliza para a aba ativa */
.bn-indicator {
  position: absolute;
  top: 0;
  left: 0;
  width: 24px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, #5C86FF, #386BFF);
  box-shadow: 0 2px 12px rgba(56,107,255, .75);
  opacity: 0;
  transition: transform .34s cubic-bezier(.3, 1.2, .4, 1), opacity .2s ease;
  pointer-events: none;
  z-index: 2;
}

/* Cada aba */
.bn-tab {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 3px;
  padding: 7px 2px 6px !important;
  margin: 0 !important;
  text-decoration: none !important;
  color: #6B7280 !important;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  transition: color .18s ease, transform .12s ease;
  touch-action: manipulation;
}

.bn-tab__icon {
  display: block;
  width: 24px;
  height: 24px;
  position: relative;
  transition: transform .18s cubic-bezier(.3, 1.4, .5, 1);
}
.bn-tab__icon svg {
  position: absolute;
  inset: 0;
  width: 24px;
  height: 24px;
  display: block;
  transition: opacity .18s ease, transform .18s cubic-bezier(.3, 1.4, .5, 1);
}
/* svg 1 = outline, svg 2 = filled */
.bn-tab__icon svg:nth-child(2) { opacity: 0; transform: scale(.75); }

.bn-tab__label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1;
  transition: color .18s ease, font-weight .2s ease;
}

/* ATIVO: ícone preenche + cor amarela */
.bn-tab.active { color: #386BFF !important; }
.bn-tab.active .bn-tab__label { font-weight: 700; }
.bn-tab.active .bn-tab__icon svg:nth-child(1) { opacity: 0; transform: scale(1.15); }
.bn-tab.active .bn-tab__icon svg:nth-child(2) { opacity: 1; transform: scale(1.06); }

/* Toque */
.bn-tab:active { transform: scale(.9); }
.bn-tab:active .bn-tab__icon { transform: scale(.86); }

/* Aba "Mais" com destaque sutil */
.bn-tab[data-mais] .bn-tab__icon { opacity: .9; }

/* ==========================================================================
   2) PAINEL "MAIS" (bottom sheet)
   ========================================================================== */
.mais-fundo {
  position: fixed;
  inset: 0;
  background: rgba(3, 5, 9, .68);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .26s ease, visibility .26s ease;
  z-index: 1100;
}
.mais-fundo.aberto { opacity: 1; visibility: visible; }

.mais-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1101;
  max-height: 84dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0 14px calc(env(safe-area-inset-bottom, 0px) + 18px);
  border-radius: 24px 24px 0 0;
  background: linear-gradient(180deg, #1C2029 0%, #14171E 38%, #0B1220 100%);
  border-top: 1px solid rgba(255, 255, 255, .09);
  box-shadow: 0 -24px 60px rgba(0, 0, 0, .7), 0 -1px 0 rgba(56,107,255, .25);
  transform: translateY(102%);
  transition: transform .36s cubic-bezier(.22, 1, .36, 1);
  will-change: transform;
  color: #F5F7FA;
}
.mais-panel.aberto { transform: translateY(0); }

/* linha dourada decorativa */
.mais-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 160px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #386BFF, transparent);
  opacity: .85;
}

/* alça */
.mais-panel__handle {
  width: 42px;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .25);
  margin: 10px auto 4px;
  touch-action: none;
}

/* cabeçalho */
.mais-panel__head {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 0 16px;
}
.mais-panel__title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(232, 234, 237, .5);
}

/* grade 4 colunas */
.mais-grid {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 8px !important;
}

.mais-item {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  padding: 12px 4px 10px !important;
  border-radius: 15px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .055);
  text-decoration: none !important;
  min-height: 82px;
  position: relative;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
  transform: translateY(14px) scale(.95);
}
.mais-panel.aberto .mais-item {
  animation: maisIn .38s cubic-bezier(.22, 1, .36, 1) forwards;
}
.mais-panel.aberto .mais-item:nth-child(1) { animation-delay: .03s; }
.mais-panel.aberto .mais-item:nth-child(2) { animation-delay: .06s; }
.mais-panel.aberto .mais-item:nth-child(3) { animation-delay: .09s; }
.mais-panel.aberto .mais-item:nth-child(4) { animation-delay: .12s; }
.mais-panel.aberto .mais-item:nth-child(5) { animation-delay: .15s; }
.mais-panel.aberto .mais-item:nth-child(6) { animation-delay: .18s; }
.mais-panel.aberto .mais-item:nth-child(7) { animation-delay: .21s; }
.mais-panel.aberto .mais-item:nth-child(8) { animation-delay: .24s; }

@keyframes maisIn { to { opacity: 1; transform: translateY(0) scale(1); } }

.mais-item:active {
  transform: scale(.93) !important;
  background: rgba(56,107,255, .14);
  border-color: rgba(56,107,255, .4);
}

/* ícone com tom colorido */
.mais-item__icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  transition: transform .18s ease;
}
.mais-item:active .mais-item__icon { transform: scale(.9); }

/* tons */
.mais-item__icon[data-tone="green"]  { background: rgba(22, 199, 132, .15); color: #16C784; }
.mais-item__icon[data-tone="blue"]   { background: rgba(52, 143, 235, .15); color: #348FEB; }
.mais-item__icon[data-tone="gold"]   { background: rgba(56,107,255, .17); color: #386BFF; }
.mais-item__icon[data-tone="purple"] { background: rgba(158, 107, 255, .16); color: #9E6BFF; }
.mais-item__icon[data-tone="pink"]   { background: rgba(255, 107, 214, .15); color: #FF6BD6; }
.mais-item__icon[data-tone="slate"]  { background: rgba(148, 163, 184, .15); color: #A5B4C4; }
.mais-item__icon[data-tone="teal"]   { background: rgba(56, 189, 193, .15); color: #38BDC1; }
.mais-item__icon[data-tone="red"]    { background: rgba(246, 70, 93, .15); color: #F6465D; }

.mais-item__label {
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  line-height: 1.15;
  color: rgba(232, 234, 237, .80);
}

.mais-item.active {
  background: rgba(56,107,255, .10);
  border-color: rgba(56,107,255, .35);
}
.mais-item.active .mais-item__label { color: #386BFF; font-weight: 700; }

/* ==========================================================================
   3) ESPAÇO PARA A NAV
   ========================================================================== */
@media (max-width: 900px) {
  body:not(.auth-page) { padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px)) !important; }
  body.mais-aberto .pwa-install-bar { display: none !important; }
  body.mais-aberto { overflow: hidden !important; }
}

/* ==========================================================================
   4) TELAS PEQUENAS
   ========================================================================== */
@media (max-width: 360px) {
  .mais-grid { grid-template-columns: repeat(3, 1fr) !important; }
  .bn-tab__label { font-size: 9px; }
  .bn-tab__icon, .bn-tab__icon svg { width: 22px; height: 22px; }
}

/* ==========================================================================
   5) ACESSIBILIDADE
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .bn-indicator, .bn-tab, .bn-tab__icon, .bn-tab__icon svg,
  .mais-panel, .mais-fundo, .mais-item { transition: none !important; animation: none !important; }
  .mais-panel .mais-item { opacity: 1 !important; transform: none !important; }
}

/* ==========================================================================
   v1.1 — Painel com altura confortável e scroll suave
   ========================================================================== */
.mais-panel {
  max-height: 82dvh !important;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 26px) !important;
}

/* Espaçamento interno mais compacto e grade visível */
.mais-grid { gap: 9px !important; padding-bottom: 8px; }

.mais-item {
  min-height: 84px !important;
  padding: 13px 4px 11px !important;
}

/* Rolagem com indicação visual */
.mais-panel {
  scrollbar-width: thin;
  scrollbar-color: rgba(56,107,255,.35) transparent;
}
.mais-panel::-webkit-scrollbar { width: 4px; }
.mais-panel::-webkit-scrollbar-thumb {
  background: rgba(56,107,255,.35);
  border-radius: 99px;
}

/* Aba "Mais" ativa quando o painel abre */
.bn-tab[data-mais].active { color: #386BFF !important; }
.bn-tab[data-mais].active .bn-tab__icon svg:nth-child(1) { opacity: 0; }
.bn-tab[data-mais].active .bn-tab__icon svg:nth-child(2) { opacity: 1; transform: scale(1.06); }

/* 5 abas mais compactas em telas baixas */
@media (max-height: 700px) {
  .mais-panel { max-height: 88dvh !important; }
  .mais-item { min-height: 76px !important; padding: 10px 3px 9px !important; }
  .mais-item__icon { width: 38px !important; height: 38px !important; }
  .mais-item__label { font-size: 10.5px !important; }
}

/* ==========================================================================
   v1.2 — Última linha visível, X de fechar, aba Mais ativa
   ========================================================================== */

/* Reserva espaço da barra inferior dentro do painel */
.mais-panel {
  padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px) + 20px) !important;
  max-height: 88dvh !important;
}

/* Botão X no cabeçalho */
.mais-panel__head {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 4px 0 14px !important;
}
.mais-close {
  position: absolute;
  right: 2px;
  top: 0;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: rgba(255,255,255,.06);
  color: #C9CED6;
  font-size: 20px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .15s ease, transform .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.mais-close:active { background: rgba(255,255,255,.14); transform: scale(.92); }

/* Aba Mais ativa quando o painel abre */
body.mais-aberto .bn-tab[data-mais] { color: #386BFF !important; }
body.mais-aberto .bn-tab[data-mais] .bn-tab__label { font-weight: 700; }
body.mais-aberto .bn-tab[data-mais] .bn-tab__icon svg:nth-child(1) { opacity: 0; }
body.mais-aberto .bn-tab[data-mais] .bn-tab__icon svg:nth-child(2) { opacity: 1; transform: scale(1.06); }
/* indicador desliza para "Mais" */
body.mais-aberto .bn-indicator { transform: translateX(calc(100vw - 52px)) !important; }

/* Grade mais compacta para caber tudo */
.mais-grid { gap: 8px !important; }
.mais-item { min-height: 78px !important; padding: 11px 3px 9px !important; }
.mais-item__icon { width: 40px !important; height: 40px !important; border-radius: 12px !important; }
.mais-item__label { font-size: 10.5px !important; }

/* ==========================================================================
   BOTÃO "SAIR" no painel Mais (mobile)
   ========================================================================== */
.mais-sair {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, .07);
}

.mais-sair__btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid rgba(246, 70, 93, .22);
  border-radius: 14px;
  background: rgba(246, 70, 93, .07);
  color: #FF8494;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: -.01em;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, transform .1s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.mais-sair__btn:active {
  transform: scale(.97);
  background: rgba(246, 70, 93, .16);
  border-color: rgba(246, 70, 93, .45);
}

.mais-sair__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  background: rgba(246, 70, 93, .14);
  color: #FF8494;
}

.mais-sair__txt {
  flex: 1 1 auto;
  text-align: left;
}

/* Espaço extra no fim do painel para o botão respirar */
.mais-panel {
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 24px) !important;
}

@media (prefers-reduced-motion: reduce) {
  .mais-sair__btn { transition: none !important; }
  .mais-sair__btn:active { transform: none !important; }
}

/* ==========================================================================
   CORREÇÃO: botão Sair visível dentro do painel Mais
   ========================================================================== */
.mais-panel {
  max-height: 88dvh !important;
  overflow-y: auto !important;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 26px) !important;
  scroll-padding-bottom: 40px;
}

/* Garante que o bloco de saída tenha espaço real no fim */
.mais-sair {
  margin: 16px 0 8px !important;
  padding: 16px 0 0 !important;
  border-top: 1px solid rgba(255, 255, 255, .08) !important;
  flex: 0 0 auto;
}

/* Conteúdo do painel em coluna, sem comprimir */
.mais-panel {
  display: flex !important;
  flex-direction: column !important;
}

.mais-grid {
  flex: 0 0 auto !important;
}

/* Em telas baixas, compacta um pouco os atalhos para caber o Sair */
@media (max-height: 760px) {
  .mais-item { min-height: 72px !important; padding: 10px 3px 8px !important; }
  .mais-item__icon { width: 38px !important; height: 38px !important; }
  .mais-panel { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 18px) !important; }
  .mais-sair__btn { min-height: 50px !important; }
}

/* ==========================================================================
   CORREÇÃO DEFINITIVA: painel Mais acima da bottom nav
   O z-index do painel (961) era MENOR que a nav (1000), então a nav
   cobria o botão Sair. Aqui os dois painéis sobem acima da nav.
   ========================================================================== */
#bottomNav.bottom-nav { z-index: 900 !important; }

#bottomNav.bn-indicator,
.bn-indicator { z-index: 901 !important; }

#maisPanel.mais-panel,
.mais-panel {
  z-index: 1200 !important;
  max-height: calc(100dvh - 24px) !important;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 30px) !important;
}

#maisFundo.mais-fundo,
.mais-fundo {
  z-index: 1199 !important;
}

/* Espaço reservado no fim do painel para o botão nunca ficar sob a nav */
#maisPanel::after {
  content: "";
  display: block;
  height: calc(70px + env(safe-area-inset-bottom, 0px));
  flex: 0 0 auto;
}
