/* =========================================================
   Turbofan Academy — Bottom Navigation
   Injected on every screen. Safe-area aware.
   + page transition (fade) between tabs
   ========================================================= */

:root {
  --ta-nav-h: 64px;
  --ta-nav-h-safe: calc(64px + env(safe-area-inset-bottom, 0px));
  --ta-page-fade: 0.22s;
}

/* Reserve space so content is not hidden under the bar */
body.ta-has-bottom-nav {
  padding-bottom: var(--ta-nav-h-safe) !important;
}

/* The bar itself */
#ta-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9000;
  height: var(--ta-nav-h-safe);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(8, 12, 18, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: stretch;
  justify-content: center;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#ta-bottom-nav .ta-nav-inner {
  width: 100%;
  max-width: 560px;
  height: var(--ta-nav-h);
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  padding: 0 4px;
}

#ta-bottom-nav a.ta-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: #6f7d90;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  min-width: 0;
  transition: color 0.18s ease, transform 0.12s ease;
  position: relative;
  padding: 6px 2px 4px;
}

#ta-bottom-nav a.ta-nav-item .ta-nav-icon {
  font-size: 1.25rem;
  line-height: 1;
  transition: transform 0.18s ease;
}

#ta-bottom-nav a.ta-nav-item .ta-nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

#ta-bottom-nav a.ta-nav-item:active {
  transform: scale(0.94);
}

#ta-bottom-nav a.ta-nav-item.active {
  color: #55d6ff;
}

#ta-bottom-nav a.ta-nav-item.active .ta-nav-icon {
  transform: translateY(-1px);
}

/* Active indicator pill */
#ta-bottom-nav a.ta-nav-item.active::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(90deg, #55d6ff, #8b7cff);
  box-shadow: 0 0 12px rgba(85, 214, 255, 0.45);
}

/* Press feedback during transition */
#ta-bottom-nav a.ta-nav-item.ta-nav-press .ta-nav-icon {
  transform: scale(0.88) translateY(-1px);
}

/* Hide on very tall landscape if needed — keep simple for mobile portrait */
@media (min-width: 900px) and (min-height: 700px) {
  /* Still show on desktop during testing */
}

/* Light theme bottom nav */
[data-theme="light"] #ta-bottom-nav {
  background: rgba(255, 255, 255, 0.92);
  border-top-color: rgba(15, 23, 42, 0.1);
  box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] #ta-bottom-nav a.ta-nav-item {
  color: #64748b;
}

[data-theme="light"] #ta-bottom-nav a.ta-nav-item.active {
  color: #0284c7;
}

[data-theme="light"] #ta-bottom-nav a.ta-nav-item.active::before {
  background: linear-gradient(90deg, #0284c7, #6366f1);
  box-shadow: 0 0 12px rgba(2, 132, 199, 0.35);
}

/* =========================================================
   Page transitions (fade between tabs)
   Klasy ustawiane przez bottom-nav.js:
   - html.ta-page-enter  → start fade-in
   - html.ta-page-ready  → widoczna strona
   - html.ta-page-exit   → fade-out przed nawigacją
   ========================================================= */

html.ta-page-enter body {
  opacity: 0;
}

html.ta-page-ready body {
  opacity: 1;
  transition: opacity var(--ta-page-fade) ease;
}

html.ta-page-exit body {
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

/* Nav zostaje widoczny podczas fade (opcjonalnie — wygląda naturalniej) */
html.ta-page-exit #ta-bottom-nav {
  opacity: 1;
}

/* View Transitions API (Chrome / Edge / Android) */
@supports (view-transition-name: none) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 1.28s;
    animation-timing-function: ease;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  #ta-bottom-nav a.ta-nav-item,
  #ta-bottom-nav a.ta-nav-item .ta-nav-icon {
    transition: none;
  }

  html.ta-page-ready body,
  html.ta-page-exit body {
    transition: none !important;
  }

  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none !important;
  }
}

/* Zabezpieczenie pozycji — nie daj lokalnym style.css przesunąć bara */
#ta-bottom-nav {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  top: auto !important;
  margin: 0 !important;
  transform: none !important;
  filter: none !important;
}