/* 
 * BackQuant Terminal Styles
 * Professional dark theme with modern aesthetics
 */

:root {
    --bg-primary: #09090b;
    --bg-secondary: #0f0f12;
    --bg-card: #111114;
    --bg-card-hover: #18181c;
    --border-color: #1f1f24;
    --border-subtle: #27272a;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #52525b;
    --accent-primary: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-green: #22c55e;
    --accent-red: #ef4444;
    --accent-amber: #f59e0b;
    --gradient-start: #3b82f6;
    --gradient-end: #06b6d4;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    min-height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.dashboard {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    max-width: 1920px;
    margin: 0 auto;
    padding: 12px 16px;
    gap: 12px;
}

/* Header - Clean Professional Bar */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    height: 56px;
    backdrop-filter: blur(8px);
}

.header-left {
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: baseline;
    text-decoration: none;
    gap: 6px;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.logo-img {
    height: 28px;
    width: auto;
    object-fit: contain;
}

.logo-suffix {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.nav-link.active {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: pulse 2s infinite;
}

.status-indicator.connected .status-dot {
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
}

.status-indicator.error .status-dot {
    background: var(--accent-red);
    box-shadow: 0 0 8px var(--accent-red);
}

.status-indicator.loading .status-dot {
    background: var(--accent-amber);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

/* Charts Layout */
.charts-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    width: 100%;
}

.charts-stack {
    margin-top: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
}

/* Chart Container - Refined Cards */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    transition: border-color 0.15s ease;
}

.chart-container:hover {
    border-color: var(--border-subtle);
}

.chart-container.chart-wide {
    padding: 16px 20px;
}

.chart-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.chart-container h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    margin: 0;
}

.chart-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

.chart-badge {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
    border-radius: 4px;
}

.chart-box {
    width: 100%;
    height: 520px;
    flex: 1;
    min-height: 0;
}

/* Large Heatmaps */
.heatmap-wrap {
    width: 100%;
    overflow: auto;
    display: flex;
    justify-content: center;
}

.heatmap-1920x1080 {
    width: 1920px;
    height: 1080px;
    max-width: 100%;
}

/* Footer */
.footer {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Loading State */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
}

/* Plotly Customization */
.js-plotly-plot .plotly .modebar {
    background: transparent !important;
}

.js-plotly-plot .plotly .modebar-btn {
    color: var(--text-muted) !important;
}

.js-plotly-plot .plotly .modebar-btn:hover {
    color: var(--text-primary) !important;
}

/* Responsive */
@media (max-width: 1200px) {
    .charts-top {
        grid-template-columns: 1fr;
    }
    .chart-box {
        height: 450px;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0 12px;
        height: 52px;
    }
    
    .logo-text, .logo-suffix {
        font-size: 1rem;
    }
    
    .nav-link {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .chart-box {
        height: 380px;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Liquidation Page Specific Styles */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 12px;
    align-items: flex-end;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.control-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.control-group select,
.control-group input[type="range"] {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    min-width: 120px;
}

.control-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.controls button {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.1s ease;
}

.controls button:hover {
    opacity: 0.9;
}

.controls button:active {
    transform: scale(0.98);
}

/* Table Styles */
.table-wrap {
    overflow-x: auto;
    margin-top: 12px;
}

.table-wrap table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.table-wrap th,
.table-wrap td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table-wrap th {
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.03em;
    background: var(--bg-secondary);
}

.table-wrap td {
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.table-wrap tr:hover td {
    background: var(--bg-card-hover);
}

/* Beta Tag */
.beta-tag {
    font-size: 0.65rem;
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-amber);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: 500;
    vertical-align: middle;
}

/* Loading Spinner */
.chart-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: var(--text-secondary);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 8px;
    color: var(--text-muted);
    text-align: center;
    padding: 20px;
}

.error-message .error-icon {
    font-size: 24px;
    color: var(--accent-red);
}

.error-message .error-text {
    font-size: 0.875rem;
    max-width: 300px;
}
