/* Trading Page Specific Styles */

.trading-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 1rem;
    padding: 1rem;
    max-width: 100%;
    height: calc(100vh - 80px);
}

.chart-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chart-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 1rem;
}

.symbol-dropdown {
    background: var(--background);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 0.65rem 1rem;
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    letter-spacing: -0.5px;
}

.symbol-dropdown:focus {
    outline: none;
    border-color: var(--primary-color);
}

.price-info {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.current-price-display {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.price-label {
    color: var(--text-secondary);
    font-weight: 600;
}

.price-amount {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.price-change {
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
}

.price-change.positive {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.price-change.negative {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.timeframe-selector {
    display: flex;
    gap: 0.5rem;
    background: var(--background);
    padding: 0.5rem;
    border-radius: 8px;
}

.timeframe-btn {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: -0.5px;
    font-size: 0.85rem;
}

.timeframe-btn.active,
.timeframe-btn:hover {
    background: var(--primary-color);
    color: white;
}

.main-chart {
    flex: 1;
    min-height: 0;
}

/* Order Panel */
.order-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.market-stats {
    background: var(--background);
    padding: 1rem;
    border-radius: 8px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
}

.stat-value {
    color: var(--text-primary);
    font-weight: 600;
}

/* Order Entry */
.order-entry {
    background: var(--background);
    padding: 1.5rem;
    border-radius: 8px;
}

.order-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.order-tab {
    padding: 0.7rem;
    border: none;
    border-radius: 10px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: -0.5px;
    font-size: 0.9rem;
}

.order-tab[data-type="buy"] {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.1));
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
    position: relative;
    overflow: hidden;
}

.order-tab[data-type="buy"]::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.2));
    opacity: 0;
    transition: opacity 0.3s;
}

.order-tab[data-type="buy"]:hover::before {
    opacity: 1;
}

.order-tab[data-type="buy"].active {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border-color: #10b981;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.order-tab[data-type="sell"] {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.1));
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
    position: relative;
    overflow: hidden;
}

.order-tab[data-type="sell"]::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.2));
    opacity: 0;
    transition: opacity 0.3s;
}

.order-tab[data-type="sell"]:hover::before {
    opacity: 1;
}

.order-tab[data-type="sell"].active {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border-color: #ef4444;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.order-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.order-type-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.order-type-btn {
    flex: 1;
    padding: 0.5rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: -0.5px;
    font-size: 0.85rem;
}

.order-type-btn.active {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

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

.input-group label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
}

.order-input {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 0.7rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
}

.order-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.order-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.leverage-selector label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
}

.leverage-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.leverage-btn {
    padding: 0.5rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    letter-spacing: -0.5px;
}

.leverage-btn.active,
.leverage-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.place-order-btn {
    width: 100%;
    padding: 0.9rem;
    border: none;
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 1rem;
    letter-spacing: -0.5px;
}

.buy-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.buy-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(16, 185, 129, 0.5);
}

.sell-btn {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.sell-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(239, 68, 68, 0.5);
}

.place-order-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Account Info */
.account-info {
    background: var(--background);
    padding: 1rem;
    border-radius: 8px;
}

.account-info h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.balance-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.balance-row {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
}

.balance-row span:last-child {
    color: var(--text-primary);
    font-weight: 600;
}

/* Bottom Panel */
.bottom-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding: 0 1rem 1rem 1rem;
    max-width: 100%;
}

.orderbook-panel,
.trades-panel {
    background: rgba(19, 19, 24, 0.6);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    backdrop-filter: blur(10px);
    height: 500px;
    display: flex;
    flex-direction: column;
}

.orderbook-panel h3,
.trades-panel h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.orderbook-container,
.trades-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.orderbook-header,
.trades-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 0.75rem 0.5rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 0.5rem;
}

.orderbook-asks,
.orderbook-bids,
.trades-list {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    overflow: hidden;
    position: relative;
}

.orderbook-asks,
.orderbook-bids {
    height: 180px;
}

.trades-list {
    flex: 1;
    overflow: hidden;
}

.orderbook-asks::after,
.orderbook-bids::after,
.trades-list::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to top, rgba(19, 19, 24, 0.9), transparent);
    pointer-events: none;
}

.orderbook-row,
.trade-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 0.6rem 0.5rem;
    transition: all 0.2s;
    position: relative;
    border-radius: 4px;
}

.orderbook-row:hover,
.trade-row:hover {
    background: rgba(59, 130, 246, 0.05);
}

.orderbook-row.ask {
    color: var(--danger);
}

.orderbook-row.bid {
    color: var(--success);
}

.orderbook-row.ask::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--danger);
    opacity: 0.3;
}

.orderbook-row.bid::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--success);
    opacity: 0.3;
}

.trade-row.buy {
    color: var(--success);
}

.trade-row.sell {
    color: var(--danger);
}

.trade-row.buy::before {
    content: '▲';
    position: absolute;
    left: -15px;
    color: var(--success);
    font-size: 0.6rem;
}

.trade-row.sell::before {
    content: '▼';
    position: absolute;
    left: -15px;
    color: var(--danger);
    font-size: 0.6rem;
}

.orderbook-spread {
    padding: 1rem;
    text-align: center;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    border: 1px solid var(--border);
    border-radius: 8px;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.9rem;
    letter-spacing: -0.3px;
    margin: 0.5rem 0;
}

/* Responsive Design */
@media (max-width: 1400px) {
    .trading-container {
        grid-template-columns: 1fr 350px;
    }
}

@media (max-width: 1024px) {
    .trading-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .chart-panel {
        height: 600px;
    }
    
    .bottom-panel {
        grid-template-columns: 1fr;
    }
    
    .chart-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    .timeframe-selector {
        overflow-x: auto;
        width: 100%;
    }
    
    .price-info {
        width: 100%;
    }
}
