/* ── Galactic Market Panel ─────────────────────────────────────────────────────
   Centered modal, matches the holographic HUD aesthetic.
   ─────────────────────────────────────────────────────────────────────────── */

#gm-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 540px;
  z-index: 20;
  pointer-events: none;
  font-family: Arial, sans-serif;
  display: none;

  background: var(--h-bg, rgba(4,12,22,0.92));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--h-border, rgba(0,190,255,0.28));
  box-shadow: 0 4px 18px rgba(0,0,0,0.60);
  user-select: none;
  -webkit-user-select: none;
}

#gm-panel.open  { display: block; pointer-events: all; }

/* Normal font override — kill holographic monospace and letter-spacing */
#gm-panel * {
  font-family: Arial, sans-serif !important;
  letter-spacing: normal !important;
}

/* ── Corner brackets ── */
#gm-panel .hc { position: absolute; width: 12px; height: 12px; }
#gm-panel .hc-tl { top: -1px; left: -1px;
  border-top:    1px solid rgba(0,185,240,0.45);
  border-left:   1px solid rgba(0,185,240,0.45); }
#gm-panel .hc-tr { top: -1px; right: -1px;
  border-top:    1px solid rgba(0,185,240,0.45);
  border-right:  1px solid rgba(0,185,240,0.45); }
#gm-panel .hc-bl { bottom: -1px; left: -1px;
  border-bottom: 1px solid rgba(0,185,240,0.45);
  border-left:   1px solid rgba(0,185,240,0.45); }
#gm-panel .hc-br { bottom: -1px; right: -1px;
  border-bottom: 1px solid rgba(0,185,240,0.45);
  border-right:  1px solid rgba(0,185,240,0.45); }

/* ── Header ── */
.gm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 8px 14px;
  border-bottom: 1px solid rgba(0,190,255,0.18);
}

.gm-header-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gm-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--h-blue, rgba(0,215,255,0.95));
  text-shadow: none;
}

.gm-sub {
  font-size: 8px;
  letter-spacing: 0.10em;
  color: #aaa;
}

.gm-close {
  background: none;
  border: 1px solid rgba(0,180,255,0.22);
  color: rgba(0,200,255,0.50);
  font: 700 14px/24px var(--h-font, monospace);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 2px;
  transition: border-color 0.12s, color 0.12s;
  flex-shrink: 0;
  pointer-events: all;
}
.gm-close:hover {
  border-color: rgba(0,215,255,0.60);
  color: rgba(0,230,255,0.90);
}

/* ── Credits bar ── */
.gm-credits-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 5px 14px;
  border-bottom: 1px solid rgba(0,190,255,0.10);
  background: rgba(0,180,255,0.035);
}

.gm-cr-label {
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #aaa;
}

.gm-cr-val {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #ffd97a;
  font-variant-numeric: tabular-nums;
  text-shadow: none;
}

/* ── Resource rows ── */
.gm-body {
  display: flex;
  flex-direction: column;
}

.gm-row {
  padding: 10px 14px 12px;
  border-bottom: 1px solid rgba(0,190,255,0.09);
}
.gm-row:last-child { border-bottom: none; }

.gm-row-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.gm-res-name {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  flex-shrink: 0;
  min-width: 80px;
}

.gm-stock {
  font-size: 9px;
  letter-spacing: 0.08em;
  color: #aaa;
  flex: 1;
}

.gm-stock-val {
  color: #ddd;
  font-variant-numeric: tabular-nums;
}

.gm-trend {
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  text-align: right;
  min-width: 70px;
}
.gm-trend-flat { color: #888; }
.gm-trend-up   { color: rgba(255,100,80,0.85); }
.gm-trend-down { color: rgba(0,255,160,0.75); }

/* ── Trade block ── */

.gm-trade-side {
  display: flex;
  align-items: center;
  gap: 6px;
}

.gm-price-label {
  font-size: 8px;
  letter-spacing: 0.08em;
  color: #aaa;
  white-space: nowrap;
  width: 108px;
  flex-shrink: 0;
}

.gm-unit-price {
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}
.gm-buy-price  { color: rgba(255,150,110,0.90); }
.gm-sell-price { color: rgba(0,255,165,0.85); }

.gm-btns {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

/* Base button style */
.gm-btn {
  padding: 4px 8px;
  background: rgba(0,180,255,0.07);
  border: 1px solid rgba(0,190,255,0.26);
  color: rgba(0,215,255,0.72);
  font: 700 9px/1 var(--h-font, monospace);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.10s, border-color 0.10s, color 0.10s;
  pointer-events: all;
  white-space: nowrap;
  text-shadow: none;
}

/* Buy-side preset hover — orange/red tint */
.gm-buy-side .gm-preset:hover {
  background: rgba(255,120,80,0.16);
  border-color: rgba(255,140,100,0.52);
  color: rgba(255,185,155,0.95);
}

/* Sell-side preset hover — green tint */
.gm-sell-side .gm-preset:hover {
  background: rgba(0,255,140,0.12);
  border-color: rgba(0,255,140,0.42);
  color: rgba(0,255,168,0.95);
}

/* BUY action button */
.gm-do-buy {
  background: rgba(255,100,70,0.12);
  border-color: rgba(255,120,90,0.40);
  color: rgba(255,160,130,0.90);
  margin-left: 2px;
}
.gm-do-buy:hover {
  background: rgba(255,120,90,0.26);
  border-color: rgba(255,155,125,0.70);
  color: rgba(255,200,175,1.00);
}

/* SELL action button */
.gm-do-sell {
  background: rgba(0,255,140,0.09);
  border-color: rgba(0,255,140,0.32);
  color: rgba(0,255,160,0.85);
  margin-left: 2px;
}
.gm-do-sell:hover {
  background: rgba(0,255,140,0.20);
  border-color: rgba(0,255,165,0.62);
  color: rgba(0,255,185,1.00);
}

/* Custom qty input */
.gm-custom {
  width: 50px;
  background: rgba(0,180,255,0.05);
  border: 1px solid rgba(0,185,255,0.20);
  color: rgba(200,230,255,0.85);
  font: 400 10px/1 var(--h-font, monospace);
  padding: 3px 5px;
  border-radius: 2px;
  outline: none;
  pointer-events: all;
}
.gm-custom:focus {
  border-color: rgba(0,215,255,0.48);
  background: rgba(0,180,255,0.10);
}
.gm-custom::-webkit-inner-spin-button,
.gm-custom::-webkit-outer-spin-button { -webkit-appearance: none; }

/* Divider between buy and sell rows */
.gm-divider {
  height: 1px;
  background: rgba(0,190,255,0.07);
  margin: 2px 0;
}

/* Blocked / disabled button */
.gm-btn:disabled,
.gm-btn-blocked {
  opacity: 0.28;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Trade wrap: buttons left, log right ── */
.gm-trade-wrap {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.gm-trade-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

/* ── Transaction log ── */
.gm-log {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  width: 148px;
  flex-shrink: 0;
  border-left: 1px solid rgba(0,190,255,0.10);
  padding-left: 8px;
}

.gm-log-empty {
  font-size: 8px;
  letter-spacing: 0.08em;
  color: #888;
  font-style: italic;
}

.gm-log-entry {
  display: block;
  font-size: 9px;
  letter-spacing: 0.07em;
  font-variant-numeric: tabular-nums;
}

.gm-log-buy  { color: rgba(255,140,100,0.78); }
.gm-log-sell { color: rgba(0,255,155,0.75); }

/* Kill stray text-shadows */
#gm-panel * { text-shadow: none !important; }

/* ══════════════════════════════════════════════════════════════════
   GALACTIC UPGRADES PANEL — sits to the right of the market
   ══════════════════════════════════════════════════════════════════ */

#gm-upgrades-panel {
  position: fixed;
  top: calc(50% + 175px);
  left: 50%;
  transform: translateX(-50%);
  width: min(700px, calc(100vw - 20px));
  z-index: 20;
  pointer-events: none;
  font-family: Arial, sans-serif;
  display: none;

  background: var(--h-bg, rgba(4,12,22,0.92));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--h-border, rgba(0,190,255,0.28));
  box-shadow: 0 4px 18px rgba(0,0,0,0.60);
  user-select: none;
  -webkit-user-select: none;
}

#gm-upgrades-panel.open { display: block; pointer-events: all; }

/* Normal font override */
#gm-upgrades-panel * {
  font-family: Arial, sans-serif !important;
  letter-spacing: normal !important;
}

/* corner brackets */
#gm-upgrades-panel .hc { position: absolute; width: 12px; height: 12px; }
#gm-upgrades-panel .hc-tl { top:-1px; left:-1px;
  border-top:1px solid rgba(0,185,240,0.45); border-left:1px solid rgba(0,185,240,0.45); }
#gm-upgrades-panel .hc-tr { top:-1px; right:-1px;
  border-top:1px solid rgba(0,185,240,0.45); border-right:1px solid rgba(0,185,240,0.45); }
#gm-upgrades-panel .hc-bl { bottom:-1px; left:-1px;
  border-bottom:1px solid rgba(0,185,240,0.45); border-left:1px solid rgba(0,185,240,0.45); }
#gm-upgrades-panel .hc-br { bottom:-1px; right:-1px;
  border-bottom:1px solid rgba(0,185,240,0.45); border-right:1px solid rgba(0,185,240,0.45); }

.gmu-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(0,190,255,0.18);
}

.gmu-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,210,80,0.95);
  text-shadow: none;
}

.gmu-sub {
  font-size: 8px;
  letter-spacing: 0.08em;
  color: #aaa;
}

.gmu-body {
  display: flex;
  flex-direction: row;
  padding: 12px;
  gap: 10px;
}

/* Upgrade card */
.gmu-card {
  flex: 1;
  padding: 14px 16px;
  border: 1px solid rgba(0,200,255,0.25);
  border-radius: 6px;
  background: rgba(0,30,55,0.80);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gmu-card-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: rgba(255,220,100,0.90);
}

.gmu-card-desc {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: #4cff8a;
  line-height: 1.4;
}

.gmu-card-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 2px;
}

.gmu-cost {
  font-size: 14px;
  font-weight: 700;
  color: #ffd97a;
  font-variant-numeric: tabular-nums;
}

.gmu-buy-btn {
  padding: 5px 16px;
  background: rgba(255,200,60,0.10);
  border: 1px solid rgba(255,210,80,0.38);
  color: rgba(255,220,100,0.85);
  font: 700 11px/1 Arial, sans-serif;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.10s, border-color 0.10s;
  text-shadow: none;
}
.gmu-buy-btn:hover:not(:disabled) {
  background: rgba(255,210,70,0.22);
  border-color: rgba(255,225,100,0.70);
  color: rgba(255,240,140,1.00);
}
.gmu-buy-btn:disabled {
  opacity: 0.30;
  cursor: not-allowed;
}
.gmu-cant-afford {
  border-color: rgba(255,80,80,0.35);
  color: rgba(255,120,100,0.60);
}

/* Purchased state */
.gmu-purchased .gmu-card-name { color: rgba(0,255,160,0.80); }
.gmu-purchased .gmu-buy-btn {
  background: rgba(0,255,140,0.08);
  border-color: rgba(0,255,140,0.30);
  color: rgba(0,255,160,0.60);
  cursor: default;
}

#gm-upgrades-panel * { text-shadow: none !important; }
