/* =====================================================================
   FLOATING DOCK — porte fiel do componente (Aceternity "Floating Dock")
   em CSS/JS puro. DESKTOP (>900px): pílula fixa embaixo, círculos
   40→80px pela distância do mouse, tooltip em cima. CELULAR (≤900px):
   topbar numa linha só (logo | tema | hambúrguer), drawer lateral com os
   links + nome do usuário, e as bets (platform-switch) viram uma barra
   fixa embaixo. A sidebar continua no DOM (escondida) e é a fonte dos
   links — o dock.js lê de lá.
   ===================================================================== */
:root {
  --dock-bg:       rgba(20, 22, 26, 0.82);
  --dock-border:   rgba(255, 255, 255, 0.08);
  --dock-circle:   #2A2E33;
  --dock-circle-h: #363B41;
  --dock-icon:     #C9CED6;
  --dock-tip-bg:   #1B1E23;
  --dock-tip-fg:   #F2F4F7;
  --dock-shadow:   0 12px 40px rgba(0, 0, 0, 0.35);
}
[data-theme="light"] {
  --dock-bg:       rgba(248, 250, 252, 0.86);
  --dock-border:   rgba(15, 17, 20, 0.10);
  --dock-circle:   #E4E7EB;
  --dock-circle-h: #D8DCE2;
  --dock-icon:     #4A5260;
  --dock-tip-bg:   #F2F4F7;
  --dock-tip-fg:   #0F1114;
  --dock-shadow:   0 12px 40px rgba(15, 17, 20, 0.14);
}

/* sidebar sai de cena em toda largura (desktop = dock, celular = hambúrguer) */
body.has-dock .sidebar { display: none !important; }
@media (min-width: 901px) {
  /* o .layout é flex [sidebar][content]; sem a sidebar o content (max 1280/1400)
     ficava grudado à esquerda — centraliza */
  body.has-dock .layout  { justify-content: center; }
  body.has-dock .content { padding-bottom: 120px; }
}

/* logo no topbar (a sidebar levava a logo junto) */
.topbar-logo {
  height: 26px;
  width: auto;
  flex-shrink: 0;
  filter: brightness(0) invert(1) drop-shadow(0 0 14px rgba(232, 1, 4, 0.30));
}
[data-theme="light"] .topbar-logo { filter: none; }

/* o dock.js embrulha logo + botão hambúrguer em .topbar-head; o embrulho é
   transparente (display:contents): logo e botão são filhos flex do topbar */
.topbar-head { display: contents; }
.mnav-btn { display: none; }

/* seletor de plataformas sem nenhuma plataforma ativa virava uma "bolinha" no meio */
.topbar .platform-switch:not(:has(a)) { display: none; }

/* ---------- celular: topbar numa linha só ---------- */
@media (max-width: 900px) {
  /* o Tropa empilha o topbar em coluna; aqui volta a ser UMA linha:
     [logo ............ tema  hambúrguer] */
  body.has-dock .topbar {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 10px 12px;
    top: 8px;                 /* sticky do Tropa era 24px (pensado pro desktop): deixava um buraco em cima */
  }
  body.has-dock .topbar .topbar-logo {
    order: 1;
    width: auto !important;
    max-width: 140px !important;
    height: 20px !important;
    flex: 0 0 auto !important;
    margin: 0 auto 0 2px !important;   /* margin-right:auto empurra o resto pra direita */
    object-fit: contain;
  }
  /* o bloco do usuário vira transparente: o toggle de tema entra na linha,
     o nome/tipo some daqui (vai pro drawer) */
  body.has-dock .topbar .user-info { display: contents; }
  body.has-dock .topbar .user-info > div { display: none; }
  body.has-dock .topbar .theme-toggle { order: 3; flex: 0 0 auto; margin: 0; }
  body.has-dock .mnav-btn {
    order: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 36px; height: 36px;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--dock-border);
    background: var(--dock-circle);
    color: var(--dock-icon);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .mnav-btn svg { width: 20px; height: 20px; }
}
@media (max-width: 480px) {
  body.has-dock .mnav-btn { width: 34px; height: 34px; }   /* mesmo tamanho do toggle de tema */
}

/* ---------- desktop: o dock ---------- */
.fdock {
  position: fixed;
  left: 0; right: 0; bottom: 18px;
  display: none;
  justify-content: center;
  z-index: 900;
  pointer-events: none;
}
@media (min-width: 901px) { .fdock { display: flex; } }
.fdock-bar {
  pointer-events: auto;
  display: flex;
  align-items: flex-end;
  gap: 16px;
  height: 64px;
  padding: 0 16px 12px;
  border-radius: 16px;
  background: var(--dock-bg);
  border: 1px solid var(--dock-border);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  box-shadow: var(--dock-shadow);
}

.fdock-item {
  position: relative;
  display: block;
  text-decoration: none;
  line-height: 0;
}
.fdock-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--dock-circle);
  transition: width 120ms cubic-bezier(.2, .8, .2, 1),
              height 120ms cubic-bezier(.2, .8, .2, 1),
              background 160ms ease;
}
.fdock-item:hover .fdock-circle { background: var(--dock-circle-h); }
.fdock-icon {
  display: flex;
  width: 20px;
  height: 20px;
  color: var(--dock-icon);
  transition: width 120ms cubic-bezier(.2, .8, .2, 1),
              height 120ms cubic-bezier(.2, .8, .2, 1);
}
.fdock-icon svg { width: 100%; height: 100%; display: block; }

/* item ativo: círculo vermelho, ícone branco, pontinho embaixo (dock style) */
.fdock-item.active .fdock-circle { background: var(--accent); box-shadow: var(--accent-glow); }
.fdock-item.active .fdock-icon   { color: #FFFFFF; }
.fdock-item.active::after {
  content: '';
  position: absolute;
  left: 50%; bottom: -8px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateX(-50%);
}

/* tooltip (título) — aparece acima, deslizando 6px */
.fdock-tip {
  position: absolute;
  left: 50%; top: -34px;
  transform: translate(-50%, 6px);
  opacity: 0;
  white-space: pre;
  font-size: 12px;
  line-height: 1.6;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--dock-border);
  background: var(--dock-tip-bg);
  color: var(--dock-tip-fg);
  transition: opacity 150ms ease, transform 150ms ease;
  pointer-events: none;
}
.fdock-item:hover .fdock-tip { opacity: 1; transform: translate(-50%, 0); }

/* separador antes do Sair */
.fdock-sep {
  width: 1px;
  height: 28px;
  align-self: center;
  margin: 0 -4px 6px;
  background: var(--dock-border);
}

/* ---------- celular: painel lateral (drawer) do hambúrguer ---------- */
.mnav { display: none; }
@media (max-width: 900px) {
  .mnav {
    position: fixed;
    inset: 0;
    z-index: 1000;              /* acima do topbar sticky (40), da sidebar (50) e da barra de bets (800) */
    display: block;
  }
  .mnav[hidden] { display: none; }
  .mnav-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    transition: opacity 200ms ease;
    touch-action: none;
  }
  .mnav-panel {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: min(320px, 86vw);
    display: flex;
    flex-direction: column;
    background: var(--dock-tip-bg);
    border-left: 1px solid var(--dock-border);
    box-shadow: var(--dock-shadow);
    transform: translateX(100%);
    transition: transform 240ms cubic-bezier(.2, .8, .2, 1);
    padding: calc(14px + env(safe-area-inset-top, 0px)) 12px calc(14px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .mnav.open .mnav-backdrop { opacity: 1; }
  .mnav.open .mnav-panel    { transform: none; }
  @media (prefers-reduced-motion: reduce) {
    .mnav-backdrop, .mnav-panel { transition: none; }
  }
  .mnav-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 4px 12px;
  }
  .mnav-logo {
    height: 20px; width: auto; max-width: 140px;
    filter: brightness(0) invert(1) drop-shadow(0 0 14px rgba(232, 1, 4, 0.30));
  }
  [data-theme="light"] .mnav-logo { filter: none; }
  .mnav-close {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; padding: 0;
    border-radius: 50%;
    border: 1px solid var(--dock-border);
    background: var(--dock-circle);
    color: var(--dock-icon);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .mnav-close svg { width: 18px; height: 18px; }
  /* usuário logado (o nome saiu do topbar e mora aqui) */
  .mnav-user {
    padding: 0 4px 12px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--dock-border);
  }
  .mnav-user b { display: block; font-size: 14px; font-weight: 600; color: var(--text); }
  .mnav-user span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-top: 2px; }
  .mnav-list { display: flex; flex-direction: column; gap: 4px; }
  .mnav-list a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 12px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    -webkit-tap-highlight-color: transparent;
  }
  .mnav-list a:active { background: var(--dock-circle); }
  .mnav-list a .fdock-icon { width: 20px; height: 20px; flex: 0 0 auto; color: var(--dock-icon); }
  .mnav-list a.active { background: var(--accent); color: #FFFFFF; box-shadow: var(--accent-glow); }
  .mnav-list a.active .fdock-icon { color: #FFFFFF; }
  .mnav-sep { height: 1px; margin: 8px 4px; background: var(--dock-border); border: 0; }
  /* trava o scroll da página com o menu aberto */
  body.mnav-lock { overflow: hidden; }
}

/* ---------- celular: bets (platform-switch) numa barra fixa embaixo ----------
   O dock.js MOVE o .platform-switch do topbar pra cá em ≤900px (o topbar tem
   backdrop-filter, que prende position:fixed dentro dele) e devolve no desktop. */
.bets-bar { display: none; }
@media (max-width: 900px) {
  .bets-bar {
    display: block;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 800;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
    background: var(--dock-bg);
    border-top: 1px solid var(--dock-border);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
  }
  .bets-bar .platform-switch {
    display: flex;
    gap: 6px;
    padding: 0;
    margin: 0;
    background: none;
    border: 0;
    border-radius: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
  }
  .bets-bar .platform-switch::-webkit-scrollbar { display: none; }
  .bets-bar .platform-switch a {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    height: 34px;
    padding: 0 16px;
    font-size: 12px;
    line-height: 1;
    border-radius: 999px;
    background: var(--dock-circle);
    color: var(--dock-icon);
    -webkit-tap-highlight-color: transparent;
  }
  .bets-bar .platform-switch a.active {
    background: var(--accent);
    color: #FFFFFF;
    box-shadow: var(--accent-glow);
  }
  /* o fim da página não fica escondido atrás da barra */
  body.has-betsbar .content { padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }
}
