/*
 * pandabu V2.0.4 RC16.213
 * Mobile Bottom Navigation Anchor Fix
 *
 * Ziel:
 * - Bottom-Navigation bleibt auf Mobile am echten unteren Viewport-Rand.
 * - Der + FAB bleibt unmittelbar oberhalb der Navigation.
 * - Bei geoeffneter Bildschirmtastatur werden beide Elemente bewusst ausgeblendet,
 *   damit iOS sie nicht an der alten Tastaturkante "parkt".
 * - Desktop bleibt unveraendert.
 */
@media (max-width:899px){
  html,
  body,
  body.pandabu-authenticated #app,
  body.pandabu-authenticated .app-shell{
    min-height:100dvh;
  }

  body.pandabu-authenticated .bottom-nav{
    position:fixed!important;
    left:0!important;
    right:0!important;
    top:auto!important;
    bottom:0!important;
    margin:0!important;
    transform:translate3d(0,0,0)!important;
    -webkit-transform:translate3d(0,0,0)!important;
    backface-visibility:hidden;
    -webkit-backface-visibility:hidden;
    will-change:transform,opacity;
    z-index:125!important;
  }

  body.pandabu-authenticated .fab{
    position:fixed!important;
    top:auto!important;
    bottom:calc(var(--nav-h) + 18px + env(safe-area-inset-bottom))!important;
    transform:translate3d(0,0,0)!important;
    -webkit-transform:translate3d(0,0,0)!important;
    backface-visibility:hidden;
    -webkit-backface-visibility:hidden;
    will-change:transform,opacity;
    z-index:120!important;
  }

  /*
   * iOS/PWA: Fixed-Elemente koennen beim Oeffnen der Tastatur an deren Oberkante
   * verankert bleiben. Waehrend eine echte Software-Tastatur offen ist, blenden
   * wir die globale Navigation deshalb aus. Nach dem Schliessen wird sie neu
   * an den Viewport gekoppelt.
   */
  html.rc213-keyboard-open body.pandabu-authenticated .bottom-nav,
  html.rc213-keyboard-open body.pandabu-authenticated .fab{
    opacity:0!important;
    visibility:hidden!important;
    pointer-events:none!important;
  }

  /* Ein 1px-Reflow fuer exakt einen Frame zwingt WebKit nach Keyboard/Rotation
     zur Neuberechnung der Fixed-Position, ohne sichtbar zu springen. */
  html.rc213-nav-reanchor body.pandabu-authenticated .bottom-nav{
    bottom:1px!important;
  }
  html.rc213-nav-reanchor body.pandabu-authenticated .fab{
    bottom:calc(var(--nav-h) + 19px + env(safe-area-inset-bottom))!important;
  }
}
