/* ============================================
   Navbar Styles — App-style navigation

   Mobile  → top bar + bottom nav + drop-up popovers
   Desktop → top bar + left sidebar (icon+label) + flyout popovers
   ============================================ */

@font-face {
  font-family: "UK-VRM";
  src: url("/fonts/uk-vrm.woff2") format("woff2");
  font-display: swap;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
  }
}

/* ============================================
   OVERLAY HIDDEN STATE
   ============================================ */
#mw-header {
  transition: opacity 300ms ease-in-out, visibility 0s linear 0s;
}

#mw-header.nav-hidden,
#header-root.nav-hidden,
#bottom-nav.nav-hidden,
#bottom-nav-tools.nav-hidden,
#sidebar-nav.nav-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
  transition: opacity 200ms ease-out, visibility 0s linear 200ms;
}

/* ============================================
   BOTTOM NAV (mobile)
   ============================================ */
#bottom-nav,
#bottom-nav-tools {
  contain: layout style;
}

/* Hide scrollbar on mobile bottom nav */
#bottom-nav > div::-webkit-scrollbar,
#bottom-nav-tools > div::-webkit-scrollbar {
  display: none;
}

.bottom-nav-tab {
  color: rgb(163 163 163);
  transition: all 200ms ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.bottom-nav-tab:hover {
  color: rgb(64 64 64);
}

.bottom-nav-tab .nav-icon-bg {
  width: 64px;
  height: 32px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 200ms ease;
}

.bottom-nav-tab i {
  font-size: 24px;
}

.bottom-nav-tab span {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
}

.bottom-nav-tab.is-active {
  color: rgb(37 99 235);
}

.bottom-nav-tab.is-active .nav-icon-bg {
  background-color: rgb(239 246 255);
}

/* ============================================
   SIDEBAR (desktop — icon over label, vertical)
   ============================================ */
.sidebar-nav {
  position: fixed;
  top: 56px; /* below header h-14 */
  left: 0;
  bottom: 0;
  width: 72px;
  z-index: 40;
  background: white;
  border-right: 1px solid #f5f5f5;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  gap: 2px;
  overflow-y: auto;
  contain: layout style;
}

/* Same compact icon-over-label look as bottom nav */
.sidebar-tab {
  width: 64px;
  gap: 4px;
  color: rgb(163 163 163);
  transition: all 200ms ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  padding: 6px 0;
}

.sidebar-tab:hover {
  color: rgb(64 64 64);
}

.sidebar-tab .nav-icon-bg {
  width: 56px;
  height: 32px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 200ms ease;
}

.sidebar-tab i {
  font-size: 22px;
}

.sidebar-tab span {
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
  line-height: 1;
}

.sidebar-tab.is-active {
  color: rgb(37 99 235);
}

.sidebar-tab.is-active .nav-icon-bg {
  background-color: rgb(239 246 255);
}

/* Sidebar tooltip — mini reg plate */
.nav-tooltip {
  position: fixed;
  display: inline-flex;
  align-items: stretch;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.06);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-50%) translateX(-4px);
  transition: opacity 180ms ease-out, transform 180ms ease-out;
  z-index: 9999;
}
.nav-tooltip.is-visible {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
.nav-tooltip-stripe {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  background: #1565C0;
  flex-shrink: 0;
}
.nav-tooltip-stripe span {
  font-size: 7px;
  font-weight: 600;
  color: white;
  line-height: 1;
}
.nav-tooltip-reg {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  background: #FFC107;
  font-family: 'UK-VRM', monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #212121;
  white-space: nowrap;
}

/* ============================================
   POPOVER — default (mobile drop-up)
   ============================================ */
.popover-panel {
  width: 260px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 180ms ease-out, transform 180ms ease-out;
}

.popover-panel.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.popover-content {
  overflow: visible;
}

/* Arrow — default: points downward */
.popover-arrow {
  position: absolute;
  bottom: -6px;
  width: 12px;
  height: 12px;
  background: white;
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  transform: translateX(-50%) rotate(45deg);
  border-radius: 0 0 3px 0;
}

/* ============================================
   POPOVER — flyout variant (desktop sidebar)
   ============================================ */
.popover-panel.is-flyout {
  transform: translateX(-8px);
}

.popover-panel.is-flyout.is-open {
  transform: translateX(0);
}

/* Arrow: points left toward the sidebar */
.popover-panel.is-flyout .popover-arrow {
  left: -6px !important;
  bottom: auto;
  transform: translateY(-50%) rotate(135deg);
  border-radius: 0 0 3px 0;
}

/* ============================================
   POPOVER BACKDROP
   ============================================ */
.popover-backdrop {
  background: transparent;
  pointer-events: none;
}

.popover-backdrop.is-open {
  pointer-events: auto;
}

/* ============================================
   POPOVER LINKS
   ============================================ */
.popover-link {
  transition: background-color 100ms ease;
}

.popover-link:hover {
  background-color: rgb(249 250 251);
}

.popover-link:active {
  background-color: rgb(243 244 246);
}

/* ============================================
   SAFE AREA (mobile)
   ============================================ */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #bottom-nav,
  #bottom-nav-tools {
    padding-bottom: env(safe-area-inset-bottom);
  }
}
