/* ================================================
   MARKETPLACE STYLES
   Matches existing game UI patterns (glassmorphism, dark theme)
   ================================================ */

/* ─────────────── MARKETPLACE TAB CONTENT ─────────────── */
#shopTab-marketplace {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Locked state (not eligible) */
.mp-locked {
  text-align: center;
  padding: 40px 20px;
}

.mp-locked-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.mp-locked-title {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.mp-locked-reason {
  font-size: 13px;
  color: var(--danger);
  line-height: 1.5;
}

/* ─────────────── TOP BAR (coins + refresh) ─────────────── */
.mp-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mp-topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mp-coins {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  font-family: var(--font-title);
}

.mp-refresh-btn {
  padding: 7px 14px;
  background: rgba(88,166,255,0.12);
  border: 1px solid rgba(88,166,255,0.3);
  border-radius: 7px;
  color: var(--accent);
  font-family: var(--font-title);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s;
}

.mp-refresh-btn:hover:not(:disabled) {
  background: rgba(88,166,255,0.25);
  transform: translateY(-1px);
}

.mp-refresh-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ─────────────── FILTERS & SORT ─────────────── */
.mp-controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.mp-filter-btn,
.mp-sort-btn {
  padding: 5px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.mp-filter-btn:hover,
.mp-sort-btn:hover {
  background: rgba(88,166,255,0.1);
  color: var(--accent);
}

.mp-filter-btn.active {
  background: rgba(88,166,255,0.2);
  border-color: var(--accent);
  color: var(--accent);
}

.mp-sort-btn.active {
  background: rgba(88,166,255,0.15);
  border-color: rgba(88,166,255,0.4);
  color: var(--accent);
}

.mp-listing-count {
  font-size: 11px;
  color: var(--muted);
  margin-left: auto;
}

/* ─────────────── MESSAGE BAR ─────────────── */
.mp-message {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  animation: fadeIn 0.2s ease;
}

.mp-msg-success {
  background: rgba(107,255,123,0.12);
  border: 1px solid rgba(107,255,123,0.3);
  color: var(--success);
}

.mp-msg-error {
  background: rgba(255,71,87,0.12);
  border: 1px solid rgba(255,71,87,0.3);
  color: var(--danger);
}

/* ─────────────── LISTINGS GRID ─────────────── */
.mp-listings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding: 2px;
}

.mp-listings-grid::-webkit-scrollbar { width: 4px; }
.mp-listings-grid::-webkit-scrollbar-track { background: transparent; }
.mp-listings-grid::-webkit-scrollbar-thumb { background: rgba(88,166,255,0.3); border-radius: 4px; }

/* ─────────────── LISTING CARD ─────────────── */
.mp-listing-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(88,166,255,0.12);
  border-radius: 10px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.mp-listing-card:hover {
  background: rgba(88,166,255,0.06);
  border-color: rgba(88,166,255,0.25);
  transform: translateY(-2px);
}

.mp-listing-preview {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mp-listing-info {
  text-align: center;
  width: 100%;
}

.mp-listing-name {
  font-family: var(--font-title);
  font-size: 10px;
  font-weight: 700;
  color: #dbe7ff;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  line-height: 1.3;
  min-height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mp-listing-rarity {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 2px 0;
}

.mp-listing-seller {
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-listing-time {
  font-size: 9px;
  color: rgba(255,255,255,0.3);
}

.mp-listing-bottom {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.mp-listing-price {
  font-family: var(--font-title);
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.5px;
}

.mp-listing-price::before {
  content: '🪙 ';
  font-size: 11px;
}

/* ─────────────── BUY MODAL PREVIEW ─────────────── */
.mp-buy-modal-preview {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ─────────────── BUY BUTTON ─────────────── */
.mp-buy-btn {
  width: 100%;
  padding: 5px 8px;
  border-radius: 6px;
  font-family: var(--font-title);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-transform: uppercase;
  background: linear-gradient(135deg, rgba(107,255,123,0.2), rgba(88,166,255,0.2));
  color: var(--success);
  border: 1px solid rgba(107,255,123,0.3);
}

.mp-buy-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(107,255,123,0.35), rgba(88,166,255,0.35));
  transform: translateY(-1px);
}

.mp-buy-btn:disabled,
.mp-buy-btn.disabled {
  opacity: 0.4;
  cursor: default;
  background: rgba(255,255,255,0.05);
  color: var(--muted);
  border-color: rgba(255,255,255,0.1);
}

/* ─────────────── LOAD MORE ─────────────── */
.mp-load-more-btn {
  width: 100%;
  padding: 8px;
  background: rgba(88,166,255,0.08);
  border: 1px solid rgba(88,166,255,0.2);
  border-radius: 8px;
  color: var(--accent);
  font-family: var(--font-title);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
}

.mp-load-more-btn:hover:not(:disabled) {
  background: rgba(88,166,255,0.18);
}

.mp-load-more-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ─────────────── EMPTY STATE ─────────────── */
.mp-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 30px 20px;
}

.mp-empty-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.mp-empty-text {
  font-family: var(--font-title);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 1px;
}

.mp-empty-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  margin-top: 4px;
}

.mp-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 30px;
  color: var(--muted);
  font-size: 13px;
}

/* ─────────────── MY LISTINGS SECTION ─────────────── */
.mp-my-section {
  margin-top: 8px;
  padding: 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(88,166,255,0.1);
  border-radius: 10px;
}

.mp-my-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.mp-my-title {
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.mp-sell-btn {
  padding: 5px 12px;
  background: linear-gradient(135deg, rgba(255,215,0,0.15), rgba(255,165,0,0.15));
  border: 1px solid rgba(255,215,0,0.3);
  border-radius: 6px;
  color: var(--gold);
  font-family: var(--font-title);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s;
}

.mp-sell-btn:hover {
  background: linear-gradient(135deg, rgba(255,215,0,0.25), rgba(255,165,0,0.25));
  transform: translateY(-1px);
}

.mp-my-empty {
  text-align: center;
  padding: 16px;
  color: var(--muted);
  font-size: 12px;
}

.mp-my-listing {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(13,21,37,0.4);
  border: 1px solid rgba(88,166,255,0.1);
  border-radius: 8px;
  margin-bottom: 6px;
}

.mp-my-preview {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mp-my-info {
  flex: 1;
  min-width: 0;
}

.mp-my-name {
  font-size: 12px;
  font-weight: 600;
  color: #dbe7ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-my-price {
  font-size: 10px;
  color: var(--gold);
}

.mp-cancel-btn {
  padding: 4px 10px;
  background: rgba(255,71,87,0.12);
  border: 1px solid rgba(255,71,87,0.3);
  border-radius: 5px;
  color: var(--danger);
  font-family: var(--font-title);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.mp-cancel-btn:hover {
  background: rgba(255,71,87,0.25);
}

/* ─────────────── SELL MODAL ─────────────── */
.mp-sell-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6,12,24,0.9);
  backdrop-filter: blur(10px);
  z-index: 200;
  animation: fadeIn 0.2s ease;
}

.mp-sell-box {
  background: rgba(13,21,37,0.98);
  border: 1px solid rgba(255,215,0,0.25);
  border-radius: 14px;
  padding: 24px;
  max-width: 360px;
  width: 90%;
  box-shadow: 0 15px 40px rgba(0,0,0,0.5);
  animation: panelPop 0.25s cubic-bezier(0.34,1.56,0.64,1);
}

.mp-sell-title {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 2px;
  text-align: center;
  margin-bottom: 16px;
}

.mp-sell-field {
  margin-bottom: 14px;
}

.mp-sell-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  display: block;
}

.mp-sell-select,
.mp-sell-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(88,166,255,0.2);
  border-radius: 8px;
  color: #dbe7ff;
  font-family: var(--font-hud);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.mp-sell-select:focus,
.mp-sell-input:focus {
  border-color: var(--accent);
}

.mp-sell-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.mp-sell-tax {
  font-size: 12px;
  color: var(--gold);
  text-align: center;
  min-height: 18px;
  margin-bottom: 12px;
}

.mp-sell-error {
  padding: 8px 12px;
  background: rgba(255,71,87,0.12);
  border: 1px solid rgba(255,71,87,0.3);
  border-radius: 6px;
  color: var(--danger);
  font-size: 12px;
  text-align: center;
  margin-bottom: 12px;
}

.mp-sell-actions {
  display: flex;
  gap: 8px;
}

.mp-sell-confirm-btn {
  flex: 2;
  padding: 10px;
  background: linear-gradient(135deg, rgba(255,215,0,0.2), rgba(255,165,0,0.2));
  border: 1px solid rgba(255,215,0,0.35);
  border-radius: 8px;
  color: var(--gold);
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
}

.mp-sell-confirm-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(255,215,0,0.35), rgba(255,165,0,0.35));
}

.mp-sell-confirm-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.mp-sell-cancel-btn {
  flex: 1;
  padding: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  color: var(--muted);
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.mp-sell-cancel-btn:hover {
  background: rgba(255,255,255,0.1);
}

/* ─────────────── RESPONSIVE ─────────────── */
@media (max-width: 600px) {
  .mp-listings-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
  }

  .mp-listing-card {
    padding: 10px 8px;
  }

  .mp-listing-name {
    font-size: 9px;
  }

  .mp-controls {
    gap: 4px;
  }

  .mp-filter-btn,
  .mp-sort-btn {
    padding: 4px 7px;
    font-size: 10px;
  }
}

@media (max-height: 700px) {
  .mp-listings-grid {
    max-height: 240px;
  }
}

@media (max-height: 600px) {
  .mp-listings-grid {
    max-height: 180px;
  }
}
/* ─────────────── SEARCH INPUT ─────────────── */
.mp-search-input {
  width: 100%;
  padding: 8px 14px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(88,166,255,0.18);
  border-radius: 8px;
  color: #dbe7ff;
  font-family: var(--font-hud);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
  margin-bottom: 2px;
}

.mp-search-input::placeholder {
  color: rgba(255,255,255,0.3);
}

.mp-search-input:focus {
  border-color: rgba(88,166,255,0.45);
  background: rgba(0,0,0,0.5);
}

/* ─────────────── RECENT TRADES ─────────────── */
.mp-recent-section {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(88,166,255,0.08);
  border-radius: 10px;
}

.mp-recent-header {
  font-family: var(--font-title);
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.mp-recent-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 11px;
}

.mp-recent-row:last-child {
  border-bottom: none;
}

.mp-recent-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mp-recent-name {
  flex: 1;
  color: #c8d8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.mp-recent-price {
  color: var(--gold);
  font-weight: 700;
  white-space: nowrap;
  font-family: var(--font-title);
  font-size: 11px;
}

.mp-recent-time {
  color: rgba(255,255,255,0.3);
  font-size: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.mp-recent-loading,
.mp-recent-empty {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  padding: 8px;
}

/* ─────────────── CARD RARITY GLOW (enhancement) ─────────────── */
.mp-listing-card {
  position: relative;
  overflow: hidden;
}

.mp-listing-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--rarity-color, #58a6ff) 8%, transparent),
    transparent 60%
  );
  pointer-events: none;
  border-radius: 10px;
  opacity: 0;
  transition: opacity 0.25s;
}

.mp-listing-card:hover::before {
  opacity: 1;
}