/* ===================================================================
   Marketplace – New Layout
   =================================================================== */

/* --- Hero --------------------------------------------------------------- */
.mp-hero {
  padding: 48px 0 32px;
  text-align: center;
}

.mp-hero h1 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 8px;
  color: var(--text-primary);
}

.mp-hero__subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin: 0 0 28px;
  max-width: 560px;
  margin-inline: auto;
  line-height: 1.5;
}

/* category intro (reused from old page) */
.mp-category-intro {
  text-align: left;
  max-width: 720px;
  margin: 0 auto 24px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.mp-category-intro h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 16px 0 6px;
  color: var(--text-primary);
}

.mp-category-intro ul {
  padding-left: 20px;
  margin: 4px 0 12px;
}

.mp-category-faq article {
  margin-bottom: 12px;
}

.mp-category-faq h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--text-primary);
}

.mp-category-faq p {
  margin: 0;
}

/* --- Search ------------------------------------------------------------- */
.mp-search {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}

.mp-search__input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.mp-search__input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 72, 197, 0.12);
}

.mp-search__icon {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
}

.mp-search__input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 1rem;
  outline: none;
  min-width: 0;
}

.mp-search__input::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

/* search suggestions */
.mp-search__suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(10, 20, 40, 0.12);
  margin-top: 6px;
  padding: 8px 0;
  max-height: 320px;
  overflow-y: auto;
}

.mp-search__suggestions.hidden {
  display: none;
}

.search-suggestions-heading {
  padding: 6px 16px 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.search-suggestion-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 100ms ease;
}

.search-suggestion-item:hover,
.search-suggestion-item:focus-visible {
  background: var(--sunken);
}

.search-suggestion-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.search-suggestion-type {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: capitalize;
  flex-shrink: 0;
}

/* --- Filter Bar --------------------------------------------------------- */
.mp-filter-bar {
  position: sticky;
  top: 0;
  z-index: 15;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color 200ms ease, box-shadow 200ms ease;
  padding: 12px 0;
}

.mp-filter-bar.is-stuck {
  border-bottom-color: var(--border);
  box-shadow: 0 4px 20px rgba(10, 20, 40, 0.06);
}

.mp-filter-bar__row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* type pills */
.mp-filter-bar__types {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(10, 20, 40, 0.04);
  flex-shrink: 0;
}

.tab-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  min-height: 38px;
  white-space: nowrap;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.tab-pill[aria-selected='false'] {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.tab-pill:hover {
  color: var(--text-primary);
  background: var(--sunken);
}

.tab-pill:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring, rgba(22, 72, 197, 0.25));
}

.tab-pill.is-active,
.tab-pill[aria-selected='true'] {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(12, 42, 120, 0.18);
}

.tab-pill.is-disabled,
.tab-pill[aria-disabled='true'] {
  color: var(--text-secondary);
  opacity: 0.5;
  cursor: not-allowed;
}

.tab-pill.is-disabled:hover {
  background: transparent;
  color: var(--text-secondary);
}

/* category chips — second row below type tabs */
.mp-filter-bar__categories {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.mp-filter-bar__categories::-webkit-scrollbar {
  display: none;
}

.chip-link {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 6px 12px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.84rem;
  min-height: 34px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.chip-link:hover,
.chip-link:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(22, 72, 197, 0.06);
}

.chip-link.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* actions: sort + filters toggle */
.mp-filter-bar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-left: auto;
}

.mp-sort-select {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  padding: 7px 12px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  min-height: 38px;
  transition: border-color 160ms ease;
}

.mp-sort-select:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 72, 197, 0.12);
}

.mp-filters-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  padding: 7px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 38px;
  white-space: nowrap;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.mp-filters-toggle:hover,
.mp-filters-toggle:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.mp-filters-toggle.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.mp-filters-toggle__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

.mp-filters-toggle:not(.is-active) .mp-filters-toggle__count {
  background: var(--sunken);
  color: var(--text-primary);
}

/* --- More Filters Panel ------------------------------------------------- */
.mp-more-filters {
  display: none;
  padding: 16px 0 4px;
}

.mp-more-filters[aria-hidden='false'],
.mp-more-filters.is-open {
  display: block;
  animation: mp-slide-down 200ms ease;
}

@keyframes mp-slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mp-filter-group {
  margin-bottom: 14px;
}

.mp-filter-group__label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 8px;
}

.mp-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mp-chip {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 180ms ease;
}

.mp-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(22, 72, 197, 0.06);
}

.mp-chip.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.mp-filters-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 8px;
}

.mp-reset-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 160ms ease;
}

.mp-reset-btn:hover {
  color: var(--text-primary);
}

/* --- Active Filter Chips ------------------------------------------------ */
.mp-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 8px;
}

.mp-active-filters:empty {
  display: none;
}

.mp-active-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--sunken);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px 4px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 160ms ease;
}

.mp-active-chip:hover {
  background: var(--border);
}

.mp-active-chip__remove {
  font-size: 1rem;
  line-height: 1;
  opacity: 0.5;
}

/* --- Publish CTA ------------------------------------------------------- */
.mp-hero__links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
}

.mp-hero__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
  background: transparent;
  text-decoration: none;
  white-space: nowrap;
  transition: background 160ms ease, color 160ms ease;
}

.mp-hero__link:hover,
.mp-hero__link:focus-visible {
  background: var(--accent);
  color: #fff;
}

.mp-hero__link-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

/* --- Featured ----------------------------------------------------------- */
.mp-featured {
  margin-bottom: 32px;
}

.mp-featured__heading {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 14px;
  color: var(--text-primary);
}

.mp-featured__row {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.mp-featured__row::-webkit-scrollbar {
  display: none;
}

.mp-featured__row > .product-card {
  flex: 0 0 300px;
  scroll-snap-align: start;
  height: auto;
}

/* --- Results ------------------------------------------------------------ */
.mp-results {
  padding: 32px 0 64px;
}

/* status line */
.mp-status {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0 0 16px;
  min-height: 1.4em;
}

.mp-status:empty {
  display: none;
}

/* --- Grid --------------------------------------------------------------- */
.mp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.mp-grid > .product-card,
.mp-grid > .bundle-card {
  transition: opacity 220ms ease, transform 220ms ease;
}

.mp-grid > .product-card.is-hidden,
.mp-grid > .bundle-card.is-hidden {
  display: none;
}

/* --- Pagination --------------------------------------------------------- */
.mp-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding-top: 40px;
}

.mp-pagination__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease;
}

.mp-pagination__btn:hover {
  border-color: var(--accent);
  background: rgba(22, 72, 197, 0.06);
}

.mp-pagination__info {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* --- Infinite Scroll ---------------------------------------------------- */
.mp-scroll-sentinel {
  padding: 32px 0;
  text-align: center;
}

.mp-load-spinner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.mp-load-spinner.hidden {
  display: none;
}

.mp-load-spinner__dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-secondary);
  opacity: 0.4;
  animation: mp-dot-pulse 1.2s ease-in-out infinite;
}

.mp-load-spinner__dot:nth-child(2) { animation-delay: 0.2s; }
.mp-load-spinner__dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes mp-dot-pulse {
  0%, 80%, 100% { opacity: 0.4; transform: scale(1); }
  40% { opacity: 1; transform: scale(1.3); }
}

.mp-load-spinner__text {
  margin-left: 4px;
}

/* --- Empty State -------------------------------------------------------- */
.mp-empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.6;
}

.mp-empty.hidden {
  display: none;
}

/* --- Modal -------------------------------------------------------------- */
.mp-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 20, 40, 0.45);
  backdrop-filter: blur(4px);
  padding: 24px;
}

.mp-modal.hidden {
  display: none;
}

.mp-modal__content {
  background: var(--surface);
  border-radius: 16px;
  padding: 28px 32px;
  max-width: 560px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(10, 20, 40, 0.18);
  animation: mp-modal-in 200ms ease;
}

@keyframes mp-modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.mp-modal__close {
  float: right;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 120ms ease;
}

.mp-modal__close:hover {
  background: var(--sunken);
}

.mp-modal__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.mp-modal__title {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 8px;
}

.mp-modal__meta {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0 0 4px;
}

.mp-modal__desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 12px 0 0;
}

/* pill (modal badges) — type-pill colors come from style.css per data-type */
.pill.subtle {
  background: var(--sunken);
  color: var(--text-secondary);
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* --- Responsive --------------------------------------------------------- */
@media (max-width: 768px) {
  .mp-hero {
    padding: 32px 0 20px;
  }

  .mp-hero h1 {
    font-size: 1.4rem;
  }

  .mp-hero__subtitle {
    font-size: 0.95rem;
  }

  .mp-filter-bar__row {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
  }

  .mp-filter-bar__row::-webkit-scrollbar {
    display: none;
  }

  .mp-filter-bar__types {
    flex-shrink: 0;
  }

  .tab-pill {
    padding: 7px 11px;
    font-size: 0.82rem;
    min-height: 34px;
  }

  .mp-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .mp-featured__row > .product-card {
    flex: 0 0 260px;
  }

  .mp-more-filters {
    padding: 12px 0;
  }
}

@media (max-width: 480px) {
  .mp-hero h1 {
    font-size: 1.2rem;
  }

  .mp-filter-bar__categories {
    max-width: 100%;
  }

  .mp-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .mp-pagination {
    flex-direction: column;
    gap: 10px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .mp-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
}

/* --- Utility ------------------------------------------------------------ */
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
