/* === MarketView === */

.container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

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

.baseName {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--chrome-silver);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.toolbarActions {
  display: flex;
  gap: 0.3rem;
}

/* Search + show filter row */
.filterBar {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.searchBox {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(10, 14, 20, 0.6);
  border: 1px solid var(--dim-grey);
  border-radius: 3px;
  padding: 0.25rem 0.4rem;
  transition: border-color 0.15s ease;
}

.searchBox:focus-within {
  border-color: var(--plasma-cyan);
}

.searchIcon {
  color: var(--hull-grey);
  flex-shrink: 0;
}

.searchInput {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: var(--star-white);
  min-width: 0;
}

.searchInput::placeholder {
  color: var(--hull-grey);
  opacity: 0.6;
}

/* Buying/Selling/All toggles */
.showToggles {
  display: flex;
  gap: 0;
  border: 1px solid var(--dim-grey);
  border-radius: 3px;
  overflow: hidden;
}

.showToggle {
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.58rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--hull-grey);
  background: transparent;
  border: none;
  border-right: 1px solid var(--dim-grey);
  padding: 0.25rem 0.45rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.showToggle:last-child {
  border-right: none;
}

.showToggle:hover {
  color: var(--chrome-silver);
  background: rgba(61, 90, 108, 0.1);
}

.showToggleActive {
  color: var(--plasma-cyan);
  background: rgba(0, 212, 255, 0.1);
}

/* Category toggles */
.categoryToggles {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.categoryToggle {
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--hull-grey);
  background: transparent;
  border: 1px solid rgba(61, 90, 108, 0.3);
  border-radius: 3px;
  padding: 0.15rem 0.4rem;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.categoryToggle:hover {
  color: var(--chrome-silver);
  border-color: var(--hull-grey);
  background: rgba(61, 90, 108, 0.08);
}

.categoryToggleActive {
  color: var(--plasma-cyan);
  border-color: var(--plasma-cyan);
  background: rgba(0, 212, 255, 0.08);
}

/* Table header */
.tableHeader {
  display: flex;
  align-items: center;
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--dim-grey);
}

.colSortable {
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--hull-grey);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0;
}

.colSortable:hover {
  color: var(--chrome-silver);
}

.sortInactive {
  opacity: 0.3;
}

.sortActive {
  color: var(--plasma-cyan);
  font-size: 0.55rem;
}

.colItem {
  flex: 1.5;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
  text-align: left;
}

.colPrice {
  flex: 1;
  text-align: right;
  justify-content: flex-end;
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.7rem;
}

.colQty {
  flex: 0.6;
  text-align: right;
  justify-content: flex-end;
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.65rem;
}

/* Category group header */
.categoryHeader {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.5rem;
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--hull-grey);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(61, 90, 108, 0.06);
  border-bottom: 1px solid rgba(61, 90, 108, 0.15);
  position: sticky;
  top: 0;
  z-index: 1;
}

.categoryCount {
  font-size: 0.5rem;
  font-weight: 600;
  color: var(--hull-grey);
  opacity: 0.6;
}

/* Item list */
.itemList {
  display: flex;
  flex-direction: column;
}

.itemBlock {
  border-bottom: 1px solid rgba(42, 58, 74, 0.5);
}

.itemRow {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.4rem 0.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
  text-align: left;
}

.itemRow:hover {
  background: rgba(61, 90, 108, 0.1);
}

.itemRowExpanded {
  background: rgba(61, 90, 108, 0.08);
  border-bottom: 1px solid rgba(61, 90, 108, 0.15);
}

.itemName {
  font-family: var(--font-space-grotesk), 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--star-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.buyPrice { color: var(--bio-green); }
.sellPrice { color: var(--shell-orange); }
.spreadPositive { color: var(--plasma-cyan); }
.haveQty { color: var(--plasma-cyan); font-weight: 600; }
.noPrice { color: var(--hull-grey); opacity: 0.6; }

.colHave {
  flex: 0.5;
  text-align: right;
  justify-content: flex-end;
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.65rem;
}

.itemRowOwned {
  background: rgba(0, 212, 255, 0.04);
  border-left: 2px solid rgba(0, 212, 255, 0.3);
}

.myOrderBadge {
  color: var(--void-purple);
  flex-shrink: 0;
  opacity: 0.8;
}

.insightBadge {
  flex-shrink: 0;
  color: var(--warning-yellow);
  display: flex;
  align-items: center;
  cursor: help;
}

.insightTooltip {
  position: fixed;
  z-index: 10000;
  width: 300px;
  background: rgba(10, 15, 28, 0.97);
  border: 1px solid rgba(255, 217, 61, 0.35);
  border-radius: 6px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6), 0 0 12px rgba(255, 217, 61, 0.1);
  pointer-events: auto;
  animation: insightFadeIn 0.15s ease-out;
}

.insightTooltipHeader {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid rgba(255, 217, 61, 0.15);
  font-family: var(--font-orbitron), 'Orbitron', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--warning-yellow);
}

.insightTooltipRow {
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid rgba(42, 58, 74, 0.3);
}

.insightTooltipRow:last-child {
  border-bottom: none;
}

.insightTooltipCategory {
  display: block;
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--warning-yellow);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.15rem;
}

.insightTooltipMessage {
  display: block;
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  line-height: 1.35;
  color: var(--chrome-silver);
}

@keyframes insightFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.analysisStatus {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  color: var(--hull-grey);
  padding: 0.15rem 0.5rem;
}

.analysisStatusClickable {
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  width: 100%;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.analysisStatusClickable:focus-visible {
  outline: 1px solid var(--warning-yellow);
  outline-offset: 1px;
}

.analysisStatusClickable:hover {
  color: var(--warning-yellow);
  background: rgba(255, 217, 61, 0.06);
  border-color: rgba(255, 217, 61, 0.2);
}

.analysisStatusActive {
  color: var(--warning-yellow);
  background: rgba(255, 217, 61, 0.1);
  border-color: rgba(255, 217, 61, 0.35);
}

/* General insights panel */
.generalInsightsPanel {
  display: flex;
  flex-direction: column;
  margin: 0.15rem 0.35rem;
  background: rgba(255, 217, 61, 0.04);
  border: 1px solid rgba(255, 217, 61, 0.15);
  border-radius: 4px;
  overflow: hidden;
}

.generalInsightsHeader {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.5rem;
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--warning-yellow);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(255, 217, 61, 0.1);
}

.generalInsightRow {
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid rgba(42, 58, 74, 0.3);
}

.generalInsightRow:last-child {
  border-bottom: none;
}

.generalInsightCategory {
  display: block;
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--warning-yellow);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.15rem;
}

.generalInsightMessage {
  display: block;
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  line-height: 1.35;
  color: var(--chrome-silver);
}

/* Quick sell bar */
.quickSell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.35rem 0.4rem;
  background: rgba(255, 107, 53, 0.06);
  border: 1px solid rgba(255, 107, 53, 0.15);
  border-radius: 4px;
}

.quickSellLabel {
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  color: var(--chrome-silver);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.sellWarning {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--shell-orange);
  padding: 0.2rem 0;
}

.sellWarningInline {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  color: var(--shell-orange);
  font-weight: 600;
  font-size: 0.55rem;
}

/* Expanded panel */
.expandedPanel {
  padding: 0.5rem 0.6rem;
  background: rgba(10, 14, 23, 0.4);
  border-top: 1px solid rgba(61, 90, 108, 0.1);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Order book */
.orderBookRow {
  display: flex;
  gap: 0.5rem;
}

.orderBookSide {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.orderBookLabel {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--chrome-silver);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid rgba(42, 58, 74, 0.4);
}

.orderBookScroll {
  max-height: 320px;
  overflow-y: auto;
}

.orderBookScroll::-webkit-scrollbar { width: 3px; }
.orderBookScroll::-webkit-scrollbar-track { background: transparent; }
.orderBookScroll::-webkit-scrollbar-thumb { background: var(--hull-grey); border-radius: 2px; }

.orderList {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.orderEntry {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.3rem;
  border-radius: 3px;
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.65rem;
}

.orderSell { background: rgba(255, 107, 53, 0.06); }
.orderBuy { background: rgba(45, 212, 191, 0.06); }
.orderMine {
  background: rgba(167, 139, 250, 0.08);
  border-left: 2px solid var(--void-purple);
}
.orderPrice { font-weight: 600; color: var(--star-white); }
.orderSell .orderPrice { color: var(--shell-orange); }
.orderBuy .orderPrice { color: var(--bio-green); }
.orderMine .orderPrice { color: var(--void-purple); }
.orderQty { color: var(--chrome-silver); }

.yourTag {
  font-size: 0.5rem;
  font-weight: 700;
  color: var(--void-purple);
  background: rgba(167, 139, 250, 0.15);
  border-radius: 2px;
  padding: 0.05rem 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.orderAction {
  display: flex;
  gap: 0.2rem;
  align-items: center;
  margin-left: auto;
  flex-shrink: 0;
}

.orderQtyInput {
  width: 48px;
  background: rgba(10, 14, 20, 0.6);
  border: 1px solid var(--dim-grey);
  border-radius: 3px;
  padding: 0.15rem 0.25rem;
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  color: var(--star-white);
  outline: none;
  text-align: right;
}

.orderQtyInput:focus {
  border-color: var(--plasma-cyan);
}

.qtyButtons {
  display: flex;
  gap: 1px;
}

.qtyBtn {
  padding: 0.1rem 0.25rem;
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.5rem;
  background: rgba(61, 90, 108, 0.2);
  border: 1px solid rgba(61, 90, 108, 0.3);
  border-radius: 2px;
  color: var(--chrome-silver);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.qtyBtn:hover:not(:disabled) {
  background: rgba(0, 212, 255, 0.12);
  color: var(--plasma-cyan);
  border-color: rgba(0, 212, 255, 0.3);
}

.qtyBtn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.qtyBtnMax {
  color: var(--plasma-cyan);
  font-weight: 600;
}

.modalBuyActions {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.npcTag {
  font-size: 0.5rem;
  font-weight: 700;
  color: var(--warning-yellow);
  background: rgba(255, 217, 61, 0.12);
  border-radius: 2px;
  padding: 0.05rem 0.25rem;
  text-transform: uppercase;
  opacity: 0.8;
}

.noOrders {
  font-family: var(--font-space-grotesk), 'Space Grotesk', sans-serif;
  font-size: 0.65rem;
  color: var(--hull-grey);
  padding: 0.3rem 0;
}

/* Quick trade forms */
.quickTradeForms {
  display: flex;
  gap: 0.5rem;
}

.quickForm {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.4rem;
  background: rgba(61, 90, 108, 0.06);
  border: 1px solid rgba(61, 90, 108, 0.15);
  border-radius: 4px;
}

.quickLabel {
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--chrome-silver);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.cargoHint {
  font-weight: 400;
  color: var(--hull-grey);
  text-transform: none;
  font-size: 0.58rem;
}

.quickRow {
  display: flex;
  gap: 0.3rem;
  align-items: stretch;
  flex-wrap: wrap;
}

.listingButtons {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

/* Estimate breakdown */
.estimateBreakdown {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.25rem;
  padding: 0.35rem 0.4rem;
  background: rgba(10, 14, 23, 0.5);
  border: 1px solid rgba(167, 139, 250, 0.2);
  border-radius: 4px;
}

.estimateTotal {
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--star-white);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.estimateUnfilled {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--shell-orange);
}

.estimateFills {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.estimateFill {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-jetbrains), 'JetBrains Mono', monospace;
  font-size: 0.6rem;
}

.estimateFillQty { color: var(--chrome-silver); font-weight: 600; }
.estimateFillPrice { color: var(--hull-grey); }

/* Mobile */
@media (max-width: 768px) {
  .itemRow { min-height: 44px; padding: 0.5rem; }
  .npcTag { font-size: 0.68rem; }
  .cargoHint { font-size: 0.68rem; }
  .categoryToggle { font-size: 0.65rem; padding: 0.25rem 0.5rem; }
  .showToggle { font-size: 0.65rem; padding: 0.3rem 0.5rem; }
}
