/* ========================================
   MARKET PAGE V2 - TokenLordsRPG
   Premium Trading Interface
   ======================================== */

/* ===== Layout ===== */
.market-page {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 1200px) {
  .market-page {
    grid-template-columns: 1fr 380px;
  }
}

/* ===== Panel Base ===== */
.market-panel {
  background: linear-gradient(180deg, rgba(18, 22, 32, 0.95) 0%, rgba(12, 15, 22, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 1.75rem;
  position: relative;
  overflow: hidden;
}

.market-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(247, 160, 15, 0.4), transparent);
}

.market-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.market-panel-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  letter-spacing: 0.25rem;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.95);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.market-panel-title .icon {
  font-size: 1.3rem;
}

.market-eyebrow {
  font-size: 0.65rem;
  letter-spacing: 0.2rem;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 0.3rem;
}

/* ===== Hero Stats Bar ===== */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.hero-stat {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  text-align: center;
}

.hero-stat-label {
  font-size: 0.65rem;
  letter-spacing: 0.15rem;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  margin: 0 0 0.4rem;
}

.hero-stat-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0;
  color: rgba(255, 255, 255, 0.95);
}

.hero-stat-value.gold { color: #f7a00f; }
.hero-stat-value.green { color: #22c55e; }
.hero-stat-value.burn { color: #ef4444; }
.hero-stat-value.blue { color: #3b82f6; }

.hero-stat-change {
  font-size: 0.7rem;
  margin-top: 0.25rem;
}

.hero-stat-change.positive { color: #22c55e; }
.hero-stat-change.negative { color: #ef4444; }

/* ===== Professional Price Chart ===== */
.price-chart-wrapper {
  background: linear-gradient(145deg, rgba(15, 20, 30, 0.9) 0%, rgba(8, 12, 18, 0.95) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
}

.price-chart-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(16, 185, 129, 0.3), transparent);
}

.price-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.price-chart-info {
  flex: 1;
  min-width: 140px;
}

.price-chart-title {
  font-size: 0.6rem;
  letter-spacing: 0.1rem;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  margin: 0 0 0.25rem;
}

.price-chart-price {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  margin-bottom: 0.15rem;
}

.price-chart-change {
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.price-chart-period {
  font-weight: 400;
  color: rgba(255, 255, 255, 0.4) !important;
  font-size: 0.7rem;
}

.price-chart-burns {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 0.25rem;
}

.price-chart-ranges {
  display: flex;
  gap: 0.2rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.price-chart-range-btn {
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all 0.15s ease;
}

.price-chart-range-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
}

.price-chart-range-btn.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.1));
  border-color: rgba(16, 185, 129, 0.5);
  color: #10b981;
}

.price-chart-download-btn {
  margin-left: 0.35rem;
  border-color: rgba(247, 160, 15, 0.35) !important;
  color: rgba(247, 200, 120, 0.85) !important;
}
.price-chart-download-btn:hover {
  background: rgba(247, 160, 15, 0.12) !important;
  color: #ffd87a !important;
  border-color: rgba(247, 160, 15, 0.6) !important;
}
.price-chart-download-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.price-chart-canvas {
  width: 100%;
  height: 140px;
  position: relative;
  cursor: crosshair;
}

.price-chart-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.8rem;
}

.price-chart-tooltip {
  position: absolute;
  background: rgba(10, 14, 22, 0.98);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 8px;
  padding: 8px 10px;
  pointer-events: none;
  z-index: 50;
  min-width: 140px;
  max-width: 180px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  transform: translateX(-50%);
}

.price-chart-tooltip .tooltip-date {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 4px;
}

.price-chart-tooltip .tooltip-price {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: #10b981;
}

.price-chart-tooltip .tooltip-burn {
  font-size: 0.7rem;
  color: #f59e0b;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Responsive adjustments */
@media (max-width: 500px) {
  .price-chart-wrapper {
    padding: 0.75rem;
  }
  
  .price-chart-price {
    font-size: 1.1rem;
  }
  
  .price-chart-change {
    font-size: 0.7rem;
  }
  
  .price-chart-canvas {
    height: 120px;
  }
  
  .price-chart-range-btn {
    padding: 0.2rem 0.4rem;
    font-size: 0.55rem;
  }
}

@media (min-width: 768px) {
  .price-chart-canvas {
    height: 160px;
  }
  
  .price-chart-price {
    font-size: 1.4rem;
  }
}

/* Legacy chart container support */
.chart-container {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  min-height: 200px;
  position: relative;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.chart-title {
  font-size: 0.75rem;
  letter-spacing: 0.15rem;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
}

.chart-range-btns {
  display: flex;
  gap: 0.25rem;
}

.chart-range-btn {
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.65rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chart-range-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.chart-range-btn.active {
  background: rgba(247, 160, 15, 0.15);
  border-color: rgba(247, 160, 15, 0.4);
  color: #f7a00f;
}

.chart-canvas {
  width: 100%;
  height: 150px;
  position: relative;
}

.chart-svg {
  width: 100%;
  height: 100%;
}

.chart-line {
  fill: none;
  stroke: #f7a00f;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-area {
  fill: url(#chartGradient);
}

.chart-grid-line {
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 1;
}

.chart-price-label {
  font-size: 0.6rem;
  fill: rgba(255, 255, 255, 0.4);
}

/* ===== Trade Panel ===== */
.trade-panel {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 1.5rem;
}

.trade-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.trade-tab {
  flex: 1;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.12rem;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
}

.trade-tab:hover {
  background: rgba(255, 255, 255, 0.03);
}

.trade-tab.active.buy {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(34, 197, 94, 0.08));
  border-color: rgba(34, 197, 94, 0.4);
  color: #22c55e;
}

.trade-tab.active.sell {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.08));
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

/* ===== Form Elements ===== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.12rem;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 0.5rem;
}

.form-input {
  width: 100%;
  padding: 1rem 1.15rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.3);
  color: rgba(255, 255, 255, 0.95);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.1rem;
  transition: all 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: rgba(247, 160, 15, 0.5);
  box-shadow: 0 0 0 3px rgba(247, 160, 15, 0.1);
}

.form-input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.form-hint {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 0.4rem;
}

.form-select {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.3);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.85rem;
  cursor: pointer;
}

/* ===== Quick Amount Buttons ===== */
.quick-amounts {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.quick-amount-btn {
  flex: 1;
  padding: 0.55rem 0.5rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-amount-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.8);
}

.quick-amount-btn.active {
  background: rgba(247, 160, 15, 0.12);
  border-color: rgba(247, 160, 15, 0.35);
  color: #f7a00f;
}

/* ===== Trade Summary ===== */
.trade-summary {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.trade-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
}

.trade-summary-row:not(:last-child) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.trade-summary-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
}

.trade-summary-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.9);
}

.trade-summary-value.highlight {
  color: #f7a00f;
  font-weight: 600;
}

/* ===== Action Buttons ===== */
.btn-trade {
  width: 100%;
  padding: 1.1rem 1.5rem;
  border-radius: 14px;
  border: none;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.15rem;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.btn-trade.buy {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #000;
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.3);
}

.btn-trade.buy:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(34, 197, 94, 0.4);
}

.btn-trade.sell {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3);
}

.btn-trade.sell:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(239, 68, 68, 0.4);
}

.btn-trade:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, #f7a00f, #c77800);
  color: #000;
  box-shadow: 0 4px 20px rgba(247, 160, 15, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(247, 160, 15, 0.4);
}

.btn-secondary {
  padding: 0.65rem 1.25rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn-cancel {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.4);
  background: transparent;
  color: #ef4444;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-cancel:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* ===== Order Book ===== */
.orderbook {
  margin-top: 1.5rem;
}

.orderbook-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.15rem;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  margin: 0 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.orderbook-header {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.65rem;
  letter-spacing: 0.1rem;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.orderbook-rows {
  max-height: 280px;
  overflow-y: auto;
}

.orderbook-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  font-size: 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  position: relative;
  transition: background 0.15s ease;
}

.orderbook-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.orderbook-row .price {
  font-family: 'IBM Plex Mono', monospace;
  color: #ef4444;
}

.orderbook-row .amount {
  font-family: 'IBM Plex Mono', monospace;
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
}

.orderbook-row .total {
  font-family: 'IBM Plex Mono', monospace;
  color: rgba(255, 255, 255, 0.5);
  text-align: right;
}

.orderbook-row .depth-bar {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  background: rgba(239, 68, 68, 0.1);
  z-index: 0;
}

.orderbook-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.8rem;
}

/* ===== My Orders ===== */
.my-orders {
  margin-top: 1.5rem;
}

.my-order-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  margin-bottom: 0.5rem;
}

.my-order-info h4 {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  margin: 0 0 0.25rem;
}

.my-order-info p {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  margin: 0;
}

.my-order-status {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1rem;
}

.my-order-status.pending {
  background: rgba(247, 160, 15, 0.15);
  color: #f7a00f;
}

.my-order-status.filled {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

/* ===== Alert Messages ===== */
.alert {
  padding: 1rem 1.25rem;
  border-radius: 12px;
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.alert.success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: #22c55e;
}

.alert.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #ef4444;
}

.alert-close {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 1.25rem;
  opacity: 0.7;
  padding: 0;
  line-height: 1;
}

.alert-close:hover {
  opacity: 1;
}

/* ===== Player Market Tab ===== */
.market-nav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.market-nav-btn {
  padding: 0.85rem 1.5rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.12rem;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.market-nav-btn:hover {
  background: rgba(255, 255, 255, 0.03);
}

.market-nav-btn.active {
  background: linear-gradient(135deg, rgba(247, 160, 15, 0.2), rgba(247, 160, 15, 0.08));
  border-color: rgba(247, 160, 15, 0.4);
  color: #f7a00f;
}

.market-nav-btn .icon {
  font-size: 1.1rem;
}

/* TLRPG token icon in nav */
.tlrpg-nav-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 6px;
}

/* ===== Listings Grid ===== */
.listings-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.listings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.listing-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 1.15rem;
  transition: transform 0.2s cubic-bezier(.2,.8,.2,1),
              border-color 0.2s ease,
              box-shadow 0.2s cubic-bezier(.2,.8,.2,1);
}

.listing-card:hover {
  border-color: hsla(38, 90%, 65%, 0.35);
  transform: translateY(-4px);
  box-shadow: 
    0 12px 32px rgba(0, 0, 0, 0.35),
    0 0 14px hsla(38, 90%, 65%, 0.2);
}

.listing-card:active {
  transform: translateY(-2px) scale(0.99);
}

.listing-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.6rem;
}

.listing-rarity {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08rem;
  font-weight: 600;
}

.listing-rarity.common { background: rgba(156, 163, 175, 0.2); color: #9ca3af; }
.listing-rarity.uncommon { background: rgba(34, 197, 94, 0.2); color: #22c55e; }
.listing-rarity.rare { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.listing-rarity.epic { background: rgba(168, 85, 247, 0.2); color: #a855f7; }
.listing-rarity.legendary { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }

.listing-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  margin: 0.3rem 0 0;
}

.listing-stats {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  margin: 0.2rem 0;
}

.listing-icon {
  font-size: 1.6rem;
}

.listing-resource {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.listing-resource-icon {
  font-size: 2rem;
}

.listing-resource-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  text-transform: capitalize;
}

.listing-resource-qty {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
}

.listing-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.listing-price {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.05rem;
  font-weight: 600;
  color: #f7a00f;
}

.listing-seller {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.4);
}

.listing-buy-btn {
  padding: 0.5rem 1rem;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #000;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.listing-buy-btn:hover {
  transform: scale(1.05);
}

/* ===== Empty States ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: rgba(255, 255, 255, 0.4);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 0.85rem;
  margin: 0;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
}

.modal {
  background: linear-gradient(180deg, rgba(20, 24, 35, 0.98) 0%, rgba(12, 15, 22, 0.99) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 2rem;
  max-width: 460px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.75rem;
}

.modal-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  letter-spacing: 0.2rem;
  text-transform: uppercase;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.75rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s ease;
}

.modal-close:hover {
  color: rgba(255, 255, 255, 0.9);
}

.type-selector {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.type-btn {
  flex: 1;
  padding: 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.type-btn.active {
  background: rgba(247, 160, 15, 0.12);
  border-color: rgba(247, 160, 15, 0.4);
  color: #f7a00f;
}

/* ===== Scrollbar ===== */
.orderbook-rows::-webkit-scrollbar,
.modal::-webkit-scrollbar {
  width: 6px;
}

.orderbook-rows::-webkit-scrollbar-track,
.modal::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 3px;
}

.orderbook-rows::-webkit-scrollbar-thumb,
.modal::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.orderbook-rows::-webkit-scrollbar-thumb:hover,
.modal::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ===== Tokenomics Section ===== */
.tokenomics-section {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.tokenomics-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tokenomics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
}

.tokenomics-card {
  background: linear-gradient(180deg, rgba(18, 22, 32, 0.8) 0%, rgba(12, 15, 22, 0.9) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
}

.tokenomics-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(247, 160, 15, 0.3), transparent);
}

.tokenomics-card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.tokenomics-icon {
  font-size: 1.25rem;
}

.tokenomics-card-header h4 {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  margin: 0;
}

.tokenomics-stats {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tokenomics-stats.compact {
  gap: 0.5rem;
}

.tokenomics-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tokenomics-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
}

.tokenomics-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
}

.tokenomics-value.small {
  font-size: 0.8rem;
  font-weight: 500;
}

.tokenomics-value.burn {
  color: #f97316;
}

.tokenomics-value.treasury {
  color: #10b981;
}

.tokenomics-value.volume {
  color: #3b82f6;
}

.tokenomics-note {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 0.75rem;
  margin-bottom: 0;
  line-height: 1.4;
}

.tokenomics-formula {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(247, 160, 15, 0.2);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 1rem;
  text-align: center;
}

.tokenomics-formula code {
  font-family: 'Fira Code', 'Monaco', monospace;
  font-size: 0.8rem;
  color: #f7a00f;
  letter-spacing: 0.5px;
}

.tokenomics-tax-bar {
  display: flex;
  height: 24px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 1rem;
  background: rgba(0, 0, 0, 0.3);
}

.tax-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
}

.tax-segment.burn {
  background: linear-gradient(180deg, #f97316 0%, #ea580c 100%);
}

.tax-segment.treasury {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
}

/* ===== Economy Dashboard - Donut Charts ===== */
.economy-dashboard {
  background: linear-gradient(180deg, rgba(18, 22, 32, 0.95) 0%, rgba(12, 15, 22, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}

.economy-dashboard::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.5), transparent);
}

.economy-header {
  text-align: center;
  margin-bottom: 2rem;
}

.economy-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  letter-spacing: 0.25rem;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.95);
  margin: 0 0 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.economy-subtitle {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
}

.economy-subtitle strong {
  color: #f7a00f;
}

/* Sold Out Banner */
.sold-out-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  margin-top: 1rem;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(220, 38, 38, 0.1) 100%);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 12px;
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(239, 68, 68, 0.2); }
  50% { box-shadow: 0 0 30px rgba(239, 68, 68, 0.4); }
}

.sold-out-icon {
  font-size: 1.5rem;
}

.sold-out-text {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: #ef4444;
  letter-spacing: 0.2rem;
  text-transform: uppercase;
}

.sold-out-detail {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
}

/* Charts Grid */
.economy-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

/* Donut Chart Component */
.donut-chart {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.donut-chart-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.15rem;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
}

.donut-container {
  position: relative;
  width: 180px;
  height: 180px;
}

/* Container class used in JSX */
.donut-chart-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.donut-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.donut-segment {
  transition: opacity 0.2s ease, transform 0.2s ease;
  transform-origin: center;
}

.donut-segment:hover {
  opacity: 0.85;
  transform: scale(1.02);
}

.donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 1;
  pointer-events: none;
}

.donut-center-value {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}

.donut-center-label {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.1rem;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 0.2rem;
}

/* Donut Legend */
.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  max-width: 280px;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  transition: background 0.2s ease;
  cursor: default;
}

.donut-legend-item:hover,
.donut-legend-item.active {
  background: rgba(255, 255, 255, 0.05);
}

.donut-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.donut-legend-label {
  flex: 1;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
}

.donut-legend-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.9);
}

.donut-legend-value small {
  color: rgba(255, 255, 255, 0.5);
  margin-left: 0.25rem;
}

/* Price Formula Box */
.price-formula {
  background: rgba(247, 160, 15, 0.05);
  border: 1px solid rgba(247, 160, 15, 0.2);
  border-radius: 12px;
  padding: 1.25rem;
  text-align: center;
  margin-bottom: 2rem;
}

.formula-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.formula-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
}

.formula-code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.9rem;
  padding: 0.4rem 0.75rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  color: #f7a00f;
}

.formula-result {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: #10b981;
}

.formula-note {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  margin: 0;
}

.formula-note strong {
  color: #10b981;
}

/* Allocation Breakdown */
.allocation-breakdown {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 1.25rem;
}

.allocation-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.15rem;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  margin: 0 0 1rem;
  text-align: center;
}

.allocation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.allocation-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  transition: border-color 0.2s ease;
}

.allocation-item:hover {
  border-color: rgba(255, 255, 255, 0.1);
}

.allocation-item.locked {
  opacity: 0.7;
}

.allocation-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.allocation-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  flex: 1;
}

.allocation-lock {
  font-size: 0.7rem;
}

.allocation-sellable {
  font-size: 0.7rem;
}

.allocation-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.allocation-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.allocation-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.allocation-amount {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.6);
}

.allocation-percent {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

/* Allocation Sections */
.allocation-section {
  margin-bottom: 1.5rem;
}

.allocation-section:last-child {
  margin-bottom: 0;
}

.allocation-section.locked {
  opacity: 0.8;
}

.allocation-section-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1rem;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.allocation-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.2);
}

.allocation-badge.burn {
  color: #ef4444;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .market-panel {
    padding: 1.25rem;
  }
  
  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .market-nav {
    flex-wrap: wrap;
  }
  
  .market-nav-btn {
    flex: 1;
    min-width: 140px;
    justify-content: center;
  }
  
  .listings-grid {
    grid-template-columns: 1fr;
  }
  
  .trade-tabs {
    flex-direction: column;
  }
  
  .tokenomics-grid {
    grid-template-columns: 1fr;
  }
  
  .economy-charts {
    grid-template-columns: 1fr;
  }
  
  .allocation-grid {
    grid-template-columns: 1fr;
  }
  
  .formula-box {
    flex-direction: column;
  }
}

/* ========================================
   ENHANCED MARKETPLACE - Filter Bar & Grid
   ======================================== */

/* Filter Bar */
.market-filter-bar {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.filter-select {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  color: #fff;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 110px;
}

.filter-select:hover {
  border-color: rgba(247, 160, 15, 0.5);
}

.filter-select:focus {
  outline: none;
  border-color: #f7a00f;
  box-shadow: 0 0 0 2px rgba(247, 160, 15, 0.2);
}

/* Catalog Grid */
.market-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

@media (min-width: 768px) {
  .market-catalog-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

/* Catalog Card */
.catalog-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}

.catalog-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(247, 160, 15, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Item display with GearCard */
.catalog-item-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.catalog-item-display .gc {
  width: 100%;
  max-width: 140px;
  margin: 0 auto;
}

.catalog-item-info {
  text-align: center;
  width: 100%;
}

.catalog-rarity {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.25rem;
}

.catalog-rarity.rarity-common { background: rgba(156, 163, 175, 0.2); color: #9ca3af; }
.catalog-rarity.rarity-uncommon { background: rgba(34, 197, 94, 0.2); color: #22c55e; }
.catalog-rarity.rarity-rare { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.catalog-rarity.rarity-epic { background: rgba(168, 85, 247, 0.2); color: #a855f7; }
.catalog-rarity.rarity-legendary { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }

.catalog-item-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: #fff;
  margin: 0.25rem 0;
}

.catalog-element {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
}

/* Resource display */
.catalog-resource-display {
  text-align: center;
  padding: 1.5rem 0.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.catalog-resource-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.catalog-resource-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: #fff;
  margin: 0 0 0.25rem;
  text-transform: capitalize;
}

.catalog-resource-qty {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
  margin: 0;
}

/* Catalog footer */
.catalog-footer {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.catalog-price-section {
  flex: 1;
}

.catalog-price {
  font-size: 1rem;
  font-weight: 700;
  color: #10b981;
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}

.catalog-price .price-unit {
  font-size: 0.65rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.5);
}

.catalog-sold {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.5);
  margin: 0.2rem 0 0;
}

.catalog-meta {
  text-align: right;
}

.catalog-count {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
}

/* ========================================
   ITEM DETAIL MODAL
   ======================================== */

.item-detail-modal {
  max-width: 550px !important;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.item-detail-content {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  flex: 1;
}

/* Item preview */
.item-detail-preview {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.item-detail-preview .gc {
  width: 100px;
  margin-top: 12px;
}

/* Always show element on preview */
.item-detail-preview .gc-element {
  opacity: 1;
  font-size: 1.5rem;
  top: auto;
  bottom: 8px;
  left: 8px;
  transform: none;
}

.item-detail-preview .gc:hover .gc-element {
  opacity: 1;
  transform: scale(1.1);
}

/* Stats grid */
.item-detail-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

@media (min-width: 480px) {
  .item-detail-stats {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  text-align: center;
}

.stat-box.highlight {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
}

.stat-label {
  display: block;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-value {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
}

.stat-value.price {
  color: #10b981;
}

/* Price chart */
.item-detail-chart {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.chart-title {
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  margin: 0 0 0.5rem;
}

.mini-chart {
  height: 80px;
  width: 100%;
}

.mini-chart svg {
  width: 100%;
  height: 100%;
}

.chart-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 0.5rem;
}

/* Listings section */
.item-detail-listings {
  margin-top: 1rem;
}

.listings-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  margin: 0 0 0.75rem;
}

.listings-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 250px;
  overflow-y: auto;
}

.listings-loading,
.listings-empty {
  text-align: center;
  padding: 2rem;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
}

.listing-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  transition: background 0.15s ease;
}

.listing-row:hover {
  background: rgba(255, 255, 255, 0.06);
}

.listing-row.best {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
}

.listing-info {
  flex: 1;
}

.listing-price {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.listing-row.best .listing-price {
  color: #10b981;
}

.best-badge {
  font-size: 0.6rem;
  font-weight: 700;
  background: #10b981;
  color: #000;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  text-transform: uppercase;
}

.listing-seller {
  display: block;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 0.15rem;
}

.btn-buy {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-buy:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Rarity text colors */
.rarity-common { color: #9ca3af; }
.rarity-uncommon { color: #22c55e; }
.rarity-rare { color: #3b82f6; }
.rarity-epic { color: #a855f7; }
.rarity-legendary { color: #f59e0b; }

/* =====================================================
   CATALOG CARD V2 - Redesigned Market Cards
   ===================================================== */

/* New Grid Layout */
.market-catalog-grid-v2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
}

@media (min-width: 1200px) {
  .market-catalog-grid-v2 {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}

/* Catalog Card V2 */
.catalog-card-v2 {
  background: linear-gradient(180deg, rgba(20, 22, 30, 0.95) 0%, rgba(12, 14, 20, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
}

.catalog-card-v2:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 179, 71, 0.3);
}

/* Rarity border variants */
.catalog-card-v2.rarity-border-common { border-color: rgba(156, 163, 175, 0.2); }
.catalog-card-v2.rarity-border-common:hover { border-color: rgba(156, 163, 175, 0.5); }
.catalog-card-v2.rarity-border-uncommon { border-color: rgba(34, 197, 94, 0.2); }
.catalog-card-v2.rarity-border-uncommon:hover { border-color: rgba(34, 197, 94, 0.5); }
.catalog-card-v2.rarity-border-rare { border-color: rgba(59, 130, 246, 0.2); }
.catalog-card-v2.rarity-border-rare:hover { border-color: rgba(59, 130, 246, 0.5); }
.catalog-card-v2.rarity-border-epic { border-color: rgba(168, 85, 247, 0.2); }
.catalog-card-v2.rarity-border-epic:hover { border-color: rgba(168, 85, 247, 0.5); }
.catalog-card-v2.rarity-border-legendary { border-color: rgba(245, 158, 11, 0.2); }
.catalog-card-v2.rarity-border-legendary:hover { border-color: rgba(245, 158, 11, 0.5); }

/* Image Section */
.catalog-image-section {
  position: relative;
  padding: 0.5rem;
  padding-top: 1rem;
  background: transparent;
  cursor: pointer;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible; /* Allow tier badge to show */
}

.catalog-item-image {
  width: 100%;
  max-width: 100px;
  margin: 0 auto;
  position: relative;
  overflow: visible; /* Allow tier badge to overflow */
}

/* Make market GearCard match inventory style exactly */
.catalog-item-image .gc {
  width: 100%;
  margin: 0;
  margin-top: 12px;
  overflow: visible; /* Tier badge can overflow */
}

/* Fix tier badge in market catalog - match inventory exactly */
.catalog-item-image .gc-tier {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  min-width: 24px;
  max-width: 40px;
  height: 18px;
  padding: 0 6px;
  font-size: 0.65rem;
  white-space: nowrap;
}

.catalog-item-image .gc-tier-num {
  font-size: 0.65rem;
}

/* Always show element icon on market items - important for buyers to see element */
.catalog-item-image .gc-element {
  opacity: 1;
  font-size: 1.5rem;
  top: auto;
  bottom: 8px;
  left: 8px;
  transform: none;
}

.catalog-item-image .gc:hover .gc-element {
  opacity: 1;
  transform: scale(1.1);
}

.catalog-resource-image {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100px;
}

.resource-icon-large {
  font-size: 4rem;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}

/* Item Badge */
.catalog-item-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
}

.rarity-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.rarity-badge.rarity-common { color: #9ca3af; border: 1px solid rgba(156, 163, 175, 0.3); }
.rarity-badge.rarity-uncommon { color: #22c55e; border: 1px solid rgba(34, 197, 94, 0.3); }
.rarity-badge.rarity-rare { color: #3b82f6; border: 1px solid rgba(59, 130, 246, 0.3); }
.rarity-badge.rarity-epic { color: #a855f7; border: 1px solid rgba(168, 85, 247, 0.3); }
.rarity-badge.rarity-legendary { color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }

/* Info Section */
.catalog-info-section {
  padding: 0.75rem 1rem 0.5rem;
}

.catalog-title {
  font-family: 'Orbitron', 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #fff;
  margin: 0 0 0.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.catalog-stats-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
}

.catalog-listings {
  color: rgba(255, 255, 255, 0.5);
}

.catalog-sold-badge {
  color: #f59e0b;
  font-weight: 500;
}

/* Mini Chart */
.catalog-mini-chart {
  position: relative;
  padding: 0.5rem 1rem;
  height: 60px;
}

.mini-sparkline {
  width: 100%;
  height: 100%;
}

.chart-price-overlay {
  position: absolute;
  top: 50%;
  left: 1rem;
  right: 1rem;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.current-price {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.current-price small {
  font-size: 0.65rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.6);
}

.price-change {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.price-change.positive { color: #10b981; }
.price-change.negative { color: #ef4444; }

/* Simplified Price Section (no chart) */
.catalog-price-section {
  padding: 0.75rem 1rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 100%);
}

.catalog-price-section .price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.catalog-price-section .current-price {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.catalog-price-section .current-price small {
  font-size: 0.65rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.6);
}

.catalog-price-section .price-change {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
}

.catalog-price-section .price-change.positive { color: #10b981; }
.catalog-price-section .price-change.negative { color: #ef4444; }

/* Action Buttons */
.catalog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.catalog-btn {
  font-family: 'Orbitron', 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.catalog-btn.buy {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
}

.catalog-btn.buy:hover {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.catalog-btn.sell {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
  color: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.catalog-btn.sell:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.08) 100%);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

/* Mobile responsiveness for V2 cards */
@media (max-width: 600px) {
  .market-catalog-grid-v2 {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  
  .catalog-card-v2 {
    border-radius: 12px;
  }
  
  .catalog-image-section {
    padding: 0.75rem;
    min-height: 100px;
  }
  
  .catalog-item-image {
    max-width: 100px;
  }
  
  .resource-icon-large {
    font-size: 2.5rem;
  }
  
  .catalog-info-section {
    padding: 0.5rem 0.75rem 0.35rem;
  }
  
  .catalog-title {
    font-size: 0.75rem;
  }
  
  .catalog-mini-chart {
    height: 45px;
    padding: 0.35rem 0.75rem;
  }
  
  .current-price {
    font-size: 0.85rem;
  }
  
  .catalog-actions {
    padding: 0.5rem 0.75rem 0.75rem;
  }
  
  .catalog-btn {
    font-size: 0.65rem;
    padding: 0.5rem;
  }
}

@media (max-width: 400px) {
  .market-catalog-grid-v2 {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

/* Legacy grid styles for backwards compat */
@media (max-width: 480px) {
  .market-catalog-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  
  .catalog-card {
    padding: 0.5rem;
  }
  
  .catalog-item-display .gc {
    max-width: 100px;
  }
  
  .filter-row {
    gap: 0.4rem;
  }
  
  .filter-select {
    font-size: 0.75rem;
    padding: 0.4rem 0.5rem;
    min-width: 80px;
    flex: 1;
  }
  
  .item-detail-modal {
    max-height: 90vh;
  }
  
  .item-detail-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}


/* ========== CATALOG TITLE ROW WITH ELEMENT ========== */
.catalog-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: space-between;
}

.catalog-element-badge {
  font-size: 1.1rem;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
}

.catalog-element-badge.element-fire {
  background: rgba(249, 115, 22, 0.2);
}

.catalog-element-badge.element-water {
  background: rgba(59, 130, 246, 0.2);
}

.catalog-element-badge.element-earth {
  background: rgba(161, 98, 7, 0.2);
}

.catalog-element-badge.element-air {
  background: rgba(226, 232, 240, 0.2);
}

/* ========== ENHANCED PRICE HISTORY CHART ========== */
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.chart-period-toggle {
  display: flex;
  gap: 0.25rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  padding: 2px;
}

.period-btn {
  padding: 0.35rem 0.75rem;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.75rem;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.period-btn:hover {
  color: rgba(255, 255, 255, 0.9);
}

.period-btn.active {
  background: var(--color-accent, #6366f1);
  color: white;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 0.5rem;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.6);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.legend-color.price {
  background: #10b981;
}

.legend-color.volume {
  background: rgba(59, 130, 246, 0.6);
}

.chart-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.summary-item {
  text-align: center;
}

.summary-label {
  display: block;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 0.25rem;
}

.summary-value {
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.chart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.85rem;
}

.chart-empty span {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.chart-empty p {
  margin: 0;
}

/* ========== ITEM DETAIL CHART IMPROVEMENTS ========== */
.item-detail-chart {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.item-detail-chart .chart-title {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.9);
}

.item-detail-chart .mini-chart {
  margin-top: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  overflow: hidden;
}

.item-detail-chart .chart-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 0.5rem;
}
