.marketplace-page {
  --market-green: #285719;
  --market-green-dark: #183f0d;
  --market-green-soft: #e8efe1;
  --market-cream: #fbfbf3;
  --market-line: #d9dfd1;
  background: var(--market-cream);
}

.marketplace-page .nav-link {
  text-decoration: none;
}

.marketplace-page .header-search {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.market-hero {
  padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(3rem, 6vw, 5.5rem);
}

.market-hero-card {
  position: relative;
  overflow: hidden;
  min-height: 430px;
  border-radius: 28px;
  display: grid;
  align-items: center;
  gap: 2rem;
  padding: clamp(2rem, 5vw, 5rem);
  color: #fff;
  background:
    radial-gradient(circle at 18% 20%, rgba(255,255,255,.08), transparent 32%),
    linear-gradient(135deg, #214f13, #3c7130);
  box-shadow: 0 24px 60px rgba(33, 79, 19, .18);
}

.market-hero-card::after {
  content: "";
  position: absolute;
  width: 290px;
  height: 290px;
  right: -80px;
  bottom: -130px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 999px;
}

.market-hero-copy {
  position: relative;
  z-index: 2;
}

.market-kicker {
  display: inline-flex;
  padding: .42rem 1rem;
  margin-bottom: 1.1rem;
  border-radius: 999px;
  color: #d9f0ca;
  background: rgba(207, 236, 190, .16);
  font-family: var(--font-heading);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.market-hero h1 {
  max-width: 650px;
  margin: 0 0 1.2rem;
  font-family: var(--font-heading);
  font-size: clamp(2.6rem, 7vw, 5rem);
  line-height: 1.02;
  letter-spacing: -.05em;
}

.market-hero p {
  max-width: 600px;
  margin: 0 0 2rem;
  color: rgba(255,255,255,.75);
  font-size: clamp(1rem, 2vw, 1.12rem);
}

.market-hero-button {
  min-height: 56px;
  border: 0;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: .9rem 1.55rem;
  color: var(--market-green-dark);
  background: #fff;
  font-family: var(--font-heading);
  font-weight: 800;
  transition: transform .2s ease, box-shadow .2s ease;
}

.market-hero-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(0,0,0,.18);
}

.market-hero-image {
  position: relative;
  z-index: 1;
  min-height: 300px;
  border-radius: 24px;
  overflow: hidden;
  transform: rotate(2deg);
  box-shadow: 0 22px 50px rgba(0,0,0,.22);
}

.market-hero-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 55%, rgba(21, 58, 11, .22));
}

.market-hero-image img,
.market-product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.market-catalog {
  padding-bottom: clamp(5rem, 9vw, 8rem);
}

.market-catalog-layout {
  display: grid;
  gap: clamp(2rem, 4vw, 3.5rem);
}

.market-filters {
  display: grid;
  align-content: start;
  gap: 1.75rem;
}

.filter-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.filter-heading h2 {
  margin: 0;
  color: var(--market-green-dark);
  font-family: var(--font-heading);
  font-size: 1.05rem;
}

.filter-heading button {
  border: 0;
  padding: .25rem;
  color: var(--color-muted);
  background: transparent;
  font-weight: 700;
}

.filter-heading button:hover {
  color: var(--market-green);
}

.filter-group {
  display: grid;
  gap: .75rem;
  margin: 0;
  padding: 0;
  border: 0;
}

.filter-group legend,
.filter-select > span,
.price-filter > span {
  margin-bottom: .9rem;
  color: var(--market-green-dark);
  font-family: var(--font-heading);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.filter-group label {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .7rem;
  cursor: pointer;
}

.filter-group input {
  width: 20px;
  height: 20px;
  accent-color: var(--market-green);
}

.filter-group small {
  min-width: 31px;
  border-radius: 999px;
  padding: .1rem .45rem;
  color: var(--color-muted);
  background: #eef1e8;
  text-align: center;
}

.filter-select {
  display: grid;
}

.filter-select select,
.price-inputs input,
.sort-control select {
  border: 1px solid #c8d0c0;
  color: var(--color-text);
  background: transparent;
  outline: 0;
}

.filter-select select {
  min-height: 52px;
  border-radius: 14px;
  padding: 0 2.75rem 0 .9rem;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23285719' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 18px;
}

.filter-select select:focus,
.price-inputs input:focus,
.sort-control select:focus {
  border-color: var(--market-green);
  box-shadow: 0 0 0 3px rgba(40, 87, 25, .12);
}

.price-filter {
  display: grid;
}

.price-inputs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr);
  align-items: center;
  gap: .65rem;
}

.price-inputs input {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  padding: 0 .75rem;
}

.price-inputs i {
  height: 1px;
  background: #98a38f;
}

.verified-note {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .85rem;
  padding: 1.4rem;
  color: #682849;
  background: #f8d6e8;
}

.verified-note::after {
  content: "";
  position: absolute;
  right: -28px;
  bottom: -38px;
  width: 105px;
  height: 105px;
  border-radius: 999px;
  background: rgba(110,43,83,.08);
}

.verified-note > span {
  position: relative;
  z-index: 1;
}

.verified-note strong {
  font-family: var(--font-heading);
}

.verified-note p {
  position: relative;
  z-index: 1;
  margin: .4rem 0 0;
  font-size: .84rem;
  line-height: 1.5;
}

.market-results {
  min-width: 0;
}

.results-toolbar {
  min-height: 45px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.results-toolbar p {
  margin: 0;
  color: var(--color-muted);
}

.results-toolbar strong {
  color: var(--market-green-dark);
}

.sort-control {
  display: flex;
  align-items: center;
  gap: .7rem;
  color: var(--color-muted);
  font-size: .9rem;
}

.sort-control select {
  min-height: 40px;
  border: 0;
  color: var(--market-green-dark);
  font-weight: 800;
  padding-right: 1.6rem;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23285719' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
  background-size: 16px;
}

.mobile-filter-toggle {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--market-green);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin-bottom: 1.25rem;
  color: var(--market-green);
  background: #fff;
  font-family: var(--font-heading);
  font-weight: 800;
}

.market-product-grid {
  display: grid;
  gap: 1.5rem;
}

.market-product-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(40,87,25,.07);
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: 0 14px 35px rgba(27, 48, 19, .06);
  transition: transform .25s ease, box-shadow .25s ease;
}

.market-product-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 22px 45px rgba(27, 48, 19, .12);
}

.market-product-image {
  position: relative;
  height: 230px;
  overflow: hidden;
  background: var(--market-green-soft);
}

.market-product-image img {
  transition: transform .55s ease;
}

.market-product-card:hover .market-product-image img {
  transform: scale(1.045);
}

.market-product-image > span {
  position: absolute;
  top: .75rem;
  right: .75rem;
  border-radius: 999px;
  padding: .28rem .8rem;
  color: var(--market-green-dark);
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(10px);
  font-size: .72rem;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(0,0,0,.08);
}

.market-product-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
}

.product-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .75rem;
}

.product-title-row h2 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1rem;
  line-height: 1.35;
}

.product-title-row strong {
  color: var(--market-green);
  white-space: nowrap;
}

.market-product-body p {
  display: flex;
  align-items: center;
  gap: .35rem;
  min-height: 24px;
  margin: .7rem 0 1.2rem;
  color: var(--color-muted);
  font-size: .78rem;
}

.market-product-body .verified {
  color: #0783bd;
  font-size: 1rem;
  font-variation-settings: 'FILL' 1;
}

.contact-seller {
  width: 100%;
  min-height: 48px;
  border: 2px solid var(--market-green);
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  margin-top: auto;
  color: var(--market-green);
  background: transparent;
  font-family: var(--font-heading);
  font-weight: 800;
  transition: color .2s ease, background .2s ease;
}

.contact-seller:hover {
  color: #fff;
  background: var(--market-green);
}

.contact-seller .material-symbols-outlined {
  font-size: 1.1rem;
}

.empty-market-state {
  border: 1px dashed #bdc8b5;
  border-radius: 22px;
  padding: 4rem 1.5rem;
  color: var(--color-muted);
  text-align: center;
  background: rgba(255,255,255,.5);
}

.empty-market-state .material-symbols-outlined {
  color: var(--market-green);
  font-size: 3rem;
}

.empty-market-state h2 {
  margin: .8rem 0 .35rem;
  color: var(--market-green-dark);
  font-family: var(--font-heading);
}

.empty-market-state p {
  margin: 0;
}

.market-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  margin-top: 3rem;
}

.market-pagination button {
  min-width: 42px;
  height: 42px;
  border: 1px solid #c6d0bd;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--market-green-dark);
  background: transparent;
  font-weight: 800;
}

.market-pagination button.active,
.market-pagination button:hover:not(:disabled) {
  border-color: var(--market-green);
  color: #fff;
  background: var(--market-green);
}

.market-pagination button:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.trade-updates {
  padding: clamp(5rem, 9vw, 8rem) 0;
  background: #eef0e8;
}

.trade-updates-inner {
  max-width: 820px;
  text-align: center;
}

.trade-updates-inner > .material-symbols-outlined {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  margin: 0 auto 1.25rem;
  color: var(--market-green);
  background: #fff;
  box-shadow: var(--shadow);
}

.trade-updates h2 {
  margin: 0 0 1rem;
  color: var(--market-green);
  font-family: var(--font-heading);
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.1;
  letter-spacing: -.035em;
}

.trade-updates p {
  color: var(--color-muted);
}

.trade-updates form {
  display: grid;
  gap: .8rem;
  max-width: 680px;
  margin: 2.2rem auto 0;
}

.trade-updates input {
  min-height: 58px;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 0 1.2rem;
  outline: 0;
  background: #fff;
  box-shadow: 0 10px 26px rgba(30,55,20,.05);
}

.trade-updates input:focus {
  border-color: var(--market-green);
  box-shadow: 0 0 0 3px rgba(40,87,25,.12);
}

.trade-updates button {
  min-height: 58px;
  border: 0;
  border-radius: 14px;
  padding: 0 1.7rem;
  color: #fff;
  background: var(--market-green);
  font-family: var(--font-heading);
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(40,87,25,.2);
}

.trade-updates button:hover {
  background: var(--market-green-dark);
}

.trade-form-message {
  min-height: 24px;
  margin: .8rem 0 0;
  color: var(--market-green) !important;
  font-weight: 700;
}

.market-dialog {
  width: min(100% - 1.5rem, 780px);
  max-height: calc(100dvh - 1.5rem);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 24px;
  color: var(--color-text);
  background: #fff;
  box-shadow: 0 30px 90px rgba(11,31,5,.35);
}

.market-dialog::backdrop {
  background: rgba(10, 24, 5, .68);
  backdrop-filter: blur(5px);
}

.market-dialog-panel {
  overflow: hidden;
  border-radius: inherit;
}

.market-dialog header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem;
  color: #fff;
  background: var(--market-green);
}

.market-dialog header > div > span {
  color: #caeab8;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.market-dialog h2 {
  margin: .2rem 0 0;
  font-family: var(--font-heading);
  line-height: 1.15;
}

.market-dialog header p {
  margin: .5rem 0 0;
  color: rgba(255,255,255,.72);
}

.market-dialog-close {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(255,255,255,.08);
}

.market-dialog form {
  max-height: calc(100dvh - 12rem);
  overflow-y: auto;
  display: grid;
  gap: 1rem;
  padding: 1.5rem;
}

.market-dialog form label {
  display: grid;
  gap: .4rem;
}

.market-dialog form label > span {
  font-family: var(--font-heading);
  font-size: .84rem;
  font-weight: 800;
}

.market-dialog input,
.market-dialog select,
.market-dialog textarea {
  width: 100%;
  min-height: 50px;
  border: 1px solid #cdd5c6;
  border-radius: 13px;
  padding: .8rem .9rem;
  outline: 0;
  background: #fbfcf8;
}

.market-dialog textarea {
  resize: vertical;
}

.market-dialog input:focus,
.market-dialog select:focus,
.market-dialog textarea:focus {
  border-color: var(--market-green);
  box-shadow: 0 0 0 3px rgba(40,87,25,.12);
}

#listing-message {
  min-height: 20px;
  margin: 0;
  color: var(--market-green);
  font-weight: 700;
}

.market-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  padding-top: .5rem;
}

.market-dialog-actions button {
  min-height: 48px;
  border-radius: 13px;
  padding: .75rem 1.15rem;
  font-weight: 800;
}

.dialog-cancel {
  border: 1px solid #cdd5c6;
  color: var(--color-text);
  background: #fff;
}

.dialog-submit {
  border: 0;
  color: #fff;
  background: var(--market-green);
}

.market-toast {
  position: fixed;
  z-index: 200;
  right: 1.25rem;
  bottom: 1.25rem;
  max-width: min(380px, calc(100% - 2.5rem));
  border-radius: 14px;
  padding: .9rem 1.1rem;
  color: #fff;
  background: var(--market-green-dark);
  box-shadow: 0 16px 38px rgba(0,0,0,.22);
  opacity: 0;
  visibility: hidden;
  transform: translateY(15px);
  transition: opacity .25s ease, visibility .25s ease, transform .25s ease;
}

.market-toast.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

@media (min-width: 640px) {
  .trade-updates form {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .market-dialog form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .market-dialog form .wide,
  #listing-message,
  .market-dialog-actions {
    grid-column: 1 / -1;
  }
}

@media (min-width: 720px) {
  .market-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 959px) {
  .market-filters {
    display: none;
    border: 1px solid var(--market-line);
    border-radius: 20px;
    padding: 1.25rem;
    background: #fff;
  }

  .market-filters.open {
    display: grid;
  }

  .results-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (min-width: 960px) {
  .market-hero-card {
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, .7fr);
  }

  .market-catalog-layout {
    grid-template-columns: 250px minmax(0, 1fr);
    align-items: start;
  }

  .market-filters {
    position: sticky;
    top: 105px;
  }

  .mobile-filter-toggle {
    display: none;
  }

  .market-product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 639px) {
  .market-hero-card {
    padding: 1.5rem;
  }

  .market-hero-image {
    min-height: 230px;
  }

  .sort-control {
    width: 100%;
    justify-content: space-between;
  }

  .product-title-row {
    grid-template-columns: 1fr;
  }

  .market-dialog-actions {
    flex-direction: column-reverse;
  }

  .market-dialog-actions button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .market-product-card,
  .market-product-image img,
  .market-hero-button,
  .market-toast {
    transition: none;
  }
}
