/* ==========================================================================
   VereinsFair One · Navigation auf Handy, Tablet und in der App (rc121)
   – Leiste unten mit den wichtigsten Bereichen je Rolle
   – „Menü“: die vollständige Seitenleiste als Schublade von links
   – Mitgliederbereich: „Mehr“ als Blatt von unten (Sprache, Darstellung, Abmelden)
   ========================================================================== */
.vf-tabbar, .vf-drawer-backdrop, .vf-drawer-close, .mp-sheet { display: none; }

@media (max-width: 960px) {
  /* ---------- Grundgerüst ---------- */
  .dashboard-shell, body.dashboard-page .dashboard-shell { display: block; }
  html.vf-menu-open, html.vf-menu-open body { overflow: hidden; }
  body.dashboard-page .dashboard-workspace { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
  body.mp-page .mp-shell { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
  body:has(.vf-tabbar) .vf-install { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
  body.mp-page .global-theme-toggle { display: none; }

  /* ---------- Kopfleiste (Programm) ---------- */
  html[data-theme] body.dashboard-page .dashboard-topbar {
    position: sticky; top: 0; z-index: 60; min-height: 0; gap: 8px;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
  }
  body.dashboard-page .dashboard-topbar .dashboard-search { min-width: 0; }

  /* ---------- Schublade: vollständige Navigation ---------- */
  html[data-theme] body #vf-sidebar {
    position: fixed; z-index: 2147481500; top: 0; bottom: 0; left: 0;
    width: min(86vw, 330px); height: auto; max-height: none;
    padding: calc(14px + env(safe-area-inset-top, 0px)) 14px calc(14px + env(safe-area-inset-bottom, 0px));
    display: flex; flex-direction: column; gap: 10px; overflow: hidden;
    border: 0; border-right: 1px solid rgba(26, 124, 255, .14); border-radius: 0 28px 28px 0;
    background: rgba(249, 251, 255, .97);
    -webkit-backdrop-filter: blur(26px) saturate(1.5); backdrop-filter: blur(26px) saturate(1.5);
    box-shadow: 40px 0 90px -40px rgba(8, 24, 60, .55);
    transform: translateX(calc(-100% - 30px)); visibility: hidden;
    transition: transform .36s cubic-bezier(.22, .9, .24, 1), visibility 0s linear .36s;
  }
  html[data-theme="dark"] body #vf-sidebar { background: rgba(10, 16, 30, .97); border-right-color: rgba(148, 163, 184, .16); box-shadow: 40px 0 90px -30px rgba(0, 0, 0, .8); }
  html.vf-menu-open body #vf-sidebar.is-open { transform: none; visibility: visible; transition: transform .36s cubic-bezier(.22, .9, .24, 1); }
  #vf-sidebar::before, #vf-sidebar::after { display: none; }
  #vf-sidebar .dashboard-brand { padding-right: 50px; }
  #vf-sidebar .dashboard-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  #vf-sidebar .dashboard-nav a { min-height: 44px; }
  #vf-sidebar .dashboard-user { flex: 0 0 auto; margin-top: 0; }
  #vf-sidebar .vf-drawer-close { position: absolute; z-index: 3; top: calc(16px + env(safe-area-inset-top, 0px)); right: 14px; }

  .vf-drawer-close {
    display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 13px; cursor: pointer;
    border: 1px solid rgba(15, 27, 45, .1); color: inherit; background: rgba(255, 255, 255, .75);
  }
  .vf-drawer-close .vf-icon { width: 18px; height: 18px; }
  html[data-theme="dark"] .vf-drawer-close { border-color: rgba(148, 163, 184, .22); background: rgba(255, 255, 255, .06); }

  .vf-drawer-backdrop {
    display: block; position: fixed; inset: 0; z-index: 2147481400;
    background: rgba(6, 14, 30, .42); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
    animation: vf-drawer-fade .25s ease;
  }
  .vf-drawer-backdrop[hidden] { display: none; }

  /* ---------- Leiste unten ---------- */
  .vf-tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px;
    position: fixed; z-index: 2147481000; left: 10px; right: 10px; bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    height: 64px; padding: 6px; border-radius: 22px;
    border: 1px solid rgba(26, 124, 255, .14); background: rgba(255, 255, 255, .86);
    -webkit-backdrop-filter: blur(22px) saturate(1.6); backdrop-filter: blur(22px) saturate(1.6);
    box-shadow: 0 18px 44px -18px rgba(10, 30, 70, .45), inset 0 1px 0 rgba(255, 255, 255, .85);
  }
  .vf-tabbar > a, .vf-tabbar > button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0;
    padding: 0 2px; border: 0; border-radius: 16px; background: none; color: #5b6b82; cursor: pointer;
    font: inherit; font-size: .68rem; font-weight: 650; letter-spacing: .01em; text-decoration: none;
    transition: color .2s ease;
  }
  .vf-tabbar > * > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .vf-tab-icon { position: relative; display: grid; place-items: center; width: 46px; height: 28px; border-radius: 999px; transition: background .2s ease, transform .2s ease; }
  .vf-tab-icon .vf-icon { width: 22px; height: 22px; stroke-width: 1.7; }
  .vf-tab-icon b {
    position: absolute; top: -5px; right: 1px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
    color: #fff; background: #ff6b4a; font-size: .62rem; font-weight: 750; line-height: 17px; text-align: center; box-shadow: 0 0 0 2px #fff;
  }
  .vf-tabbar .is-active, .vf-tabbar [aria-expanded="true"] { color: #1a5bd1; }
  .vf-tabbar .is-active .vf-tab-icon, .vf-tabbar [aria-expanded="true"] .vf-tab-icon {
    background: linear-gradient(180deg, rgba(61, 151, 255, .24), rgba(26, 109, 255, .13)); box-shadow: inset 0 0 0 1px rgba(26, 109, 255, .12);
  }
  .vf-tabbar > :active .vf-tab-icon { transform: scale(.92); }
  html[data-theme="dark"] .vf-tabbar { border-color: rgba(148, 163, 184, .18); background: rgba(14, 22, 40, .86); box-shadow: 0 18px 44px -16px rgba(0, 0, 0, .75), inset 0 1px 0 rgba(255, 255, 255, .06); }
  html[data-theme="dark"] .vf-tabbar > a, html[data-theme="dark"] .vf-tabbar > button { color: #9fb0c8; }
  html[data-theme="dark"] .vf-tabbar .is-active, html[data-theme="dark"] .vf-tabbar [aria-expanded="true"] { color: #8cc8ff; }
  html[data-theme="dark"] .vf-tab-icon b { box-shadow: 0 0 0 2px #0e1628; }

  /* ---------- Mitgliederbereich: Kopf ---------- */
  html[data-theme] body.mp-page .mp-top {
    position: sticky; top: 0; z-index: 60; flex-wrap: nowrap; gap: 10px;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
    -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5);
  }
  body.mp-page .mp-user { display: none; }
  body.mp-page .mp-nav { order: 0; flex: 0 1 auto; flex-basis: auto; margin: 0 0 0 auto; }
  body.mp-page .mp-nav:has(> a[href^="#"]) { display: none; }
  body.mp-page .mp-brand img { width: 36px; height: 36px; }

  /* ---------- Mitgliederbereich: Blatt „Mehr“ ---------- */
  .mp-sheet {
    display: grid; gap: 14px; position: fixed; z-index: 2147481500; left: 0; right: 0; bottom: 0;
    max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain;
    padding: 10px 18px calc(20px + env(safe-area-inset-bottom, 0px)); border-radius: 28px 28px 0 0;
    color: #0f1b2d; background: rgba(250, 252, 255, .98); box-shadow: 0 -30px 80px -30px rgba(8, 24, 60, .5);
    transform: translateY(105%); visibility: hidden;
    transition: transform .38s cubic-bezier(.22, .9, .24, 1), visibility 0s linear .38s;
  }
  .mp-sheet.is-open { transform: none; visibility: visible; transition: transform .38s cubic-bezier(.22, .9, .24, 1); }
  .mp-sheet-grip { justify-self: center; width: 42px; height: 5px; border-radius: 99px; background: rgba(15, 27, 45, .18); }
  .mp-sheet-head { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
  .mp-sheet-head strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mp-sheet-head small { color: #5b6b82; }
  .mp-sheet-avatar {
    display: grid; place-items: center; width: 46px; height: 46px; border-radius: 15px; color: #fff; font-weight: 750;
    background: linear-gradient(145deg, #3d97ff, #1a6dff 60%, #5a63f5); box-shadow: 0 12px 24px -12px rgba(26, 109, 255, .8);
  }
  .mp-sheet-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .mp-sheet-grid a {
    display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 14px; border-radius: 16px;
    border: 1px solid rgba(26, 124, 255, .12); color: inherit; background: rgba(26, 124, 255, .05);
    font-size: .88rem; font-weight: 650; line-height: 1.2; text-decoration: none;
  }
  .mp-sheet-grid .vf-icon { flex: none; width: 20px; height: 20px; color: #1a6dff; }
  .mp-sheet-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid rgba(15, 27, 45, .08); font-weight: 650; }
  .mp-sheet-theme {
    display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 999px; cursor: pointer;
    border: 1px solid rgba(26, 124, 255, .2); color: inherit; background: none; font: inherit; font-size: .86rem; font-weight: 650;
  }
  .mp-sheet-theme .vf-icon { width: 18px; height: 18px; }
  .mp-sheet-theme .theme-sun, html[data-theme="dark"] .mp-sheet-theme .theme-moon { display: none; }
  html[data-theme="dark"] .mp-sheet-theme .theme-sun { display: block; }
  .mp-sheet-logout {
    width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; border-radius: 16px; cursor: pointer;
    border: 1px solid rgba(200, 60, 60, .25); color: #b4322b; background: rgba(200, 60, 60, .06); font: inherit; font-weight: 700;
  }
  .mp-sheet-logout .vf-icon { width: 18px; height: 18px; }
  html[data-theme="dark"] .mp-sheet { color: #eaf1ff; background: rgba(12, 18, 32, .98); box-shadow: 0 -30px 80px -20px rgba(0, 0, 0, .85); }
  html[data-theme="dark"] .mp-sheet-grip { background: rgba(255, 255, 255, .2); }
  html[data-theme="dark"] .mp-sheet-head small { color: #a9b8d0; }
  html[data-theme="dark"] .mp-sheet-grid a { border-color: rgba(96, 165, 250, .18); background: rgba(96, 165, 250, .07); }
  html[data-theme="dark"] .mp-sheet-grid .vf-icon { color: #7cc0ff; }
  html[data-theme="dark"] .mp-sheet-row { border-color: rgba(148, 163, 184, .16); }
  html[data-theme="dark"] .mp-sheet-logout { color: #ffb4ac; border-color: rgba(255, 120, 110, .3); background: rgba(255, 120, 110, .08); }
}

/* Installierte App: Statusleiste des Handys berücksichtigen */
@media (max-width: 960px) and (display-mode: standalone) {
  .vf-tabbar { bottom: max(8px, env(safe-area-inset-bottom, 0px)); }
}
@keyframes vf-drawer-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  html[data-theme] body #vf-sidebar, .mp-sheet, .vf-drawer-backdrop { transition: none !important; animation: none !important; }
}
@media print { .vf-tabbar, .vf-drawer-backdrop, .mp-sheet { display: none !important; } }

/* ==========================================================================
   rc129 · Weiche Seitenübergänge (View Transitions) und „Herunterziehen zum Aktualisieren“
   ========================================================================== */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vf-page-out .16s ease-in both; }
::view-transition-new(root) { animation: vf-page-in .26s cubic-bezier(.22, .9, .24, 1) both; }
/* Leiste unten, Kopfzeilen und Seitenleiste bleiben stehen – nur der Inhalt wechselt */
.vf-tabbar { view-transition-name: vf-tabbar; }
body.dashboard-page .dashboard-topbar { view-transition-name: vf-topbar; }
body.mp-page .mp-top { view-transition-name: vf-mp-top; }
@media (min-width: 961px) { body.dashboard-page #vf-sidebar { view-transition-name: vf-sidebar; } }
::view-transition-group(vf-tabbar), ::view-transition-group(vf-topbar), ::view-transition-group(vf-mp-top), ::view-transition-group(vf-sidebar) { animation-duration: 0s; }
@keyframes vf-page-out { to { opacity: 0; } }
@keyframes vf-page-in { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* Antippen fühlt sich an wie in einer App */
html.is-app { -webkit-tap-highlight-color: transparent; }
html.is-app :is(a, button, [role="button"]) { touch-action: manipulation; }

.vf-ptr {
  position: fixed; z-index: 2147482000; top: calc(env(safe-area-inset-top, 0px) + 4px); left: 50%;
  display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border-radius: 999px;
  color: #0f1b2d; background: rgba(255, 255, 255, .96); box-shadow: 0 14px 34px -14px rgba(8, 24, 60, .55), 0 0 0 1px rgba(26, 124, 255, .12);
  transform: translate(-50%, -64px); opacity: 0; pointer-events: none; transition: transform .25s ease, opacity .2s ease;
}
.vf-ptr.is-pulling { transition: none; }
.vf-ptr-ring { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: #fff; background: linear-gradient(145deg, #3d97ff, #1a6dff 60%, #5a63f5); }
.vf-ptr-ring svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease; }
.vf-ptr.is-ready .vf-ptr-ring svg { transform: rotate(180deg); }
.vf-ptr.is-loading .vf-ptr-ring svg { animation: vf-ptr-spin .8s linear infinite; }
.vf-ptr.is-loading .vf-ptr-ring svg path { d: path("M12 4a8 8 0 1 0 8 8"); }
.vf-ptr small { font-size: .8rem; font-weight: 650; white-space: nowrap; }
.vf-ptr.is-message .vf-ptr-ring { background: #f59e0b; }
@keyframes vf-ptr-spin { to { transform: rotate(360deg); } }
html[data-theme="dark"] .vf-ptr { color: #eaf1ff; background: rgba(16, 24, 40, .96); box-shadow: 0 14px 34px -10px rgba(0, 0, 0, .8), 0 0 0 1px rgba(96, 165, 250, .2); }
@media print { .vf-ptr { display: none !important; } }
/* rc133: Kopfbereich von Begehung und ähnlichen Seiten mit Knöpfen – auf dem Handy untereinander */
@media (max-width: 800px) {
  .member-hero .heading-actions { grid-column: 1 / -1; width: 100%; display: grid; gap: 8px; }
  .member-hero .heading-actions > *, .member-hero .heading-actions form > button { width: 100%; justify-content: center; }
  .member-hero h1 { font-size: clamp(1.6rem, 7vw, 2.4rem); hyphens: auto; }
  .inspection-walk-card .primary-link { width: 100%; justify-content: center; }
}
/* rc136: Feste Knopfleiste der Rundgänge (Zähler, Begehung, Anwesenheit) über der Tab-Leiste statt dahinter */
@media (max-width: 960px) {
  body:has(.vf-tabbar) .mw-nav { bottom: calc(88px + env(safe-area-inset-bottom, 0px)); padding-bottom: 10px; }
}
