/* ============================================================
   TribeCity Modern UI — Mobile Bottom Navigation Bar
   Dedicated stylesheet for the sticky bottom tab bar + "More"
   bottom sheet. Markup: views/templates/header/bottomNavMobile.tpl
   Loaded by: views/templates/layouts/head.tpl

   Additive — does not touch the hamburger drawer (tcmobilemenu.css).
   Kept separate so each mobile pattern owns its own tokens.
   ============================================================ */

/* Tokens — tweak the whole bar/sheet from one place */
:root {
  --tc-bn-h:            58px;
  --tc-bn-bg:           #ffffff;
  --tc-bn-fg:           #6b7280;
  --tc-bn-fg-active:    #1f2430;
  --tc-bn-border:       rgba(0, 0, 0, 0.10);
  --tc-bn-surface:      rgba(0, 0, 0, 0.04);
  --tc-bn-surface-hov:  rgba(0, 0, 0, 0.07);
  --tc-bn-overlay:      rgba(15, 18, 26, 0.45);
  --tc-bn-accent:       var(--tc-brand, #e8a66d);
  --tc-bn-active-bg:    rgba(232, 166, 109, 0.12);
  --tc-bn-radius:       16px;
  --tc-bn-ease:         cubic-bezier(0.22, 1, 0.36, 1);
  --tc-bn-speed:        0.28s;
  --tc-bn-z:            900;          /* below the fixed top header (1000) */
}

/* ---------- Sticky bottom bar ---------- */
.tc-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: stretch;
  height: calc(var(--tc-bn-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--tc-bn-bg);
  border-top: 1px solid var(--tc-bn-border);
  z-index: var(--tc-bn-z);
}

.tc-bn-tab {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 2px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--tc-bn-fg);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease, transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.tc-bn-tab:active { transform: scale(0.94); }
.tc-bn-tab:focus-visible {
  color: var(--tc-bn-fg-active);
  background: var(--tc-bn-surface);
}

.tc-bn-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 24px;
}
.tc-bn-icon img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  opacity: 0.55;
  transition: opacity 0.15s ease;
}
.tc-bn-icon svg {
  width: 22px;
  height: 22px;
  opacity: 0.8;
}

.tc-bn-label {
  max-width: 100%;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Active tab */
.tc-bn-tab.active { color: var(--tc-bn-accent); }
.tc-bn-tab.active .tc-bn-icon img { opacity: 1; }
.tc-bn-tab.active .tc-bn-icon svg { opacity: 1; }

/* Unread badge bubble */
.tc-bn-badge {
  position: absolute;
  top: -5px;
  right: -9px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: #e8632f;
  border-radius: 999px;
}

/* ---------- "More" bottom sheet ---------- */
.tc-bn-sheet-overlay {
  position: fixed;
  inset: 0;
  height: 100vh;
  background: var(--tc-bn-overlay);
  z-index: calc(var(--tc-bn-z) + 1);
  display: none;
  opacity: 0;
  transition: opacity var(--tc-bn-speed) ease-in-out;
}

.tc-bn-sheet-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--tc-bn-bg);
  color: var(--tc-bn-fg-active);
  border-top: 1px solid var(--tc-bn-border);
  border-radius: var(--tc-bn-radius) var(--tc-bn-radius) 0 0;
  transform: translateY(100%);
  transition: transform var(--tc-bn-speed) var(--tc-bn-ease);
  z-index: calc(var(--tc-bn-z) + 2);
}

.tc-bn-sheet.active .tc-bn-sheet-panel { transform: translateY(0); }
.tc-bn-sheet.active .tc-bn-sheet-overlay { display: block; opacity: 1; }

.tc-bn-sheet-handle {
  align-self: center;
  width: 36px;
  height: 4px;
  margin: 2px 0 10px;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 999px;
  flex-shrink: 0;
}

.tc-bn-sheet-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--tc-bn-fg);
  cursor: pointer;
  transition: color 0.15s ease, transform 0.15s ease;
  z-index: 2;
}
.tc-bn-sheet-close:active { transform: scale(0.94); }
.tc-bn-sheet-close svg { width: 18px; height: 18px; display: block; }

.tc-bn-sheet-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.tc-bn-sheet-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tc-bn-sheet-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  width: 100%;
  background: var(--tc-bn-surface);
  border-radius: 8px;
  color: var(--tc-bn-fg-active);
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.tc-bn-sheet-link:focus-visible {
  background: var(--tc-bn-surface-hov);
  color: var(--tc-bn-fg-active);
  text-decoration: none;
}
.tc-bn-sheet-link.active { background: var(--tc-bn-active-bg); }
.tc-bn-sheet-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--tc-bn-accent);
  border-radius: 0 3px 3px 0;
}
.tc-bn-sheet-link-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  opacity: 0.7;
  flex-shrink: 0;
}
.tc-bn-sheet-link-text {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tc-bn-sheet-link .tc-bn-badge {
  position: static;
  margin-left: auto;
  box-shadow: none;
  min-width: 20px;
  height: 20px;
  font-size: 10px;
}

.tc-bn-sheet-help {
  text-align: center;
  font-size: 12px;
  opacity: 0.8;
}
.tc-bn-sheet-help a,
.tc-bn-sheet-help a:focus-visible {
  color: var(--tc-bn-fg);
  text-decoration: none;
  font-size: 12px;
}

/* ---------- Content offset (mobile only) ----------
   The bar is fixed; reserve space so it never covers the
   footer / page bottom. Scoped via :has() so it only applies
   on pages that actually render the bar (authenticated pages)
   — public/login pages have no .tc-bottom-nav and get no dead
   space. Desktop & tablet are untouched (media query). */
@media screen and (max-width: 767px) {
  body:has(.tc-bottom-nav) {
    padding-bottom: calc(var(--tc-bn-h) + env(safe-area-inset-bottom, 0px));
  }
}
