/* =========================================================================
   DER MARKTPLATZ (01.10.2026), nachgebaut nach dem Launcher
   =========================================================================
   Werte aus `launcher/src/styles/markt.css` (Zweig launcher-reiter), nicht
   angenähert. Groß: links Kartenkopf und Karte, rechts eine Spalte von
   340 Punkten mit Suche, Liste und Preisverlauf. Schmal: nur die Spalte.
   Code: assets/js/features/market/marketplace.js
   ========================================================================= */

.mp {
  position: relative;
  display: grid;

  /*
    Die rechte Spalte ist das Wichtigste und bekommt viel Platz (Renés Ansage
    01.10.2026: "Rechts der Bereich, der soll viel Platz bekommen. Der ist viel,
    viel wichtiger."). Im Launcher waren es feste 340 Punkte. Die linke Spalte ist
    genau so breit wie die Karte (`--mp-mapw`, gesetzt von marketplace.js aus
    ihrer Höhe), die Mitte fest 340, die rechte nimmt den Rest. Nichts
    verschiebt sich, wenn ein Händler aufgeht. Rechts Luft zum Rand.
  */
  grid-template-columns: var(--mp-mapw, minmax(0, 1fr)) 340px minmax(400px, 1fr);
  padding-right: 14px;
  gap: 14px;
  height: 100%;
  min-height: 0;
  color: rgb(230 232 238);
  font-size: 0.8125rem;
}

.panel:not(.is-gross) .mp {
  grid-template-columns: minmax(0, 1fr);
  height: auto;
}

/* Im Großen füllt der Markt den rollenden Teil, wie die Karte. */
.panel.is-gross #view-markt:not([hidden]) {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding-bottom: 0.6rem;
}

.panel.is-gross #view-markt .mp {
  flex: 1 1 auto;
}

/* ------------------------------------------------------------- Kartenspalte */

.mp-mapcol {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  min-height: 0;
}

.mp-maphead {
  display: flex;
  gap: 8px;
  align-items: center;
}

.mp-arrow {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid rgb(232 195 122 / 30%);
  border-radius: 6px;
  background: rgb(232 195 122 / 8%);
  color: var(--gold);
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.mp-arrow:hover:not(:disabled) {
  border-color: rgb(232 195 122 / 70%);
  background: rgb(232 195 122 / 18%);
}

.mp-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

.mp-mapname {
  flex: 1 1 auto;
  overflow: hidden;
  color: var(--gold);
  font-size: 0.9375rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mp-mapcount,
.mp-status {
  color: rgb(210 190 150 / 62%);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
}

.mp-mapfield {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  gap: 12px;
  align-items: stretch;
  min-width: 0;
  min-height: 0;
}

.mp-mapbox {
  position: relative;
  flex: 0 0 auto;
  height: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.mp-mapimg {
  position: absolute;
  max-width: none;
  user-select: none;
  pointer-events: none;
}

.mp-markers {
  position: absolute;
  inset: 0;
}

.mp .asg-wk-nscmarke-laden {
  --asg-wk-artfarbe: rgb(232 195 122);

  width: 9px;
  height: 9px;
}

.mp-nomap {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgb(210 190 150 / 62%);
}

.mp-nomap[hidden] {
  display: none;
}

/* ------------------------------------------- die Mitte: Suche oder Laden */

/*
  Renés Aufteilung 01.10.2026: oben die Suche, darunter die Suchanzeige oder
  der gewählte Händler, fest 340 breit.
*/
.mp-middle {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  min-height: 0;
}

.mp-results {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.mp-results[hidden] {
  display: none;
}

/* Die Suchanzeige in der Mitte: Waren mit Ladenzahl und Preis ab. */
.mp-hitlist {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mp-hit {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 3px 8px;
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 6px;
  background: rgb(255 255 255 / 4%);
  color: rgb(230 232 238);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.mp-hit:hover {
  background: rgb(255 255 255 / 8%);
}

.mp-hit.is-on {
  border-color: rgb(214 176 106 / 70%);
  background: rgb(214 176 106 / 10%);
}

.mp-hitinfo {
  flex: 0 0 auto;
  margin-left: auto;
  color: rgb(210 190 150 / 70%);
  font-size: 0.6875rem;
  white-space: nowrap;
}

/* Ohne Suche: der Hinweis in einer eigenen Box, mittig im freien Feld. */
.mp-results.is-hint {
  display: grid;
  place-items: center;
}

.mp-searchhint {
  max-width: 17rem;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 10px;
  background: rgb(0 0 0 / 22%);
  line-height: 1.5;
  text-align: center;
}

/* --------------------------------------------------------------- der Laden */

.mp-shop {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  min-height: 0;
  padding: 8px;
  border: 1px solid rgb(214 176 106 / 35%);
  border-radius: 8px;
  background: rgb(255 255 255 / 4%);
  animation: mp-appear 320ms ease 200ms both;
}

.mp-shop[hidden] {
  display: none;
}

@keyframes mp-appear {
  from {
    opacity: 0;
    transform: translateX(14px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.mp-figure {
  display: grid;
  flex: 0 0 auto;
  place-items: end center;
  height: 170px;
  overflow: hidden;
}

/* Schmal steht der Laden über der Liste: kleiner, damit die Liste sichtbar bleibt. */
.panel:not(.is-gross) .mp-shop {
  max-height: 30rem;
}

.panel:not(.is-gross) .mp-figure {
  height: 110px;
}

.mp-figure img {
  max-height: 100%;
  image-rendering: pixelated;
}

.mp-figure img[hidden] {
  display: none;
}

.mp-shophead {
  display: grid;
  grid-template: 'title close' auto 'seller close' auto / 1fr auto;
  column-gap: 8px;
  align-items: center;
}

.mp-shophead .mp-shoptitle {
  grid-area: title;
}

.mp-shopseller {
  grid-area: seller;
  color: rgb(210 215 225 / 72%);
  font-size: 0.75rem;
}

.mp-close {
  grid-area: close;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 50%;
  background: none;
  color: rgb(230 232 238 / 70%);
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.mp-close:hover {
  border-color: rgb(214 176 106 / 60%);
  color: var(--gold);
}

.mp-tablewrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden auto;
}

.mp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.mp-table th {
  position: sticky;
  top: 0;
  padding: 3px 4px;
  background: rgb(12 14 20 / 95%);
  color: rgb(210 190 150 / 62%);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-align: left;
  text-transform: uppercase;
}

.mp-table td {
  padding: 3px 4px;
  border-top: 1px solid rgb(255 255 255 / 6%);
  vertical-align: middle;
}

/* Die Ware nimmt den Rest und wird gekürzt; Menge und Preis bleiben einzeilig. */
.mp-shop .mp-table td:first-child {
  max-width: 0;
  overflow: hidden;
}

.mp-num {
  width: 1%;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.mp-shop .mp-table th:nth-child(2),
.mp-shop .mp-table td:nth-child(2) {
  padding-right: 12px;
  text-align: center;
}
