/* ============================================
   Spot Trading Page - Specific Styles
   Loads trade-option.css for shared styles
   ============================================ */

/* ===== SPOT LAYOUT GRID ===== */
.spot-layout {
  display: grid;
  grid-template-columns: 220px 1fr 280px;
  grid-template-rows: auto 1fr auto;
  gap: 0;
  height: calc(100vh - 56px);
  overflow: hidden;
}

/* ===== LEFT: MARKET LIST ===== */
.spot-market-panel {
  grid-row: 1 / -1;
  background: #111827;
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.market-panel-header {
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.market-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: #e0e0e8;
  margin-bottom: 10px;
  letter-spacing: 0.3px;
}

.market-search-wrap {
  position: relative;
}

.market-search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #4a4a5a;
  pointer-events: none;
}

.market-search {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 8px 10px 8px 32px;
  color: #e0e0e8;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.market-search::placeholder {
  color: #4a4a5a;
}

.market-search:focus {
  border-color: rgba(92,184,230,0.3);
}

.market-tabs {
  display: flex;
  gap: 0;
  padding: 0 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.market-tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #5a5a6a;
  font-size: 11px;
  font-weight: 600;
  padding: 9px 0;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  font-family: inherit;
}

.market-tab:hover {
  color: #a8a8b8;
}

.market-tab.active {
  color: #5cb8e6;
  border-bottom-color: #5cb8e6;
}

.market-list-header {
  display: flex;
  justify-content: space-between;
  padding: 8px 14px;
  font-size: 10px;
  font-weight: 600;
  color: #4a4a5a;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.market-list {
  flex: 1;
  overflow-y: auto;
}

.market-list::-webkit-scrollbar {
  width: 3px;
}

.market-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
}

.market-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.1s;
  border-left: 2px solid transparent;
}

.market-row:hover {
  background: rgba(255,255,255,0.02);
}

.market-row.active {
  background: rgba(92,184,230,0.04);
  border-left-color: #5cb8e6;
}

.market-row-left {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.market-row-symbol {
  font-size: 13px;
  font-weight: 600;
  color: #e0e0e8;
}

.market-row-volume {
  font-size: 10px;
  color: #5a5a6a;
}

.market-row-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.market-row-price {
  font-size: 13px;
  font-weight: 600;
  color: #e0e0e8;
  font-variant-numeric: tabular-nums;
}

.market-row-change {
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.market-row-change.positive { color: #4ecb71; }
.market-row-change.negative { color: #e65c5c; }

/* ===== CENTER TOP: INSTRUMENT BAR (override for spot) ===== */
.spot-instrument-bar {
  grid-column: 2 / 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: #111827;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.spot-inst-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.spot-inst-symbol {
  font-size: 18px;
  font-weight: 700;
  color: #e0e0e8;
  letter-spacing: -0.3px;
}

.spot-inst-metrics {
  display: flex;
  align-items: center;
  gap: 0;
}

.spot-inst-metric {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 0 16px;
}

.spot-inst-metric .metric-label {
  font-size: 9px;
  margin-bottom: 2px;
}

.spot-inst-metric .metric-value {
  font-size: 13px;
}

.spot-inst-metric .metric-sub {
  font-size: 10px;
}

.spot-inst-divider {
  width: 1px;
  height: 28px;
  background: rgba(255,255,255,0.06);
  flex-shrink: 0;
}

/* ===== CENTER: CHART AREA ===== */
.spot-chart-area {
  grid-column: 2 / 3;
  background: #111827;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.spot-chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.spot-chart-container {
  flex: 1;
  min-height: 0;
  position: relative;
}

#spotTvChart {
  width: 100%;
  height: 100%;
}

/* ===== RIGHT: ORDER BOOK ===== */
.spot-orderbook-panel {
  grid-row: 1 / -1;
  background: #111827;
  border-left: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ob-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.ob-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: #e0e0e8;
}

.ob-view-btns {
  display: flex;
  gap: 4px;
}

.ob-view-btn {
  background: none;
  border: none;
  color: #4a4a5a;
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ob-view-btn:hover { color: #a8a8b8; }
.ob-view-btn.active { color: #5cb8e6; background: rgba(92,184,230,0.1); }

.ob-precision-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.ob-precision-label {
  font-size: 10px;
  color: #5a5a6a;
  font-weight: 500;
}

.ob-precision-btns {
  display: flex;
  gap: 2px;
}

.ob-precision-btn {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  color: #6a6a7a;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.ob-precision-btn:hover { color: #e0e0e8; }
.ob-precision-btn.active { color: #5cb8e6; border-color: rgba(92,184,230,0.3); background: rgba(92,184,230,0.06); }

.ob-asks-section,
.ob-bids-section {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.ob-asks-section {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.ob-asks-section::-webkit-scrollbar,
.ob-bids-section::-webkit-scrollbar {
  width: 2px;
}

.ob-asks-section::-webkit-scrollbar-thumb,
.ob-bids-section::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.04);
  border-radius: 2px;
}

.ob-row-spot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 14px;
  position: relative;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background 0.08s;
}

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

.ob-row-spot .ob-price {
  width: 75px;
  font-weight: 500;
  font-size: 12px;
}

.ob-row-spot.ask .ob-price { color: #e65c5c; }
.ob-row-spot.bid .ob-price { color: #4ecb71; }

.ob-row-spot .ob-size {
  width: 70px;
  text-align: right;
  color: #a8a8b8;
  font-size: 12px;
}

.ob-row-spot .ob-total-col {
  width: 75px;
  text-align: right;
  color: #5a5a6a;
  font-size: 11px;
}

.ob-depth-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  pointer-events: none;
  border-radius: 1px;
}

.ob-depth-bar.ask {
  right: 0;
  background: rgba(230, 92, 92, 0.06);
}

.ob-depth-bar.bid {
  right: 0;
  background: rgba(78, 203, 113, 0.06);
}

.ob-spread-row-spot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.01);
}

.ob-spread-price {
  font-size: 16px;
  font-weight: 700;
  color: #e0e0e8;
  font-variant-numeric: tabular-nums;
}

.ob-spread-price.up { color: #4ecb71; }
.ob-spread-price.down { color: #e65c5c; }

.ob-spread-info {
  font-size: 10px;
  color: #5a5a6a;
}

/* Recent Trades in orderbook panel */
.ob-trades-section {
  border-top: 1px solid rgba(255,255,255,0.06);
}

.ob-trades-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 8px;
}

.ob-trades-title {
  font-size: 12px;
  font-weight: 600;
  color: #a8a8b8;
}

.ob-trades-list {
  max-height: 140px;
  overflow-y: auto;
}

.ob-trades-list::-webkit-scrollbar {
  width: 2px;
}

.ob-trades-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.04);
}

.ob-trade-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 14px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.ob-trade-price {
  width: 75px;
  font-weight: 500;
}

.ob-trade-row.buy .ob-trade-price { color: #4ecb71; }
.ob-trade-row.sell .ob-trade-price { color: #e65c5c; }

.ob-trade-amount {
  width: 70px;
  text-align: right;
  color: #a8a8b8;
}

.ob-trade-time {
  width: 55px;
  text-align: right;
  color: #5a5a6a;
  font-size: 10px;
}

/* ===== BOTTOM SECTION ===== */
.spot-bottom-area {
  grid-column: 2 / 3;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 0;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: #111827;
  max-height: 320px;
  min-height: 280px;
}

/* ===== BOTTOM-LEFT: ORDER FORM ===== */
.spot-order-form {
  border-right: 1px solid rgba(255,255,255,0.06);
  padding: 14px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.spot-order-form::-webkit-scrollbar {
  width: 3px;
}

.spot-order-form::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
}

.spot-order-side-toggle {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  background: rgba(255,255,255,0.03);
  border-radius: 6px;
  padding: 2px;
}

.spot-side-btn {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  background: transparent;
  color: #5a5a6a;
  font-family: inherit;
}

.spot-side-btn.buy.active {
  background: rgba(78, 203, 113, 0.15);
  color: #4ecb71;
}

.spot-side-btn.sell.active {
  background: rgba(230, 92, 92, 0.15);
  color: #e65c5c;
}

.spot-side-btn:hover:not(.active) {
  color: #a8a8b8;
}

.spot-type-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 4px;
  padding: 2px;
}

.spot-type-btn {
  flex: 1;
  background: none;
  border: none;
  color: #5a5a6a;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 0;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  font-family: inherit;
}

.spot-type-btn:hover {
  color: #a8a8b8;
}

.spot-type-btn.active {
  color: #e0e0e8;
  background: rgba(255,255,255,0.06);
}

.spot-field {
  margin-bottom: 10px;
}

.spot-field label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #5a5a6a;
  font-weight: 500;
  margin-bottom: 5px;
}

.spot-field label span {
  color: #6a6a7a;
}

.spot-input-wrap {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  overflow: hidden;
  transition: border-color 0.15s;
}

.spot-input-wrap:focus-within {
  border-color: rgba(92, 184, 230, 0.3);
}

.spot-input {
  flex: 1;
  background: none;
  border: none;
  color: #e0e0e8;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 12px;
  outline: none;
  font-variant-numeric: tabular-nums;
  font-family: inherit;
}

.spot-input-unit {
  font-size: 11px;
  font-weight: 600;
  color: #5a5a6a;
  padding-right: 12px;
  white-space: nowrap;
}

.spot-step-btn {
  background: none;
  border: none;
  color: #5a5a6a;
  font-size: 14px;
  padding: 9px 10px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  line-height: 1;
}

.spot-step-btn:hover {
  color: #e0e0e8;
  background: rgba(255,255,255,0.04);
}

/* Percentage slider */
.spot-pct-slider {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}

.spot-pct-btn {
  flex: 1;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  color: #5a5a6a;
  font-size: 10px;
  font-weight: 600;
  padding: 5px 0;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  font-family: inherit;
}

.spot-pct-btn:hover {
  color: #e0e0e8;
  border-color: rgba(255,255,255,0.12);
}

.spot-pct-btn.active {
  color: #5cb8e6;
  border-color: rgba(92,184,230,0.3);
  background: rgba(92,184,230,0.06);
}

.spot-order-total {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 8px 0;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 10px;
}

.spot-order-total .label {
  color: #5a5a6a;
}

.spot-order-total .value {
  color: #e0e0e8;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.spot-submit-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.3px;
  font-family: inherit;
}

.spot-submit-btn.buy {
  background: linear-gradient(135deg, #4ecb71, #3dba60);
  color: #fff;
}

.spot-submit-btn.buy:hover {
  background: linear-gradient(135deg, #5dd97f, #4ecb71);
  box-shadow: 0 4px 20px rgba(78, 203, 113, 0.3);
}

.spot-submit-btn.sell {
  background: linear-gradient(135deg, #e65c5c, #d44a4a);
  color: #fff;
}

.spot-submit-btn.sell:hover {
  background: linear-gradient(135deg, #f06b6b, #e65c5c);
  box-shadow: 0 4px 20px rgba(230, 92, 92, 0.3);
}

.spot-balance-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #5a5a6a;
  margin-top: 8px;
}

.spot-balance-row .avail {
  color: #a8a8b8;
  font-weight: 500;
}

/* ===== BOTTOM-RIGHT: ORDERS & HISTORY ===== */
.spot-orders-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.spot-orders-tabs {
  display: flex;
  gap: 0;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.spot-orders-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #5a5a6a;
  font-size: 12px;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}

.spot-orders-tab:hover {
  color: #a8a8b8;
}

.spot-orders-tab.active {
  color: #e0e0e8;
  border-bottom-color: #5cb8e6;
}

.spot-orders-tab .tab-count {
  font-size: 10px;
  font-weight: 700;
  color: #5cb8e6;
  background: rgba(92,184,230,0.12);
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 6px;
}

.spot-orders-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.spot-orders-content::-webkit-scrollbar {
  width: 3px;
}

.spot-orders-content::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
}

/* Orders table */
.spot-orders-table {
  width: 100%;
  border-collapse: collapse;
}

.spot-orders-table thead th {
  font-size: 10px;
  font-weight: 600;
  color: #4a4a5a;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 8px 12px;
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: #111827;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.spot-orders-table tbody td {
  font-size: 12px;
  color: #a8a8b8;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.spot-orders-table tbody tr:hover {
  background: rgba(255,255,255,0.02);
}

.order-side-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 3px;
}

.order-side-tag.buy {
  color: #4ecb71;
  background: rgba(78,203,113,0.1);
}

.order-side-tag.sell {
  color: #e65c5c;
  background: rgba(230,92,92,0.1);
}

.order-status-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 3px;
}

.order-status-tag.open {
  color: #5cb8e6;
  background: rgba(92,184,230,0.1);
}

.order-status-tag.filled {
  color: #4ecb71;
  background: rgba(78,203,113,0.1);
}

.order-status-tag.partial {
  color: #f0b90b;
  background: rgba(240,185,11,0.1);
}

.order-cancel-btn {
  background: none;
  border: 1px solid rgba(230,92,92,0.2);
  color: #e65c5c;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.order-cancel-btn:hover {
  background: rgba(230,92,92,0.1);
  border-color: rgba(230,92,92,0.4);
}

/* Empty state */
.spot-orders-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: #4a4a5a;
}

.spot-orders-empty svg {
  margin-bottom: 12px;
  opacity: 0.4;
}

.spot-orders-empty p {
  font-size: 13px;
  margin: 0;
}

/* ===== TYPE TAG ===== */
.type-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.type-tag.spot {
  color: #5cb8e6;
  background: rgba(92,184,230,0.12);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .spot-layout {
    grid-template-columns: 180px 1fr 240px;
  }
  .spot-bottom-area {
    grid-template-columns: 300px 1fr;
  }
}

@media (max-width: 1024px) {
  .spot-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto;
    height: auto;
    overflow: auto;
  }
  .spot-market-panel {
    display: none;
  }
  .spot-orderbook-panel {
    display: none;
  }
  .spot-chart-area {
    grid-column: 1;
    min-height: 350px;
  }
  .spot-instrument-bar {
    grid-column: 1;
  }
  .spot-bottom-area {
    grid-column: 1;
    grid-template-columns: 1fr;
    max-height: none;
  }
  .spot-order-form {
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
}

@media (max-width: 600px) {
  .spot-inst-metrics {
    display: none;
  }
  .spot-bottom-area {
    grid-template-columns: 1fr;
  }
}
