/* ===== Tab Navigation ===== */
.page-tabs {
    display: flex; justify-content: center; gap: 12px;
    max-width: 1000px; width: 100%; margin: 0 auto 20px; padding: 0 20px;
}
.page-tab {
    flex: 1; max-width: 260px; padding: 14px 20px; font-size: 16px; font-weight: bold;
    color: #ffffff; background: rgba(51, 65, 85, 0.55); backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 50px; cursor: pointer;
    transition: all 0.25s ease; letter-spacing: 1px;
}
.page-tab:hover { background: rgba(51, 65, 85, 0.8); transform: translateY(-2px); }
.page-tab.active {
    background: linear-gradient(135deg, #1e3a8a 0%, #312e81 100%); color: #ffffff;
    box-shadow: 0 6px 15px rgba(15, 23, 42, 0.4); border-color: rgba(255,255,255,0.6);
}
.tab-panel { display: none; width: 100%; justify-content: center; }
.tab-panel.active { display: flex; }

/* ===== Market Table extras ===== */
#market-table .coin-name-cell { display: flex; align-items: center; gap: 10px; font-weight: bold; color: #1e293b; }
#market-table .coin-symbol { color: #64748b; font-weight: 500; font-size: 13px; text-transform: uppercase; }
.pct-up { color: #16a34a; font-weight: bold; }
.pct-down { color: #dc2626; font-weight: bold; }

/* ===== Coin Selector ===== */
.coin-selector { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 25px; }
.coin-chip {
    padding: 8px 20px; font-size: 14px; font-weight: bold; color: #1e3a8a;
    background: rgba(255, 255, 255, 0.7); border: 2px solid rgba(30, 58, 138, 0.2);
    border-radius: 50px; cursor: pointer; transition: all 0.2s ease;
}
.coin-chip:hover { background: rgba(56, 189, 248, 0.2); border-color: #38bdf8; }
.coin-chip.active {
    background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%); color: #ffffff;
    border-color: transparent; box-shadow: 0 4px 10px rgba(56, 189, 248, 0.4);
}

/* ===== Derivatives Stat Cards ===== */
.derivatives-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px; width: 100%; margin-bottom: 10px;
}
.stat-card {
    background: rgba(255, 255, 255, 0.75); border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 18px; padding: 24px 22px; box-shadow: 0 8px 20px rgba(0,0,0,0.06);
    transition: transform 0.3s;
}
.stat-card:hover { transform: translateY(-4px); }
.stat-label { color: #475569; font-size: 14px; font-weight: bold; margin-bottom: 10px; letter-spacing: 0.5px; }
.stat-value { color: #0f172a; font-size: 28px; font-weight: 900; margin-bottom: 6px; }
.stat-value.positive { color: #16a34a; }
.stat-value.negative { color: #dc2626; }
.stat-sub { color: #64748b; font-size: 13px; font-weight: 500; }

.ls-bar {
    display: flex; width: 100%; height: 32px; border-radius: 8px; overflow: hidden;
    margin-bottom: 10px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.15);
}
.ls-bar-long, .ls-bar-short {
    display: flex; align-items: center; justify-content: center; color: white;
    font-size: 12px; font-weight: bold; transition: width 0.5s ease; white-space: nowrap; overflow: hidden;
}
.ls-bar-long { background: linear-gradient(90deg, #16a34a, #22c55e); }
.ls-bar-short { background: linear-gradient(90deg, #ef4444, #dc2626); }

/* ===== Liquidity Summary ===== */
.liquidity-summary {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px; margin-bottom: 20px;
}
.liq-stat {
    border-radius: 15px; padding: 18px 22px; display: flex; flex-direction: column; gap: 8px;
    box-shadow: 0 6px 15px rgba(0,0,0,0.06);
}
.liq-stat span { font-size: 13px; font-weight: bold; color: #475569; }
.liq-stat strong { font-size: 24px; font-weight: 900; }
.liq-stat.long { background: rgba(22, 163, 74, 0.12); border: 1px solid rgba(22, 163, 74, 0.3); }
.liq-stat.long strong { color: #15803d; }
.liq-stat.short { background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.3); }
.liq-stat.short strong { color: #b91c1c; }

/* ===== Order Book Depth Chart ===== */
.depth-chart-wrapper {
    width: 100%; height: 340px; border-radius: 15px; overflow: hidden;
    background: rgba(255, 255, 255, 0.7); border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 20px rgba(0,0,0,0.06); padding: 10px 0;
}
.depth-chart-wrapper svg { width: 100%; height: 100%; display: block; }
.depth-chart-legend {
    display: flex; flex-wrap: wrap; gap: 20px; justify-content: center;
    margin-top: 14px; font-size: 13px; font-weight: bold; color: #475569;
}
.depth-chart-legend span { display: flex; align-items: center; gap: 6px; }
.legend-dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.legend-dot.bid { background: #16a34a; }
.legend-dot.ask { background: #dc2626; }
.legend-dot.mid { background: #64748b; }

/* ===== Capital Flow ===== */
.interval-selector { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.interval-chip {
    padding: 7px 18px; font-size: 13px; font-weight: bold; color: #1e3a8a;
    background: rgba(255, 255, 255, 0.7); border: 2px solid rgba(30, 58, 138, 0.2);
    border-radius: 50px; cursor: pointer; transition: all 0.2s ease;
}
.interval-chip:hover { background: rgba(56, 189, 248, 0.2); border-color: #38bdf8; }
.interval-chip.active {
    background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%); color: #ffffff;
    border-color: transparent; box-shadow: 0 4px 10px rgba(56, 189, 248, 0.4);
}

.flow-panel {
    width: 100%; background: rgba(255, 255, 255, 0.7); border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 15px; padding: 18px 20px; box-shadow: 0 8px 20px rgba(0,0,0,0.06);
    margin-bottom: 20px;
}
.flow-panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; flex-wrap: wrap; gap: 8px; }
.flow-title { font-size: 15px; font-weight: bold; color: #1e293b; }
.flow-total { font-size: 18px; font-weight: 900; }
.flow-total.positive { color: #16a34a; }
.flow-total.negative { color: #dc2626; }
.flow-chart-wrapper { width: 100%; height: 260px; position: relative; cursor: crosshair; }
.flow-chart-wrapper svg { width: 100%; height: 100%; display: block; }
.flow-tooltip {
    position: absolute; pointer-events: none; display: none; z-index: 5;
    background: rgba(15, 23, 42, 0.94); color: #e2e8f0; padding: 8px 12px;
    border-radius: 8px; font-size: 12px; line-height: 1.7; white-space: nowrap;
    transform: translate(-50%, -110%); box-shadow: 0 6px 15px rgba(0,0,0,0.3);
}
.flow-tooltip .tt-date { color: #94a3b8; font-weight: bold; margin-bottom: 2px; display: block; }
.flow-tooltip .tt-positive { color: #4ade80; }
.flow-tooltip .tt-negative { color: #f87171; }
.flow-tooltip .tt-price { color: #fbbf24; }
.flow-chart-legend {
    display: flex; flex-wrap: wrap; gap: 18px; justify-content: center;
    margin-top: 10px; font-size: 12px; font-weight: bold; color: #475569;
}
.flow-chart-legend span { display: flex; align-items: center; gap: 6px; }
.legend-line { display: inline-block; width: 16px; height: 3px; border-radius: 2px; background: #f59e0b; }

@media (max-width: 600px) {
    .page-tabs { flex-direction: column; }
    .page-tab { max-width: 100%; }
    .depth-chart-wrapper { height: 260px; }
    .flow-chart-wrapper { height: 220px; }
}
