/* =========================================================
   Bottom Navigation Bar — Ryan Ashcraft's FabBar Architecture
   Fluid Liquid Glass Capsule with Squashing Wall Physics
   ========================================================= */

.nav-dock-wrapper {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 16px);
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  pointer-events: none;
  padding: 0 16px;
}

/* Glass Tab Bar Dock Container (FabBar Constants.barHeight = 62px, contentPadding = 3px) */
.bottom-nav {
  pointer-events: auto;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 66px;
  box-sizing: border-box;
  padding: 3px 4px;
  gap: 0;
  border-radius: 9999px;
  background: rgba(18, 22, 28, 0.82);
  backdrop-filter: blur(30px) saturate(190%);
  -webkit-backdrop-filter: blur(30px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 1.5px rgba(255, 255, 255, 0.18), 0 16px 44px rgba(0, 0, 0, 0.55);
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden; /* Clips all children strictly to the capsule pill */
}

[data-theme="light"] .bottom-nav {
  background: rgba(245, 245, 247, 0.88);
  border: 1px solid rgba(0, 0, 0, 0.09);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.95), 0 12px 36px rgba(0, 0, 0, 0.14);
}

/* Individual Tab Segment (Generous touch target: 132px width, 60px height) */
.nav-item {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 0 0 132px;
  width: 132px;
  min-width: 132px;
  max-width: 132px;
  height: 60px;
  box-sizing: border-box;
  padding: 0;
  border-radius: 9999px;
  border: none;
  background: transparent !important;
  box-shadow: none !important;
  cursor: pointer;
  color: #8e8e93;
  transition: color 0.18s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.nav-item:active {
  transform: none;
}

/* Active Tab: Tinted accent color (Background is exclusively rendered by #nav-drag-bubble) */
.nav-item.active {
  color: var(--accent, #38bdf8);
}

[data-theme="light"] .nav-item.active {
  color: var(--accent, #007aff);
}

.nav-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-bottom: 2px;
  pointer-events: none;
}

.nav-icon-wrap .tg-emoji {
  width: 25px;
  height: 25px;
  object-fit: contain;
  transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}

.nav-item.active .nav-icon-wrap .tg-emoji {
  transform: scale(1.1);
}

/* Profile Tab Circular Avatar Thumbnail */
.nav-avatar-icon {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  background: #181c24;
  display: block;
  transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1), border-color 0.2s ease, box-shadow 0.2s ease;
}

.nav-item.active .nav-avatar-icon {
  transform: scale(1.1);
  border-color: var(--accent, #38bdf8);
}

.nav-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.15px;
  line-height: 1.1;
  pointer-events: none;
  transition: color 0.18s ease;
}

/* Telegram Notification Badges */
.nav-badge {
  position: absolute;
  top: -3px;
  right: -8px;
  background: #ff3b30;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 9999px;
  min-width: 17px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(255, 59, 48, 0.45);
  border: 1.5px solid var(--app-bg);
  z-index: 5;
  pointer-events: none;
}

/* =========================================================
   Unified Liquid Glass Lens Capsule & Drag Bubble (FabBar _UILiquidLensView)
   ========================================================= */

.nav-drag-bubble {
  position: absolute;
  top: 3px;
  left: 0;
  width: var(--bubble-w, 132px);
  height: 60px;
  border-radius: 9999px;
  pointer-events: none;
  z-index: 1;
  opacity: 1;
  transform: translate3d(var(--bubble-x, 4px), 0, 0) scaleX(var(--bubble-scale-x, 1));
  transform-origin: var(--bubble-origin, center center);
  will-change: transform, width, box-shadow;

  /* Rest state: Native iOS Liquid Glass capsule */
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.32s cubic-bezier(0.175, 0.885, 0.32, 1.25),
              width 0.32s cubic-bezier(0.175, 0.885, 0.32, 1.25),
              box-shadow 0.22s ease,
              border-color 0.22s ease;
}

[data-theme="light"] .nav-drag-bubble {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), inset 0 1px 0 #ffffff;
}

/* Touch-down Interactive State */
.nav-drag-bubble.holding {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.16);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.32);
}

/* Dragging State: 1:1 Instantaneous Transform Tracking with squash-and-stretch */
.nav-drag-bubble.dragging {
  transition: none !important;
}

.nav-drag-bubble.dragging::after {
  opacity: 1;
}

.nav-drag-bubble.dragging .bubble-gloss {
  opacity: 0.95;
}

/* Snapping State: Spring Bounce Animation */
.nav-drag-bubble.snapping {
  transition: transform 0.34s cubic-bezier(0.175, 0.885, 0.32, 1.25),
              width 0.34s cubic-bezier(0.175, 0.885, 0.32, 1.25),
              box-shadow 0.26s ease,
              border-color 0.26s ease !important;
}

.nav-drag-bubble.snapping::after {
  opacity: 0;
}

.nav-drag-bubble.snapping .bubble-gloss {
  opacity: 0;
}
