/* ============================================================
   WebTrader Pro - Trading-specific Components
   ============================================================ */

/* ============ PRICE DISPLAY ============ */
.price-cell { font-family: var(--font-mono); white-space: nowrap; }
.price-bid { color: var(--sell); }
.price-ask { color: var(--buy); }
.price-big { font-size: var(--fs-xl); font-weight: var(--fw-bold); }
.price-small { font-size: var(--fs-sm); opacity: 0.7; }
.price-super { font-size: var(--fs-2xl); font-weight: var(--fw-bold); }
.price-spread {
    font-size: var(--fs-xs); color: var(--text-tertiary); text-align: center;
    padding: 0 var(--sp-1);
}
.price-flash-up { animation: priceFlashUp 0.5s ease; }
.price-flash-down { animation: priceFlashDown 0.5s ease; }

.price-change {
    display: inline-flex; align-items: center; gap: 2px; font-size: var(--fs-xs);
    font-weight: var(--fw-medium); font-family: var(--font-mono); padding: 2px 6px;
    border-radius: var(--radius-sm);
}
.price-change.up   { color: var(--profit); background: var(--profit-bg); }
.price-change.down { color: var(--loss); background: var(--loss-bg); }
.price-change.flat { color: var(--text-tertiary); background: var(--bg-tertiary); }

/* ============ INSTRUMENT LIST / WATCHLIST ============ */
.instrument-list { display: flex; flex-direction: column; }
.instrument-row {
    display: flex; align-items: center; padding: 10px var(--sp-4); gap: var(--sp-4);
    border-bottom: 1px solid var(--border); cursor: pointer;
    transition: background var(--tr-fast);
}
.instrument-row:hover { background: var(--bg-hover); }
.instrument-row:last-child { border-bottom: none; }
.instrument-row.selected {
    background: var(--accent-subtle); border-left: 3px solid var(--accent);
}
.instrument-info { flex: 1; min-width: 0; }
.instrument-symbol { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-primary); }
.instrument-name   { font-size: var(--fs-xs); color: var(--text-tertiary); }
.instrument-prices { text-align: right; font-family: var(--font-mono); }
.instrument-bid-ask { font-size: var(--fs-sm); font-weight: var(--fw-medium); }

/* ============ ORDER PANEL ============ */
.order-panel {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius-lg); overflow: hidden;
}
.order-type-tabs {
    display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--border);
}
.order-type-tab {
    padding: 12px; text-align: center; font-size: var(--fs-sm); font-weight: var(--fw-semibold);
    cursor: pointer; transition: all var(--tr-fast); border: none; background: transparent;
    color: var(--text-secondary);
}
.order-type-tab.buy-tab.active {
    background: var(--profit-bg); color: var(--profit); border-bottom: 2px solid var(--profit);
}
.order-type-tab.sell-tab.active {
    background: var(--loss-bg); color: var(--loss); border-bottom: 2px solid var(--loss);
}
.order-type-tab:hover:not(.active) { background: var(--bg-tertiary); }

.order-form { padding: var(--sp-4); }
.order-form .form-group { margin-bottom: var(--sp-3); }

.lot-input-wrapper {
    display: flex; align-items: center; gap: var(--sp-2);
}
.lot-input-wrapper .input {
    text-align: center; font-size: var(--fs-lg); font-weight: var(--fw-semibold);
    font-family: var(--font-mono);
}
.lot-btn {
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); background: var(--bg-tertiary); border-radius: var(--radius-md);
    cursor: pointer; font-size: var(--fs-lg); color: var(--text-secondary);
    transition: all var(--tr-fast);
}
.lot-btn:hover { background: var(--bg-quaternary); color: var(--text-primary); }

.order-summary {
    background: var(--bg-tertiary); border-radius: var(--radius-md); padding: var(--sp-3);
    margin: var(--sp-3) 0; font-size: var(--fs-xs);
}
.order-summary-row {
    display: flex; justify-content: space-between; padding: 3px 0;
    color: var(--text-secondary);
}
.order-summary-row .value { color: var(--text-primary); font-family: var(--font-mono); font-weight: var(--fw-medium); }

.order-submit-buy {
    width: 100%; padding: 14px; border: none; border-radius: var(--radius-lg);
    background: var(--profit); color: white; font-size: var(--fs-md); font-weight: var(--fw-bold);
    cursor: pointer; transition: all var(--tr-fast); text-transform: uppercase; letter-spacing: 0.05em;
}
.order-submit-buy:hover { background: #059669; box-shadow: var(--glow-green); }
.order-submit-sell {
    width: 100%; padding: 14px; border: none; border-radius: var(--radius-lg);
    background: var(--loss); color: white; font-size: var(--fs-md); font-weight: var(--fw-bold);
    cursor: pointer; transition: all var(--tr-fast); text-transform: uppercase; letter-spacing: 0.05em;
}
.order-submit-sell:hover { background: #dc2626; box-shadow: var(--glow-red); }

/* ============ POSITIONS TABLE ============ */
.position-row {
    display: grid;
    grid-template-columns: 100px 60px 70px 100px 100px 100px 80px;
    align-items: center; gap: var(--sp-2); padding: 8px var(--sp-4);
    font-size: var(--fs-sm); border-bottom: 1px solid var(--border);
}
.position-pnl { font-family: var(--font-mono); font-weight: var(--fw-semibold); }
.position-pnl.positive { color: var(--profit); }
.position-pnl.negative { color: var(--loss); }
.position-side { font-weight: var(--fw-semibold); text-transform: uppercase; font-size: var(--fs-xs); }
.position-side.buy  { color: var(--buy); }
.position-side.sell { color: var(--sell); }

/* ============ CHART AREA ============ */
.chart-container { flex: 1; position: relative; min-height: 400px; background: var(--bg-primary); }
.chart-toolbar {
    display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3);
    border-bottom: 1px solid var(--border); background: var(--bg-secondary);
}
.chart-tf-btn {
    padding: 4px 10px; font-size: var(--fs-xs); font-weight: var(--fw-medium);
    color: var(--text-secondary); background: transparent; border: 1px solid transparent;
    border-radius: var(--radius-sm); cursor: pointer; transition: all var(--tr-fast);
    font-family: var(--font);
}
.chart-tf-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.chart-tf-btn.active { background: var(--accent-subtle); color: var(--accent-text); border-color: var(--accent); }
.chart-divider { width: 1px; height: 20px; background: var(--border); margin: 0 var(--sp-1); }

/* ============ ACCOUNT BAR ============ */
.account-bar {
    display: flex; align-items: center; gap: var(--sp-6); padding: var(--sp-3) var(--sp-5);
    background: var(--bg-secondary); border-top: 1px solid var(--border);
    font-family: var(--font-mono); font-size: var(--fs-sm); overflow-x: auto;
}
.account-stat { display: flex; flex-direction: column; gap: 2px; white-space: nowrap; }
.account-stat-label { font-size: var(--fs-xs); color: var(--text-tertiary); font-family: var(--font); text-transform: uppercase; letter-spacing: 0.05em; }
.account-stat-value { font-weight: var(--fw-semibold); }
.account-stat-value.positive { color: var(--profit); }
.account-stat-value.negative { color: var(--loss); }

/* ============ DEALING EXPOSURE ============ */
.exposure-bar {
    display: flex; height: 24px; border-radius: var(--radius-full); overflow: hidden;
    background: var(--bg-tertiary);
}
.exposure-long { background: var(--profit); transition: width var(--tr-normal); }
.exposure-short { background: var(--loss); transition: width var(--tr-normal); }

/* ============ PIPELINE (CRM) ============ */
.pipeline {
    display: flex; gap: var(--sp-4); overflow-x: auto; padding-bottom: var(--sp-4);
}
.pipeline-stage {
    min-width: 280px; flex-shrink: 0; background: var(--bg-secondary);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.pipeline-stage-header {
    padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.pipeline-stage-title { font-size: var(--fs-sm); font-weight: var(--fw-semibold); }
.pipeline-stage-count { font-size: var(--fs-xs); color: var(--text-secondary); background: var(--bg-tertiary); padding: 2px 8px; border-radius: var(--radius-full); }
.pipeline-stage-body { padding: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-2); max-height: 500px; overflow-y: auto; }

.pipeline-card {
    background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: var(--sp-3); cursor: pointer; transition: all var(--tr-fast);
}
.pipeline-card:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-md); }

/* ============ QUICK ACTIONS ============ */
.quick-trade {
    display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--sp-1); align-items: center;
}
.quick-trade-price {
    padding: var(--sp-3); text-align: center; border-radius: var(--radius-md);
    cursor: pointer; transition: all var(--tr-fast); border: 1px solid var(--border);
    background: var(--bg-tertiary);
}
.quick-trade-price:hover { border-color: var(--accent); }
.quick-trade-price.buy-price:hover { border-color: var(--profit); background: var(--profit-bg); }
.quick-trade-price.sell-price:hover { border-color: var(--loss); background: var(--loss-bg); }
.quick-trade-label { font-size: var(--fs-xs); color: var(--text-tertiary); text-transform: uppercase; margin-bottom: 2px; }
.quick-trade-value { font-size: var(--fs-xl); font-weight: var(--fw-bold); font-family: var(--font-mono); }
.quick-trade-spread { font-size: var(--fs-xs); color: var(--text-tertiary); padding: 0 var(--sp-2); }
