/* CSS variables for visual theme */
:root {
    --bg-primary: #06090e;
    --bg-secondary: #0c1017;
    --bg-card: #121824;
    --bg-card-hover: #172030;
    --border-color: #21262d;
    --border-glow: rgba(0, 216, 255, 0.15);
    
    --text-primary: #f0f3f6;
    --text-secondary: #8b949e;
    --text-muted: #57606a;
    
    --accent-cyan: #00d8ff;
    --accent-purple: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #00d8ff 0%, #8b5cf6 100%);
    
    --buy-green: #10b981;
    --buy-green-bg: rgba(16, 185, 129, 0.1);
    --buy-green-glow: rgba(16, 185, 129, 0.25);
    
    --sell-red: #ef4444;
    --sell-red-bg: rgba(239, 68, 68, 0.1);
    --sell-red-glow: rgba(239, 68, 68, 0.25);
    
    --warning-yellow: #f59e0b;
    --warning-yellow-bg: rgba(245, 158, 11, 0.1);
    
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --scrollbar-track: #0b0e14;
    --scrollbar-thumb: #21262d;
    --scrollbar-thumb-hover: #30363d;
}

/* Reset and Core Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    font-size: 13px;
    line-height: 1.4;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}
::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* Header */
.main-header {
    height: 50px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    position: relative;
    z-index: 10;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.logo-icon {
    font-size: 18px;
    color: var(--accent-cyan);
    filter: drop-shadow(0 0 5px rgba(0, 216, 255, 0.5));
}

.logo-text {
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 0.5px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-accent {
    font-weight: 300;
}

.header-ticker {
    display: flex;
    align-items: center;
    gap: 16px;
    border-left: 1px solid var(--border-color);
    padding-left: 16px;
}

.ticker-pair {
    display: flex;
    flex-direction: column;
}

.pair-name {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.pair-price {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
}

.ticker-stat {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 10px;
    color: var(--text-muted);
}

.stat-val {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
}

/* Color classes for tickers and prices */
.price-up, .change-up {
    color: var(--buy-green);
    text-shadow: 0 0 8px rgba(16, 185, 129, 0.15);
}

.price-down, .change-down {
    color: var(--sell-red);
    text-shadow: 0 0 8px rgba(239, 68, 68, 0.15);
}

.account-summary {
    display: flex;
    gap: 16px;
}

.account-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.acc-label {
    font-size: 10px;
    color: var(--text-secondary);
}

.acc-val {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-cyan);
}

.pnl-neutral {
    color: var(--text-primary);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-dot.online {
    background-color: var(--buy-green);
    box-shadow: 0 0 6px var(--buy-green);
}

.status-text {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Workspace Layout */
.workspace-container {
    display: flex;
    height: calc(100vh - 50px);
    width: 100vw;
    position: relative;
    overflow: hidden;
}

/* Left Sidebar Navigation (Desktop) */
.sidebar-nav {
    width: 50px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    z-index: 5;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    align-items: center;
}

.nav-item {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-item:hover {
    color: var(--accent-cyan);
    background-color: var(--bg-card);
}

.nav-item.active {
    color: var(--accent-cyan);
    background-color: rgba(0, 216, 255, 0.1);
    box-shadow: inset 0 0 0 1px rgba(0, 216, 255, 0.2);
}

.nav-item i {
    font-size: 16px;
}

/* Main Grid Workspace */
.main-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 280px 280px;
    grid-template-rows: 1fr 260px;
    gap: 4px;
    padding: 4px;
    background-color: var(--bg-primary);
    overflow: hidden;
    height: 100%;
}

/* Grid Sections */
.grid-section {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s ease;
}

.grid-section:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

/* Common Section Header */
.section-header {
    height: 38px;
    min-height: 38px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: rgba(255, 255, 255, 0.02);
}

.border-bottom {
    border-bottom: 1px solid var(--border-color);
}

.border-top {
    border-top: 1px solid var(--border-color);
}

.tab-title {
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.tab-title i {
    color: var(--accent-cyan);
}

/* Column 1: Chart */
.chart-section {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
}

.header-tab-group {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 100%;
}

.ticker-selector-wrapper select {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    outline: none;
    cursor: pointer;
}

.chart-wrapper {
    flex: 1;
    position: relative;
    background-color: #131722;
}

.tv-chart-container {
    width: 100%;
    height: 100%;
}

/* Column 2: Order Book & Watchlist split */
.book-markets-section {
    grid-column: 2 / 3;
    grid-row: 1 / 3;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    border: none;
}

.order-book-card {
    flex: 1.3;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.watchlist-card {
    flex: 0.7;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Order Book styling */
.spread-indicator {
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

#marketSpread {
    color: var(--accent-cyan);
}

.book-grid {
    flex: 1;
    display: flex;
    flex-direction: column;
    font-family: var(--font-mono);
    font-size: 11px;
    overflow: hidden;
    padding: 4px;
}

.book-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    color: var(--text-muted);
    font-size: 10px;
    padding: 4px 6px;
    border-bottom: 1px solid var(--border-color);
}

.book-entries {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.book-entries.asks {
    justify-content: flex-end;
}

.book-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 2.5px 6px;
    position: relative;
    cursor: pointer;
    transition: background 0.1s ease;
}

.book-row:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.book-row .size-bar {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.08;
}

.asks .size-bar {
    background-color: var(--sell-red);
}

.bids .size-bar {
    background-color: var(--buy-green);
}

.book-row span {
    z-index: 2;
    white-space: nowrap;
}

.book-row .price {
    font-weight: 500;
}

.asks .price {
    color: var(--sell-red);
}

.bids .price {
    color: var(--buy-green);
}

.book-row .size {
    color: var(--text-primary);
}

.book-row .total {
    color: var(--text-secondary);
    text-align: right;
}

.book-middle-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.01);
}

.book-middle-bar .current-price {
    font-size: 14px;
    font-weight: 700;
}

.book-middle-bar .price-indicator-arrow {
    font-size: 11px;
}

/* Watchlist styling */
.watchlist-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.watchlist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.watchlist-item:hover, .watchlist-item.selected {
    background-color: var(--bg-card);
}

.wl-left {
    display: flex;
    flex-direction: column;
}

.wl-symbol {
    font-weight: 700;
    font-size: 12px;
}

.wl-name {
    font-size: 10px;
    color: var(--text-muted);
}

.wl-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-family: var(--font-mono);
}

.wl-price {
    font-size: 12px;
    font-weight: 600;
}

.wl-change {
    font-size: 10px;
    font-weight: 500;
}

/* Column 3: Trade Panel */
.trade-section {
    grid-column: 3 / 4;
    grid-row: 1 / 3;
}

.trade-panel-content {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    flex: 1;
}

.action-switcher {
    display: flex;
    background-color: var(--bg-primary);
    padding: 3px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.action-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 0;
    font-size: 11px;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn.buy.active {
    background-color: var(--buy-green);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.action-btn.sell.active {
    background-color: var(--sell-red);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

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

.type-tab {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 6px 0;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
}

.type-tab.active {
    color: var(--text-primary);
}

.type-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-gradient);
}

.trade-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.input-label {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 600;
}

.input-wrapper {
    position: relative;
    display: flex;
}

.trade-input {
    width: 100%;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s ease;
}

.trade-input:focus {
    border-color: var(--accent-cyan);
}

.input-addon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

.quick-percent-buttons {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.btn-percent {
    flex: 1;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 4px;
    padding: 3px 0;
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-percent:hover {
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

/* Leverage styles */
.leverage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.leverage-val {
    font-weight: 700;
    font-size: 11px;
    color: var(--accent-cyan);
}

.leverage-slider-wrapper {
    margin-top: 4px;
}

.leverage-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    background: var(--border-color);
    outline: none;
}

.leverage-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-cyan);
    cursor: pointer;
    box-shadow: 0 0 8px rgba(0, 216, 255, 0.5);
    transition: transform 0.1s ease;
}

.leverage-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.leverage-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: var(--text-muted);
    margin-top: 4px;
    padding: 0 2px;
}

/* TP / SL Toggle Switch */
.tpsl-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

.tpsl-title {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
}

.switch {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 16px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: .2s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-secondary);
    transition: .2s;
}

input:checked + .slider {
    background-color: var(--accent-cyan);
}

input:checked + .slider:before {
    transform: translateX(16px);
    background-color: white;
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.tpsl-inputs-container {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.form-group-half {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.input-label-small {
    font-size: 9px;
    color: var(--text-muted);
}

.trade-input-small {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 11px;
    outline: none;
}

/* Stats */
.trade-summary-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background-color: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    padding: 8px 10px;
    border-radius: 6px;
}

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

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

.liq-val {
    color: var(--warning-yellow) !important;
}

/* Big Action Button */
.submit-order-btn {
    border: none;
    border-radius: 6px;
    padding: 11px 0;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.5px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.submit-order-btn.buy-btn {
    background-color: var(--buy-green);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.submit-order-btn.buy-btn:hover {
    background-color: #059669;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.45);
    transform: translateY(-1px);
}

.submit-order-btn.sell-btn {
    background-color: var(--sell-red);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.submit-order-btn.sell-btn:hover {
    background-color: #dc2626;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.45);
    transform: translateY(-1px);
}

.submit-order-btn:active {
    transform: translateY(1px);
}

/* Column 4: Positions Bottom Panel */
.bottom-positions-section {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
}

.section-tabs-header {
    height: 34px;
    min-height: 34px;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.01);
}

.tab-list {
    display: flex;
    height: 100%;
}

.position-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0 16px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    height: 100%;
    transition: color 0.2s ease;
}

.position-tab-btn:hover {
    color: var(--text-primary);
}

.position-tab-btn.active {
    color: var(--accent-cyan);
}

.position-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--accent-cyan);
    box-shadow: 0 0 8px var(--accent-cyan);
}

.tab-panels-content {
    flex: 1;
    overflow: hidden;
}

.panel-item {
    display: none;
    height: 100%;
}

.panel-item.active {
    display: block;
}

.table-container {
    width: 100%;
    height: 100%;
    overflow: auto;
}

.positions-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 11px;
}

.positions-table th {
    background-color: rgba(255, 255, 255, 0.01);
    color: var(--text-muted);
    font-weight: 600;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 2;
}

.positions-table td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    vertical-align: middle;
    font-family: var(--font-mono);
}

.positions-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.01);
}

.empty-table-message {
    text-align: center;
    color: var(--text-muted) !important;
    padding: 36px 0 !important;
    font-family: var(--font-main) !important;
    font-size: 12px;
}

.text-right {
    text-align: right;
}

/* Badge tags for lists */
.badge {
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge.long {
    background-color: var(--buy-green-bg);
    color: var(--buy-green);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge.short {
    background-color: var(--sell-red-bg);
    color: var(--sell-red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-close-position {
    background-color: var(--sell-red-bg);
    color: var(--sell-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-main);
    transition: all 0.2s ease;
}

.btn-close-position:hover {
    background-color: var(--sell-red);
    color: white;
    border-color: var(--sell-red);
}

.btn-cancel-order {
    background-color: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-main);
    transition: all 0.2s ease;
}

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

/* Small utilities */
.btn-icon-small {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-icon-small:hover {
    color: var(--accent-cyan);
    background-color: var(--bg-card);
}

/* Mobile Bottom Navigation Bar (Hidden by Default) */
.mobile-nav-bar {
    display: none;
}

/* Interactive animations and pulses */
@keyframes flash-green {
    0% { background-color: rgba(16, 185, 129, 0.3); }
    100% { background-color: transparent; }
}

@keyframes flash-red {
    0% { background-color: rgba(239, 68, 68, 0.3); }
    100% { background-color: transparent; }
}

.flash-up {
    animation: flash-green 0.8s ease-out;
}

.flash-down {
    animation: flash-red 0.8s ease-out;
}

/* ==============================================
   RESPONSIVE MEDIA QUERIES (MOBILE OPTIMIZED)
   ============================================== */

@media (max-width: 1024px) {
    /* Collapse sidebars & columns */
    .desktop-only {
        display: none !important;
    }

    /* Shift layout from sidebar/workspace flex to top header + mobile main area */
    .workspace-container {
        height: calc(100vh - 50px - 50px); /* Subtract header and mobile nav heights */
    }

    /* Grid collapses to stack layout where we only show ONE block at a time */
    .main-grid {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
        padding: 2px;
        gap: 0;
        height: 100%;
        background-color: var(--bg-secondary);
    }

    .grid-section {
        display: none; /* Hide all by default, active is displayed by JS */
        border: none;
        border-radius: 0;
        height: 100%;
    }

    .grid-section.active-mobile-tab {
        display: flex !important;
    }

    /* Set 100% screen width and remove padding margins for mobile sections */
    .section-header {
        height: 34px;
        min-height: 34px;
        padding: 0 6px;
    }

    .trade-panel-content {
        padding: 8px;
        gap: 8px;
    }

    /* Compact Cards for Watchlist / Order Book on Mobile */
    .book-markets-section {
        flex-direction: column;
        gap: 2px;
        height: 100%;
    }

    .order-book-card {
        flex: 1;
        border: none;
        border-radius: 0;
    }

    .watchlist-card {
        flex: 1;
        border: none;
        border-top: 1px solid var(--border-color);
        border-radius: 0;
    }

    .book-grid {
        padding: 2px;
        font-size: 10px;
    }

    .book-row {
        padding: 2px 4px;
    }

    .watchlist-item {
        padding: 6px 8px;
    }

    /* Mobile Bottom Navigation Bar */
    .mobile-nav-bar {
        display: flex;
        height: 50px;
        background-color: var(--bg-secondary);
        border-top: 1px solid var(--border-color);
        justify-content: space-around;
        align-items: center;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 10;
    }

    .mob-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--text-secondary);
        text-decoration: none;
        font-size: 9px;
        font-weight: 500;
        flex: 1;
        height: 100%;
        gap: 3px;
        transition: all 0.2s ease;
    }

    .mob-nav-item i {
        font-size: 14px;
    }

    .mob-nav-item.active {
        color: var(--accent-cyan);
        background-color: rgba(0, 216, 255, 0.04);
    }
    
    /* Table optimizations for small screens */
    .positions-table {
        font-size: 10px;
    }
    
    .positions-table th, .positions-table td {
        padding: 6px 4px;
    }
}

/* ==============================================
   PAGE LAYOUT & SWITCHING
   ============================================== */
.page-view {
    display: none;
    width: 100vw;
    height: 100vh;
    overflow-y: auto;
    background-color: var(--bg-primary);
}

.page-view.active {
    display: block;
}

#tradingTerminal.page-view.active {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ==============================================
   LANDING PAGE STYLING
   ============================================== */

/* Landing Header */
.landing-header {
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    background-color: rgba(6, 9, 14, 0.7);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.landing-nav {
    display: flex;
    gap: 24px;
}

.landing-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.landing-nav a:hover {
    color: var(--accent-cyan);
}

.btn-primary-glow {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.4);
    transition: all 0.2s ease;
}

.btn-primary-glow:hover {
    box-shadow: 0 0 20px rgba(0, 216, 255, 0.6);
    transform: translateY(-1px);
}

/* Hero Section */
.hero-section {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 40px;
    padding: 80px 80px 60px 80px;
    max-width: 1400px;
    margin: 0 auto;
    align-items: center;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
}

.hero-badge {
    background-color: rgba(0, 216, 255, 0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 216, 255, 0.2);
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
}

.hero-badge i {
    animation: pulse-glow 1.5s infinite;
}

@keyframes pulse-glow {
    0% { opacity: 0.5; }
    50% { opacity: 1; filter: drop-shadow(0 0 4px var(--accent-cyan)); }
    100% { opacity: 0.5; }
}

.hero-title {
    font-size: 42px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.5px;
}

.gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    width: 100%;
}

.btn-hero-primary {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 216, 255, 0.3);
    transition: all 0.2s ease;
}

.btn-hero-primary:hover {
    box-shadow: 0 4px 25px rgba(139, 92, 246, 0.5);
    transform: translateY(-2px);
}

.btn-hero-secondary {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-hero-secondary:hover {
    background-color: var(--bg-card);
    border-color: var(--text-secondary);
}

/* Micro Live Tickers Bar on Hero */
.hero-tickers {
    display: flex;
    gap: 16px;
    margin-top: 30px;
    width: 100%;
    flex-wrap: wrap;
}

.ticker-card-mini {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 130px;
    font-family: var(--font-mono);
}

.ticker-card-mini .sym {
    font-weight: 700;
    font-size: 11px;
    font-family: var(--font-main);
}

.ticker-card-mini .val {
    font-weight: 600;
    font-size: 11px;
}

.ticker-card-mini .pct {
    font-size: 9px;
    font-weight: 500;
}

/* Hero Graphic Mockup */
.hero-graphic {
    display: flex;
    justify-content: center;
    position: relative;
}

.hero-graphic::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(0, 216, 255, 0.15) 0%, rgba(139, 92, 246, 0.05) 50%, transparent 100%);
    z-index: 1;
    pointer-events: none;
    filter: blur(40px);
}

.mockup-frame {
    width: 100%;
    max-width: 500px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05);
    z-index: 2;
    aspect-ratio: 1.3;
    display: flex;
    flex-direction: column;
}

.mockup-header {
    height: 32px;
    background-color: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 6px;
}

.mockup-header .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.mockup-header .dot.red { background-color: #ff5f56; }
.mockup-header .dot.yellow { background-color: #ffbd2e; }
.mockup-header .dot.green { background-color: #27c93f; }

.mockup-title {
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-left: 12px;
}

.mockup-content {
    flex: 1;
    background-color: #0b0e14;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.sim-chart-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    font-family: var(--font-mono);
}

.sim-pair {
    font-size: 12px;
    font-weight: 700;
}

.sim-price {
    font-size: 14px;
    font-weight: 700;
}

.sim-bars-container {
    flex: 1;
    display: flex;
    align-items: flex-end;
    border-left: 1px dashed rgba(255,255,255,0.05);
    border-bottom: 1px dashed rgba(255,255,255,0.05);
    padding-bottom: 8px;
    padding-left: 8px;
}

.sim-candlestick-wrapper {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: flex-end;
    height: 100%;
}

.sim-candlestick {
    width: 18%;
    position: relative;
    border-radius: 2px;
}

.sim-candlestick.green {
    background-color: var(--buy-green);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
    animation: pulse-bar-green 2s infinite alternate;
}

.sim-candlestick.red {
    background-color: var(--sell-red);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
    animation: pulse-bar-red 2s infinite alternate;
}

.sim-candlestick .wick {
    position: absolute;
    width: 2px;
    left: 50%;
    transform: translateX(-50%);
    z-index: -1;
}

.sim-candlestick.green .wick { background-color: var(--buy-green); }
.sim-candlestick.red .wick { background-color: var(--sell-red); }

@keyframes pulse-bar-green {
    0% { transform: scaleY(0.95); opacity: 0.8; }
    100% { transform: scaleY(1.05); opacity: 1; }
}

@keyframes pulse-bar-red {
    0% { transform: scaleY(1.05); opacity: 1; }
    100% { transform: scaleY(0.95); opacity: 0.8; }
}

/* Features Grid */
.features-section {
    padding: 60px 80px 80px 80px;
    max-width: 1400px;
    margin: 0 auto;
}

.section-title-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 40px;
    text-align: center;
}

.section-tag {
    color: var(--accent-cyan);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.section-heading {
    font-size: 28px;
    font-weight: 800;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.feature-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 216, 255, 0.3);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.feat-icon {
    width: 44px;
    height: 44px;
    background-color: rgba(0, 216, 255, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-cyan);
    font-size: 18px;
    margin-bottom: 16px;
}

.feature-card h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Landing Footer */
.landing-footer {
    border-top: 1px solid var(--border-color);
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 11px;
}

/* ==============================================
   VIEWER / SIMULATION SPECIFIC LABELS
   ============================================== */
.badge-tag {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    margin-left: 8px;
}

.viewer-mode-badge {
    background-color: rgba(0, 216, 255, 0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 216, 255, 0.2);
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
}

.demo-tag {
    background-color: var(--warning-yellow-bg);
    color: var(--warning-yellow);
    border: 1px solid rgba(245, 158, 11, 0.3);
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

.sim-disclaimer {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 10px;
    padding: 8px;
    border-radius: 6px;
    line-height: 1.4;
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.sim-disclaimer i {
    color: var(--accent-cyan);
    margin-top: 2px;
}

.btn-outline-small {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-outline-small:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

/* ==============================================
   RESPONSIVE LAYOUT UPDATES FOR LANDING
   ============================================== */
@media (max-width: 1024px) {
    .landing-header {
        padding: 0 16px;
    }
    
    .landing-nav {
        display: none; /* Hide nav links on mobile header */
    }

    .hero-section {
        grid-template-columns: 1fr;
        padding: 40px 16px;
        gap: 30px;
        text-align: center;
    }

    .hero-content {
        align-items: center;
    }

    .hero-title {
        font-size: 28px;
    }

    .hero-subtitle {
        font-size: 13px;
    }

    .hero-actions {
        flex-direction: column;
        gap: 10px;
    }

    .btn-hero-primary, .btn-hero-secondary {
        width: 100%;
        justify-content: center;
    }

    .hero-tickers {
        margin-top: 20px;
        gap: 8px;
    }

    .ticker-card-mini {
        padding: 6px 10px;
        min-width: 100px;
    }

    .features-section {
        padding: 40px 16px;
    }

    .section-heading {
        font-size: 20px;
    }
}

