/* =========================================================
   FFW Westoverledingen – Mobile Bottom-Navigation (App-Style)
   ---------------------------------------------------------
   Ziel: Bottom-Bar + Menü-Sheet wie „App“.
   WICHTIG: Keine Veränderungen an Farben/Typo des Seiteninhalts.
   Es werden nur Bottom-Bar + Sheet gestaltet.
   ========================================================= */

@media (max-width: 860px){
  :root{
    --ffw-safe-bottom: env(safe-area-inset-bottom, 0px);
    --ffw-appnav-h: 72px; /* ohne safe-area */
    /* Appbar-Farbe wie Header (Rot-Verlauf) */
    --ffw-appnav-bg: linear-gradient(90deg, #c00000 0%, #a30000 55%, #6f0000 100%);
    --ffw-appnav-line: rgba(255,255,255,0.14);
    --ffw-appnav-radius: 18px;
    --ffw-appnav-shadow: 0 14px 40px rgba(0,0,0,0.35);
    /* Gesamthöhe inkl. Außen-Padding + Safe-Area (für Scroll-Abstand) */
    --ffw-appnav-total: calc(var(--ffw-appnav-h) + var(--ffw-safe-bottom) + 34px);

    --ffw-sheet-bg: rgba(7, 26, 43, 0.96);
    --ffw-sheet-line: rgba(255,255,255,0.14);
    --ffw-sheet-shadow: 0 18px 60px rgba(0,0,0,0.45);
  }

  /* Platz für Bottom-Bar (ohne Seitenfarben anzufassen) */
  .ffw-wrap{
    /* Extra Reserve, da die Bar inkl. Padding höher ist als --ffw-appnav-h */
    padding-bottom: var(--ffw-appnav-total) !important;
  }

  /* Zusätzlicher Scroll-Abstand (z.B. Ankerlinks / iOS) */
  html{ scroll-padding-bottom: var(--ffw-appnav-total); }

  /* Obere Desktop-Navigation auf Mobile ausblenden (Bottom-Bar übernimmt) */
  .ffw-nav{ display:none; }

  /* Bottom Navigation */
  .ffw-appnav{
    position: fixed !important;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    padding: 10px 12px calc(10px + var(--ffw-safe-bottom)) 12px;
    pointer-events: none; /* nur inner klickbar */
  }

  .ffw-appnav__inner{
    pointer-events: auto;
    background: var(--ffw-appnav-bg);
    border: 1px solid var(--ffw-appnav-line);
    border-radius: var(--ffw-appnav-radius);
    box-shadow: var(--ffw-appnav-shadow);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 10px 10px;
    backdrop-filter: blur(10px);
  }

  /* Sicherstellen, dass der Seiteninhalt NICHT unter die fixe Bar rutscht */
  body{
    padding-bottom: var(--ffw-appnav-total) !important;
  }

  /* Manche Templates/Plugins hängen Content nicht sauber in .ffw-wrap – daher zusätzlich: */
  main,
  .site,
  .site-content,
  #content,
  #page{
    padding-bottom: var(--ffw-appnav-total) !important;
  }

  /* Footer darf nicht hinter der Bar verschwinden */
  .ffw-footer{
    padding-bottom: calc(var(--ffw-appnav-total) + 10px) !important;
  }

  .ffw-appnav__item{
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    font-weight: 700;
    font-size: 12px;
    line-height: 1;
    color: rgba(255,255,255,0.78);
    padding: 10px 8px;
    border-radius: 14px;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }

  .ffw-appnav__item svg{
    width: 22px;
    height: 22px;
    display: block;
  }

  .ffw-appnav__item.is-active{
    color: #ffffff;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.14);
  }

  /* Bottom Sheet – Backdrop */
  .ffw-sheet-backdrop{
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
    z-index: 998;
  }

  /* Bottom Sheet Container */
  .ffw-sheet{
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    transform: translateY(110%);
    transition: transform .22s ease;
    z-index: 999;
  }

  .ffw-sheet__panel{
    margin: 0 12px calc(12px + var(--ffw-safe-bottom)) 12px;
    background: var(--ffw-sheet-bg);
    border: 1px solid var(--ffw-sheet-line);
    border-radius: 20px;
    box-shadow: var(--ffw-sheet-shadow);
    overflow: hidden;
    backdrop-filter: blur(12px);
  }

  .ffw-sheet__grabber{
    width: 58px;
    height: 5px;
    border-radius: 99px;
    background: rgba(255,255,255,0.22);
    margin: 10px auto 6px auto;
  }

  .ffw-sheet__head{
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--ffw-sheet-line);
  }

  .ffw-sheet__title{
    font-weight: 800;
    font-size: 14px;
    letter-spacing: .2px;
    color: #fff;
  }

  .ffw-sheet__close{
    border: 0;
    background: rgba(255,255,255,0.10);
    color: #fff;
    border-radius: 12px;
    padding: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }
  .ffw-sheet__close svg{ width: 18px; height: 18px; }

  .ffw-sheet__body{
    padding: 10px 14px 14px 14px;
    max-height: 60vh;
    overflow: auto;
  }

  /* Menü im Sheet */
  .ffw-sheet-menu,
  .ffw-sheet-menu ul{
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .ffw-sheet-menu > li{
    border-bottom: 1px solid rgba(255,255,255,0.10);
  }

  .ffw-sheet-menu a{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 8px;
    text-decoration: none;
    color: rgba(255,255,255,0.92);
    font-weight: 700;
  }

  .ffw-sheet-menu .sub-menu{
    display: none;
    padding-left: 10px;
    margin-bottom: 6px;
  }

  .ffw-subtoggle{
    border: 0;
    background: rgba(255,255,255,0.10);
    color: #fff;
    border-radius: 10px;
    padding: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
  }
  .ffw-subtoggle svg{ width: 16px; height: 16px; }

  /* Offene States via Body-Klasse */
  body.ffw-menu-open .ffw-sheet-backdrop{
    opacity: 1;
    pointer-events: auto;
  }
  body.ffw-menu-open .ffw-sheet{
    transform: translateY(0);
  }
}

/* =========================================================
   Mobil: Seite 105 ohne Appbar/Sheet + ohne Reserven
   (z.B. Vollbild-Formular / spezieller Inhalt)
   ========================================================= */
@media (max-width: 860px){
  body.page-id-105 .ffw-appnav,
  body.page-id-105 .ffw-sheet,
  body.page-id-105 .ffw-sheet-backdrop{
    display: none !important;
  }

  body.page-id-105 .ffw-wrap{
    padding-bottom: 0 !important;
  }

  body.page-id-105{
    scroll-padding-bottom: 0 !important;
  }

  body.page-id-105 .ffw-footer{
    padding-bottom: 20px !important;
  }
}
