/**
 * FrenzyGo fixed bottom tab bar — single source of truth for app shell footer.
 * Loaded from header.ejs on all fg-app pages (before page-specific CSS).
 */

html:has(body.fg-app) {
  min-height: 100%;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  /* iOS: green below fixed bar when page is shorter than viewport */
  background-color: var(--fg-bottom-nav-green, #1d8f3e);
}

:root {
  --fg-safe-area-bottom: constant(safe-area-inset-bottom);
  --fg-safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --fg-bottom-dock: calc(var(--fg-tab-bar-h, 64px) + var(--fg-safe-area-bottom));
  --fg-bottom-dock-with-checkout: calc(var(--fg-tab-bar-h, 64px) + 52px + var(--fg-safe-area-bottom));
}

body.fg-app {
  box-sizing: border-box;
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  padding-bottom: var(--fg-bottom-dock);
  font-family: inherit;
  overscroll-behavior-y: none;
}

.fixed-footer.fg-bottom-nav {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-width: 100vw !important;
  margin: 0 !important;
  z-index: 1010;
  display: flex !important;
  justify-content: center;
  align-items: stretch;
  box-sizing: border-box;
  min-height: var(--fg-bottom-dock);
  padding-bottom: var(--fg-safe-area-bottom);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  background-color: var(--fg-bottom-nav-green, #1d8f3e);
  background: linear-gradient(180deg, #2dca5e 0%, #22a347 42%, #1d8f3e 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.14);
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
}

.fixed-footer.fg-bottom-nav::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: max(0px, var(--fg-safe-area-bottom));
  background: var(--fg-bottom-nav-green, #1d8f3e);
  pointer-events: none;
}

.fixed-footer .fg-bottom-nav__menu.ui.menu {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  margin: 0 !important;
  width: 100%;
  max-width: 720px;
  min-height: var(--fg-tab-bar-h);
  flex: 1 1 auto;
  position: relative;
  z-index: 1;
  padding: 6px var(--fg-tab-bar-pad-x) 8px;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 2px;
}

.fixed-footer .fg-bottom-nav__menu > a.item {
  flex: 1 1 0;
  min-width: 0;
  max-width: 140px;
  min-height: 48px;
  margin: 0 !important;
  padding: 6px 4px 8px !important;
  border-radius: 12px !important;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: rgba(255, 255, 255, 0.88) !important;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1.15;
  text-align: center;
  text-decoration: none !important;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

@media (hover: hover) {
  .fixed-footer .fg-bottom-nav__menu > a.item:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.12) !important;
  }
}

.fixed-footer .fg-bottom-nav__menu > a.item:active {
  background: rgba(0, 0, 0, 0.08) !important;
}

.fixed-footer .fg-bottom-nav__menu > a.item:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.95);
  outline-offset: -3px;
}

.fixed-footer .fg-bottom-nav__menu > a.item.active {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.18) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.fixed-footer .fg-bottom-nav__menu > a.item.active .fg-tab__icon {
  opacity: 1;
}

.fixed-footer .fg-tab__icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 26px;
  opacity: 0.95;
}

.fixed-footer .fg-tab__icon > i.icon {
  font-size: 1.35rem !important;
  margin: 0 !important;
  line-height: 1 !important;
}

.fixed-footer .fg-tab__label {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 2px;
}

.fixed-footer .fg-tab__label--account {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  line-height: 1.12;
  max-width: 100%;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.fixed-footer .fg-tab__account-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 780;
  letter-spacing: 0.02em;
}

.fixed-footer .fg-tab__account-hint {
  display: block;
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.82;
}

.fixed-footer .fg-bottom-nav__menu > a.item.fg-tab--account {
  padding-bottom: 6px !important;
}

.fixed-footer .fg-bottom-nav__menu > a.item.fg-tab--sell {
  flex: 1.05 1 0;
  color: #0f5132 !important;
  background: rgba(255, 255, 255, 0.94) !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.85);
  border-radius: 14px !important;
  margin: 2px 3px !important;
  padding-left: 6px !important;
  padding-right: 6px !important;
  font-weight: 750;
}

.fixed-footer .fg-bottom-nav__menu > a.item.fg-tab--sell .fg-tab__icon > i.icon {
  color: #ca8a04;
}

@media (hover: hover) {
  .fixed-footer .fg-bottom-nav__menu > a.item.fg-tab--sell:hover {
    background: #fff !important;
    color: #052e16 !important;
  }
}

.fixed-footer .fg-bottom-nav__menu > a.item.fg-tab--sell.active {
  background: #fff !important;
  color: #052e16 !important;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.65), 0 4px 16px rgba(0, 0, 0, 0.15) !important;
}

.fixed-footer .fg-bottom-nav__menu > a.item.fg-tab--sell:active {
  background: #f0fdf4 !important;
  color: #052e16 !important;
}

.fixed-footer .menu .item .ui.label.cart-count,
.fixed-footer .menu .item .ui.label.account-notification-count {
  position: absolute !important;
  top: -2px;
  right: calc(50% - 26px);
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 5px !important;
  margin: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #dc2626 !important;
  color: #fff !important;
  font-size: 9px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  border-radius: 999px !important;
  border: 2px solid #fff !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.fixed-footer .menu .item .ui.label.account-notification-count {
  right: calc(50% - 20px);
  top: -4px;
}

.fixed-footer .fg-tab__avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.fixed-footer .fg-bottom-nav__menu > a.item.active .fg-tab__avatar {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.fixed-footer .menu .logo-item .fg-tab__icon > img {
  width: 26px;
  height: 26px;
}

.fg-checkout-strip {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--fg-bottom-dock);
  z-index: 999;
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(244, 246, 249, 0.99) 100%);
  border-top: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.1);
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.fg-checkout-strip--hidden {
  display: none !important;
}

.fg-checkout-strip__inner {
  max-width: 520px;
  margin: 0 auto;
}

.fg-checkout-strip .ui.button {
  margin: 0 !important;
  font-weight: 700 !important;
  letter-spacing: 0.02em;
}

body.fg-app.fg-with-cart-checkout {
  padding-bottom: var(--fg-bottom-dock-with-checkout) !important;
}

body.fg-app:has(.fg-cart-page) #fg-checkout-strip,
body.fg-app:has(.fg-checkout-page) #fg-checkout-strip,
body.fg-app:has(.fg-guest-checkout-details) #fg-checkout-strip,
body.fg-app:has(.fg-thankyou-page) #fg-checkout-strip {
  display: none !important;
}

body.fg-app:has(.fg-bottom-nav--onboarding) {
  padding-bottom: calc(var(--fg-onboarding-footer-h) + var(--fg-safe-area-bottom) + 12px) !important;
}

.fixed-footer.fg-bottom-nav.fg-bottom-nav--onboarding {
  min-height: calc(var(--fg-onboarding-footer-h) + var(--fg-safe-area-bottom));
  z-index: 1010;
}

.fg-onboarding-footer {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px calc(var(--fg-tab-bar-pad-x) + 8px) calc(12px + var(--fg-safe-area-bottom));
  color: rgba(255, 255, 255, 0.95);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: 0.01em;
}

.fg-onboarding-footer__label strong {
  display: block;
  font-weight: 800;
  margin-bottom: 2px;
}

.fg-onboarding-footer .ui.mini.basic.inverted.button {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45) !important;
  flex-shrink: 0;
  color: #fff !important;
}

@media only screen and (max-width: 380px) {
  :root {
    --fg-tab-bar-h: 60px;
  }

  .fixed-footer .fg-bottom-nav__menu > a.item {
    font-size: 9px;
    padding: 4px 2px 6px !important;
  }

  .fixed-footer .fg-tab__icon > i.icon {
    font-size: 1.2rem !important;
  }

  .fixed-footer .fg-tab__avatar {
    width: 24px;
    height: 24px;
  }

  body.fg-app.fg-with-cart-checkout {
    padding-bottom: calc(var(--fg-tab-bar-h) + 48px + var(--fg-safe-area-bottom)) !important;
  }

  .fg-checkout-strip {
    padding: 8px 12px;
  }
}
