/* ================================================================
   The installed app's bottom bar (apps/pwa/templates/pwa/tabbar.html).
   Used on the app's own screens and, through apps/pwa/middleware.py, on the
   dashboard's pages inside the installed app. Self-contained.
   ================================================================ */

:root {
  --bar-h: 64px;
  --bar-ink: #0f172a;
  --bar-muted: #64748b;
  --bar-line: #e2e8f0;
  --bar-paper: #ffffff;
  --bar-indigo: #4f46e5;
  --bar-danger: #dc2626;
  --bar-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

.app-tabbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--bar-line);
  background: var(--bar-paper);
  touch-action: manipulation;
}

.app-tabbar__list {
  display: flex;
  align-items: center;
  max-width: 640px;
  height: var(--bar-h);
  margin: 0 auto;
  padding: 0 8px;
  list-style: none;
}

.app-tabbar__item {
  display: flex;
  flex: 1;
  justify-content: center;
  margin: 0;
  padding: 0;
}

.app-tab {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--bar-h);
  color: var(--bar-muted);
  font-size: 22px;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.app-tab:focus-visible {
  outline: 2px solid var(--bar-indigo);
  outline-offset: -4px;
}

.app-tab.is-active {
  color: var(--bar-ink);
}

.app-tab.is-active::after {
  position: absolute;
  bottom: 9px;
  width: 5px;
  height: 5px;
  border-radius: 9999px;
  background: var(--bar-indigo);
  content: "";
}

.app-tab__icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 160ms var(--bar-ease);
}

.app-tab:active .app-tab__icon {
  transform: scale(0.9);
}

.app-tab__badge {
  position: absolute;
  top: -8px;
  right: -12px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9999px;
  background: var(--bar-danger);
  color: var(--bar-paper);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 18px;
  text-align: center;
}

.app-tab--raised .app-tab__icon {
  width: 60px;
  height: 60px;
  margin-top: -30px;
  border: 4px solid var(--bar-paper);
  border-radius: 9999px;
  background: var(--bar-indigo);
  color: var(--bar-paper);
  box-shadow: 0 10px 18px -8px rgba(79, 70, 229, 0.6);
}

.app-tab--raised .app-tab__badge {
  top: -4px;
  right: -4px;
  border: 2px solid var(--bar-paper);
  box-sizing: content-box;
}

.app-tab--raised.is-active::after {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .app-tab__icon {
    transition: none;
  }
}
