/*
 * Bottom Tab Bar
 * Mobile-first: base styles are mobile, min-width scales up
 *
 * This HTML tab bar is shown in the browser. When running inside
 * a Hotwire Native shell, it is hidden via .native-app body class
 * and replaced by the native UITabBarController / BottomNavigationView.
 */

.bottom-tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  background: var(--gray-900);
  border-top: 1px solid var(--gray-800);
  /* Safe area for devices with home indicator (iPhone X+) */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  /* 44px minimum touch target */
  min-height: 52px;
  padding: var(--space-2) var(--space-2);
  text-decoration: none;
  color: var(--gray-500);
  transition: color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.tab-item:hover {
  color: var(--gray-300);
}

/* Active tab */
.tab-item.tab-active {
  color: #ffffff;
}

.tab-item.tab-active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 25%;
  right: 25%;
  height: 2px;
  background: #ffffff;
  border-radius: 0 0 2px 2px;
}

.tab-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.tab-label {
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
}

/* When body has tab bar, offset main content so nothing is hidden behind it */
body.has-tab-bar {
  padding-bottom: calc(52px + env(safe-area-inset-bottom, 0px));
}

/* Also push flash notifications above the tab bar */
body.has-tab-bar .flash-notifications {
  bottom: calc(52px + env(safe-area-inset-bottom, 0px) + var(--space-4));
}

/* Hide HTML tab bar when inside Hotwire Native shell */
body.native-app .bottom-tab-bar {
  display: none;
}

body.native-app {
  padding-bottom: 0;
}

/* Scale up for larger screens */
@media (min-width: 480px) {
  .tab-label {
    font-size: 0.6875rem;
  }
}

@media (min-width: 768px) {
  .tab-icon {
    width: 24px;
    height: 24px;
  }

  .tab-label {
    font-size: 0.75rem;
  }
}
