/* PWA mobile app shell — bottom dock, tab bar, install banner, standalone polish */

:root {
  --pmts-pwa-tabbar-core: 4.25rem;
  --pmts-pwa-tabbar-height: calc(var(--pmts-pwa-tabbar-core) + env(safe-area-inset-bottom, 0px));
  --pmts-pwa-mobile-footer-height: 0px;
  --pmts-pwa-dock-height: var(--pmts-pwa-tabbar-height);
  --pmts-pwa-brand: #bf5f0b;
  --pmts-pwa-brand-soft: rgb(255 247 237);
  --pmts-pwa-tab-bg: rgb(255 255 255 / 0.97);
  --pmts-pwa-tab-border: rgb(226 232 240 / 0.95);
  --pmts-floating-fab-size: 2.75rem;
  --pmts-floating-stack-gap: 0.5rem;
  --pmts-floating-edge: 0.65rem;
  --pmts-floating-dock-offset: 0.55rem;
}

/* ── Bottom dock (tab bar only — footer lives in page scroll) ───── */

.pmts-pwa-dock {
  display: none;
}

.pmts-pwa-tabbar {
  display: none;
}

@media (max-width: 991px) {
  body.pmts-pwa-mobile:not(.pmts-has-sidebar) .pmts-pwa-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    display: block;
    pointer-events: none;
  }

  body.pmts-pwa-mobile:not(.pmts-has-sidebar) .pmts-pwa-dock > * {
    pointer-events: auto;
  }

  body.pmts-pwa-mobile.pmts-has-sidebar .pmts-pwa-dock {
    display: none;
  }

  body.pmts-pwa-mobile:not(.pmts-has-sidebar) #page-scroll-shell {
    padding-bottom: var(--pmts-pwa-tabbar-height);
  }

  body.pmts-pwa-mobile.pmts-has-sidebar #page-scroll-shell {
    padding-bottom: 0;
  }

  body.pmts-pwa-mobile.pmts-pwa-install-visible:not(.pmts-has-sidebar) #page-scroll-shell {
    padding-bottom: calc(var(--pmts-pwa-tabbar-height) + 3.5rem);
  }

  body.pmts-pwa-mobile:not(.pmts-has-sidebar) .public-site-footer--desktop {
    display: none;
  }

  body.pmts-pwa-mobile .pmts-pwa-tabbar {
    position: relative;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: end;
    gap: 0;
    min-height: var(--pmts-pwa-tabbar-height);
    padding:
      0.65rem max(0.35rem, env(safe-area-inset-left, 0px))
      max(0.35rem, env(safe-area-inset-bottom, 0px))
      max(0.35rem, env(safe-area-inset-right, 0px));
    border-top: 1px solid var(--pmts-pwa-tab-border);
    background:
      linear-gradient(180deg, rgb(255 255 255 / 0.98) 0%, rgb(248 250 252 / 0.98) 100%);
    backdrop-filter: blur(16px) saturate(1.35);
    -webkit-backdrop-filter: blur(16px) saturate(1.35);
    box-shadow:
      0 -1px 0 rgb(255 255 255 / 0.8) inset,
      0 -10px 30px rgb(15 23 42 / 0.08);
  }

  /* Notch curve behind the raised centre tab */
  body.pmts-pwa-mobile .pmts-pwa-tabbar::before {
    content: '';
    position: absolute;
    left: 50%;
    top: -1.15rem;
    transform: translateX(-50%);
    width: 5.5rem;
    height: 1.35rem;
    border-radius: 1.35rem 1.35rem 0 0;
    border: 1px solid var(--pmts-pwa-tab-border);
    border-bottom: none;
    background: rgb(255 255 255 / 0.98);
    box-shadow: 0 -4px 14px rgb(15 23 42 / 0.05);
    pointer-events: none;
  }
}

/* ── Tab items ──────────────────────────────────────────────────── */

.pmts-pwa-tab {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.22rem;
  min-width: 0;
  min-height: 2.85rem;
  padding: 0.15rem 0.2rem 0.1rem;
  border: none;
  border-radius: 0.75rem;
  background: transparent;
  color: rgb(100 116 139);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.015em;
  text-decoration: none;
  touch-action: manipulation;
  transition: color 0.15s ease, transform 0.12s ease;
}

.pmts-pwa-tab:active:not(.pmts-pwa-tab--center) {
  transform: scale(0.96);
}

.pmts-pwa-tab__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
}

.pmts-pwa-tab__icon .public-nav-icon {
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 0.55rem;
}

.pmts-pwa-tab__icon .public-nav-icon svg {
  width: 1.05rem;
  height: 1.05rem;
}

.pmts-pwa-tab__label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.1;
}

.pmts-pwa-tab--active {
  color: var(--nav-icon-color, var(--pmts-pwa-brand));
}

.pmts-pwa-tab--active .pmts-pwa-tab__icon .public-nav-icon {
  background: color-mix(in srgb, var(--nav-icon-color, #64748b) 22%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--nav-icon-color, #64748b) 32%, transparent);
}

/* Raised centre tab (Public Statistics) */
.pmts-pwa-tab--center {
  justify-content: flex-end;
  padding-bottom: 0;
}

.pmts-pwa-tab--center .pmts-pwa-tab__lift {
  position: absolute;
  left: 50%;
  bottom: 1.35rem;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.35rem;
  height: 3.35rem;
  border-radius: 1.1rem 1.1rem 0.85rem 0.85rem;
  border: 1px solid color-mix(in srgb, var(--nav-icon-color, var(--pmts-pwa-brand)) 28%, white);
  border-bottom: none;
  background: linear-gradient(
    180deg,
    #fff 0%,
    color-mix(in srgb, var(--nav-icon-color, var(--pmts-pwa-brand)) 10%, white) 100%
  );
  box-shadow:
    0 -6px 18px color-mix(in srgb, var(--nav-icon-color, var(--pmts-pwa-brand)) 18%, transparent),
    0 8px 20px rgb(15 23 42 / 0.1),
    inset 0 1px 0 rgb(255 255 255 / 0.95);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pmts-pwa-tab--center .pmts-pwa-tab__icon .public-nav-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 0.7rem;
}

.pmts-pwa-tab--center .pmts-pwa-tab__icon .public-nav-icon svg {
  width: 1.2rem;
  height: 1.2rem;
}

.pmts-pwa-tab--center.pmts-pwa-tab--active .pmts-pwa-tab__lift {
  border-color: color-mix(in srgb, var(--nav-icon-color, var(--pmts-pwa-brand)) 40%, white);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--nav-icon-color, var(--pmts-pwa-brand)) 8%, white) 0%,
    color-mix(in srgb, var(--nav-icon-color, var(--pmts-pwa-brand)) 16%, white) 100%
  );
  box-shadow:
    0 -8px 22px color-mix(in srgb, var(--nav-icon-color, var(--pmts-pwa-brand)) 24%, transparent),
    0 10px 24px rgb(15 23 42 / 0.12),
    inset 0 1px 0 rgb(255 255 255 / 0.95);
}

.pmts-pwa-tab--center.pmts-pwa-tab--active .pmts-pwa-tab__icon .public-nav-icon {
  background: color-mix(in srgb, var(--nav-icon-color, #059669) 22%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--nav-icon-color, #059669) 32%, transparent);
}

.pmts-pwa-tab--center:active .pmts-pwa-tab__lift {
  transform: translateX(-50%) scale(0.96);
}

.pmts-pwa-tab--center .pmts-pwa-tab__label {
  margin-top: 0.15rem;
  font-weight: 800;
}

body.pmts-public-menu-open .pmts-pwa-tab[data-pwa-open-menu] {
  color: #B45309;
}

body.pmts-public-menu-open .pmts-pwa-tab[data-pwa-open-menu] .pmts-pwa-tab__icon .public-nav-icon {
  background: color-mix(in srgb, #B45309 22%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #B45309 32%, transparent);
}

/* ── Mobile footer (in page scroll — above fixed tab bar) ───────── */

.pmts-public-mobile-footer {
  display: none;
}

body.pmts-pwa-mobile:not(.pmts-has-sidebar) .pmts-public-mobile-footer {
  display: block;
  margin-top: auto;
  padding:
    0.85rem max(0.75rem, env(safe-area-inset-left, 0px))
    0.75rem
    max(0.75rem, env(safe-area-inset-right, 0px));
  border-top: 1px solid rgb(226 232 240);
  background: rgb(248 250 252);
}

.pmts-public-mobile-footer__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}

.pmts-public-mobile-footer__chip {
  display: inline-flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-width: 0;
  min-height: 2.25rem;
  padding: 0.4rem 0.45rem;
  border-radius: 9999px;
  border: 1px solid rgb(226 232 240);
  background: #fff;
  color: rgb(51 65 85);
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1.1;
  text-decoration: none;
  white-space: nowrap;
  touch-action: manipulation;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.pmts-public-mobile-footer__chip span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.pmts-public-mobile-footer__chip:active {
  transform: scale(0.97);
  background: var(--pmts-pwa-brand-soft);
  border-color: rgb(253 230 138);
  color: var(--pmts-pwa-brand);
}

.pmts-public-mobile-footer__chip--accent {
  border-color: rgb(253 230 138);
  background: linear-gradient(180deg, #fff 0%, #fffbeb 100%);
  color: rgb(180 83 9);
}

/* ── Install banner ─────────────────────────────────────────────── */

.pmts-pwa-install {
  position: fixed;
  left: max(0.75rem, env(safe-area-inset-left, 0px));
  right: max(0.75rem, env(safe-area-inset-right, 0px));
  bottom: calc(var(--pmts-pwa-tabbar-height) + 0.5rem);
  z-index: 46;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.875rem;
  border-radius: 1rem;
  border: 1px solid rgb(226 232 240);
  background: linear-gradient(135deg, #fff 0%, #fffbf5 100%);
  box-shadow: 0 12px 32px rgb(15 23 42 / 0.14);
}

.pmts-pwa-install[hidden] {
  display: none !important;
}

.pmts-pwa-install__icon {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  object-fit: cover;
  box-shadow: 0 4px 12px rgb(15 23 42 / 0.1);
}

.pmts-pwa-install__copy {
  flex: 1;
  min-width: 0;
}

.pmts-pwa-install__title {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 800;
  color: rgb(15 23 42);
  line-height: 1.25;
}

.pmts-pwa-install__text {
  margin: 0.15rem 0 0;
  font-size: 0.6875rem;
  line-height: 1.35;
  color: rgb(100 116 139);
}

.pmts-pwa-install__actions {
  display: flex;
  flex-shrink: 0;
  flex-direction: column;
  gap: 0.35rem;
}

.pmts-pwa-install__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.35rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  font-size: 0.6875rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.pmts-pwa-install__btn--primary {
  color: #fff;
  background: linear-gradient(135deg, #d97706, var(--pmts-pwa-brand));
}

.pmts-pwa-install__btn--ghost {
  color: rgb(100 116 139);
  background: transparent;
  border-color: rgb(226 232 240);
}

.pmts-pwa-install--ios .pmts-pwa-install__share-icon {
  display: inline-block;
  width: 0.95rem;
  height: 0.95rem;
  margin: 0 0.1rem;
  vertical-align: -0.15em;
  color: var(--pmts-pwa-brand);
}

body.pmts-pwa-mobile.pmts-has-sidebar .pmts-pwa-install,
body.pmts-pwa-mobile.pmts-has-sidebar .pmts-pwa-toast {
  bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
}

/* ── Update / error toasts ─────────────────────────────────────── */

.pmts-pwa-toast {
  position: fixed;
  left: max(0.75rem, env(safe-area-inset-left, 0px));
  right: max(0.75rem, env(safe-area-inset-right, 0px));
  bottom: calc(var(--pmts-pwa-tabbar-height) + 0.5rem);
  z-index: 47;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.875rem;
  border: 1px solid rgb(226 232 240);
  background: rgb(255 255 255 / 0.98);
  box-shadow: 0 10px 28px rgb(15 23 42 / 0.12);
}

.pmts-pwa-toast[hidden] {
  display: none !important;
}

.pmts-pwa-toast--update {
  border-color: rgb(191 219 254);
  background: linear-gradient(135deg, #fff 0%, #eff6ff 100%);
}

.pmts-pwa-toast--error {
  border-color: rgb(254 202 202);
  background: linear-gradient(135deg, #fff 0%, #fef2f2 100%);
}

.pmts-pwa-toast__copy {
  flex: 1;
  min-width: 0;
}

.pmts-pwa-toast__title {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 800;
  color: rgb(15 23 42);
}

.pmts-pwa-toast__text {
  margin: 0.12rem 0 0;
  font-size: 0.6875rem;
  line-height: 1.35;
  color: rgb(100 116 139);
}

.pmts-pwa-toast__actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.pmts-pwa-toast__btn {
  border: 1px solid transparent;
  border-radius: 9999px;
  padding: 0.35rem 0.65rem;
  font-size: 0.6875rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.pmts-pwa-toast__btn--primary {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.pmts-pwa-toast__btn--ghost {
  color: rgb(100 116 139);
  background: transparent;
  border-color: rgb(226 232 240);
  min-width: 2rem;
  padding-inline: 0.45rem;
}

body.pmts-pwa-update-visible:not(.pmts-has-sidebar) #page-scroll-shell,
body.pmts-pwa-sw-error-visible:not(.pmts-has-sidebar) #page-scroll-shell {
  padding-bottom: calc(var(--pmts-pwa-tabbar-height) + 3.25rem);
}

/* ── Offline indicator ─────────────────────────────────────────── */

.pmts-pwa-network {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 0.5rem);
  left: 50%;
  z-index: 50;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: 9999px;
  border: 1px solid rgb(252 165 165);
  background: rgb(254 242 242 / 0.96);
  color: rgb(153 27 27);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  box-shadow: 0 8px 20px rgb(15 23 42 / 0.12);
  backdrop-filter: blur(8px);
}

.pmts-pwa-network[hidden] {
  display: none !important;
}

.pmts-pwa-network__dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 9999px;
  background: rgb(239 68 68);
}

/* ── Floating widgets — clear the dock on mobile public portal ─── */

@media (max-width: 991px) {
  body.pmts-pwa-mobile:not(.pmts-has-sidebar) .pmts-assistant {
    right: var(--pmts-floating-edge);
    bottom: calc(var(--pmts-pwa-tabbar-height) + var(--pmts-floating-dock-offset));
    z-index: 44;
  }

  body.pmts-pwa-mobile:not(.pmts-has-sidebar) .pmts-assistant__toggle {
    width: var(--pmts-floating-fab-size);
    height: var(--pmts-floating-fab-size);
    padding: 0;
    justify-content: center;
    border-radius: 9999px;
  }

  body.pmts-pwa-mobile:not(.pmts-has-sidebar) .pmts-assistant__toggle span.label {
    display: none;
  }

  /* Back-to-top sits above the assistant FAB (same right edge, stacked) */
  body.pmts-pwa-mobile:not(.pmts-has-sidebar) .staff-manual__back-top {
    right: var(--pmts-floating-edge);
    bottom: calc(
      var(--pmts-pwa-tabbar-height) + var(--pmts-floating-dock-offset) +
        var(--pmts-floating-fab-size) + var(--pmts-floating-stack-gap)
    );
    width: var(--pmts-floating-fab-size);
    height: var(--pmts-floating-fab-size);
    z-index: 45;
  }

  /* Hide back-to-top while the assistant panel is open — avoids overlap */
  body.pmts-pwa-mobile:not(.pmts-has-sidebar):has(.pmts-assistant--open) .staff-manual__back-top {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  body.pmts-pwa-mobile:not(.pmts-has-sidebar) .cookieyes {
    left: var(--pmts-floating-edge);
    bottom: calc(var(--pmts-pwa-tabbar-height) + var(--pmts-floating-dock-offset));
    z-index: 44;
  }

  body.pmts-pwa-mobile:not(.pmts-has-sidebar) .cookieyes__launcher {
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    justify-content: center;
    border-radius: 9999px;
  }

  body.pmts-pwa-mobile:not(.pmts-has-sidebar) .cookieyes__launcher-label {
    display: none;
  }

  body.pmts-pwa-mobile:not(.pmts-has-sidebar) .cookieyes--idle {
    transform: translateX(calc(-100% + 2.75rem));
  }
}

/* ── Standalone / installed app polish ──────────────────────────── */

@media (display-mode: standalone) {
  body.pmts-pwa-standalone .pmts-topbar {
    padding-top: env(safe-area-inset-top, 0px);
  }
}

body.pmts-pwa-standalone.pmts-pwa-mobile .public-site-header,
body.pmts-pwa-standalone.pmts-pwa-mobile .pmts-topbar {
  box-shadow: 0 1px 0 rgb(226 232 240 / 0.9);
}

body.pmts-pwa-standalone.pmts-pwa-mobile #page-scroll-shell {
  background: linear-gradient(180deg, #e8ecf1 0%, #f3f4f6 100%);
}

/* Offline page */
.pmts-pwa-offline-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: min(70vh, 32rem);
  padding: 2rem 1.25rem;
  text-align: center;
}

.pmts-pwa-offline-page__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  margin-bottom: 1rem;
  border-radius: 1.25rem;
  background: rgb(255 247 237);
  color: var(--pmts-pwa-brand);
}

.pmts-pwa-offline-page__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: rgb(15 23 42);
}

.pmts-pwa-offline-page__lead {
  margin: 0.75rem 0 0;
  max-width: 22rem;
  font-size: 0.875rem;
  line-height: 1.55;
  color: rgb(100 116 139);
}

.pmts-pwa-offline-page__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.pmts-pwa-offline-page__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.55rem 1rem;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  touch-action: manipulation;
}

.pmts-pwa-offline-page__btn--primary {
  color: #fff;
  background: linear-gradient(135deg, #d97706, var(--pmts-pwa-brand));
}

.pmts-pwa-offline-page__btn--ghost {
  color: rgb(51 65 85);
  background: #fff;
  border: 1px solid rgb(203 213 225);
}
