* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #0a0e27;
    color: #e0e0e0;
    overflow-x: hidden;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, #1a1f3a 0%, #0f1429 100%);
    border-radius: 12px;
    padding: 20px 30px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.header-title {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.header-title .logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.header-title h1 {
    font-size: 28px;
    margin: 0;
    background: linear-gradient(135deg, #ff6b6b, #ffa500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

select {
    background: #1a1f3a;
    border: 1px solid #2a2f4a;
    border-radius: 6px;
    padding: 8px 12px;
    color: #e0e0e0;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

select:hover {
    border-color: #4a5f8f;
    background: #1f2440;
}

select:focus {
    outline: none;
    border-color: #5a7fbf;
    box-shadow: 0 0 0 3px rgba(90, 127, 191, 0.2);
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
}

input[type="range"] {
    flex: 1;
    height: 6px;
    background: #1a1f3a;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #ff6b6b, #ffa500);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(255, 107, 107, 0.4);
    transition: all 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 10px rgba(255, 107, 107, 0.6);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #ff6b6b, #ffa500);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(255, 107, 107, 0.4);
}

#thresholdValue {
    min-width: 50px;
    text-align: right;
    font-weight: 600;
    color: #ffa500;
}

.btn-primary, .btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #ff6b6b, #ffa500);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

.btn-secondary {
    background: #1a1f3a;
    color: #e0e0e0;
    border: 1px solid #2a2f4a;
}

.btn-secondary:hover {
    background: #1f2440;
    border-color: #4a5f8f;
}

/* Chart Container */
.chart-container {
    background: #0f1429;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    min-height: 600px;
}

.chart-wrapper {
    position: relative;
    width: calc(100% - 80px);
    height: 600px;
    margin-right: 0;
}

#heatmapCanvas, #candlestickCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#heatmapCanvas {
    pointer-events: auto;
    cursor: crosshair;
}

.liquidation-tooltip {
    position: fixed;
    background: rgba(26, 31, 58, 0.95);
    border: 2px solid #ffa500;
    border-radius: 8px;
    padding: 12px 16px;
    color: #e0e0e0;
    font-size: 13px;
    pointer-events: none;
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    min-width: 180px;
}

#heatmapCanvas {
    z-index: 1;
}

#candlestickCanvas {
    z-index: 2;
}

.price-scale {
    position: absolute;
    right: 0;
    top: 0;
    width: 60px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 11px;
    color: #888;
}

/* Legend */
.legend {
    position: absolute;
    left: 20px;
    bottom: 20px;
    background: rgba(26, 31, 58, 0.9);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #2a2f4a;
}

.legend-title {
    font-size: 11px;
    color: #888;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.legend-gradient {
    width: 20px;
    height: 200px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #666;
}

/* Loading */
.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #1a1f3a;
    border-top-color: #ff6b6b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading p {
    color: #888;
    font-size: 14px;
}

/* Error Message */
.error-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid #ff6b6b;
    color: #ff6b6b;
    padding: 20px 30px;
    border-radius: 8px;
    z-index: 10;
}

/* Stats Panel */
.stats-panel {
    background: linear-gradient(135deg, #1a1f3a 0%, #0f1429 100%);
    border-radius: 12px;
    padding: 20px 30px;
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-label {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #ffa500;
}

/* Responsive */
@media (max-width: 1200px) {
    .chart-wrapper {
        margin-right: 60px;
    }
    
    .price-scale {
        width: 50px;
    }
}

@media (max-width: 768px) {
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-group {
        width: 100%;
    }
    
    .chart-wrapper {
        height: 400px;
        margin-right: 50px;
    }
    
    .price-scale {
        width: 40px;
        font-size: 10px;
    }
}
