/*
 * VoltNear phone tab bar: a floating dark pill of five links on phones. The only stylesheet for it.
 * The app renders it from components/MobileTabBar.tsx and the Framer pages from initTabbar() in enhance.js, with the same DOM.
 * Shared by both, so colours are the design's literal values and every motion token has a fallback.
 * Compact mode is one transform on .vn-tabbar-pill; motion is transform and opacity only, only under prefers-reduced-motion: no-preference.
 */
.vn-tabbar, .vn-tabbar *, .vn-tabbar-sheet, .vn-tabbar-sheet * { box-sizing: border-box; }
.vn-tabbar { display: none; }
.vn-tab-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 809.98px) {
  :root { --vn-tabbar-space: calc(64px + 12px + env(safe-area-inset-bottom, 0px)); }

  /* Above the station and booking bars (z 40), below the assistant launcher (45) and the app header (50) */
  .vn-tabbar {
    display: block; position: fixed; z-index: 42;
    left: max(12px, env(safe-area-inset-left, 0px)); right: max(12px, env(safe-area-inset-right, 0px));
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    font-family: "Inter", "Inter Placeholder", sans-serif; -webkit-tap-highlight-color: transparent;
    --vn-tabbar-dur: 320ms; --vn-tabbar-ease: cubic-bezier(0.32, 0.72, 0, 1);
  }
  .vn-tabbar-pill {
    position: relative; isolation: isolate; display: flex; align-items: stretch; gap: 0;
    height: 64px; max-width: 520px; margin: 0 auto; padding: 4px; border-radius: 999px;
    transform-origin: 50% 100%;
  }
  /* The glass is part of the pill, so it moves and scales with the items. */
  .vn-tabbar-pill::before {
    content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 999px; pointer-events: none;
    background: rgba(22, 45, 37, 0.86);
    -webkit-backdrop-filter: blur(12px) saturate(1.4); backdrop-filter: blur(12px) saturate(1.4);
    box-shadow: 0 8px 24px rgba(22, 45, 37, 0.28);
  }
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .vn-tabbar-pill::before { background: #162d25; }
  }
  @media (prefers-reduced-transparency: reduce) {
    .vn-tabbar-pill::before { background: #162d25; -webkit-backdrop-filter: none; backdrop-filter: none; }
  }

  .vn-tab {
    position: relative; flex: 1 1 0; min-width: 44px; min-height: 44px; margin: 0; padding: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    border: 0; border-radius: 999px; background: transparent; color: #c3cdc6; text-decoration: none; cursor: pointer; isolation: isolate;
    font: 500 12px/14px "Inter", "Inter Placeholder", sans-serif; letter-spacing: -0.01em;
  }
  .vn-tab[aria-current="page"] { color: #fff; }
  /* Current tab: a pill 4px inside its column, 8px inside the bar, so on Home and Owner it nests in the bar's rounded ends (24 = 32 - 8) */
  .vn-tab[aria-current="page"]::before {
    content: ""; position: absolute; inset: 4px; z-index: -1; border-radius: 999px; pointer-events: none;
    background: rgba(255, 255, 255, 0.14);
  }
  .vn-tab:focus-visible { outline: 2px solid #e8eee6; outline-offset: 2px; }
  .vn-tab-icon { position: relative; flex: none; width: 24px; height: 24px; display: grid; place-items: center; }
  .vn-tab-icon svg { display: block; width: 24px; height: 24px; }
  .vn-tab-label { display: block; white-space: nowrap; }

  /* Home: the V in the VoltNear green on a white disc */
  .vn-tab-disc { width: 28px; height: 28px; margin: -2px; display: grid; place-items: center; border-radius: 50%; background: #fff; }
  .vn-tab-disc svg { width: 18px; height: 18px; }
  .vn-tab-v rect { fill: #087a50; }

  /* Owner: the initial on a green circle, or an outlined person icon when signed out */
  .vn-tab-avatar {
    width: 28px; height: 28px; margin: -2px; display: grid; place-items: center; border-radius: 50%;
    background: #087a50; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.7); color: #fff; font: 500 14px/1 "Inter", "Inter Placeholder", sans-serif;
  }
  .vn-tab-dot {
    position: absolute; top: -3px; right: -4px; width: 8px; height: 8px; border-radius: 50%;
    background: #a23b2a; box-shadow: 0 0 0 2px #162d25;
  }
  .vn-tab-dot[hidden] { display: none; }

  /* Entrance on the Framer pages (enhance.js sets data-enter) and compact mode while reading down */
  @media (prefers-reduced-motion: no-preference) {
    @keyframes vn-tabbar-in { from { opacity: 0; } }
    .vn-tabbar[data-enter] { animation: vn-tabbar-in var(--vn-dur-2, 200ms) var(--vn-ease-standard, cubic-bezier(0.2, 0, 0, 1)) backwards; }
    .vn-tabbar-pill { will-change: transform; transition: transform var(--vn-tabbar-dur) var(--vn-tabbar-ease); }
    .vn-tab-icon { transition: transform var(--vn-tabbar-dur) var(--vn-tabbar-ease); }
    .vn-tab-label { transition: opacity 200ms cubic-bezier(0.2, 0, 0, 1) 80ms, transform var(--vn-tabbar-dur) var(--vn-tabbar-ease); }
    .vn-tabbar[data-compact="true"] .vn-tabbar-pill { transform: translateY(6px) scale(0.88); }
    /* Icon centre 20px -> 28px of the 56px column: icons-only, centred in the highlight */
    .vn-tabbar[data-compact="true"] .vn-tab-icon { transform: translateY(8px); }
    .vn-tabbar[data-compact="true"] .vn-tab-label {
      opacity: 0; transform: translateY(4px);
      transition: opacity 140ms cubic-bezier(0.2, 0, 0, 1), transform var(--vn-tabbar-dur) var(--vn-tabbar-ease);
    }
  }

  /* Hidden: while typing, when the menu is open, and when the station page's action bar shows */
  .vn-tabbar[data-hidden="true"], html.vn-x-menu-open .vn-tabbar, html:has(.vn-mobile-bar[data-reveal="shown"]) .vn-tabbar { visibility: hidden; }
  @media (prefers-reduced-motion: no-preference) {
    .vn-tabbar { transition: transform var(--vn-tabbar-dur) var(--vn-tabbar-ease), visibility 0s linear 0s; }
    .vn-tabbar[data-hidden="true"], html.vn-x-menu-open .vn-tabbar, html:has(.vn-mobile-bar[data-reveal="shown"]) .vn-tabbar {
      /* height + 12px offset + 32px shadow + the home-indicator inset: fully off screen */
      transform: translateY(calc(100% + 44px + env(safe-area-inset-bottom, 0px)));
      transition: transform var(--vn-tabbar-dur) var(--vn-tabbar-ease), visibility 0s linear var(--vn-tabbar-dur);
    }
  }

  /* Keep the page and the footer clear of the bar (and of the assistant launcher above it) */
  html:has(.vn-tabbar) { scroll-padding-bottom: calc(var(--vn-tabbar-space) + 16px); }
  html.vn-ai-on:has(.vn-tabbar) { scroll-padding-bottom: calc(var(--vn-tabbar-space) + 16px + 60px); }
  html:has(.vn-tabbar) :is(.vn-footer, footer[data-framer-name="Footer"]) { padding-bottom: calc(var(--vn-tabbar-space) + 24px); }
  html.vn-ai-on:has(.vn-tabbar) :is(.vn-footer, footer[data-framer-name="Footer"]) { padding-bottom: calc(var(--vn-tabbar-space) + 12px + 48px + 24px); }

  /* Owner sheet for signed-out visitors: a native dialog above the bar */
  .vn-tabbar-sheet {
    position: fixed; inset: auto 12px calc(var(--vn-tabbar-space) + 8px) 12px; margin: 0 auto; width: min(380px, calc(100vw - 24px));
    max-width: none; max-height: calc(100dvh - var(--vn-tabbar-space) - 24px); overflow: auto; padding: 8px 16px 16px;
    border: 0; border-radius: 20px; background: #fff; color: #162d25;
    box-shadow: 0 8px 24px rgba(22, 45, 37, 0.28);
    font: 400 15px/1.4 "Inter", "Inter Placeholder", sans-serif; letter-spacing: -0.01em;
  }
  .vn-tabbar-sheet::backdrop { background: rgba(22, 45, 37, 0.3); }
  .vn-tabbar-sheet h2 { margin: 0; padding: 12px 0 4px; font: 500 16px/1.4 "Inter", "Inter Placeholder", sans-serif; }
  .vn-tabbar-sheet a {
    display: flex; align-items: center; min-height: 48px; border-bottom: 1px solid #dde4db; color: #162d25; font-weight: 500; text-decoration: none;
  }
  .vn-tabbar-sheet a:focus-visible, .vn-tabbar-sheet button:focus-visible { outline: 2px solid #087a50; outline-offset: 2px; }
  .vn-tabbar-sheet button {
    display: block; width: 100%; min-height: 44px; margin-top: 12px; border: 1px solid #dde4db; border-radius: var(--vn-r-control, 8px);
    background: #fff; color: #162d25; font: 500 15px/1 "Inter", "Inter Placeholder", sans-serif; cursor: pointer;
  }
  /* Owner workspace More sheet: buttons that look like the link rows */
  .vn-tabbar-sheet .vn-sheet-row {
    display: flex; align-items: center; justify-content: flex-start; width: 100%; min-height: 48px; margin: 0; padding: 0;
    border: 0; border-bottom: 1px solid #dde4db; border-radius: 0; background: transparent; color: #162d25;
    font: 500 15px/1.4 "Inter", "Inter Placeholder", sans-serif; letter-spacing: -0.01em; text-align: left; cursor: pointer;
  }
  .vn-tabbar-sheet .vn-sheet-row:disabled { opacity: 0.6; cursor: default; }
  .vn-tabbar-sheet a[aria-current="page"] { color: #087a50; }
  .vn-tabbar-sheet a .vn-count { margin-left: auto; }
  /* The pending bar sits under the label, light on the dark pill */
  .vn-tabbar .vn-link-pending { left: 28%; right: 28%; bottom: 6px; background: #fff; }
  /* Availability is the widest label: smaller on the narrowest phones so five tabs fit */
  @media (max-width: 339.98px) {
    .vn-tabbar[data-variant="owner"] .vn-tab-label { font-size: 11px; }
  }
  @media (prefers-reduced-motion: no-preference) {
    @keyframes vn-tabbar-sheet-in { from { opacity: 0; translate: 0 12px; } }
    .vn-tabbar-sheet[open] { animation: vn-tabbar-sheet-in var(--vn-dur-2, 200ms) var(--vn-ease-standard, cubic-bezier(0.2, 0, 0, 1)); }
  }
}

@media (min-width: 810px), print {
  .vn-tabbar, .vn-tabbar-sheet { display: none !important; }
}
