/* ================================================================
   Bottom Navigation Bar — Material Design 3
   Показується тільки на мобільних (≤768px)
   ================================================================ */

/* На мобільному: ховаємо topbar-nav — він переїхав у bottom nav */
@media (max-width: 768px) {
  .topbar-nav,
  .topbar-sep,
  .topbar-hamburger,
  .topbar-collapse {
    display: none !important;
  }

  /* Відступ знизу щоб контент не ховався під bottom nav.
     Використовуємо ту саму специфічність що й mobile-flexbox-simple.css
     (html.mobile-flexbox-layout body), щоб гарантовано перекрити padding:0 */
  body,
  html.mobile-flexbox-layout body,
  html.mobile-flexbox-layout body.page-home {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Прибираємо зайві відступи якщо є */
  .topbar {
    gap: var(--space-2, 8px);
  }
}

/* ---- Бар ---- */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--color-surface, #fff);
  border-top: 1px solid var(--color-border, #e8ede8);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -1px 0 0 var(--color-border, #e8ede8), 0 -4px 16px rgba(0, 0, 0, 0.05);
}

@media (max-width: 768px) {
  .bottom-nav {
    display: flex;
  }
}

/* ---- Елемент (кнопка/лінк) ---- */
.bnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 10px 4px 6px;
  text-decoration: none;
  color: var(--color-text-muted, #6b7280);
  border: none;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  min-width: 0;
  transition: color 0.15s;
}

.bnav-item:hover,
.bnav-item:focus {
  outline: none;
  color: var(--color-text, #1a2e1a);
}

/* ---- Індикатор активності (pill) ---- */
.bnav-indicator {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 32px;
  border-radius: 16px;
  transition: background 0.2s ease;
  margin-bottom: 4px;
}

.bnav-item.active .bnav-indicator {
  background: var(--color-primary-100, #B7E4C7);
}

/* Ripple при натисканні */
.bnav-item:active .bnav-indicator {
  background: var(--color-primary-100, #B7E4C7);
  opacity: 0.7;
}

/* ---- Іконка ---- */
.bnav-icon {
  font-size: 24px;
  line-height: 1;
  color: inherit;
  transition: color 0.15s;
}

.bnav-item.active .bnav-icon {
  color: var(--color-primary, #2D6A4F);
}

/* ---- Підпис ---- */
.bnav-label {
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-sans, 'Inter', sans-serif);
  line-height: 1;
  color: inherit;
  white-space: nowrap;
  transition: color 0.15s;
}

.bnav-item.active .bnav-label {
  color: var(--color-primary, #2D6A4F);
  font-weight: 600;
}

/* ================================================================
   More Sheet — Bottom Drawer
   ================================================================ */

/* Підложка */
.bnav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  z-index: 1100;
  transition: background 0.25s ease;
}

.bnav-backdrop.open {
  display: block;
  background: rgba(0, 0, 0, 0.4);
}

/* Шторка */
.bnav-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1200;
  background: var(--color-surface, #fff);
  border-radius: 24px 24px 0 0;
  padding: 0 0 calc(var(--space-4, 16px) + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.12);
}

.bnav-sheet.open {
  transform: translateY(0);
}

/* Заголовок шторки */
.bnav-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
}

.bnav-sheet-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text, #1a1a1a);
  font-family: var(--font-sans, 'Inter', sans-serif);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bnav-sheet-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  color: var(--color-text-secondary, #666);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}

.bnav-sheet-close:active {
  background: var(--color-surface-container, #f0f0f0);
}

.bnav-sheet-close .material-icons-round {
  font-size: 22px;
}

/* Роздільник */
.bnav-sheet-divider {
  height: 1px;
  background: var(--color-border, #e8ede8);
  margin: var(--space-1, 4px) 0;
}

/* Пункт меню */
.bnav-sheet-item {
  display: flex;
  align-items: center;
  gap: var(--space-4, 16px);
  padding: var(--space-4, 16px) var(--space-6, 24px);
  color: var(--color-text, #1a2e1a);
  text-decoration: none;
  font-size: var(--text-base, 15px);
  font-weight: 500;
  font-family: var(--font-sans, 'Inter', sans-serif);
  background: none;
  border: none;
  width: 100%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
  text-align: left;
}

.bnav-sheet-item:hover,
.bnav-sheet-item:active {
  background: var(--color-surface-2, #f0faf3);
  outline: none;
}

.bnav-sheet-item .material-icons-round {
  font-size: 22px;
  color: var(--color-text-muted, #6b7280);
  flex-shrink: 0;
}

.bnav-sheet-item.bnav-danger {
  color: var(--color-error, #dc2626);
}

.bnav-sheet-item.bnav-danger .material-icons-round {
  color: var(--color-error, #dc2626);
}
