/* Mobile bottom bar — parity with theme-raed-react mobile-bottom-bar.scss */

.mobile-bottom-bar {
  --mbb-badge-bg: #b3261e;
  --mbb-badge-text: #ffffff;
  --mbb-muted: var(--navbar-text, #666666);
  --color-primary: var(--navbar-active, var(--primary-color, #161616));
  --color-primary-reverse: #ffffff;
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 998;
  display: none;
  justify-content: center;
  padding: 0 16px calc(12px + var(--safe-bottom));
  pointer-events: none;
}

.mobile-bottom-bar-scrim {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 997;
  display: none;
  height: calc(72px + var(--safe-bottom));
  pointer-events: none;
  background: linear-gradient(
    to top,
    rgb(255 255 255 / 72%) 0%,
    rgb(255 255 255 / 52%) 42%,
    rgb(255 255 255 / 0%) 100%
  );
  backdrop-filter: blur(22px) saturate(180%) brightness(1.06);
  -webkit-backdrop-filter: blur(22px) saturate(180%) brightness(1.06);
  mask-image: linear-gradient(to top, #000 32%, rgb(0 0 0 / 0%) 100%);
  -webkit-mask-image: linear-gradient(to top, #000 32%, rgb(0 0 0 / 0%) 100%);
}

.mobile-bottom-bar__inner {
  display: flex;
  width: 100%;
  max-width: 28rem;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  height: 52px;
  border-radius: 9999px;
  padding: 0 8px;
  background: var(--navbar-bg, #ffffff);
  box-shadow: 0 8px 30px rgb(0 0 0 / 12%);
  pointer-events: auto;
}

.mobile-bottom-bar__item {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-width: 40px;
  height: 36px;
  padding: 0 6px;
  border: 0;
  border-radius: 9999px;
  background: transparent;
  color: var(--mbb-muted);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  transition:
    color 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    background-color 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    padding 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.mobile-bottom-bar__item.is-active {
  background: var(--color-primary, #9ca3af);
  color: var(--color-primary-reverse, #ffffff);
  padding: 0 10px;
}

.mobile-bottom-bar__icon {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.mobile-bottom-bar svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mobile-bottom-bar__label {
  display: block;
  overflow: hidden;
  max-width: 0;
  margin-inline-start: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(4px);
  transition:
    max-width 0.6s cubic-bezier(0.22, 1, 0.36, 1),
    margin-inline-start 0.6s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.14s ease,
    transform 0.6s ease;
}

[dir='rtl'] .mobile-bottom-bar__label {
  transform: translateX(-4px);
}

.mobile-bottom-bar__item.is-active .mobile-bottom-bar__label {
  max-width: 6.5rem;
  margin-inline-start: 8px;
  opacity: 1;
  transform: none;
  transition:
    max-width 0.6s cubic-bezier(0.22, 1, 0.36, 1),
    margin-inline-start 0.6s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.22s ease 0.1s,
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1) 0.1s;
}

.mobile-bottom-bar__badge {
  position: absolute;
  bottom: -6px;
  left: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border: 2px solid #ffffff;
  border-radius: 9999px;
  background: var(--mbb-badge-bg);
  color: var(--mbb-badge-text);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  transform: translateX(-50%);
  animation: mbb-badge-pop 0.28s ease;
}

.mobile-bottom-bar__badge.is-on {
  display: flex;
}

.mobile-bottom-bar__item.is-active .mobile-bottom-bar__badge {
  border-color: var(--color-primary, #9ca3af);
}

@keyframes mbb-badge-pop {
  from {
    transform: translateX(-50%) scale(0.4);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) scale(1);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-bottom-bar__item,
  .mobile-bottom-bar__label {
    transition: none;
  }
  .mobile-bottom-bar__label {
    transform: none;
  }
  .mobile-bottom-bar__badge {
    animation: none;
  }
}

@media (max-width: 767px) {
  .mobile-bottom-bar,
  .mobile-bottom-bar-scrim {
    display: flex;
  }

  body.has-mobile-bottom-bar {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }

  body.has-mobile-bottom-bar {
    --mx-bnav-offset: 76px;
  }
}

@media (min-width: 768px) {
  .mobile-bottom-bar,
  .mobile-bottom-bar-scrim {
    display: none !important;
  }
}
