/* /themes/bedrebyttede/assets/css/pages/market.css */

/* Container + header */
.market-wrap .wrap {
  width: min(var(--container-xl), 96vw);
  padding-inline: clamp(12px, 2vw, var(--space-4));
  margin-inline: auto;
}

.market-hero {
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: end;
  border-radius: var(--radius-2);
}

.market-hero h1 {
  color: var(--text);
}

.market-hero .muted {
  color: var(--text-muted);
}

.market-hero .hero-header {
  display: flex;
  justify-content: center;
}

.market-hero .lead {
  text-align: center;
  margin-bottom: var(--space-16);
}

/* === Main results grid (cards) ========================================== */
.market-wrap .bb-grid>* {
  min-width: 0;
}

.bb-toggle {
  background: var(--btn-bg);
  padding: var(--space-3);
  display: flex;
  justify-content: space-around;
  color: var(--input-fg);
  border: var(--border-1) solid var(--input-line);
  border-radius: var(--input-radius);
  outline: none;
  max-width: max-content;
}

.bb-toggle label {
  padding: var(--space-1) var(--space-2);
}



/* Soft loading on grid */
.market-wrap .bb-grid.is-loading {
  opacity: .6;
  filter: saturate(.7);
  transition: opacity var(--dur-2) var(--ease-out), filter var(--dur-2) var(--ease-out);
  pointer-events: none;
}

/* === Pager =============================================================== */
.pager {
  color: var(--text-muted);
}

.pager a {
  color: var(--text);
  transition: color var(--dur-2) var(--ease-in-out), border-color var(--dur-2) var(--ease-in-out);
}

.pager a:hover,
.pager a:focus-visible {
  color: var(--brand);
}

/* === Suggest dropdown refinements (base visuals live in tokens.css) ===== */
.bb-search__suggest {
  max-height: 50vh;
  overflow: auto;
  position: absolute;
  z-index: 9999;
  min-width: 46vw;
}

.bb-search__suggest li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
}

.bb-search__suggest .bb-sug-label {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
}

.bb-search__suggest .bb-sug-pill {
  flex: 0 0 auto;
  font-size: var(--fs-sm);
  line-height: 1;
  padding: 2px 8px;
  color: var(--text-muted);
}

.bb-search__suggest li[aria-selected="true"] {
  background: var(--surface-2);
}

/* Ensure highlight color uses tokens */
.bb-search__suggest .bb-sug-hl {
  color: var(--text);
}

/* e.g. in tokens.css or a component css */
.bb-search__input.is-unsafe {
  outline: 2px solid var(--danger, #d33);
}

.bb-search__btn[disabled] {
  opacity: .5;
  cursor: not-allowed;
}

/* collapses the region when empty/hidden */
.bb-safety[hidden] {
  display: none !important;
}

.bb-safety:empty {
  display: none !important;
}

/* optional styling when shown */
.bb-safety {
  margin-top: .5rem;
  font-size: .95rem;
  line-height: 1.35;
  padding: .5rem .75rem;
  border-radius: .5rem;
  border: 1px solid var(--bb-danger-600, #8b2d2d);
  background: var(--bb-danger-950, #2a0f0f);
  color: var(--bb-danger-100, #ffdede);
}

/* === Zero-results fallback + Related categories ========================= */
/* Renders OUTSIDE the main grid (#bb-fallback is injected by JS) */
#bb-fallback {
  margin-top: var(--space-4);
}

#bb-fallback .muted {
  text-align: center;
  color: var(--text-2);
  font-size: var(--fs-sm);
  background: var(--surface);
  padding: var(--space-2) var(--space-6);
  border-radius: var(--radius-1);
  margin: var(--space-6) auto var(--space-12) auto;
}

/* Wrapper for “Relaterede kategorier” columns */
.bb-related-wrap {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: 1fr;
}

@media (--md) {
  .bb-related-wrap {
    grid-template-columns: 1fr 1fr;
  }
}

@media (--lg) {
  .bb-related-wrap {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

/* Each category block + its internal mini grid of cards */
.bb-related-block {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
}

.bb-related-block>.bb-subhead {
  margin-top: .25rem;
}

/* Mini grid reuses card styles but tighter gap */
.bb-grid--related {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (--lg) {
  .bb-grid--related {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Loading state: use generic shimmer from tokens */
.bb-related-wrap.is-loading .bb-related-block {
  min-block-size: 160px;
  border-radius: var(--card-radius);
  border: var(--border-1) solid var(--line);
  background: var(--surface);
  position: relative;
}

.bb-related-wrap.is-loading .bb-related-block::after {
  content: "";
  display: block;
  block-size: 140px;
  border-radius: var(--card-radius);
  background: linear-gradient(90deg,
      color-mix(in oklab, var(--surface-2), transparent 40%) 0%,
      color-mix(in oklab, var(--surface), transparent 10%) 40%,
      color-mix(in oklab, var(--surface-2), transparent 40%) 80%);
  background-size: 200% 100%;
  animation: bb-shimmer 1.1s linear infinite;
}

/* === Market Search Pill (Phase 2 — Google-style hero search) ============= */

.bb-market-toolbar {
  margin: 0 auto var(--space-6);
  max-width: 640px;
  border-radius: 100px;
  background: var(--surface);
  padding: var(--space-1) var(--space-2);
  border: 1px solid color-mix(in oklab, var(--line), transparent 40%);
  box-shadow:
    0 2px 8px rgba(0,0,0,.06),
    0 0 0 1px rgba(0,0,0,.03);
  transition: box-shadow var(--dur-2) var(--ease-out);
}

.bb-market-toolbar:focus-within {
  box-shadow:
    0 4px 16px rgba(0,0,0,.10),
    0 0 0 2px color-mix(in oklab, var(--brand), transparent 75%);
}

.bb-market-toolbar__row {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--space-1);
  align-items: center;
}

.bb-market-toolbar__row :last-child {
  margin-left: auto;
}

.bb-market-toolbar__search {
  flex: 1 1 0;
  min-width: 0;
  max-width: none;
}

/* Town button: compact, left-aligned inside pill */
.bb-market-town-btn {
  white-space: nowrap;
  font-size: var(--fs-sm);
  --_bg: transparent;
  padding: var(--space-2) var(--space-3);
  border-radius: 100px;
  border: none;
  color: var(--text-2);
  transition: color var(--dur-1), background var(--dur-1);
  flex-shrink: 0;
}

.bb-market-town-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.bb-market-town-label {
  max-width: 8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Search input inside pill: no border, transparent bg */
.bb-market-toolbar .bb-search__input {
  border: none;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: var(--space-2) var(--space-3);
  font-size: var(--fs-md);
}

.bb-market-toolbar .bb-search__input:focus {
  border-color: transparent;
  box-shadow: none;
}

/* Search button inside pill: round, brand-colored */
.bb-market-toolbar .bb-search__btn {
  border-radius: 100px;
  min-height: 40px;
  min-width: 40px;
  padding: 0 var(--space-4);
  background: var(--brand, #4361ee);
  color: #fff;
  font-weight: 600;
  font-size: var(--fs-sm);
  border: none;
  flex-shrink: 0;
}

.bb-market-toolbar .bb-search__btn:hover {
  transform: none;
  filter: brightness(1.1);
  box-shadow: 0 2px 8px color-mix(in oklab, var(--brand), transparent 60%);
}

/* Filter button: ghost, compact inside pill */
.bb-market-filter-btn {
  font-size: var(--fs-sm);
  align-items: center;
  --_bg: transparent;
  padding: var(--space-2) var(--space-3);
  border-radius: 100px;
  border: none;
  color: var(--text-2);
  flex-shrink: 0;
}

.bb-market-filter-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* Radius control */
.bb-market-radius {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.bb-market-radius input[type="range"] {
  flex: 1 1 auto;
  min-width: 10vh;
}

.bb-market-radius__value {
  font-size: var(--fs-xs);
  color: var(--text-2);
  text-align: right;
}

/* Mobile: pill stretches full-width, wraps gracefully */
@media (max-width: 40rem) {
  .bb-market-toolbar {
    border-radius: var(--radius-3, 16px);
    padding: var(--space-2);
    max-width: none;
  }

  .bb-market-toolbar__row {
    flex-wrap: wrap;
    gap: var(--space-1);
  }

  .bb-market-toolbar__search {
    flex-basis: 100%;
    order: 1;
  }

  .bb-market-town-btn {
    order: 0;
  }

  .bb-market-filter-btn {
    order: 0;
  }

  .bb-market-toolbar .bb-search__btn {
    border-radius: var(--radius-2);
  }
}

/* === New Mobile-First Filter Surface (2025-2026) === */

.bb-filter-surface {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 100%;
  overflow: hidden;
  background: var(--bg);
  border-radius: var(--radius-2);
}

.bb-filter-surface__head {
  /* Now inside body, remove top padding overlap if needed, or keep for spacing */
  padding: 0 0 var(--space-6) var(--space-6);
  background: var(--bg);
}

.bb-filter-surface__title {
  font-size: var(--fs-3xl);
  margin-bottom: var(--space-1);
  color: var(--text);
  font-weight: 800;
}

.bb-filter-surface__lede {
  color: var(--text-3);
  font-size: var(--fs-sm);
  margin: 0;
}

.bb-filter-surface__form {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
  position: relative;
  /* Context for absolute footer */
}

.bb-filter-surface__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) var(--space-2) var(--space-24);
  /* Extra padding for sticky footer */
  display: grid;
  gap: var(--space-5);
  align-content: start;
}

/* Card-based sections */
.bb-filter-section {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  border-radius: var(--radius-3);
  padding: var(--space-5);
  margin: 0;
  min-width: 0;
}

.bb-filter-section__title {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: var(--space-4);
  padding: 0;
  border: none;
}

.bb-filter-section__content {
  display: grid;
  gap: var(--space-4);
}

/* Toggle Boxes (Primary touch target) */
.bb-toggle-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
}

.bb-toggle-box {
  position: relative;
  cursor: pointer;
  user-select: none;
}

.bb-toggle-box input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.bb-toggle-box span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  /* Premium touch target */
  padding: var(--space-2) var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-2);
  transition: all var(--dur-2) var(--ease-out);
  text-align: center;
}

.bb-toggle-box--sm span {
  min-height: 44px;
  font-size: var(--fs-xs);
  padding: var(--space-1) var(--space-3);
}

.bb-toggle-box input:checked+span {
  border-color: var(--text);
  color: var(--text);
}

/* Sticky Action Footer */
.bb-filter-surface__foot {
  position: absolute;
  bottom: var(--space-2);
  right: var(--space-0);
  padding: var(--space-3) var(--space-4);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  z-index: 10;
}

.bb-filter-surface__actions {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-3);
  align-items: center;
}

/* Fields & Pickers */
.bb-filter-grid {
  display: grid;
  gap: var(--space-4);
}

.bb-field {
  display: grid;
  gap: var(--space-2);
}

.bb-field__label {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-muted);
  margin-left: 2px;
}

.bb-field__control-row {
  display: flex;
  gap: var(--space-2);
}

.bb-field__picker {
  flex: 1;
  justify-content: space-between !important;
  text-align: left;
  min-height: 52px !important;
  padding: 0 var(--space-4) !important;
  font-weight: 700;
  background: var(--surface-2) !important;
  border-radius: var(--radius-2) !important;
}

.bb-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

/* Icon Buttons in fields */
.btn--icon {
  width: 52px;
  height: 52px;
  min-width: 52px;
  padding: 0;
  border-radius: var(--radius-2);
  color: var(--brand);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

/* === Ring/Market Dividers → Floating Badges (Phase 2) =================== */
.bb-ring-divider,
.bb-market-divider {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: var(--space-4) 0 var(--space-2) 0;
      color: var(--text-3);
    font-size: var(--fs-sm);
}

.bb-ring-divider__label {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-4);
  background: var(--surface-2);
  border-radius: var(--radius-pill, 100px);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Remove the horizontal lines — clean floating badge only */
.bb-ring-divider::before,
.bb-ring-divider::after,
.bb-market-divider::before,
.bb-market-divider::after {
  content: none;
}

/* Filter counter badge */
.bb-filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 .35rem;
  margin-left: .4rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  line-height: 1;
  background: var(--input-line);
  color: var(--text);
  transform: translateY(-.05rem);
}

#bb-market-filter-btn.has-filters .fa-filter {
  opacity: 1;
}

/* Hide standard number input spinners for cleaner UI */
/* Chrome, Safari, Edge, Opera */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Firefox */
input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* === New Cone Search Inputs & Groups === */
.bb-input-group {
  display: grid;
  gap: var(--space-1);
}

.bb-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-2);
}

.bb-market-to-town-btn {
  white-space: nowrap;
}

.bb-market-to-town-label {
  max-width: 10rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === Geo Popover (Town Picker) === */
.bb-geo-popover {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  border-radius: var(--radius-2);
  width: 300px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.bb-geo-input {
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none !important;
  background: var(--surface);
}

.bb-geo-list {
  max-height: 240px;
  overflow-y: auto;
}

.bb-geo-item {
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  font-size: var(--fs-sm);
  color: var(--text);
  border-bottom: 1px solid var(--line);
}

.bb-geo-item:last-child {
  border-bottom: none;
}



.bb-geo-item:hover,
.bb-geo-item.is-active {
  background: var(--surface-2);
}

@media (--md) {
  .bb-filter-surface__body {
    padding: var(--space-8) var(--space-10) var(--space-32);
    display: flex;
    flex-direction: column;
    max-width: 680px;
    margin: 0 auto;
    width: 100%;
  }

  .bb-filter-section {
    width: 100%;
  }

  .bb-toggle-group {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ─── Trending Chips (Dynamic Discovery) ─── */
.bb-trending {
  display: flex;
  align-items: center;
  gap: var(--space-2, 8px);
  padding: var(--space-1, 4px) 0 var(--space-3, 12px);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  max-width: 640px;
  margin-inline: auto;
}

.bb-trending::-webkit-scrollbar {
  display: none;
}

.bb-trending__label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted, #888);
  white-space: nowrap;
  letter-spacing: 0.03em;
  flex-shrink: 0;
  text-transform: uppercase;
}

.bb-trending__chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  border-radius: var(--radius-pill, 100px);
  border: 1px solid color-mix(in oklab, var(--line), transparent 30%);
  background: var(--surface);
  color: var(--text, #1a1a1a);
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.bb-trending__chip:hover {
  background: var(--brand, #4361ee);
  color: #fff;
  border-color: var(--brand, #4361ee);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px color-mix(in oklab, var(--brand), transparent 65%);
}

.bb-trending__chip:active {
  transform: translateY(0);
}

/* ─── iOS-style Swap Type Toggle (Phase 2 prep — HTML in Phase 3) ────── */
.bb-swap-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: var(--radius-pill, 100px);
  max-width: 640px;
  margin: 0 auto var(--space-3);
}

.bb-swap-toggle__item {
  position: relative;
  cursor: pointer;
  user-select: none;
}

.bb-swap-toggle__item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.bb-swap-toggle__item span {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-pill, 100px);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-3);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.bb-swap-toggle__item input:checked + span {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.bb-swap-toggle__item span:hover {
  color: var(--text);
}

/* ─── Category Chips Row (Phase 2 prep — HTML in Phase 3) ────────────── */
.bb-hero-categories {
  display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0 var(--space-4) var(--space-4);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    width: auto;
    margin-inline: calc(var(--space-4) * -1);
    padding-inline: var(--space-4);
    max-width: none;
}

@media (min-width: 80rem) {
  .bb-hero-categories {
    max-width: var(--container-xl);
    margin-inline: auto;
    padding-inline: 0;
  }
}

.bb-hero-categories::-webkit-scrollbar {
  display: none;
}

.bb-hero-cat {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill, 100px);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  text-decoration: none;
}

.bb-hero-cat.is-selected {
  background: var(--brand, #4361ee);
  color: #fff;
  border-color: var(--brand, #4361ee);
}

.bb-hero-cat:hover {
  background: var(--brand, #4361ee);
  color: #fff;
  border-color: var(--brand, #4361ee);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px color-mix(in oklab, var(--brand), transparent 65%);
}

.bb-hero-cat:active {
  transform: translateY(0);
}

.bb-hero-cat__icon {
  font-size: 1.1em;
  line-height: 1;
}

/* ─── Skeleton Cards (loading state polish) ─────────────────────────── */
.bb-card--skeleton {
  border-radius: var(--card-radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid color-mix(in oklab, var(--line), transparent 50%);
}