@media (max-width: 980px) {
  .marketplace-header-main {
    gap: 14px;
  }

  .marketplace-search {
    max-width: 100%;
  }
}

.marketplace-search-toggle,
.marketplace-mobile-action-icon{
    display: none;
}

@media (max-width: 640px) {
  .marketplace-header-main {
    position: relative;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 12px;
    min-height: auto;
  }

  .marketplace-logo {
    grid-column: 1;
    min-width: 0;
    gap: 8px;
    font-size: 1.1rem;
  }

  .marketplace-logo-image {
    max-width: 38vw;
    max-height: 40px;
  }

  .marketplace-search {
    grid-column: 2;
    width: auto;
    max-width: none;
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .marketplace-search-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    min-width: 42px !important;
    min-height: 42px !important;
    padding: 9px;
    border: 1px solid var(--market-border) !important;
    border-radius: 12px;
    background: var(--market-surface) !important;
    color: var(--market-secondary) !important;
  }

  .marketplace-search-toggle svg,
  .marketplace-mobile-action-icon {
    display: block;
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
  }

  .marketplace-search > input[type="search"],
  .marketplace-search > button[type="submit"] {
    display: none;
  }

  .marketplace-search.is-open {
    position: absolute;
    z-index: 2;
    top: calc(100% + 8px);
    right: auto;
    left: 50%;
    display: flex;
    width: 100vw;
    max-width: none;
    padding: 6px;
    border: 1px solid var(--market-border);
    border-radius: 14px;
    background: var(--market-surface);
    box-shadow: var(--market-shadow-md);
    box-sizing: border-box;
    transform: translateX(-50%);
  }

  .marketplace-search.is-open > input[type="search"] {
    display: block;
    min-width: 0;
    min-height: 44px;
    padding: 0 10px;
  }

  .marketplace-search.is-open > button[type="submit"] {
    display: block;
    min-width: 72px;
    min-height: 44px;
    border-radius: 10px;
  }

  .marketplace-user-actions {
    grid-column: 3;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: nowrap;
  }

  .marketplace-icon-link {
    justify-content: center;
    width: 36px;
    height: 40px;
  }

  .marketplace-mobile-action-icon {
    display: block;
  }

  .marketplace-icon-link .marketplace-mobile-action-icon + span {
    display: none;
  }

  .marketplace-icon-link span:not(.marketplace-badge) {
    display: none;
  }
}

.marketplace-page .marketplace-shop-grid {
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: clamp(16px, 2vw, 24px);
}

.marketplace-page .woocommerce ul.products {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: clamp(12px, 1.8vw, 20px);
  margin: 0;
}

.marketplace-page .woocommerce ul.products li.product > a:first-child {
  aspect-ratio: 1 / 1;
}

.marketplace-page .woocommerce ul.products li.product > a:first-child img {
  height: 100%;
  object-fit: contain;
}

.marketplace-mobile-listing-controls,
.marketplace-filter-backdrop {
  display: none;
}

.marketplace-active-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px 0 18px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.marketplace-filter-chip,
.marketplace-filter-clear {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
}

.marketplace-filter-chip {
  background: var(--market-hover);
  color: var(--market-secondary);
}

.marketplace-filter-clear {
  color: var(--market-primary);
  font-weight: 700;
  text-decoration: underline;
}

.marketplace-price-range {
  display: grid;
  gap: 8px;
}

.marketplace-price-range-values {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--market-muted);
  font-size: 0.8rem;
}

.marketplace-price-range-values strong {
  color: var(--market-secondary);
}

.marketplace-price-slider {
  position: relative;
  height: 32px;
  margin: 0 6px;
}

.marketplace-price-slider-track,
.marketplace-price-slider-fill {
  position: absolute;
  top: 13px;
  right: 0;
  left: 0;
  height: 6px;
  border-radius: 999px;
}

.marketplace-price-slider-track {
  background: var(--market-border);
}

.marketplace-price-slider-fill {
  right: auto;
  width: 100%;
  background: linear-gradient(90deg, var(--market-primary), var(--market-accent));
}

.marketplace-price-slider input[type="range"] {
  position: absolute;
  z-index: 2;
  top: 0;
  left: -6px;
  width: calc(100% + 12px);
  height: 32px;
  margin: 0;
  pointer-events: none;
  appearance: none;
  background: transparent;
}

.marketplace-price-slider input[type="range"]::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  border: 3px solid var(--market-surface);
  border-radius: 50%;
  background: var(--market-primary);
  box-shadow: 0 0 0 1px var(--market-primary), 0 2px 6px rgba(52, 37, 29, 0.2);
  cursor: grab;
  pointer-events: auto;
  appearance: none;
}

.marketplace-price-slider input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 3px solid var(--market-surface);
  border-radius: 50%;
  background: var(--market-primary);
  box-shadow: 0 0 0 1px var(--market-primary), 0 2px 6px rgba(52, 37, 29, 0.2);
  cursor: grab;
  pointer-events: auto;
}

.marketplace-price-slider input[type="range"]:focus-visible {
  outline: 3px solid var(--market-accent);
  outline-offset: 3px;
}

.marketplace-page .woocommerce ul.products li.product .astra-shop-summary-wrap {
  padding: 14px;
}

.marketplace-page .marketplace-archive-banner-visual {
  clip-path: polygon(12% 0, 100% 0, 100% 100%, 0 100%);
}

@media (min-width: 1280px) {
  .marketplace-page .woocommerce ul.products {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) and (max-width: 1279px) {
  .marketplace-page .woocommerce ul.products {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .marketplace-page .woocommerce ul.products {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1023px) {
  .marketplace-page .marketplace-shop-grid {
    grid-template-columns: 1fr;
  }

  .marketplace-page .marketplace-sidebar {
    position: fixed;
    z-index: 1060;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(360px, calc(100vw - 28px));
    overflow-y: auto;
    border: 0;
    border-radius: 0;
    padding: 20px;
    background: var(--market-surface);
    box-shadow: -12px 0 32px rgba(52, 37, 29, 0.18);
    transform: translateX(105%);
    transition: transform 0.24s ease;
  }

  .marketplace-page .marketplace-sidebar.is-expanded {
    transform: translateX(0);
  }

  .marketplace-page .marketplace-sidebar .marketplace-filter-toggle {
    display: flex;
    position: sticky;
    top: -20px;
    z-index: 1;
    padding: 20px 0 16px;
    background: var(--market-surface);
  }

  .marketplace-page .marketplace-sidebar .marketplace-filter-toggle span {
    font-size: 0;
  }

  .marketplace-page .marketplace-sidebar .marketplace-filter-toggle span::before {
    content: '\00d7';
    font-size: 1.5rem;
  }

  .marketplace-page .marketplace-sidebar:not(.is-expanded) .marketplace-filter-form {
    display: block;
  }

  .marketplace-filter-backdrop {
    position: fixed;
    z-index: 1055;
    inset: 0;
    display: block;
    background: rgba(43, 36, 31, 0.42);
  }

  .marketplace-filter-backdrop[hidden] {
    display: none;
  }

  body.marketplace-filter-open {
    overflow: hidden;
  }

  .marketplace-mobile-listing-controls {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
  }

  .marketplace-mobile-filter-button,
  .marketplace-mobile-sort-control {
    flex: 1 1 0;
    min-height: 46px;
    border: 1px solid var(--market-border);
    border-radius: 10px;
    background: var(--market-surface);
  }

  .marketplace-mobile-filter-button {
    color: var(--market-secondary);
    font: inherit;
    font-weight: 700;
  }

  .marketplace-mobile-filter-button span {
    margin-right: 6px;
  }

  .marketplace-mobile-sort-control {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
  }

  .marketplace-mobile-sort-control label {
    flex: 0 0 auto;
    color: var(--market-muted);
    font-size: 0.75rem;
  }

  .marketplace-mobile-sort-control .woocommerce-ordering {
    min-width: 0;
    margin: 0;
  }

  .marketplace-mobile-sort-control select {
    min-width: 0;
    max-width: 100%;
    padding: 8px 4px;
    border: 0;
    background: transparent;
    font-size: 0.8rem;
  }

  .marketplace-desktop-ordering {
    display: none;
  }
}

@media (max-width: 767px) {
  .marketplace-page .woocommerce ul.products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .marketplace-page .woocommerce ul.products li.product .product-card-body {
    padding: 12px;
  }

  .marketplace-page .woocommerce ul.products li.product .product-card-meta {
    display: block;
    line-height: 1.35;
  }

  .marketplace-page .woocommerce ul.products li.product .product-card-meta span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .marketplace-page .woocommerce ul.products li.product h2,
  .marketplace-page .woocommerce ul.products li.product h3 {
    display: -webkit-box;
    min-height: 2.8em;
    overflow: hidden;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .marketplace-page .marketplace-archive-banner {
    min-height: 0;
  }

  .marketplace-page .marketplace-archive-banner-copy {
    min-height: 170px;
  }

  .marketplace-page .marketplace-archive-banner-visual {
    min-height: 190px;
    clip-path: none;
  }
}
