/* Atomicamente Mobile — Etapa 2 / Barra inferior; isolada por prefixo atomic-.
   Nao modifica navegacao desktop nem aulas, prova em curso ou laboratorio. */
@media (max-width: 640px) {
  body.atomic-has-bottom-nav {
    --atomic-bottom-nav-height: calc(76px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    padding-bottom: var(--atomic-bottom-nav-height) !important;
    scroll-padding-bottom: calc(var(--atomic-bottom-nav-height) + 14px);
  }

  .atomic-bottom-nav {
    box-sizing: border-box !important;
    position: fixed !important;
    inset: auto 0 0 !important;
    width: 100% !important;
    z-index: 650 !important;
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    align-items: stretch !important;
    gap: 2px !important;
    padding: 7px max(8px, env(safe-area-inset-right, 0px))
      calc(8px + env(safe-area-inset-bottom, 0px))
      max(8px, env(safe-area-inset-left, 0px)) !important;
    background: rgba(255, 255, 255, 0.97) !important;
    color: #64748b !important;
    border-top: 1px solid #e9e2f7 !important;
    box-shadow: 0 -5px 24px rgba(45, 25, 82, .07) !important;
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    font-family: 'Inter', 'Plus Jakarta Sans', system-ui, sans-serif;
    -webkit-tap-highlight-color: transparent;
  }

  .atomic-bottom-link,
  .atomic-bottom-link:visited {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    min-width: 0 !important;
    min-height: 58px !important;
    padding: 6px 2px !important;
    box-sizing: border-box !important;
    border-radius: 13px !important;
    background: transparent !important;
    color: #64748b !important;
    text-decoration: none !important;
    font-weight: 650 !important;
    transition: background-color .16s ease, color .16s ease !important;
    touch-action: manipulation;
  }
  .atomic-bottom-icon {
    box-sizing: border-box;
    display: grid;
    place-items: center;
    width: 27px;
    height: 26px;
    flex: 0 0 26px;
  }
  .atomic-bottom-icon svg { display: block; width: 23px; height: 23px; }
  .atomic-bottom-label {
    display: block;
    max-width: 100%;
    font-size: 10.5px;
    line-height: 1.16;
    letter-spacing: -.12px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
  }
  .atomic-bottom-link.is-active,
  .atomic-bottom-link.is-active:visited {
    color: #6d28d9 !important;
    background: #f2eaff !important;
    font-weight: 800 !important;
  }
  .atomic-bottom-link:active { background: #eee4ff !important; }
  .atomic-bottom-link:focus-visible {
    outline: 2px solid #7c3aed;
    outline-offset: -2px;
  }

  /* Claro/escuro do Atomicamente: algumas paginas aplicam data-theme no html,
     outras no body. */
  html[data-theme="dark"] .atomic-bottom-nav,
  body[data-theme="dark"] .atomic-bottom-nav {
    background: rgba(25, 20, 43, .97) !important;
    border-top-color: #453456 !important;
    box-shadow: 0 -8px 28px rgba(0, 0, 0, .24) !important;
  }
  html[data-theme="dark"] .atomic-bottom-link,
  body[data-theme="dark"] .atomic-bottom-link {
    color: #c6bed6 !important;
  }
  html[data-theme="dark"] .atomic-bottom-link.is-active,
  body[data-theme="dark"] .atomic-bottom-link.is-active {
    background: rgba(124, 58, 237, .24) !important;
    color: #e7d6ff !important;
  }

  /* Prova configuravel: manter o CTA acima da barra, jamais encoberto. */
  body.atomic-has-bottom-nav .barra-acao-fixa {
    bottom: calc(var(--atomic-bottom-nav-height) + 8px) !important;
  }

  /* Chat ocupa a tela inteira no mobile, sem competicao de controles. */
  body.atomic-chat-open .atomic-bottom-nav,
  body.atomic-keyboard-active .atomic-bottom-nav {
    display: none !important;
    pointer-events: none !important;
  }
}

@media (min-width: 641px) { .atomic-bottom-nav { display: none !important; } }
@media print { .atomic-bottom-nav { display: none !important; } }
@media (prefers-reduced-motion: reduce) {
  .atomic-bottom-nav, .atomic-bottom-link { transition: none !important; }
}
