/* ════════════════════════════════════════
   MARKET — Player-to-Player Trading Panel
════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════════════════════
   SIDEBAR PANEL (#panel-market)
   display controlled by .side-panel / .side-panel.active in hud.css
══════════════════════════════════════════════════════════════════════════ */
#panel-market {
  flex-direction: column;
  gap: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

/* ── Compact sidebar header ──────────────────────────────────────────────── */
.mkt-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-bottom: 1px solid rgba(180,140,50,0.3);
  background: linear-gradient(180deg, rgba(28,18,6,0.9) 0%, rgba(14,10,3,0.7) 100%);
  flex-shrink: 0;
}
.mkt-panel-label {
  font-family: var(--font-title);
  font-size: 9px;
  color: var(--text-gold);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  opacity: 0.85;
}
.mkt-open-btn {
  padding: 5px 11px;
  background: linear-gradient(180deg, rgba(200,160,20,0.22) 0%, rgba(160,120,0,0.16) 100%);
  border: 1px solid rgba(200,160,0,0.6);
  border-radius: 3px;
  color: var(--text-gold);
  font-family: var(--font-title);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,220,80,0.08);
}
.mkt-open-btn:hover {
  background: linear-gradient(180deg, rgba(200,160,20,0.38) 0%, rgba(160,120,0,0.28) 100%);
  border-color: rgba(220,180,0,0.85);
  box-shadow: 0 0 10px rgba(200,160,0,0.22), inset 0 1px 0 rgba(255,220,80,0.1);
  color: #ffe070;
}

/* ══════════════════════════════════════════════════════════════════════════
   FULL MARKET OVERLAY (#market-main — inside #main-area)
══════════════════════════════════════════════════════════════════════════ */
#market-main {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  flex-direction: column;
  background: #0c0905;
}
#market-main.open { display: flex; }

/* ── Full market header bar ──────────────────────────────────────────────── */
.mkt-main-topbar {
  display: flex;
  align-items: stretch;
  background: linear-gradient(180deg, #1e1608 0%, #120e05 100%);
  border-bottom: 2px solid rgba(180,140,50,0.5);
  flex-shrink: 0;
  min-height: 52px;
}

.mkt-main-title {
  font-family: var(--font-title);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-gold);
  letter-spacing: 3px;
  text-transform: uppercase;
  padding: 0 20px;
  white-space: nowrap;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  text-shadow: 0 0 16px rgba(200,160,40,0.35);
  border-right: 1px solid rgba(180,140,50,0.25);
}
.mkt-main-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  opacity: 0.80;
  filter: sepia(0.3) brightness(1.1);
  flex-shrink: 0;
}

/* Tabs inside full market topbar */
.mkt-main-topbar .mkt-tabs {
  flex: 1;
  align-self: stretch;
  border-bottom: none;
  background: none;
  justify-content: flex-start;
  align-items: stretch;
  gap: 0;
  padding: 0 6px;
}
.mkt-main-topbar .mkt-tab {
  flex: none;
  padding: 0 24px;
  font-family: var(--font-title);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  align-self: stretch;
  height: auto;
  color: rgba(190,160,90,0.55);
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.mkt-main-topbar .mkt-tab:hover {
  color: var(--text-light);
  background: rgba(180,140,50,0.07);
}
.mkt-main-topbar .mkt-tab.active {
  color: var(--text-gold);
  border-bottom-color: var(--text-gold);
  background: rgba(180,140,50,0.1);
}

.mkt-close-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  border-left: 1px solid rgba(180,140,50,0.2);
  color: rgba(180,140,90,0.5);
  font-family: var(--font-ui);
  font-size: 10px;
  cursor: pointer;
  padding: 0 18px;
  align-self: stretch;
  transition: all 0.15s;
  white-space: nowrap;
  letter-spacing: 0.5px;
}
.mkt-close-btn:hover {
  color: #e57373;
  background: rgba(200,60,60,0.1);
}

/* ══════════════════════════════════════════════════════════════════════════
   SHARED — SIDEBAR & FULL MARKET
══════════════════════════════════════════════════════════════════════════ */

/* ── Sidebar tab bar ─────────────────────────────────────────────────────── */
.mkt-tabs {
  display: flex;
  border-bottom: 2px solid rgba(180,140,50,0.28);
  background: rgba(0,0,0,0.28);
  flex-shrink: 0;
}

.mkt-tab {
  flex: 1;
  padding: 9px 4px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: var(--text-dim);
  font-family: var(--font-title);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.mkt-tab:hover  { color: var(--text-light); background: rgba(180,140,50,0.05); }
.mkt-tab.active { color: var(--text-gold);  border-bottom-color: var(--text-gold); }

/* ── Pane container ──────────────────────────────────────────────────────── */
.mkt-pane {
  display: none;
  flex: 1;
  overflow: hidden;
  flex-direction: column;
}
.mkt-pane.active { display: flex; }

/* ── Toolbar (search + filters) ──────────────────────────────────────────── */
.mkt-toolbar {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 7px 9px;
  background: rgba(0,0,0,0.2);
  border-bottom: 1px solid rgba(180,140,50,0.18);
  flex-shrink: 0;
}

.mkt-search-row { display: flex; gap: 4px; }

.mkt-search-input {
  flex: 1;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(180,140,50,0.3);
  border-radius: 3px;
  color: var(--text-light);
  font-family: var(--font-ui);
  font-size: 10px;
  padding: 5px 8px;
  outline: none;
  transition: border-color 0.15s;
}
.mkt-search-input::placeholder { color: var(--text-dim); }
.mkt-search-input:focus { border-color: rgba(180,140,50,0.6); }

.mkt-search-btn {
  padding: 4px 9px;
  background: rgba(180,140,50,0.18);
  border: 1px solid rgba(180,140,50,0.4);
  border-radius: 3px;
  color: var(--text-gold);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.mkt-search-btn:hover { background: rgba(180,140,50,0.3); }

.mkt-filter-row { display: flex; gap: 4px; }

.mkt-select {
  flex: 1;
  min-width: 0;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(180,140,50,0.25);
  border-radius: 3px;
  color: var(--text-light);
  font-family: var(--font-ui);
  font-size: 9px;
  padding: 4px 4px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.mkt-select:focus { border-color: rgba(180,140,50,0.5); }
.mkt-select option { background: #160f04; }

/* ── Scrollable listing area ─────────────────────────────────────────────── */
.mkt-list {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}
.mkt-list::-webkit-scrollbar       { width: 4px; }
.mkt-list::-webkit-scrollbar-track { background: transparent; }
.mkt-list::-webkit-scrollbar-thumb { background: rgba(180,140,50,0.3); border-radius: 2px; }

.mkt-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 10px;
  font-family: var(--font-ui);
  padding: 28px 16px;
  line-height: 1.9;
  letter-spacing: 0.3px;
}
.mkt-loading {
  text-align: center;
  color: var(--text-dim);
  font-size: 10px;
  font-family: var(--font-ui);
  padding: 18px;
}

/* ══════════════════════════════════════════════════════════════════════════
   BROWSE — Listing rows
══════════════════════════════════════════════════════════════════════════ */
.mkt-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-bottom: 1px solid rgba(180,140,50,0.1);
  cursor: pointer;
  transition: background 0.12s;
}
.mkt-row:hover     { background: rgba(180,140,50,0.07); }
.mkt-row:last-child { border-bottom: none; }

.mkt-row-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(180,140,50,0.28);
  border-radius: 4px;
  overflow: hidden;
  cursor: help;
  transition: border-color 0.15s;
}
.mkt-row-icon:hover {
  border-color: rgba(180,140,50,0.65);
}

.mkt-row-info { flex: 1; min-width: 0; }

.mkt-row-name {
  font-family: var(--font-title);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  letter-spacing: 0.3px;
}
.mkt-row-meta {
  font-family: var(--font-ui);
  font-size: 9px;
  color: var(--text-dim);
  line-height: 1.4;
  margin-top: 1px;
}

/* Rarity badge inline in meta/qty lines */
.mkt-rar-badge {
  font-family: var(--font-title);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.mkt-row-price {
  text-align: right;
  flex-shrink: 0;
}
.mkt-price-unit {
  font-family: var(--font-ui);
  font-size: 11px;
  color: #f0c040;
  font-weight: bold;
  white-space: nowrap;
}
.mkt-price-total {
  font-family: var(--font-ui);
  font-size: 8px;
  color: var(--text-dim);
  white-space: nowrap;
  margin-top: 1px;
}

.mkt-buy-btn {
  padding: 5px 8px;
  background: rgba(40,120,40,0.28);
  border: 1px solid rgba(80,180,80,0.45);
  border-radius: 3px;
  color: #7ddc7d;
  font-family: var(--font-title);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s;
  flex-shrink: 0;
}
.mkt-buy-btn:hover { background: rgba(40,120,40,0.5); }

/* ── Full market overlay — all tabs: 2-column card grid ─────────────────── */
#mkt-browse-list-m,
#mkt-my-list-m,
#mkt-hist-list-m {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 4px;
  align-content: start;
}

/* Empty / loading states span both columns */
#mkt-browse-list-m > .mkt-empty,
#mkt-browse-list-m > .mkt-loading,
#mkt-my-list-m > .mkt-empty,
#mkt-my-list-m > .mkt-loading,
#mkt-hist-list-m > .mkt-empty,
#mkt-hist-list-m > .mkt-loading {
  grid-column: 1 / -1;
}

/* Card styling for each row */
#market-main .mkt-row {
  padding: 10px 14px;
  gap: 11px;
  border-bottom: none;
  border: 1px solid rgba(180,140,50,0.13);
  border-radius: 4px;
  background: rgba(0,0,0,0.18);
}
#market-main .mkt-row:hover {
  background: rgba(180,140,50,0.09);
  border-color: rgba(180,140,50,0.28);
}

#market-main .mkt-row-icon {
  width: 46px;
  height: 46px;
  border-radius: 5px;
}
#market-main .mkt-row-name {
  font-size: 12px;
  letter-spacing: 0.5px;
}
#market-main .mkt-row-meta {
  font-size: 11px;
  margin-top: 4px;
  line-height: 1.5;
}
#market-main .mkt-price-unit  {
  font-size: 13px;
}
#market-main .mkt-price-total {
  font-size: 12px;
  color: #c8a830;
  font-weight: bold;
  margin-top: 3px;
}
#market-main .mkt-buy-btn {
  padding: 7px 14px;
  font-size: 10px;
  letter-spacing: 1px;
}
#market-main .mkt-toolbar {
  padding: 9px 16px;
  gap: 7px;
}
#market-main .mkt-search-input {
  font-size: 11px;
  padding: 6px 10px;
}
#market-main .mkt-select {
  font-size: 10px;
  padding: 5px 6px;
}
#market-main .mkt-search-btn {
  font-size: 14px;
  padding: 6px 12px;
}

/* ══════════════════════════════════════════════════════════════════════════
   MY LISTINGS tab
══════════════════════════════════════════════════════════════════════════ */
.mkt-my-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 9px;
  border-bottom: 1px solid rgba(180,140,50,0.18);
  background: rgba(0,0,0,0.2);
  flex-shrink: 0;
}
#market-main .mkt-my-header { padding: 10px 16px; }

.mkt-slot-count {
  font-family: var(--font-ui);
  font-size: 10px;
  color: var(--text-dim);
}
.mkt-slot-count.full { color: #e57373; font-weight: bold; }

.mkt-sell-btn {
  padding: 5px 11px;
  background: rgba(180,140,50,0.2);
  border: 1px solid rgba(180,140,50,0.55);
  border-radius: 3px;
  color: var(--text-gold);
  font-family: var(--font-title);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.12s;
}
.mkt-sell-btn:hover { background: rgba(180,140,50,0.38); }
#market-main .mkt-sell-btn { padding: 7px 16px; font-size: 10px; letter-spacing: 1.5px; }

.mkt-my-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-bottom: 1px solid rgba(180,140,50,0.1);
  transition: background 0.12s;
}
.mkt-my-row:hover { background: rgba(180,140,50,0.05); }
.mkt-my-row:last-child { border-bottom: none; }
#market-main .mkt-my-row {
  padding: 10px 14px;
  gap: 11px;
  border-bottom: none;
  border: 1px solid rgba(180,140,50,0.13);
  border-radius: 4px;
  background: rgba(0,0,0,0.18);
}
#market-main .mkt-my-row:hover {
  background: rgba(180,140,50,0.09);
  border-color: rgba(180,140,50,0.28);
}

.mkt-my-row-info { flex: 1; min-width: 0; }
.mkt-my-row-name {
  font-family: var(--font-title);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.3px;
}
#market-main .mkt-my-row-name { font-size: 12px; letter-spacing: 0.5px; }

.mkt-my-row-qty {
  font-family: var(--font-ui);
  font-size: 9px;
  color: var(--text-dim);
  margin-top: 2px;
}
#market-main .mkt-my-row-qty { font-size: 10px; margin-top: 3px; }

/* Rarity badge inside mkt-my-row-qty */
.mkt-my-row-qty .mkt-rar-badge {
  font-size: 9px;
}
#market-main .mkt-my-row-qty .mkt-rar-badge {
  font-size: 10px;
}

.mkt-cancel-btn {
  padding: 4px 8px;
  background: rgba(120,30,30,0.32);
  border: 1px solid rgba(180,60,60,0.45);
  border-radius: 3px;
  color: #e57373;
  font-family: var(--font-ui);
  font-size: 9px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s;
}
.mkt-cancel-btn:hover { background: rgba(140,35,35,0.55); }
#market-main .mkt-cancel-btn { padding: 6px 12px; font-size: 10px; }

/* Status variants */
.mkt-my-row.expired   { opacity: 0.45; }
.mkt-my-row.sold      { opacity: 0.55; }
.mkt-my-row.cancelled { opacity: 0.45; }

/* ══════════════════════════════════════════════════════════════════════════
   HISTORY tab
══════════════════════════════════════════════════════════════════════════ */
.mkt-hist-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 9px;
  border-bottom: 1px solid rgba(180,140,50,0.1);
  transition: background 0.12s;
}
.mkt-hist-row:hover { background: rgba(180,140,50,0.05); }
.mkt-hist-row:last-child { border-bottom: none; }
#market-main .mkt-hist-row {
  padding: 10px 14px;
  gap: 11px;
  border-bottom: none;
  border: 1px solid rgba(180,140,50,0.13);
  border-radius: 4px;
  background: rgba(0,0,0,0.18);
}
#market-main .mkt-hist-row:hover {
  background: rgba(180,140,50,0.09);
  border-color: rgba(180,140,50,0.28);
}

/* ── History icon: item image + tx-type badge overlay ───────────────────── */
.mkt-hist-icon-wrap {
  position: relative;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
}
.mkt-hist-item-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(180,140,50,0.28);
  border-radius: 4px;
  overflow: hidden;
}
.mkt-hist-tx-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  font-size: 11px;
  line-height: 1;
  filter: drop-shadow(0 0 3px rgba(0,0,0,0.9)) drop-shadow(0 0 3px rgba(0,0,0,0.9));
}
#market-main .mkt-hist-icon-wrap {
  width: 46px;
  height: 46px;
}
#market-main .mkt-hist-item-icon {
  width: 46px;
  height: 46px;
  border-radius: 5px;
}
#market-main .mkt-hist-tx-badge {
  font-size: 14px;
  bottom: -5px;
  right: -5px;
}

.mkt-hist-info {
  flex: 1;
  min-width: 0;
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 9px;
  line-height: 1.6;
}
#market-main .mkt-hist-info { font-size: 10px; line-height: 1.7; }

.mkt-hist-name {
  font-family: var(--font-title);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 1px;
  letter-spacing: 0.3px;
}
#market-main .mkt-hist-name { font-size: 12px; letter-spacing: 0.5px; }

.mkt-hist-amount       { color: #f0c040; font-weight: bold; }
.mkt-hist-amount.spent { color: #e57373; }

/* ══════════════════════════════════════════════════════════════════════════
   SELL MODAL
══════════════════════════════════════════════════════════════════════════ */
#market-sell-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0,0,0,0.75);
  align-items: center;
  justify-content: center;
}
#market-sell-modal.visible { display: flex; }

.sell-modal-box {
  background: linear-gradient(180deg, #1a120a 0%, #110c05 100%);
  border: 1px solid rgba(180,140,50,0.55);
  border-radius: 6px;
  box-shadow: 0 10px 50px rgba(0,0,0,0.85);
  width: 380px;
  max-width: 96vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sell-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(180,140,50,0.3);
  background: rgba(0,0,0,0.25);
}
.sell-modal-title {
  font-family: var(--font-title);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-gold);
  letter-spacing: 1px;
}
.sell-modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 17px;
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
  transition: color 0.12s;
}
.sell-modal-close:hover { color: var(--text-light); }

/* Step container */
.sell-step {
  display: none;
  flex: 1;
  overflow: hidden;
  flex-direction: column;
}
.sell-step.active { display: flex; }

.sell-step-label {
  font-family: var(--font-title);
  font-size: 9px;
  font-weight: 700;
  color: var(--text-dim);
  padding: 7px 16px 5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* Step 1: inventory grid */
.sell-inv-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  padding: 8px 12px;
  overflow-y: auto;
  flex: 1;
}
.sell-inv-grid::-webkit-scrollbar       { width: 4px; }
.sell-inv-grid::-webkit-scrollbar-thumb { background: rgba(180,140,50,0.3); border-radius: 2px; }

.sell-item-slot {
  aspect-ratio: 1;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(180,140,50,0.22);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: border-color 0.12s, background 0.12s;
  overflow: hidden;
}
.sell-item-slot:hover    { border-color: rgba(180,140,50,0.55); background: rgba(180,140,50,0.1); }
.sell-item-slot.selected { border-color: var(--text-gold);       background: rgba(180,140,50,0.18); }

/* ── Rarity glow on sell-modal inventory slots ───────────────────────────── */
/* border + outer glow + inset glow for each rarity/quality tier             */
.sell-item-slot[data-rarity="uncommon"] {
  border-color: rgba(59,255,69,0.75);
  box-shadow: 0 0 7px rgba(59,255,69,0.35), inset 0 0 8px rgba(59,255,69,0.18);
}
.sell-item-slot[data-rarity="rare"] {
  border-color: rgba(42,144,247,0.80);
  box-shadow: 0 0 8px rgba(42,144,247,0.40), inset 0 0 8px rgba(42,144,247,0.20);
}
.sell-item-slot[data-rarity="superior"] {
  border-color: rgba(250,227,21,0.85);
  box-shadow: 0 0 8px rgba(250,227,21,0.40), inset 0 0 9px rgba(250,227,21,0.20);
}
.sell-item-slot[data-rarity="epic"] {
  border-color: rgba(163,4,211,0.90);
  box-shadow: 0 0 10px rgba(163,4,211,0.50), inset 0 0 10px rgba(163,4,211,0.24);
}
.sell-item-slot[data-rarity="legendary"] {
  border-color: rgba(253,127,9,0.95);
  box-shadow: 0 0 12px rgba(253,127,9,0.55), inset 0 0 10px rgba(253,127,9,0.26);
}
.sell-item-slot[data-rarity="mythic"] {
  border-color: rgba(180,245,0,0.90);
  box-shadow: 0 0 12px rgba(180,245,0,0.50), inset 0 0 10px rgba(180,245,0,0.24);
}
.sell-item-slot[data-rarity="ancient"] {
  border-color: rgba(0,255,170,0.90);
  box-shadow: 0 0 12px rgba(0,255,170,0.50), inset 0 0 10px rgba(0,255,170,0.24);
}
.sell-item-slot[data-rarity="divine"] {
  border-color: rgba(247,14,177,0.95);
  box-shadow: 0 0 14px rgba(247,14,177,0.55), inset 0 0 11px rgba(247,14,177,0.28);
}
.sell-item-slot[data-rarity="transcendent"] {
  border-color: rgba(255,0,21,0.95);
  box-shadow: 0 0 14px rgba(255,0,21,0.55), inset 0 0 11px rgba(255,0,21,0.28);
}

/* Image glow inside the slot — applies to both <img> and emoji <span> */
.sell-item-slot[data-rarity="uncommon"]     img,
.sell-item-slot[data-rarity="uncommon"]     > span { filter: drop-shadow(0 0 4px #3bff45); }
.sell-item-slot[data-rarity="rare"]         img,
.sell-item-slot[data-rarity="rare"]         > span { filter: drop-shadow(0 0 4px #2a90f7); }
.sell-item-slot[data-rarity="superior"]     img,
.sell-item-slot[data-rarity="superior"]     > span { filter: drop-shadow(0 0 5px #fae315); }
.sell-item-slot[data-rarity="epic"]         img,
.sell-item-slot[data-rarity="epic"]         > span { filter: drop-shadow(0 0 6px #a304d3) drop-shadow(0 0 3px #a304d3); }
.sell-item-slot[data-rarity="legendary"]    img,
.sell-item-slot[data-rarity="legendary"]    > span { filter: drop-shadow(0 0 6px #fd7f09) drop-shadow(0 0 3px #fd7f09); }
.sell-item-slot[data-rarity="mythic"]       img,
.sell-item-slot[data-rarity="mythic"]       > span { filter: drop-shadow(0 0 6px #b4f500); }
.sell-item-slot[data-rarity="ancient"]      img,
.sell-item-slot[data-rarity="ancient"]      > span { filter: drop-shadow(0 0 6px #00ffaa); }
.sell-item-slot[data-rarity="divine"]       img,
.sell-item-slot[data-rarity="divine"]       > span { filter: drop-shadow(0 0 7px #f70eb1) drop-shadow(0 0 3px #f70eb1); }
.sell-item-slot[data-rarity="transcendent"] img,
.sell-item-slot[data-rarity="transcendent"] > span { filter: drop-shadow(0 0 7px #ff0015) drop-shadow(0 0 3px #ff0015); }

.sell-item-slot .item-qty-badge {
  position: absolute;
  bottom: 1px;
  right: 2px;
  font-size: 8px;
  color: #fff;
  font-family: var(--font-ui);
  text-shadow: 0 0 3px #000, 0 0 3px #000;
  pointer-events: none;
}

/* Step 2: form */
.sell-form {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  flex: 1;
  overflow-y: auto;
}

.sell-selected-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(180,140,50,0.25);
  border-radius: 5px;
}
.sell-selected-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(180,140,50,0.28);
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}
.sell-selected-info { flex: 1; min-width: 0; }
.sell-selected-name {
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.4px;
}
.sell-selected-rarity {
  font-family: var(--font-ui);
  font-size: 9px;
  color: var(--text-dim);
  text-transform: capitalize;
  margin-top: 2px;
}
.sell-selected-qty {
  font-family: var(--font-ui);
  font-size: 9px;
  color: rgba(180,160,100,0.7);
  margin-top: 3px;
  letter-spacing: 0.3px;
}

.sell-form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.sell-form-label {
  font-family: var(--font-title);
  font-size: 9px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.sell-form-input {
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(180,140,50,0.32);
  color: var(--text-light);
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 6px 9px;
  border-radius: 3px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.sell-form-input:focus { border-color: rgba(180,140,50,0.65); }

/* Duration buttons */
.sell-duration-row { display: flex; gap: 6px; }
.sell-dur-btn {
  flex: 1;
  padding: 6px 4px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(180,140,50,0.25);
  border-radius: 3px;
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 9px;
  cursor: pointer;
  text-align: center;
  transition: all 0.12s;
}
.sell-dur-btn:hover    { border-color: rgba(180,140,50,0.5); color: var(--text-light); }
.sell-dur-btn.selected { border-color: var(--text-gold); color: var(--text-gold); background: rgba(180,140,50,0.14); }
.sell-dur-label { font-size: 11px; font-weight: bold; display: block; }
.sell-dur-tax   { font-size: 8px; color: #e57373; display: block; margin-top: 1px; }

/* Summary box */
.sell-summary {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(180,140,50,0.22);
  border-radius: 5px;
  padding: 9px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sell-summary-line {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-ui);
  font-size: 10px;
  color: var(--text-dim);
}
.sell-summary-line.total {
  border-top: 1px solid rgba(180,140,50,0.2);
  padding-top: 5px;
  margin-top: 3px;
  color: var(--text-light);
  font-weight: bold;
}
.sell-summary-gold { color: #f0c040; }
.sell-summary-tax  { color: #e57373; }

/* Modal footer */
.sell-modal-footer {
  display: flex;
  gap: 7px;
  padding: 11px 16px;
  border-top: 1px solid rgba(180,140,50,0.22);
  flex-shrink: 0;
  background: rgba(0,0,0,0.2);
}
.sell-footer-btn {
  flex: 1;
  padding: 8px;
  border-radius: 3px;
  font-family: var(--font-title);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  border: 1px solid;
  transition: background 0.15s;
}
.sell-footer-btn.primary {
  background: rgba(180,140,50,0.22);
  border-color: rgba(180,140,50,0.65);
  color: var(--text-gold);
}
.sell-footer-btn.primary:hover    { background: rgba(180,140,50,0.38); }
.sell-footer-btn.primary:disabled { opacity: 0.38; cursor: default; }
.sell-footer-btn.secondary {
  background: rgba(0,0,0,0.3);
  border-color: rgba(180,140,50,0.22);
  color: var(--text-dim);
}
.sell-footer-btn.secondary:hover { background: rgba(0,0,0,0.5); color: var(--text-light); }

/* ══════════════════════════════════════════════════════════════════════════
   BUY MODAL
══════════════════════════════════════════════════════════════════════════ */
#market-buy-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0,0,0,0.72);
  align-items: center;
  justify-content: center;
}
#market-buy-modal.visible { display: flex; }

.buy-modal-box {
  background: linear-gradient(180deg, #1a120a 0%, #110c05 100%);
  border: 1px solid rgba(180,140,50,0.55);
  border-radius: 6px;
  box-shadow: 0 10px 50px rgba(0,0,0,0.85);
  width: 300px;
  max-width: 96vw;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.buy-modal-title {
  font-family: var(--font-title);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-gold);
  text-align: center;
  letter-spacing: 1px;
}
.buy-modal-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,0.3);
  padding: 9px 10px;
  border-radius: 5px;
  border: 1px solid rgba(180,140,50,0.22);
}
.buy-modal-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(180,140,50,0.25);
  border-radius: 4px;
  overflow: hidden;
}
.buy-modal-info { flex: 1; min-width: 0; }
.buy-modal-name {
  font-family: var(--font-title);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.4px;
}
.buy-modal-seller {
  font-family: var(--font-ui);
  font-size: 9px;
  color: var(--text-dim);
  margin-top: 2px;
}
.buy-modal-field { display: flex; flex-direction: column; gap: 5px; }
.buy-modal-label {
  font-family: var(--font-title);
  font-size: 9px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.buy-modal-input {
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(180,140,50,0.32);
  color: var(--text-light);
  font-family: var(--font-ui);
  font-size: 13px;
  padding: 7px 9px;
  border-radius: 3px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  transition: border-color 0.15s;
}
.buy-modal-input:focus { border-color: rgba(180,140,50,0.65); }
.buy-modal-total {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
}
.buy-modal-total .gold { color: #f0c040; font-weight: bold; }
.buy-modal-actions { display: flex; gap: 7px; }
.buy-confirm-btn {
  flex: 1;
  padding: 8px;
  background: rgba(40,120,40,0.28);
  border: 1px solid rgba(80,180,80,0.48);
  border-radius: 3px;
  color: #7ddc7d;
  font-family: var(--font-title);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.12s;
}
.buy-confirm-btn:hover    { background: rgba(40,120,40,0.5); }
.buy-confirm-btn:disabled { opacity: 0.38; cursor: default; }
.buy-cancel-btn {
  flex: 1;
  padding: 8px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(180,140,50,0.25);
  border-radius: 3px;
  color: var(--text-dim);
  font-family: var(--font-title);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.12s;
}
.buy-cancel-btn:hover { background: rgba(0,0,0,0.5); color: var(--text-light); }
