/* ===== Marketplace ===== */
.marketplace {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  padding: 120px 20px 40px;
  max-width: 1200px;
  margin: 0 auto;
  align-items: start;
}

.filters {
  background: #fff;
  border: 1px solid rgba(128, 0, 128, 0.2);
  border-radius: 16px;
  padding: 20px;
  position: -webkit-sticky;
  position: sticky;
  top: 90px;
  height: fit-content;
  align-self: start;
}

.filters h2 {
  color: purple;
  margin-bottom: 16px;
}

.filters-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.filters-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  color: #333;
}

.filters-form input,
.filters-form select {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 10px;
  outline: none;
  width: 100%;
  min-width: 0;
}

.price-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-primary {
  background: purple;
  color: #fff;
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
}

.btn-outline {
  background: transparent;
  color: purple;
  border: 1px solid purple;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.listing-header h1 {
  color: #222;
  margin-bottom: 6px;
}

.listing-header p {
  color: #666;
  margin-bottom: 20px;
}

.filters-toggle {
  display: none;
  background: purple;
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  gap: 6px;
  align-items: center;
}

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.card-link:focus-visible {
  outline: 2px solid purple;
  border-radius: 14px;
}

.card {
  border: 1px solid #eee;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}

.card-media {
  position: relative;
  aspect-ratio: 2 / 1;
  height: auto;
  overflow: hidden;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.badge {
  position: absolute;
  left: 10px;
  top: 10px;
  background: purple;
  color: #fff;
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 999px;
}

.fav {
  position: absolute;
  right: 10px;
  top: 10px;
  background: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.fav .bx {
  color: purple;
  font-size: 18px;
}

.fav.is-active {
  background: purple;
}

.fav.is-active .bx {
  color: #fff;
}

.fav:hover {
  transform: scale(1.08);
  transition: transform 0.15s ease;
}

.card-body {
  padding: 14px;
}

.card-body h3 {
  font-size: 1rem;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e0e0e0;
}

.card-body p {
  color: #666;
  font-size: 0.85rem;
}

.price-row-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.pro {
  border: 1px solid purple;
  color: purple;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
}

.specs {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.specs span {
  display: block;
  color: #777;
  font-size: 0.65rem;
}

.specs strong {
  font-size: 0.75rem;
  color: #222;
}

.seller-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.seller-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(128, 0, 128, 0.15);
  color: purple;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.8rem;
  overflow: hidden;
}

.seller-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.seller {
  color: #333;
  font-size: 0.9rem;
  margin: 0;
}

.verified {
  color: #1d9bf0;
  font-size: 0.95rem;
  vertical-align: middle;
  margin-left: 4px;
}

.seller-sub {
  color: #1a9b3f !important;
  font-size: 0.75rem;
  margin: 2px 0 0;
}

/* ===== Pagination ===== */
.pagination {
  margin: 24px 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.page-btn {
  border: 1px solid rgba(128, 0, 128, 0.3);
  background: #fff;
  color: purple;
  padding: 8px 12px;
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
  font-size: 0.9rem;
}

.page-btn.is-active {
  background: purple;
  color: #fff;
  border-color: purple;
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-btn:not(:disabled):hover {
  background: rgba(128, 0, 128, 0.08);
}

.empty-state {
  background: #fff;
  border: 1px dashed rgba(128, 0, 128, 0.35);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  color: #4b0076;
  grid-column: 1 / -1;
}

.empty-state h3 {
  margin-bottom: 8px;
}

.empty-state p {
  color: #666;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.price {
  color: purple;
  font-weight: 700;
}

@media (max-width: 900px) {
  .marketplace {
    grid-template-columns: 1fr;
  }

  .filters {
    position: static;
  }
}

@media (max-width: 768px) {
  .marketplace {
    padding-top: 100px;
    overflow-x: hidden;
  }

  .listing {
    margin-top: 0;
    min-width: 0;
  }
  .filters-toggle {
    display: inline-flex;
    margin-bottom: 12px;
  }

  .filters {
    position: fixed;
    top: 80px;
    left: 12px;
    right: 12px;
    z-index: 1400;
    max-height: 75vh;
    overflow: auto;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition:
      opacity 0.2s ease,
      transform 0.2s ease;
  }

  body.filters-open .filters {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .filters-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1300;
  }

  body.filters-open .filters-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .cards {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .card {
    width: 100%;
    min-width: 0;
  }

  .card-link,
  .card-body,
  .specs,
  .specs > div {
    min-width: 0;
  }

  .card-body h3 {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 92%;
  }

  .page-btn {
    padding: 6px 10px;
    font-size: 0.85rem;
  }
}
