/* PBO Invest — Trading Terminal v2
   Professional trading interface. Bloomberg density, surgical precision.
   Every pixel earns its place. */

/* ===================== TERMINAL LAYOUT ===================== */
.terminal {
  display: grid;
  grid-template-columns: 1fr 300px;
  grid-template-rows: 42px 36px 1fr 220px;
  grid-template-areas:
    "symbolbar  symbolbar"
    "infostrip  infostrip"
    "chart      orderpanel"
    "positions  positions";
  height: 100vh;
  overflow: hidden;
  background: var(--tr-bg);
}

/* ===================== SYMBOL BAR ===================== */
.symbol-bar {
  grid-area: symbolbar;
  background: var(--tr-bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 0 0 12px;
}

.symbol-back {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 14px 0 2px;
  height: 100%;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s;
  font-size: 12px;
  font-weight: 500;
  border-right: 1px solid var(--border);
  margin-right: 2px;
}

.symbol-back:hover { color: var(--text-primary); }
.symbol-back i { width: 15px; height: 15px; }

.symbol-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  height: 100%;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}

.symbol-tab:hover { color: var(--text-secondary); }

.symbol-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--gold);
  background: rgba(201, 168, 76, 0.04);
}

.symbol-tab-price {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 400;
}

.symbol-tab-change {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 2px;
}

.symbol-tab-change.positive { color: var(--green); background: var(--green-dim); }
.symbol-tab-change.negative { color: var(--red); background: var(--red-dim); }

.symbol-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
}

.symbol-bar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  height: 100%;
}

.account-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  height: 100%;
  border-left: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.account-pill:hover { background: rgba(255,255,255,0.02); }

.account-pill-id {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.account-pill-balance {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.account-pill-tier {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 5px;
  border-radius: 2px;
  background: linear-gradient(135deg, #A3832B, #D4B968);
  color: #1A1400;
}

.account-pill i { width: 14px; height: 14px; color: var(--text-muted); }

.symbol-search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  height: 100%;
  border-left: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.symbol-search:hover { background: rgba(255,255,255,0.02); }
.symbol-search i { width: 14px; height: 14px; }

.symbol-search-key {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-muted);
}

/* ===================== INFO STRIP ===================== */
.info-strip {
  grid-area: infostrip;
  background: var(--tr-bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
}

.info-strip-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 14px;
  font-size: 11px;
  border-right: 1px solid var(--border);
  height: 100%;
}

.info-strip-item:last-child { border-right: none; }
.info-strip-item:first-child { padding-left: 0; }

.info-strip-label {
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-strip-value {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.info-strip-value.bid { color: var(--green); }
.info-strip-value.ask { color: var(--red); }

.info-strip-spread {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--gold);
  padding: 2px 6px;
  background: var(--gold-dim);
  border-radius: 2px;
  font-weight: 600;
}

.info-strip-change {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

.info-strip-change.positive { color: var(--green); }
.info-strip-change.negative { color: var(--red); }

.info-strip-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-muted);
}

.info-strip-live {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  animation: livePulse 2s infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ===================== CHART AREA ===================== */
.chart-area {
  grid-area: chart;
  background: var(--tr-bg);
  border-right: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.chart-tools {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 2;
}

.chart-tool-group {
  display: flex;
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.chart-tf-btn {
  padding: 4px 8px;
  background: rgba(30, 36, 35, 0.92);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  letter-spacing: 0.3px;
}

.chart-tf-btn:hover { color: var(--text-secondary); background: var(--bg-hover); }
.chart-tf-btn.active { color: var(--text-primary); background: var(--bg-hover); }

.chart-tool-btn {
  padding: 4px 8px;
  background: rgba(30, 36, 35, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.chart-tool-btn:hover { color: var(--text-secondary); border-color: var(--border-light); }
.chart-tool-btn i { width: 11px; height: 11px; }

.chart-tools-right {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

/* Price overlay */
.chart-price-overlay {
  position: absolute;
  top: 40px;
  left: 12px;
  z-index: 2;
}

.chart-price-pair {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.chart-price-big {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -1px;
  line-height: 1;
}

.chart-price-big .last-digits { color: var(--green); }

.chart-ohlc {
  display: flex;
  gap: 12px;
  margin-top: 6px;
}

.chart-ohlc-item {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

.chart-ohlc-item strong {
  color: var(--text-secondary);
  font-weight: 500;
}

/* Chart SVG */
.chart-canvas {
  position: absolute;
  bottom: 0; left: 0; right: 0; top: 100px;
}

.chart-gridline { stroke: rgba(42, 47, 46, 0.6); stroke-width: 0.5; }
.chart-gridline-v { stroke: rgba(42, 47, 46, 0.3); stroke-width: 0.5; }
.chart-y-label { font-family: 'IBM Plex Mono', monospace; font-size: 9px; fill: #5C6662; }
.chart-x-label { font-family: 'IBM Plex Mono', monospace; font-size: 9px; fill: #5C6662; }

.candle-up { fill: var(--green); }
.candle-down { fill: var(--red); }
.wick-up { stroke: var(--green); stroke-width: 1; }
.wick-down { stroke: var(--red); stroke-width: 1; }
.vol-up { fill: rgba(0, 200, 83, 0.12); }
.vol-down { fill: rgba(229, 57, 53, 0.12); }

.ma-line {
  fill: none;
  stroke: rgba(201, 168, 76, 0.4);
  stroke-width: 1.2;
}

.price-line { stroke: var(--gold); stroke-width: 1; stroke-dasharray: 3 2; }
.price-tag { fill: var(--gold); }
.price-tag-text { fill: #1A1400; font-family: 'IBM Plex Mono', monospace; font-size: 9px; font-weight: 700; }

/* ===================== ORDER PANEL ===================== */
.order-panel {
  grid-area: orderpanel;
  background: var(--tr-bg-secondary);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.order-panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.order-panel-tab {
  flex: 1;
  padding: 10px 12px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}

.order-panel-tab:hover { color: var(--text-secondary); }
.order-panel-tab.active { color: var(--text-primary); border-bottom-color: var(--gold); }

.order-content {
  padding: 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.order-type-row {
  display: flex;
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.order-type-btn {
  flex: 1;
  padding: 6px 10px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
  text-align: center;
  transition: all 0.15s;
}

.order-type-btn.active { background: var(--bg-hover); color: var(--text-primary); }

.side-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.side-btn {
  padding: 10px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
  border-radius: var(--radius);
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.side-btn.buy {
  background: rgba(0, 200, 83, 0.1);
  color: var(--green);
  border: 1px solid rgba(0, 200, 83, 0.2);
}

.side-btn.buy.active {
  background: var(--green);
  color: #0A1F0A;
  border-color: var(--green);
}

.side-btn.sell {
  background: rgba(229, 57, 53, 0.1);
  color: var(--red);
  border: 1px solid rgba(229, 57, 53, 0.2);
}

.side-btn.sell.active {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.order-bidask {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.order-bidask-side {
  padding: 8px 10px;
  background: var(--bg-card);
  text-align: center;
}

.order-bidask-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.order-bidask-price {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
}

.order-bidask-price.bid { color: var(--green); }
.order-bidask-price.ask { color: var(--red); }

.order-field { display: flex; flex-direction: column; gap: 4px; }

.order-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.order-input {
  padding: 7px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
}

.order-input:focus { border-color: var(--border-light); }

.order-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.leverage-row { display: flex; flex-direction: column; gap: 4px; }

.leverage-pills {
  display: flex;
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.leverage-pill {
  flex: 1;
  padding: 5px;
  text-align: center;
  background: var(--bg-card);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.leverage-pill.active { background: var(--bg-hover); color: var(--text-primary); }

.order-summary {
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.order-summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
}

.order-summary-row span:last-child {
  font-family: var(--font-mono);
  color: var(--text-secondary);
  font-weight: 500;
}

.order-submit {
  padding: 11px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.15s;
  margin-top: auto;
}

.order-submit.buy { background: var(--green); color: #0A1F0A; }
.order-submit.buy:hover { background: #00B84A; }
.order-submit.sell { background: var(--red); color: #fff; }
.order-submit.sell:hover { background: #D32F2F; }

/* ===================== POSITIONS PANEL ===================== */
.positions-panel {
  grid-area: positions;
  background: var(--tr-bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.positions-header {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
}

.positions-tab {
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}

.positions-tab:hover { color: var(--text-secondary); }
.positions-tab.active { color: var(--text-primary); border-bottom-color: var(--gold); }

.positions-count {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  background: var(--gold-dim);
  color: var(--gold);
  padding: 1px 5px;
  border-radius: 2px;
  margin-left: 5px;
}

.positions-summary {
  margin-left: auto;
  display: flex;
  gap: 16px;
  align-items: center;
}

.positions-summary-item {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.positions-summary-item span {
  font-family: var(--font-mono);
  font-weight: 700;
  margin-left: 4px;
}

.positions-summary-item span.positive { color: var(--green); }

.positions-table { flex: 1; overflow-y: auto; }

.positions-table table { width: 100%; border-collapse: collapse; }

.positions-table thead th {
  position: sticky; top: 0;
  background: rgba(28, 33, 32, 0.98);
  padding: 6px 12px;
  text-align: left;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.positions-table thead th:last-child { text-align: center; }

.positions-table tbody td {
  padding: 5px 12px;
  font-size: 11px;
  border-bottom: 1px solid rgba(42, 47, 46, 0.5);
  color: var(--text-secondary);
  white-space: nowrap;
}

.positions-table tbody td:last-child { text-align: center; }
.positions-table tbody tr { transition: background 0.1s; }
.positions-table tbody tr:hover { background: rgba(255, 255, 255, 0.015); }

.positions-table .td-symbol { font-family: var(--font-mono); font-weight: 700; color: var(--text-primary); font-size: 11px; }
.positions-table .td-mono { font-family: var(--font-mono); font-size: 11px; }
.positions-table .td-buy { color: var(--green); font-weight: 700; font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.positions-table .td-sell { color: var(--red); font-weight: 700; font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.td-pnl-pos { font-family: var(--font-mono); color: var(--green); font-weight: 700; font-size: 11px; }
.td-pnl-neg { font-family: var(--font-mono); color: var(--red); font-weight: 700; font-size: 11px; }

.close-btn {
  padding: 2px 8px;
  border: 1px solid rgba(229, 57, 53, 0.3);
  border-radius: 2px;
  background: rgba(229, 57, 53, 0.06);
  color: var(--red);
  font-size: 9px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.15s;
}

.close-btn:hover { background: rgba(229, 57, 53, 0.15); border-color: rgba(229, 57, 53, 0.5); }
