/* ---------- Empty / placeholder states ---------- */

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 16px;
}

.empty-state svg { color: var(--border); margin-bottom: 10px; }
.empty-state p { margin: 4px 0; font-size: 13px; }

.placeholder-screen {
  text-align: center;
  padding: 64px 16px;
  color: var(--text-muted);
}

/* ---------- Bottom nav ---------- */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 10;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
}

.nav-item.active { color: var(--brand-text); }

/* ---------- FAB ---------- */

.fab {
  position: fixed;
  right: 16px;
  bottom: 68px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--on-brand);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
  cursor: pointer;
  z-index: 9;
}

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 20;
  overflow-y: auto;
}

/* Pop-up chat widget: unlike .modal-backdrop, this never dims or blocks the rest of the page — the whole
   point (per the user request that led to it) is to message a vendor/seller without losing your place. */
.chat-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 16px;
}
.chat-backdrop[hidden] { display: none; }
.chat-panel {
  pointer-events: auto;
  width: 360px;
  max-width: calc(100vw - 32px);
  max-height: min(70vh, 560px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(0,0,0,0.3);
  overflow: hidden;
}
.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-panel-title-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-panel-title-wrap h2 { margin: 0; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-panel-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
}
.chat-panel-close:hover { background: var(--surface-2); }
#chatPanelThread { flex: 1; overflow-y: auto; padding: 12px 14px; margin-top: 0; }
#chatPanelForm { padding: 10px 14px 14px; border-top: 1px solid var(--border); margin-top: 0; flex-shrink: 0; }

#notifPanelList { flex: 1; overflow-y: auto; padding: 8px 14px 14px; margin-top: 0; gap: 2px; }
/* The panel's rows are .nt-row (css/notifications-page.css), shared with the #/notifications page. */

.notif-panel-footer {
  display: block;
  text-align: center;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  color: var(--brand-text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  flex-shrink: 0;
}
.notif-panel-footer:hover { background: var(--surface-2); }

.product-context-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 14px;
  padding: 6px 10px;
  background: var(--brand-tint);
  color: var(--brand-text);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.product-context-chip button { background: none; border: none; color: inherit; cursor: pointer; font-size: 12px; padding: 0; }
.message-product-context { font-size: 11px; font-weight: 600; color: var(--brand-text); margin-bottom: 4px; }

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px 16px 24px;
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  margin: auto;
}

.modal-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin: 6px 0 16px;
}

.modal-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.modal-option {
  text-align: left;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}

.modal-close {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}


/* ---------- Location picker (reuses the modal shell) ---------- */

.location-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}

.location-option:hover { border-color: var(--brand-text); }
#locationGps { margin-bottom: 10px; }
#locationClear { margin: 4px 0 10px; color: var(--text-muted); }
.location-sub { color: var(--text-muted); font-size: 12px; }
.location-see-all { justify-content: center; border-style: dashed; color: var(--brand-text); font-weight: 600; }
.location-country-flag { font-size: 16px; }
.location-group-label {
  padding: 14px 4px 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}
.location-group-label:first-child { padding-top: 4px; }

.location-back {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--brand-text);
  font-family: inherit;
  font-size: 13px;
  padding: 0 0 12px;
  cursor: pointer;
}
.location-back[hidden] { display: none; }

.location-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

#locationHint { margin: 8px 0 8px; min-height: 1em; }


/* Location tiers on the Discover lists: a heading where each group starts (your street, your area, the rest) */
.tier-head {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin: 14px 0 2px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.tier-head:first-child { margin-top: 0; }
.tier-head.tier-3 { border-bottom-style: dashed; color: var(--text-muted); margin-top: 22px; }
.tier-head.tier-3:first-child { margin-top: 0; }
.tier-count { font-weight: 400; font-size: 12px; color: var(--text-muted); }
.location-chip #locationChipLabel { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }


/* Distance bands inside "Other parts of Abuja", and the Show more button */
.band-head {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin: 10px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.tier-head + .band-head { margin-top: 2px; }
.show-more {
  grid-column: 1 / -1;
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--brand-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.show-more:hover { border-color: var(--brand-text); }


/* ---------- Sticky category bar, category sheet, back to top ---------- */

/* zero-height wrapper: the bar overlays the page instead of pushing content down when it appears */
.cat-sticky-wrap {
  position: sticky;
  top: var(--topbar-h, 96px);
  height: 0;
  z-index: 8;
}
.cat-sticky {
  position: absolute;
  left: -16px; right: -16px; top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
  visibility: hidden;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
}
.cat-sticky.visible { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
.sticky-chips { flex: 1; min-width: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.sticky-chips::-webkit-scrollbar { display: none; }
.sticky-all { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.sticky-chip, .sticky-open {
  flex: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.sticky-chip { border: none; background: var(--brand-tint); color: var(--brand-text); }
.sticky-open { border: 1px solid var(--brand-text); background: transparent; color: var(--brand-text); }
.result-row { scroll-margin-top: calc(var(--topbar-h, 96px) + 56px); }

.sheet-backdrop { align-items: flex-end; padding: 0; }
.sheet { max-width: 520px; max-height: 80vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; margin: 0 auto; display: flex; flex-direction: column; overflow: hidden; }
.sheet-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; overflow-y: auto; min-height: 0; flex: 1; } /* only the list scrolls; the buttons stay in view */
.cat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}
.cat-row .category-icon-box { width: 32px; height: 32px; flex: none; }
.cat-row.on { border-color: var(--brand-text); background: var(--brand-tint); }
.cat-row.is-empty { opacity: 0.55; }
.cat-row-label { flex: 1; }
.cat-row-count { font-size: 12px; color: var(--text-muted); }
.cat-row-check { width: 16px; color: var(--brand-text); font-weight: 700; text-align: center; }
.sheet-actions { display: flex; gap: 8px; }
.sheet-actions .modal-close { width: auto; flex: none; padding: 10px 16px; }
.sheet-done {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--brand);
  color: var(--on-brand);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.to-top {
  position: fixed;
  right: 16px;
  bottom: 128px; /* above the + button, which sits above the bottom nav */
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  cursor: pointer;
  z-index: 9;
}
.to-top[hidden] { display: none; }
@media (min-width: 860px) {
  .to-top { bottom: 84px; }
  .sheet-backdrop { align-items: center; padding: 16px; }
  .sheet { border-radius: var(--radius-lg); }
  .cat-sticky { left: 0; right: 0; }
}



/* ---------- Action pop-up (showActionToast in js/core.js) ----------
   One at a time, above the bottom tab bar on a phone, bottom-left of the content from 860px. */
.action-toast {
  position: fixed; left: 16px; right: 16px; bottom: 72px; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 52px; padding: 0 6px 0 16px; box-sizing: border-box;
  background: var(--text); color: var(--bg); border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); font-size: 14px;
}
.action-toast[hidden] { display: none; }
.action-toast-msg { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.action-toast-btn {
  flex: none; min-height: 44px; padding: 0 14px; border: 0; border-radius: var(--radius-sm); background: transparent;
  color: var(--brand-tint); font: inherit; font-weight: 700; cursor: pointer;
}
.action-toast-btn:focus-visible { outline: 2px solid var(--bg); outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) {
  .action-toast:not([hidden]) { animation: action-toast-in 160ms ease-out; }
  @keyframes action-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}
@media (min-width: 860px) {
  .action-toast { left: auto; right: 24px; bottom: 24px; width: min(420px, calc(100vw - 48px)); }
}
