/**
 * JPMS Spot Trading Page Styles
 * @author AI Assistant
 * @created 2026-02-21
 * @description Zyrix Exchange Spot Trading Page - Dark Theme Professional Trading Interface
 */

/* ========================================
   CSS Variables - Design System (Zyrix Style)
   ======================================== */
:root {
    /* Background Colors - Dark Theme (�?wallet 统一) */
    --spot-bg-primary: #0a0a0a;
    --spot-bg-secondary: #111111;
    --spot-bg-tertiary: #161616;
    --spot-bg-card: #161616;
    --spot-bg-input: #111111;
    --spot-bg-hover: #1c1c1c;
    --spot-bg-active: rgba(255, 215, 0, 0.1);

    /* Text Colors (�?wallet 统一) */
    --spot-text-primary: #ffffff;
    --spot-text-secondary: #9ca3af;
    --spot-text-muted: #6b7280;
    --spot-text-disabled: #4b5563;

    /* Accent Colors - Gold/Yellow (统一�?wallet 配色) */
    --spot-accent-gold: #FFD700;
    --spot-accent-gold-hover: #e6c200;
    --spot-accent-gold-light: rgba(255, 215, 0, 0.15);

    /* Trading Colors - 绿色�?红色�?*/
    --spot-success: #0ecb81;
    --spot-success-light: rgba(14, 203, 129, 0.15);
    --spot-success-bg: rgba(14, 203, 129, 0.1);
    --spot-success-hover: #00d68f;
    --spot-danger: #f6465d;
    --spot-danger-light: rgba(246, 70, 93, 0.15);
    --spot-danger-bg: rgba(246, 70, 93, 0.1);
    --spot-danger-hover: #ff6b7d;

    /* Border Colors (�?wallet 统一) */
    --spot-border-color: #2a2a2a;
    --spot-border-light: #1a1a1a;
    --spot-border-hover: #3a3a3a;

    /* Chart Colors */
    --spot-chart-up: #0ecb81;
    --spot-chart-down: #f6465d;
    --spot-chart-grid: #2b2f36;

    /* Spacing */
    --spot-spacing-xs: 4px;
    --spot-spacing-sm: 8px;
    --spot-spacing-md: 12px;
    --spot-spacing-lg: 16px;
    --spot-spacing-xl: 20px;
    --spot-spacing-2xl: 24px;
    --spot-spacing-3xl: 32px;

    /* Border Radius */
    --spot-radius-sm: 4px;
    --spot-radius-md: 6px;
    --spot-radius-lg: 8px;
    --spot-radius-xl: 12px;

    /* Font Sizes */
    --spot-font-xs: 11px;
    --spot-font-sm: 12px;
    --spot-font-md: 13px;
    --spot-font-base: 14px;
    --spot-font-lg: 16px;
    --spot-font-xl: 18px;
    --spot-font-2xl: 20px;
    --spot-font-3xl: 24px;

    /* Shadows */
    --spot-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --spot-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
}

/* ========================================
   Base Styles & Reset
   ======================================== */
.spot-page {
    background-color: var(--spot-bg-primary);
    min-height: 100vh;
    color: var(--spot-text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: var(--spot-font-base);
    line-height: 1.5;
}

.spot-page * {
    box-sizing: border-box;
}

.spot-page .container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 16px;
    width: 100% !important;
}

/* ========================================
   Trading Header
   ======================================== */
.trading-header {
    background-color: var(--spot-bg-secondary);
    border-bottom: 1px solid var(--spot-border-color);
    padding: 12px 0;
}

.trading-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spot-spacing-2xl);
    flex-wrap: wrap;
}

.pair-info {
    display: flex;
    align-items: center;
    gap: var(--spot-spacing-md);
    flex-shrink: 0;
}

.pair-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #f7931a 0%, #ffad33 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(247, 147, 26, 0.3);
}

.pair-icon-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    flex-shrink: 0;
}

.pair-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pair-details h2 {
    font-size: var(--spot-font-xl);
    font-weight: 600;
    color: var(--spot-text-primary);
    margin: 0;
    white-space: nowrap;
}

.pair-label {
    font-size: var(--spot-font-xs);
    color: var(--spot-text-muted);
    white-space: nowrap;
}

.pair-stats {
    display: flex;
    align-items: center;
    gap: var(--spot-spacing-3xl);
    flex: 1;
    flex-wrap: wrap;
    min-width: 0;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}

.stat-label {
    font-size: var(--spot-font-xs);
    color: var(--spot-text-muted);
    text-transform: capitalize;
    white-space: nowrap;
}

.stat-value {
    font-size: var(--spot-font-sm);
    font-weight: 500;
    color: var(--spot-text-primary);
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    white-space: nowrap;
}

.stat-value.positive {
    color: var(--spot-success);
}

.stat-value.negative {
    color: var(--spot-danger);
}

/* ========================================
   Trading Layout
   ======================================== */
.trading-layout {
    display: flex;
    min-height: 520px;
    background-color: var(--spot-bg-primary);
    border-bottom: 1px solid var(--spot-border-color);
}

/* ========================================
   Trading Panels
   ======================================== */
.trading-panel {
    background-color: var(--spot-bg-secondary);
    border-right: 1px solid var(--spot-border-color);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.trading-panel:last-child {
    border-right: none;
}

/* ========================================
   Chart Panel (Left)
   ======================================== */
.chart-panel {
    flex: 1;
    min-width: 0;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spot-spacing-sm) var(--spot-spacing-lg);
    border-bottom: 1px solid var(--spot-border-color);
    background-color: var(--spot-bg-secondary);
    flex-shrink: 0;
    gap: var(--spot-spacing-md);
}

.timeframes {
    display: flex;
    align-items: center;
    gap: var(--spot-spacing-xs);
    flex-shrink: 0;
}

.timeframe-btn {
    padding: 6px 12px;
    font-size: var(--spot-font-xs);
    font-weight: 500;
    color: var(--spot-text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--spot-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.timeframe-btn:hover {
    color: var(--spot-text-primary);
    background-color: var(--spot-bg-hover);
}

.timeframe-btn.active {
    color: var(--spot-accent-gold);
    background-color: var(--spot-accent-gold-light);
}

.chart-tools {
    display: flex;
    align-items: center;
    gap: var(--spot-spacing-xs);
    flex-shrink: 0;
}

.chart-tool-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--spot-text-secondary);
    cursor: pointer;
    border-radius: var(--spot-radius-sm);
    transition: all 0.2s ease;
}

.chart-tool-btn:hover {
    background-color: var(--spot-bg-hover);
    color: var(--spot-text-primary);
}

.chart-tool-btn svg {
    width: 16px;
    height: 16px;
}

.chart-container {
    flex: 1;
    background-color: var(--spot-bg-primary);
    position: relative;
    overflow: hidden;
    min-width: 0;
    min-height: 400px;
}

#klineChart {
    width: 100%;
    height: 100%;
    min-height: 400px;
}

/* ========================================
   Pairs Panel (Right)
   ======================================== */
.pairs-panel {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spot-spacing-md) var(--spot-spacing-lg);
    border-bottom: 1px solid var(--spot-border-color);
    flex-shrink: 0;
}

.panel-title {
    font-size: var(--spot-font-base);
    font-weight: 600;
    color: var(--spot-text-primary);
}

.pairs-search {
    padding: var(--spot-spacing-md) var(--spot-spacing-lg);
    border-bottom: 1px solid var(--spot-border-color);
    flex-shrink: 0;
}

.search-input {
    width: 100%;
    padding: 8px var(--spot-spacing-md);
    background-color: var(--spot-bg-input);
    border: 1px solid var(--spot-border-color);
    border-radius: var(--spot-radius-md);
    color: var(--spot-text-primary);
    font-size: var(--spot-font-sm);
    outline: none;
    transition: all 0.2s ease;
}

.search-input:focus {
    border-color: var(--spot-accent-gold);
    box-shadow: 0 0 0 2px var(--spot-accent-gold-light);
}

.search-input::placeholder {
    color: var(--spot-text-muted);
}

.pairs-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--spot-border-color) transparent;
}

.pairs-list::-webkit-scrollbar {
    width: 4px;
}

.pairs-list::-webkit-scrollbar-track {
    background: transparent;
}

.pairs-list::-webkit-scrollbar-thumb {
    background: var(--spot-border-color);
    border-radius: 2px;
}

.pairs-header {
    display: flex;
    align-items: center;
    padding: var(--spot-spacing-md) var(--spot-spacing-lg);
    font-size: var(--spot-font-xs);
    color: var(--spot-text-muted);
    border-bottom: 1px solid var(--spot-border-color);
    flex-shrink: 0;
}

.pairs-header span {
    flex: 1;
    text-align: right;
}

.pairs-header span:first-child {
    text-align: left;
}

.pair-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px var(--spot-spacing-lg);
    border-bottom: 1px solid var(--spot-border-light);
    cursor: pointer;
    transition: all 0.2s ease;
}

.pair-row:hover {
    background-color: var(--spot-bg-hover);
}

.pair-row.active {
    background-color: var(--spot-accent-gold-light);
    border-left: 3px solid var(--spot-accent-gold);
}

.pair-name-cell {
    display: flex;
    align-items: center;
    gap: var(--spot-spacing-sm);
    min-width: 120px;
}

.pair-icon-small {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    font-weight: 600;
    font-size: 12px;
}

.pair-icon-small-img {
    max-width: 24px;
    max-height: 24px;
    width: auto;
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.pair-symbol {
    font-size: var(--spot-font-sm);
    font-weight: 500;
    color: var(--spot-text-primary);
    white-space: nowrap;
}

.pair-price-cell {
    font-size: var(--spot-font-sm);
    color: var(--spot-text-primary);
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    min-width: 80px;
    text-align: right;
}

.pair-change-cell {
    font-size: var(--spot-font-sm);
    font-weight: 500;
    min-width: 60px;
    text-align: right;
}

.pair-change-cell.positive {
    color: var(--spot-success);
}

.pair-change-cell.negative {
    color: var(--spot-danger);
}

/* ========================================
   Trading Forms Section
   ======================================== */
.trading-forms-section {
    background-color: var(--spot-bg-primary);
    padding: 0;
    width: 100%;
}

.trading-forms-section .container {
    padding: 0;
    max-width: 100%;
    width: 100% !important;
    margin: 0;
}

.trading-forms-grid {
    display: grid;
    grid-template-columns: 360px minmax(300px, 1fr) minmax(400px, 1.5fr);
    gap: 1px;
    background-color: var(--spot-border-color);
    min-height: 480px;
    width: 100%;
}

/* ========================================
   Trading Form Panel
   ======================================== */
.trading-form-panel {
    background-color: var(--spot-bg-secondary);
    padding: var(--spot-spacing-lg);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.form-panel-tabs {
    display: flex;
    align-items: center;
    gap: var(--spot-spacing-xs);
    margin-bottom: var(--spot-spacing-md);
    flex-shrink: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.form-panel-tab {
    flex: 1;
    min-width: fit-content;
    padding: var(--spot-spacing-sm) var(--spot-spacing-md);
    font-size: var(--spot-font-xs);
    font-weight: 500;
    color: var(--spot-text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--spot-radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    white-space: nowrap;
}

.form-panel-tab:hover {
    color: var(--spot-text-primary);
    background-color: var(--spot-bg-hover);
}

.form-panel-tab.active {
    color: var(--spot-text-primary);
    background-color: var(--spot-bg-card);
    border: 1px solid var(--spot-border-hover);
}

/* Order Type Tabs */
.order-type-tabs {
    display: flex;
    align-items: center;
    gap: var(--spot-spacing-xs);
    margin-bottom: var(--spot-spacing-md);
    flex-shrink: 0;
}

.order-type-tab {
    padding: var(--spot-spacing-sm) var(--spot-spacing-md);
    font-size: var(--spot-font-xs);
    font-weight: 500;
    color: var(--spot-text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: var(--spot-radius-sm);
}

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

.order-type-tab.active {
    color: var(--spot-accent-gold);
    background-color: var(--spot-accent-gold-light);
}

.buy-sell-tabs {
    display: flex;
    margin-bottom: var(--spot-spacing-lg);
    border-radius: var(--spot-radius-md);
    overflow: hidden;
    flex-shrink: 0;
    background-color: var(--spot-bg-input);
    border: 1px solid var(--spot-border-color);
}

.buy-sell-tab {
    flex: 1;
    padding: var(--spot-spacing-md);
    font-size: var(--spot-font-base);
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    background-color: transparent;
    color: var(--spot-text-secondary);
}

.buy-sell-tab.buy.active {
    background-color: var(--spot-success);
    color: white;
}

.buy-sell-tab.sell.active {
    background-color: var(--spot-danger);
    color: white;
}

.buy-sell-tab:hover:not(.active) {
    background-color: var(--spot-bg-hover);
    color: var(--spot-text-primary);
}

.trading-form-panel form {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spot-spacing-md);
    min-height: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.form-group label {
    font-size: var(--spot-font-xs);
    color: var(--spot-text-muted);
    text-transform: capitalize;
}

.input-group {
    display: flex;
    align-items: center;
    background-color: var(--spot-bg-input);
    border: 1px solid var(--spot-border-color);
    border-radius: var(--spot-radius-md);
    overflow: hidden;
    transition: all 0.2s ease;
}

.input-group:focus-within {
    border-color: var(--spot-accent-gold);
    box-shadow: 0 0 0 2px var(--spot-accent-gold-light);
}

.input-group input {
    flex: 1;
    padding: 10px var(--spot-spacing-md);
    background: transparent;
    border: none;
    color: var(--spot-text-primary);
    font-size: var(--spot-font-base);
    outline: none;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    min-width: 0;
    text-align: right;
}

.input-group input::placeholder {
    color: var(--spot-text-muted);
}

.input-group .unit {
    padding: 10px var(--spot-spacing-md);
    font-size: var(--spot-font-xs);
    color: var(--spot-text-muted);
    border-left: 1px solid var(--spot-border-color);
    background-color: var(--spot-bg-tertiary);
    font-weight: 500;
    white-space: nowrap;
    min-width: 60px;
    text-align: center;
}

.slider-container {
    flex-shrink: 0;
    padding: var(--spot-spacing-sm) 0;
}

.percentage-slider {
    width: 100%;
    height: 4px;
    background-color: var(--spot-border-color);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    margin: var(--spot-spacing-sm) 0;
}

.percentage-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background-color: var(--spot-accent-gold);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--spot-shadow-sm);
}

.percentage-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background-color: var(--spot-accent-gold);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--spot-shadow-sm);
    border: none;
}

.percentage-buttons {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spot-spacing-xs);
    margin-top: var(--spot-spacing-sm);
}

.percentage-btn,
.percent-btn {
    flex: 1;
    min-width: 0;
    padding: 6px;
    font-size: var(--spot-font-xs);
    color: var(--spot-text-secondary);
    background-color: var(--spot-bg-input);
    border: 1px solid var(--spot-border-color);
    border-radius: var(--spot-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.percentage-btn:hover,
.percent-btn:hover {
    border-color: var(--spot-border-hover);
    color: var(--spot-text-primary);
    background-color: var(--spot-bg-hover);
}

.percentage-btn.active,
.percent-btn.active {
    border-color: var(--spot-accent-gold);
    color: var(--spot-accent-gold);
    background-color: var(--spot-accent-gold-light);
}

.form-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spot-spacing-sm) 0;
    font-size: var(--spot-font-xs);
    flex-shrink: 0;
}

.form-info-label {
    color: var(--spot-text-muted);
}

.form-info-value {
    color: var(--spot-text-primary);
    font-weight: 500;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
}

.btn-submit {
    width: 100%;
    padding: 14px;
    font-size: var(--spot-font-base);
    font-weight: 600;
    border: none;
    border-radius: var(--spot-radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: auto;
    flex-shrink: 0;
}

.btn-submit.buy {
    background-color: var(--spot-success);
    color: white;
}

.btn-submit.sell {
    background-color: var(--spot-danger);
    color: white;
}

.btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: var(--spot-shadow-md);
}

.btn-submit.buy:hover {
    background-color: var(--spot-success-hover);
}

.btn-submit.sell:hover {
    background-color: var(--spot-danger-hover);
}

/* ========================================
   Orderbook Panel (In Trading Forms Grid)
   ======================================== */
.orderbook-panel {
    background-color: var(--spot-bg-secondary);
    border-right: none;
    padding: var(--spot-spacing-lg);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    min-width: 0;
}

.orderbook-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: var(--spot-spacing-md);
    border-bottom: 1px solid var(--spot-border-color);
    flex-shrink: 0;
    margin-bottom: var(--spot-spacing-md);
}

.orderbook-title {
    font-size: var(--spot-font-base);
    font-weight: 600;
    color: var(--spot-text-primary);
    margin: 0;
}

.orderbook-precision {
    display: flex;
    align-items: center;
    gap: var(--spot-spacing-xs);
    flex-shrink: 0;
}

.precision-btn {
    padding: 4px 8px;
    font-size: var(--spot-font-xs);
    color: var(--spot-text-secondary);
    background-color: var(--spot-bg-input);
    border: 1px solid var(--spot-border-color);
    border-radius: var(--spot-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.precision-btn:hover {
    border-color: var(--spot-border-hover);
    color: var(--spot-text-primary);
}

.precision-btn.active {
    color: var(--spot-accent-gold);
    border-color: var(--spot-accent-gold);
    background-color: var(--spot-accent-gold-light);
}

.orderbook-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.orderbook-header-row {
    display: flex;
    padding: var(--spot-spacing-sm) 0;
    font-size: var(--spot-font-xs);
    color: var(--spot-text-muted);
    border-bottom: 1px solid var(--spot-border-color);
    flex-shrink: 0;
}

.orderbook-header-row span {
    flex: 1;
    text-align: right;
}

.orderbook-header-row span:first-child {
    text-align: left;
}

.orderbook-list {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    scrollbar-width: none;
    flex: 1;
    min-height: 280px;
    max-height: 320px;
}

.orderbook-list::-webkit-scrollbar {
    display: none;
}

.orderbook-asks {
    justify-content: flex-end;
}

.order-row {
    display: flex;
    align-items: center;
    padding: 4px 0;
    font-size: var(--spot-font-xs);
    position: relative;
    cursor: pointer;
    height: 24px;
}

.order-row:hover {
    background-color: var(--spot-bg-hover);
}

.order-row span {
    flex: 1;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 1;
    position: relative;
}

.order-row span:first-child {
    text-align: left;
}

.order-row span:not(:first-child) {
    text-align: right;
}

.order-row.ask span:first-child {
    color: var(--spot-danger);
}

.order-row.bid span:first-child {
    color: var(--spot-success);
}

.order-row span:not(:first-child) {
    color: var(--spot-text-secondary);
}

.depth-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    opacity: 0.12;
    z-index: 0;
    pointer-events: none;
}

.depth-bar.ask {
    right: 0;
    background-color: var(--spot-danger);
}

.depth-bar.bid {
    right: 0;
    background-color: var(--spot-success);
}

.current-price {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spot-spacing-sm);
    padding: var(--spot-spacing-md) 0;
    border-top: 1px solid var(--spot-border-color);
    border-bottom: 1px solid var(--spot-border-color);
    margin: var(--spot-spacing-xs) 0;
    flex-shrink: 0;
    background-color: var(--spot-bg-tertiary);
    font-size: var(--spot-font-xl);
    font-weight: 700;
    color: var(--spot-success);
}

.current-price.down {
    color: var(--spot-danger);
}

.current-price svg {
    width: 16px;
    height: 16px;
}

/* ========================================
   Trade History Panel
   ======================================== */
.trade-history-panel {
    background-color: var(--spot-bg-secondary);
    padding: var(--spot-spacing-lg);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    min-width: 0;
}

.history-tabs {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spot-spacing-md);
    flex-shrink: 0;
    gap: var(--spot-spacing-xs);
    flex-wrap: wrap;
    border-bottom: 1px solid var(--spot-border-color);
    padding-bottom: var(--spot-spacing-md);
}

.history-tab {
    font-size: var(--spot-font-xs);
    font-weight: 500;
    color: var(--spot-text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: var(--spot-spacing-sm) var(--spot-spacing-md);
    border-radius: var(--spot-radius-md);
}

.history-tab:hover {
    color: var(--spot-text-primary);
    background-color: var(--spot-bg-hover);
}

.history-tab.active {
    color: var(--spot-accent-gold);
    background-color: var(--spot-accent-gold-light);
}

.view-all-link {
    font-size: var(--spot-font-xs);
    color: var(--spot-text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
    margin-left: auto;
}

.view-all-link:hover {
    color: var(--spot-accent-gold);
    text-decoration: underline;
}

.history-table-wrapper {
    flex: 1;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--spot-border-color) transparent;
}

.history-table-wrapper::-webkit-scrollbar {
    height: 6px;
    width: 6px;
}

.history-table-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.history-table-wrapper::-webkit-scrollbar-thumb {
    background: var(--spot-border-color);
    border-radius: 3px;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

.history-table th {
    text-align: left;
    padding: var(--spot-spacing-md) var(--spot-spacing-sm);
    font-size: var(--spot-font-xs);
    font-weight: 500;
    color: var(--spot-text-muted);
    text-transform: capitalize;
    border-bottom: 1px solid var(--spot-border-color);
    white-space: nowrap;
}

.history-table td {
    padding: var(--spot-spacing-md) var(--spot-spacing-sm);
    font-size: var(--spot-font-xs);
    border-bottom: 1px solid var(--spot-border-light);
    color: var(--spot-text-primary);
    white-space: nowrap;
}

.history-table tbody tr:hover td {
    background-color: var(--spot-bg-hover);
}

.history-type {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: var(--spot-radius-sm);
    font-size: var(--spot-font-xs);
    font-weight: 500;
}

.history-type.buy {
    background-color: var(--spot-success-bg);
    color: var(--spot-success);
}

.history-type.sell {
    background-color: var(--spot-danger-bg);
    color: var(--spot-danger);
}

.history-status {
    font-size: var(--spot-font-xs);
    font-weight: 500;
}

.history-status.pending {
    color: var(--spot-accent-gold);
}

.history-status.completed {
    color: var(--spot-success);
}

.history-status.cancelled {
    color: var(--spot-danger);
}

/* ========================================
   Responsive Styles
   ======================================== */

/* Desktop Large (>=1400px) */
@media (min-width: 1400px) {
    .trading-layout {
        min-height: 600px;
    }

    .trading-forms-grid {
        grid-template-columns: 380px minmax(300px, 1fr) minmax(450px, 1.5fr);
    }
}

/* Desktop (1200px - 1399px) */
@media (max-width: 1399px) and (min-width: 1200px) {
    .trading-layout {
        min-height: 550px;
    }

    .pairs-panel {
        width: 280px;
    }

    .trading-forms-grid {
        grid-template-columns: 340px minmax(280px, 1fr) minmax(400px, 1.5fr);
    }
}

/* Tablet (992px - 1199px) */
@media (max-width: 1199px) and (min-width: 992px) {
    .trading-layout {
        flex-direction: column;
        min-height: auto;
    }

    .trading-panel {
        border-right: none;
        border-bottom: 1px solid var(--spot-border-color);
    }

    .chart-panel {
        min-height: 450px;
    }

    .pairs-panel {
        width: 100%;
        max-height: 280px;
    }

    .trading-forms-grid {
        grid-template-columns: 320px 1fr;
    }

    .trade-history-panel {
        grid-column: span 2;
    }

    .pair-stats {
        gap: var(--spot-spacing-xl);
    }
}

/* Tablet Small (768px - 991px) */
@media (max-width: 991px) {
    .trading-header .container {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spot-spacing-md);
    }

    .pair-stats {
        width: 100%;
        justify-content: space-between;
        gap: var(--spot-spacing-lg);
    }

    .stat-item {
        flex: 1;
    }

    .trading-forms-grid {
        grid-template-columns: 1fr 1fr;
    }

    .trade-history-panel {
        grid-column: span 2;
    }
}

/* Mobile (<=768px) */
@media (max-width: 768px) {
    .spot-page {
        padding-bottom: 60px; /* Space for bottom nav */
    }

    .trading-header {
        padding: var(--spot-spacing-sm) 0;
    }

    .trading-header .container {
        padding: var(--spot-spacing-sm) var(--spot-spacing-md);
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spot-spacing-sm);
    }

    .pair-info {
        gap: var(--spot-spacing-sm);
        width: 100%;
        margin-bottom: var(--spot-spacing-sm);
    }

    .pair-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .pair-details h2 {
        font-size: var(--spot-font-xl);
        margin: 0;
    }

    .pair-label {
        font-size: 11px;
        color: var(--spot-text-muted);
    }

    .pair-stats {
        flex-direction: row;
        flex-wrap: wrap;
        gap: var(--spot-spacing-sm);
        width: 100%;
        justify-content: space-between;
    }

    .stat-item {
        flex: 0 0 calc(33.333% - var(--spot-spacing-sm));
        min-width: auto;
        text-align: center;
    }

    .stat-label {
        font-size: 10px;
        display: block;
        margin-bottom: 2px;
    }

    .stat-value {
        font-size: var(--spot-font-xs);
        display: block;
    }

    .trading-layout {
        flex-direction: column;
        min-height: auto;
    }

    .trading-panel {
        border-right: none;
        border-bottom: 1px solid var(--spot-border-color);
    }

    .chart-panel {
        min-height: 320px;
    }

    .chart-header {
        flex-wrap: wrap;
        gap: var(--spot-spacing-sm);
        padding: var(--spot-spacing-sm);
    }

    .timeframes {
        order: 2;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: var(--spot-spacing-sm);
        gap: 4px;
    }

    .timeframe-btn {
        padding: 6px 10px;
        font-size: 11px;
        flex-shrink: 0;
        min-height: 32px;
    }

    .chart-tools {
        gap: 4px;
    }

    .chart-tool-btn {
        width: 36px;
        height: 36px;
        min-height: 36px;
    }

    .chart-container {
        min-height: 280px;
    }

    #klineChart {
        min-height: 280px;
    }

    .pairs-panel {
        width: 100%;
        max-height: none;
        height: auto;
        min-height: 200px;
    }

    .pairs-list {
        max-height: 300px;
        overflow-y: auto;
    }

    .panel-header {
        padding: var(--spot-spacing-sm) var(--spot-spacing-md);
    }

    .panel-title {
        font-size: var(--spot-font-sm);
    }

    .pairs-search {
        padding: var(--spot-spacing-sm) var(--spot-spacing-md);
    }

    .search-input {
        font-size: 16px; /* Prevent iOS zoom */
        padding: 10px var(--spot-spacing-md);
        min-height: 44px;
    }

    .pairs-header {
        padding: var(--spot-spacing-sm) var(--spot-spacing-md);
        font-size: 11px;
        display: flex;
        justify-content: space-between;
        color: var(--spot-text-muted);
        border-bottom: 1px solid var(--spot-border-color);
    }

    .pairs-header span {
        flex: 1;
        text-align: center;
    }

    .pairs-header span:first-child {
        text-align: left;
    }

    .pairs-header span:last-child {
        text-align: right;
    }

    .pair-row {
        padding: 12px var(--spot-spacing-md);
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .pair-name-cell {
        display: flex;
        align-items: center;
        gap: var(--spot-spacing-sm);
        flex: 1;
    }

    .pair-icon-small {
        width: 28px;
        height: 28px;
        font-size: 11px;
        flex-shrink: 0;
    }

    .pair-symbol {
        font-size: var(--spot-font-sm);
        font-weight: 500;
    }

    .pair-price-cell {
        font-size: var(--spot-font-sm);
        flex: 1;
        text-align: center;
    }

    .pair-change-cell {
        font-size: var(--spot-font-sm);
        flex: 1;
        text-align: right;
        font-weight: 500;
    }

    /* Trading Forms Grid Mobile */
    .trading-forms-grid {
        grid-template-columns: 1fr;
        gap: 1px;
        min-height: auto;
    }

    .trading-form-panel {
        padding: var(--spot-spacing-md);
    }

    .form-panel-tabs {
        gap: 4px;
        margin-bottom: var(--spot-spacing-sm);
    }

    .form-panel-tab {
        padding: var(--spot-spacing-sm);
        font-size: 11px;
        min-height: 36px;
    }

    .order-type-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: var(--spot-spacing-sm);
        gap: 4px;
    }

    .order-type-tab {
        padding: var(--spot-spacing-sm) var(--spot-spacing-md);
        font-size: 11px;
        flex-shrink: 0;
        min-height: 32px;
    }

    .buy-sell-tabs {
        margin-bottom: var(--spot-spacing-md);
    }

    .buy-sell-tab {
        padding: var(--spot-spacing-sm);
        font-size: var(--spot-font-sm);
        min-height: 44px;
    }

    .form-group label {
        font-size: 11px;
    }

    .input-group input {
        padding: 12px var(--spot-spacing-md);
        font-size: 16px; /* Prevent iOS zoom */
        min-height: 48px;
    }

    .input-group .unit {
        padding: 12px var(--spot-spacing-md);
        font-size: 11px;
        min-width: 50px;
    }

    .percentage-buttons {
        gap: 4px;
    }

    .percentage-btn,
    .percent-btn {
        padding: 8px 2px;
        font-size: 11px;
        min-height: 36px;
    }

    .btn-submit {
        padding: 14px;
        font-size: var(--spot-font-base);
        min-height: 48px;
    }

    /* Orderbook Mobile */
    .orderbook-panel {
        padding: var(--spot-spacing-md);
        max-height: 400px;
    }

    .orderbook-header {
        padding-bottom: var(--spot-spacing-sm);
        margin-bottom: var(--spot-spacing-sm);
    }

    .orderbook-title {
        font-size: var(--spot-font-sm);
    }

    .precision-btn {
        padding: 4px 8px;
        font-size: 10px;
        min-height: 28px;
    }

    .orderbook-header-row {
        padding: var(--spot-spacing-xs) 0;
        font-size: 10px;
    }

    .order-row {
        padding: 3px 0;
        height: 22px;
    }

    .order-row span {
        font-size: 11px;
    }

    .current-price {
        padding: var(--spot-spacing-sm) 0;
        font-size: var(--spot-font-lg);
    }

    /* Trade History Mobile */
    .trade-history-panel {
        grid-column: span 1;
        padding: var(--spot-spacing-md);
    }

    .history-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 4px;
        padding-bottom: var(--spot-spacing-sm);
    }

    .history-tabs::-webkit-scrollbar {
        display: none;
    }

    .history-tab {
        padding: var(--spot-spacing-sm);
        font-size: 11px;
        flex-shrink: 0;
        min-height: 32px;
    }

    .view-all-link {
        font-size: 11px;
        flex-shrink: 0;
    }

    .history-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .history-table {
        min-width: 600px;
    }

    .history-table th,
    .history-table td {
        padding: var(--spot-spacing-sm);
        font-size: 11px;
    }
}

/* Small Mobile (<=480px) */
@media (max-width: 480px) {
    /* Hide history tabs and table on mobile */
    .history-tabs,
    .history-table-wrapper,
    .trade-history-panel {
        display: none !important;
    }

    .trading-form-panel,
    .orderbook-panel {
        padding: var(--spot-spacing-md);
    }

    .chart-panel {
        min-height: 320px;
    }

    .pair-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .pair-details h2 {
        font-size: var(--spot-font-base);
    }

    .order-row span {
        font-size: var(--spot-font-xs);
    }

    .stat-value {
        font-size: var(--spot-font-xs);
    }
}

/* ========================================
   Tab Content Switching
   ======================================== */
.tab-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tab-panel {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
}

.tab-panel.active {
    display: flex;
}

/* Order Form Switching */
.order-form {
    display: flex;
    flex-direction: column;
    gap: var(--spot-spacing-md);
}

.order-form.hidden {
    display: none;
}

/* Placeholder Content for Tabs */
.placeholder-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spot-spacing-md);
    padding: var(--spot-spacing-xl);
    text-align: center;
    color: var(--spot-text-secondary);
}

.placeholder-content.small {
    padding: var(--spot-spacing-lg);
}

.placeholder-content svg {
    color: var(--spot-text-muted);
    opacity: 0.5;
}

.placeholder-content h3 {
    font-size: var(--spot-font-lg);
    font-weight: 600;
    color: var(--spot-text-primary);
    margin: 0;
}

.placeholder-content p {
    font-size: var(--spot-font-sm);
    color: var(--spot-text-muted);
    margin: 0;
    max-width: 280px;
}

.btn-enable {
    padding: 10px 24px;
    font-size: var(--spot-font-sm);
    font-weight: 600;
    color: var(--spot-accent-gold);
    background-color: var(--spot-accent-gold-light);
    border: 1px solid var(--spot-accent-gold);
    border-radius: var(--spot-radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: var(--spot-spacing-sm);
}

.btn-enable:hover {
    background-color: var(--spot-accent-gold);
    color: var(--spot-bg-primary);
}

/* Futures Tag */
.futures-tag {
    font-size: 10px;
    color: var(--spot-text-muted);
    background-color: var(--spot-bg-hover);
    padding: 2px 6px;
    border-radius: var(--spot-radius-sm);
    margin-left: var(--spot-spacing-xs);
}

/* ========================================
   Animation & Transitions
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.spot-page {
    animation: fadeIn 0.3s ease-out;
}

/* Focus states for accessibility */
.spot-page button:focus-visible,
.spot-page input:focus-visible {
    outline: 2px solid var(--spot-accent-gold);
    outline-offset: 2px;
}

/* Selection color */
.spot-page ::selection {
    background-color: var(--spot-accent-gold-light);
    color: var(--spot-text-primary);
}

/* ========================================
   Pagination Styles
   ======================================== */
.pagination-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spot-spacing-md) var(--spot-spacing-lg);
    border-top: 1px solid var(--spot-border-color);
    background-color: var(--spot-bg-secondary);
    flex-shrink: 0;
}

.pagination-info {
    font-size: var(--spot-font-xs);
    color: var(--spot-text-muted);
}

.pagination-buttons {
    display: flex;
    align-items: center;
    gap: var(--spot-spacing-sm);
}

.pagination-btn {
    padding: 6px 12px;
    font-size: var(--spot-font-xs);
    font-weight: 500;
    color: var(--spot-text-secondary);
    background-color: var(--spot-bg-tertiary);
    border: 1px solid var(--spot-border-color);
    border-radius: var(--spot-radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    color: var(--spot-text-primary);
    background-color: var(--spot-bg-hover);
    border-color: var(--spot-border-hover);
}

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

.pagination-current {
    font-size: var(--spot-font-xs);
    font-weight: 600;
    color: var(--spot-accent-gold);
    padding: 0 var(--spot-spacing-sm);
}

/* History Header */
.history-header {
    padding: var(--spot-spacing-md) var(--spot-spacing-lg);
    border-bottom: 1px solid var(--spot-border-color);
    background-color: var(--spot-bg-secondary);
}

.history-title {
    font-size: var(--spot-font-sm);
    font-weight: 600;
    color: var(--spot-text-primary);
    margin: 0;
}

/* ========================================
   Mobile Range Input Fix
   ======================================== */
@media (max-width: 768px) {
    /* 修复移动端滑块显示为灰色色块的问题 */
    .percentage-slider {
        -webkit-appearance: none;
        appearance: none;
        width: 100%;
        height: 6px;
        background: linear-gradient(to right, var(--spot-accent-gold) 0%, var(--spot-accent-gold) var(--value, 0%), var(--spot-border-color) var(--value, 0%), var(--spot-border-color) 100%);
        border-radius: 3px;
        outline: none;
    }

    /* Webkit 浏览器 (Chrome, Safari) */
    .percentage-slider::-webkit-slider-runnable-track {
        height: 6px;
        background: var(--spot-border-color);
        border-radius: 3px;
    }

    .percentage-slider::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 20px;
        height: 20px;
        background-color: var(--spot-accent-gold);
        border-radius: 50%;
        cursor: pointer;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
        margin-top: -7px;
        border: 2px solid var(--spot-bg-primary);
    }

    /* Firefox */
    .percentage-slider::-moz-range-track {
        height: 6px;
        background: var(--spot-border-color);
        border-radius: 3px;
        border: none;
    }

    .percentage-slider::-moz-range-thumb {
        width: 20px;
        height: 20px;
        background-color: var(--spot-accent-gold);
        border-radius: 50%;
        cursor: pointer;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
        border: 2px solid var(--spot-bg-primary);
    }

    /* 确保滑块容器有足够的高度 */
    .slider-container {
        padding: var(--spot-spacing-md) 0;
        min-height: 40px;
    }
}
