/* Directorio público de cambios. Todo queda acotado a .trades-page para no
   interferir con la aplicación privada ni con los perfiles públicos. */
.trades-page {
  --tr-ink: #f7f8ff;
  --tr-muted: #a8acc2;
  --tr-soft: #747a94;
  --tr-bg: #0e1124;
  --tr-surface: #191d35;
  --tr-surface-strong: #242a4a;
  --tr-line: rgba(215, 221, 255, .13);
  --tr-yellow: #ffd24f;
  --tr-aqua: #71e7d1;
  --tr-pink: #f7a6cf;
  --tr-danger: #ff9cac;
  --tr-shadow: 0 24px 70px rgba(0, 0, 0, .31);
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--tr-ink);
  background:
    radial-gradient(circle at 88% 2%, rgba(93, 72, 159, .38), transparent 25rem),
    radial-gradient(circle at 4% 77%, rgba(18, 120, 132, .20), transparent 25rem),
    var(--tr-bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.trades-page *,
.trades-page *::before,
.trades-page *::after { box-sizing: border-box; }

.trades-page button,
.trades-page input,
.trades-page select { font: inherit; }

.trades-page button { cursor: pointer; }
.trades-page a { color: inherit; }
.trades-page [hidden] { display: none !important; }

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

.trades-page button:focus-visible,
.trades-page input:focus-visible,
.trades-page select:focus-visible,
.trades-page a:focus-visible {
  outline: 3px solid rgba(113, 231, 209, .6);
  outline-offset: 3px;
}

.trades-skip-link {
  position: fixed;
  z-index: 20;
  top: 10px;
  left: 10px;
  transform: translateY(-180%);
  padding: 10px 13px;
  border-radius: 10px;
  color: #19172b;
  background: var(--tr-yellow);
  font-size: .8rem;
  font-weight: 850;
  text-decoration: none;
}

.trades-skip-link:focus { transform: translateY(0); }

.trades-header {
  width: min(1180px, calc(100% - 32px));
  min-height: 82px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.trades-brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--tr-ink);
  font-size: 1.2rem;
  font-weight: 850;
  letter-spacing: -.04em;
  text-decoration: none;
}

.trades-brand-logo {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: block;
  object-fit: cover;
  object-position: center;
  border-radius: 50%;
}

.trades-header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
}

.trades-link-button,
.trades-primary-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--tr-line);
  border-radius: 11px;
  color: var(--tr-ink);
  font-size: .79rem;
  font-weight: 800;
  text-decoration: none;
  transition: transform .16s ease, filter .16s ease, background .16s ease;
}

.trades-link-button { background: rgba(255, 255, 255, .045); }

.trades-primary-button {
  border-color: var(--tr-yellow);
  color: #18162a;
  background: var(--tr-yellow);
  box-shadow: 0 9px 18px rgba(255, 196, 61, .15);
}

.trades-primary-icon {
  display: inline-grid;
  width: 16px;
  margin-right: 6px;
  place-items: center;
  color: #18162a;
  font-size: .93rem;
  font-weight: 900;
  line-height: 1;
}

.trades-link-button:hover { background: rgba(255, 255, 255, .09); }
.trades-primary-button:hover { filter: brightness(1.06); transform: translateY(-1px); }

.trades-main {
  width: min(1100px, calc(100% - 32px));
  margin: 24px auto 58px;
}

.trades-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.trades-eyebrow {
  margin: 0;
  color: var(--tr-aqua);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.trades-title {
  margin: 6px 0 5px;
  font-size: clamp(1.75rem, 4vw, 2.55rem);
  letter-spacing: -.06em;
  line-height: 1.06;
}

.trades-description {
  max-width: 590px;
  margin: 0;
  color: var(--tr-muted);
  font-size: .86rem;
  line-height: 1.55;
}

.trades-intro-note {
  max-width: 230px;
  margin: 0 0 2px;
  color: var(--tr-soft);
  font-size: .75rem;
  line-height: 1.45;
  text-align: right;
}

.trades-contact-resume {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 18px;
  padding: 13px 14px;
  border: 1px solid rgba(113, 231, 209, .32);
  border-radius: 15px;
  background: rgba(113, 231, 209, .07);
}

.trades-contact-copy {
  margin: 4px 0 0;
  color: var(--tr-ink);
  font-size: .82rem;
  font-weight: 700;
}

.trades-contact-resume-button,
.trade-card-contact {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  border: 1px solid rgba(255, 210, 79, .62);
  border-radius: 8px;
  color: #1d1a2f !important;
  background: var(--tr-yellow);
  font-size: .67rem;
  font-weight: 850;
  text-decoration: none;
  transition: filter .16s ease, transform .16s ease;
}

.trades-contact-resume-button {
  min-height: 36px;
  flex: 0 0 auto;
  padding-inline: 12px;
  font-size: .74rem;
}

.trades-contact-resume-button:hover,
.trade-card-contact:hover { filter: brightness(1.06); transform: translateY(-1px); }

.trades-filter-panel {
  position: relative;
  overflow: hidden;
  margin-bottom: 22px;
  padding: 18px;
  border: 1px solid rgba(192, 205, 255, .17);
  border-radius: 20px;
  background: linear-gradient(125deg, rgba(42, 50, 91, .84), rgba(24, 28, 53, .93));
  box-shadow: 0 13px 31px rgba(0, 0, 0, .14);
}

.trades-filter-panel::after {
  content: "";
  position: absolute;
  width: 160px;
  height: 160px;
  top: -103px;
  right: -78px;
  border: 28px solid rgba(113, 231, 209, .09);
  border-radius: 50%;
  pointer-events: none;
}

.trades-filter-form {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(156px, .34fr) minmax(166px, .38fr) auto;
  gap: 10px;
  align-items: end;
}

.trades-filter-field {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.trades-filter-field label,
.trades-filter-label {
  color: var(--tr-muted);
  font-size: .72rem;
  font-weight: 750;
}

input.trades-search,
select.trades-province,
.trades-search input,
.trades-province select {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(215, 221, 255, .17);
  border-radius: 12px;
  color: var(--tr-ink);
  background: #11162d;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input.trades-search,
.trades-search input { padding: 0 13px; }

select.trades-province,
.trades-province select {
  appearance: auto;
  padding: 0 34px 0 12px;
}

input.trades-search::placeholder,
.trades-search input::placeholder { color: var(--tr-soft); }

input.trades-search:focus,
select.trades-province:focus,
.trades-search input:focus,
.trades-province select:focus {
  outline: none;
  border-color: rgba(113, 231, 209, .68);
  background: #121832;
  box-shadow: 0 0 0 3px rgba(113, 231, 209, .10);
}

.trades-search { position: relative; min-width: 0; }

.trades-search-icon {
  position: absolute;
  top: 50%;
  left: 13px;
  transform: translateY(-50%);
  color: var(--tr-soft);
  pointer-events: none;
}

.trades-search:has(.trades-search-icon) input { padding-left: 37px; }

.trades-filter-submit,
.trades-filter-reset {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: 12px;
  font-size: .78rem;
  font-weight: 850;
  white-space: nowrap;
  transition: transform .16s ease, filter .16s ease, background .16s ease;
}

.trades-filter-submit {
  border: 1px solid var(--tr-yellow);
  color: #18162a;
  background: var(--tr-yellow);
  box-shadow: 0 9px 18px rgba(255, 196, 61, .14);
}

.trades-filter-reset {
  border: 1px solid var(--tr-line);
  color: var(--tr-muted);
  background: rgba(255, 255, 255, .045);
  text-decoration: none;
}

.trades-filter-submit:hover { filter: brightness(1.06); transform: translateY(-1px); }
.trades-filter-reset:hover { color: var(--tr-ink); background: rgba(255, 255, 255, .09); }

.trades-filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.trades-filter-help {
  position: relative;
  z-index: 1;
  margin: 11px 1px 0;
  color: var(--tr-soft);
  font-size: .71rem;
  line-height: 1.45;
}

.trades-filter-help b { color: var(--tr-aqua); }

.trades-results-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 15px;
}

.trades-results-title {
  margin: 4px 0 0;
  font-size: clamp(1.16rem, 3vw, 1.48rem);
  letter-spacing: -.045em;
}

.trades-result-count {
  margin: 0 0 2px;
  color: var(--tr-muted);
  font-size: .78rem;
  text-align: right;
}

.trades-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.trade-card {
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--tr-line);
  border-radius: 17px;
  background: rgba(255, 255, 255, .035);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .11);
  transition: transform .17s ease, border-color .17s ease, background .17s ease;
}

.trade-card:hover {
  transform: translateY(-3px);
  border-color: rgba(113, 231, 209, .38);
  background: rgba(255, 255, 255, .055);
}

.trade-card-image {
  position: relative;
  aspect-ratio: 5 / 6.98;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(150deg, #a8243c, #381b43 57%, #d5a34f);
}

.trade-card-image::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 8px;
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 8px;
  pointer-events: none;
}

.trade-card-image img {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.trade-image-fallback {
  z-index: 0;
  max-width: 12ch;
  padding: 8px;
  color: #fff7df;
  font-size: .72rem;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
}

.trade-card-image.has-image .trade-image-fallback { opacity: 0; }

.trade-card-copy {
  min-width: 0;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  padding: 13px 13px 14px;
}

.trade-card-title {
  margin: 0;
  overflow: hidden;
  color: var(--tr-ink);
  font-size: .88rem;
  font-weight: 800;
  letter-spacing: -.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-card-set {
  min-height: 2.45em;
  margin: 5px 0 10px;
  overflow: hidden;
  color: var(--tr-muted);
  font-size: .72rem;
  line-height: 1.28;
}

.trade-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.trade-card-meta li,
.trade-badge {
  min-height: 21px;
  display: inline-flex;
  align-items: center;
  padding: 3px 6px;
  border-radius: 7px;
  color: #bfd2ff;
  background: rgba(147, 184, 255, .11);
  font-size: .64rem;
  font-weight: 700;
  line-height: 1.2;
}

.trade-card-asking-price {
  margin: 9px 0 0;
  color: var(--tr-yellow);
  font-size: .72rem;
  font-weight: 850;
  line-height: 1.25;
}

.trade-badge.is-sale {
  color: #201a31;
  background: var(--tr-yellow);
}

.trade-badge {
  width: fit-content;
  margin: 0 0 8px;
  color: var(--tr-aqua);
  background: rgba(113, 231, 209, .12);
}

.trade-user {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(215, 221, 255, .10);
  color: var(--tr-muted);
  font-size: .71rem;
  font-weight: 750;
  text-decoration: none;
}

.trade-user:hover { color: var(--tr-aqua); }

.trade-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 10px;
}

.trade-card-share {
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid rgba(113, 231, 209, .25);
  border-radius: 8px;
  color: var(--tr-aqua);
  background: rgba(113, 231, 209, .06);
  font-size: .67rem;
  font-weight: 800;
  transition: color .16s ease, background .16s ease, border-color .16s ease;
}

.trade-card-share:hover { border-color: rgba(113, 231, 209, .55); background: rgba(113, 231, 209, .13); }

.trade-card-own-listing {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border: 1px solid rgba(215, 221, 255, .16);
  border-radius: 8px;
  color: var(--tr-soft);
  background: rgba(255, 255, 255, .035);
  font-size: .65rem;
  font-weight: 750;
}

.trade-user-avatar {
  position: relative;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(113, 231, 209, .38);
  border-radius: 50%;
  color: #eafff9;
  background: linear-gradient(145deg, #5ba6a8, #7462ba 52%, #ef9fc5);
  font-size: .68rem;
  font-weight: 850;
}

.trade-user-avatar-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.trade-user-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-user-location {
  display: block;
  margin-top: 1px;
  color: var(--tr-soft);
  font-size: .64rem;
  font-weight: 650;
}

.trades-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 24px;
}

.trades-pagination a,
.trades-pagination button,
.trades-page-button {
  min-width: 38px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid var(--tr-line);
  border-radius: 10px;
  color: var(--tr-muted);
  background: rgba(255, 255, 255, .04);
  font-size: .75rem;
  font-weight: 800;
  text-decoration: none;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.trades-pagination a:hover,
.trades-pagination button:hover,
.trades-page-button:hover {
  color: var(--tr-ink);
  border-color: rgba(113, 231, 209, .38);
  background: rgba(113, 231, 209, .09);
}

.trades-pagination .is-current,
.trades-pagination [aria-current="page"],
.trades-page-button.is-current {
  border-color: var(--tr-yellow);
  color: #19172b;
  background: var(--tr-yellow);
}

.trades-pagination [disabled],
.trades-page-button[disabled] {
  cursor: not-allowed;
  opacity: .42;
  pointer-events: none;
}

.trades-page-ellipsis { color: var(--tr-soft); font-size: .8rem; }

.trades-loading,
.trades-unavailable,
.trades-empty {
  grid-column: 1 / -1;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 36px;
  border-radius: 20px;
  text-align: center;
}

.trades-loading,
.trades-unavailable {
  min-height: 300px;
  border: 1px solid var(--tr-line);
  background: linear-gradient(135deg, rgba(37, 43, 78, .88), rgba(24, 28, 53, .92));
  box-shadow: var(--tr-shadow);
}

.trades-loading { gap: 13px; color: var(--tr-muted); font-size: .88rem; }
.trades-loading p { margin: 0; }

.trades-loader {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(113, 231, 209, .2);
  border-top-color: var(--tr-aqua);
  border-radius: 50%;
  animation: trades-spin .85s linear infinite;
}

@keyframes trades-spin { to { transform: rotate(360deg); } }

.trades-unavailable { max-width: 590px; margin: 44px auto; }

.trades-state-mark {
  width: 49px;
  height: 49px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 16px;
  color: var(--tr-aqua);
  background: rgba(113, 231, 209, .1);
  font-size: 1.45rem;
}

.trades-unavailable.is-error .trades-state-mark {
  color: var(--tr-danger);
  background: rgba(255, 156, 172, .11);
}

.trades-unavailable h1,
.trades-unavailable h2,
.trades-empty h2,
.trades-empty h3 {
  margin: 6px 0 8px;
  color: var(--tr-ink);
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  letter-spacing: -.045em;
}

.trades-unavailable p,
.trades-empty p {
  max-width: 410px;
  margin: 0;
  color: var(--tr-muted);
  font-size: .8rem;
  line-height: 1.5;
}

.trades-empty {
  min-height: 210px;
  border: 1px dashed rgba(215, 221, 255, .23);
  color: var(--tr-muted);
  background: rgba(255, 255, 255, .025);
}

.trades-empty .trades-state-mark { margin-bottom: 2px; }

.trades-footer {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto 26px;
  color: var(--tr-soft);
  font-size: .72rem;
  text-align: center;
}

@media (max-width: 920px) {
  .trades-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .trades-filter-form { grid-template-columns: minmax(0, 1fr) minmax(160px, .42fr); }
  .trades-filter-actions { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .trades-header { width: min(100% - 24px, 1100px); min-height: 70px; }
  .trades-main { width: min(100% - 24px, 1100px); margin-top: 13px; }
  .trades-footer { width: min(100% - 24px, 1100px); }
  .trades-header-actions { gap: 6px; }
  .trades-link-button, .trades-primary-button { min-height: 38px; padding: 0 10px; font-size: .73rem; }
  .trades-intro { display: block; margin-bottom: 15px; }
  .trades-title { font-size: 1.75rem; }
  .trades-intro-note { max-width: none; margin-top: 9px; text-align: left; }
  .trades-contact-resume { align-items: flex-start; }
  .trades-filter-panel { padding: 14px; border-radius: 17px; }
  .trades-filter-form { grid-template-columns: 1fr; gap: 11px; }
  .trades-filter-actions { grid-column: auto; }
  .trades-filter-submit, .trades-filter-reset { flex: 1 1 132px; }
  .trades-results-header { align-items: start; margin-bottom: 12px; }
  .trades-result-count { max-width: 118px; font-size: .71rem; }
  .trades-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .trade-card { border-radius: 14px; }
  .trade-card-copy { padding: 10px; }
  .trade-card-set { margin-bottom: 8px; }
  .trade-user { padding-top: 10px; }
  .trade-card-actions { justify-content: stretch; }
  .trade-card-actions > * { flex: 1 1 auto; }
  .trades-loading, .trades-unavailable, .trades-empty { padding: 28px 20px; border-radius: 17px; }
}

@media (max-width: 390px) {
  .trades-header { gap: 8px; }
  .trades-brand { gap: 7px; font-size: 1rem; }
  .trades-brand-logo { width: 29px; height: 29px; flex-basis: 29px; }
  .trades-header-actions { gap: 4px; }
  .trades-header-actions .trades-link-button,
  .trades-header-actions .trades-primary-button { min-height: 36px; padding-inline: 8px; font-size: .68rem; }
  .trade-card-meta li { font-size: .6rem; }
}

/* A 320 px el nombre completo de la marca competiría con los dos accesos.
   El enlace ya tiene nombre accesible y el logotipo mantiene la identidad; se
   reserva el ancho para que Entrar nunca desaparezca ni se solape. */
@media (max-width: 350px) {
  .trades-brand > span { display: none; }
  .trades-header { justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
  .trades-page *,
  .trades-page *::before,
  .trades-page *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
