/* Mobile Bottom Navigation — Frontend Styles */
:root {
  --mbn-bg:         #ffffff;
  --mbn-text:       #9ca3af;
  --mbn-active:     #6366f1;
  --mbn-active-bg:  #eef2ff;
  --mbn-font-size:  11px;
  --mbn-icon-size:  22px;
  --mbn-height:     64px;
  --mbn-radius:     0px;
  --mbn-shadow:     0 -4px 24px rgba(0,0,0,.08), 0 -1px 0 rgba(0,0,0,.04);
  --mbn-border-top: 1px solid #e5e7eb;
}

/* ── Bar ──────────────────────────────────────────── */
#mbn-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99999;
  height: var(--mbn-height);
  background: var(--mbn-bg);
  box-shadow: var(--mbn-shadow);
  border-top: var(--mbn-border-top);
  border-radius: var(--mbn-radius) var(--mbn-radius) 0 0;
  /* safe area for notched devices */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mbn-bar-inner {
  display: flex;
  align-items: stretch;
  height: 100%;
  max-width: 640px;
  margin: 0 auto;
}

/* ── Items ───────────────────────────────────────── */
.mbn-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--mbn-text);
  font-size: var(--mbn-font-size);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 500;
  letter-spacing: 0.3px;
  position: relative;
  transition: color 0.22s ease;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  padding: 8px 4px 4px;
}

.mbn-item:hover {
  color: var(--mbn-active);
}

/* active state set by JS */
.mbn-item.mbn-active {
  color: var(--mbn-active);
}

/* ── Icon wrap ───────────────────────────────────── */
.mbn-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--mbn-icon-size) + 16px);
  height: calc(var(--mbn-icon-size) + 10px);
  border-radius: 100px;
  transition: transform 0.22s cubic-bezier(.34,1.56,.64,1);
}

.mbn-item.mbn-active .mbn-icon-wrap {
  transform: translateY(-1px);
}

/* icon itself */
.mbn-icon {
  position: relative;
  z-index: 2;
  width: var(--mbn-icon-size);
  height: var(--mbn-icon-size);
  display: block;
  transition: transform 0.22s cubic-bezier(.34,1.56,.64,1);
}

.mbn-item.mbn-active .mbn-icon {
  transform: scale(1.1);
}

/* ── Label ───────────────────────────────────────── */
.mbn-label {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60px;
  transition: opacity 0.2s, transform 0.2s;
}

/* ── Indicator: Pill ─────────────────────────────── */
.mbn-pill-bg {
  position: absolute;
  inset: 0;
  border-radius: 100px;
  background: var(--mbn-active-bg);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(.34,1.56,.64,1);
  z-index: 1;
}

.mbn-item.mbn-active .mbn-pill-bg {
  opacity: 1;
  transform: scale(1);
}

/* ── Indicator: Dot ──────────────────────────────── */
.mbn-dot {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%) scale(0);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--mbn-active);
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), opacity 0.2s;
  opacity: 0;
  z-index: 3;
}

.mbn-item.mbn-active .mbn-dot {
  transform: translateX(-50%) scale(1);
  opacity: 1;
}

/* ── Indicator: Line ─────────────────────────────── */
.mbn-line {
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 24px;
  height: 3px;
  border-radius: 2px 2px 0 0;
  background: var(--mbn-active);
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1);
  z-index: 3;
}

.mbn-item.mbn-active .mbn-line {
  transform: translateX(-50%) scaleX(1);
}

/* ── Tap ripple ──────────────────────────────────── */
.mbn-ripple {
  position: absolute;
  border-radius: 50%;
  background: var(--mbn-active);
  opacity: 0;
  pointer-events: none;
  transform: scale(0);
  animation: mbn-ripple-anim 0.5s ease-out forwards;
  z-index: 0;
}

@keyframes mbn-ripple-anim {
  0%   { transform: scale(0); opacity: 0.25; }
  100% { transform: scale(3); opacity: 0; }
}

/* ── Entrance animations ─────────────────────────── */
.mbn-anim-slide {
  animation: mbn-slide-in 0.4s cubic-bezier(.22,1,.36,1) both;
}

.mbn-anim-fade {
  animation: mbn-fade-in 0.4s ease both;
}

.mbn-anim-none {
  /* no animation */
}

@keyframes mbn-slide-in {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

@keyframes mbn-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Body padding ────────────────────────────────── */
body.mbn-active-bar {
  padding-bottom: calc(var(--mbn-height) + env(safe-area-inset-bottom, 0px));
}
