/* =========================================================
   PULSE — navigation.css
   Topbar, bottom nav (5 tabs), FAB, sheets, menus
   ========================================================= */

.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--top-h); padding: 0 var(--s-4);
  display: flex; align-items: center; justify-content: space-between;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border); z-index: 50;
}
.topbar-left {
  display: flex; align-items: center; gap: var(--s-2);
  min-width: 0; flex: 1;
}
.topbar-left h2 {
  margin: 0; font-size: var(--f-lg); font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-brand {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex-shrink: 0;
}
.topbar-brand img {
  width: 32px; height: 32px; object-fit: contain;
}
.topbar-right { display: flex; gap: var(--s-2); flex-shrink: 0; }

/* ---------------- Bottom nav — 5 tabs ---------------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 50;
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  color: var(--text-2);
  font-size: 10px;
  font-weight: 600;
  min-width: 0;
  padding: 0 2px;
  transition: color var(--dur) var(--ease);
}
.nav-item.active { color: var(--primary); }
.nav-item svg { transition: transform var(--dur) var(--ease); flex-shrink: 0; }
.nav-item.active svg { transform: scale(1.1); }
.nav-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
}
@media (max-width: 360px) {
  .nav-item { font-size: 9px; gap: 2px; }
  .nav-item svg { width: 20px; height: 20px; }
}

/* ---------------- FAB ---------------- */
.fab {
  position: fixed;
  right: var(--s-5);
  bottom: calc(var(--nav-h) + var(--s-4));
  width: 60px; height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 12px 30px color-mix(in srgb, var(--primary) 40%, transparent), var(--clay-raised);
  z-index: 40;
  transition: transform var(--dur) var(--ease);
}
.fab:active { transform: scale(0.92); }

/* ---------------- Sheets ---------------- */
.sheet, .menu {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: end center;
}
.menu { place-items: start end; }
.sheet-backdrop, .menu-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px); animation: fadeIn 200ms var(--ease);
}
.sheet-card {
  position: relative; width: 100%; max-width: var(--maxw);
  padding: var(--s-5);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  display: flex; flex-direction: column; gap: var(--s-3);
  animation: slideUp 260ms var(--ease);
  overflow-y: auto; max-height: 90vh;
}
.sheet-card h3 { margin: 0; }
.sheet-actions { display: flex; gap: var(--s-2); justify-content: flex-end; }

/* ---------------- Menus ---------------- */
.menu-card {
  position: relative;
  margin: calc(var(--top-h) + var(--s-2)) var(--s-4) 0 0;
  padding: var(--s-2);
  display: flex; flex-direction: column;
  min-width: 180px;
  animation: scaleIn 180ms var(--ease);
  transform-origin: top right;
}
@keyframes scaleIn {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.menu-card button {
  text-align: left;
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: var(--f-sm);
  font-weight: 500;
  transition: background var(--dur) var(--ease);
}
.menu-card button:hover { background: var(--bg-2); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}