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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0a0e17;
    color: #e0e6f0;
    height: 100vh;
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #0f1923 0%, #1a2a3a 100%);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #1e3a5a;
}

header h1 {
    font-size: 18px;
    font-weight: 600;
    color: #42a5f5;
    letter-spacing: 1px;
}

header h1 span {
    color: #fdd835;
    font-weight: 300;
}

header .subtitle {
    font-size: 11px;
    color: #5a7a9a;
}

.controls-bar {
    display: flex;
    gap: 10px;
    align-items: center;
}

.main-container {
    display: flex;
    height: calc(100vh - 52px);
}

.chart-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chart-container {
    flex: 1;
    position: relative;
    background: #0d1b2a;
    border-right: 1px solid #1e3a5a;
    min-height: 300px;
}

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

.status-bar {
    display: flex;
    gap: 20px;
    padding: 8px 16px;
    background: #0f1923;
    border-bottom: 1px solid #1e3a5a;
    font-size: 12px;
    font-family: monospace;
    flex-wrap: wrap;
}

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

.status-item .label {
    color: #5a7a9a;
}

.status-item .value {
    color: #e0e6f0;
    font-weight: 600;
}

.status-item .value.price {
    color: #42a5f5;
    font-size: 14px;
}

.status-item .value.trend-bullish {
    color: #26a69a;
    font-weight: 700;
}

.status-item .value.trend-bullish::after {
    content: ' ↑';
}

.status-item .value.trend-bearish {
    color: #ef5350;
    font-weight: 700;
}

.status-item .value.trend-bearish::after {
    content: ' ↓';
}

.candle-info {
    display: flex;
    gap: 12px;
    font-size: 11px;
}

.candle-info span {
    color: #5a7a9a;
}

.candle-info span strong {
    color: #e0e6f0;
}

.sidebar {
    width: 28%;
    min-width: 320px;
    background: #0f1923;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.panel {
    border-bottom: 1px solid #1e3a5a;
    padding: 12px 16px;
}

.panel-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #5a7a9a;
    margin-bottom: 10px;
}

.panel-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    padding: 8px 16px;
    border: 1px solid #1e3a5a;
    border-radius: 4px;
    background: #1a2a3a;
    color: #e0e6f0;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn:hover:not(:disabled) {
    border-color: #42a5f5;
    background: #1e3a5a;
}

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

.btn-primary {
    background: #1565c0;
    border-color: #1565c0;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #1976d2;
}

.btn-danger {
    background: #c62828;
    border-color: #c62828;
}

.btn-danger:hover:not(:disabled) {
    background: #d32f2f;
}

.btn-success {
    background: #2e7d32;
    border-color: #2e7d32;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #388e3c;
}

.btn-warning {
    background: #f57f17;
    border-color: #f57f17;
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background: #f9a825;
}

.form-group {
    margin-bottom: 10px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: #5a7a9a;
    margin-bottom: 4px;
}

.form-group input[type="range"] {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #1e3a5a;
    border-radius: 2px;
    outline: none;
}

.form-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #42a5f5;
    cursor: pointer;
}

.form-group .range-value {
    font-size: 12px;
    color: #42a5f5;
    font-weight: 600;
    text-align: right;
}

.strategy-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    margin-bottom: 4px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
}

.strategy-option:hover {
    background: #1a2a3a;
}

.strategy-option input[type="radio"] {
    accent-color: #42a5f5;
}

.strategy-option .strat-desc {
    font-size: 12px;
    color: #5a7a9a;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.toggle {
    position: relative;
    width: 44px;
    height: 22px;
    background: #1e3a5a;
    border-radius: 11px;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle.active {
    background: #2e7d32;
}

.toggle .knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle.active .knob {
    transform: translateX(22px);
}

.toggle-label {
    font-size: 14px;
    font-weight: 600;
}

.toggle-label.active {
    color: #26a69a;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.stat-card {
    background: #0d1b2a;
    border: 1px solid #1e3a5a;
    border-radius: 4px;
    padding: 8px 10px;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 18px;
    font-weight: 700;
    color: #e0e6f0;
}

.stat-card .stat-value.positive {
    color: #26a69a;
}

.stat-card .stat-value.negative {
    color: #ef5350;
}

.stat-card .stat-label {
    font-size: 11px;
    color: #5a7a9a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.log-panel {
    flex: 2;
    min-height: 300px;
    display: flex;
    flex-direction: column;
}

.log-content {
    flex: 1;
    overflow-y: auto;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.6;
    color: #8a9bb5;
}

.log-content div {
    padding: 1px 0;
    border-bottom: 1px solid #0d1b2a;
}

.signal-display {
    background: #0d1b2a;
    border: 1px solid #1e3a5a;
    border-radius: 4px;
    padding: 8px 10px;
    font-size: 12px;
    font-family: monospace;
    min-height: 20px;
    margin-top: 4px;
}

.table-trades {
    width: 100%;
    font-size: 11px;
    border-collapse: collapse;
    margin-top: 4px;
}

.table-trades th {
    text-align: left;
    color: #5a7a9a;
    font-weight: 600;
    padding: 4px 6px;
    border-bottom: 1px solid #1e3a5a;
    font-size: 10px;
    text-transform: uppercase;
}

.table-trades td {
    padding: 4px 6px;
    border-bottom: 1px solid #0d1b2a;
    font-family: monospace;
}

.table-trades .win {
    color: #26a69a;
}

.table-trades .loss {
    color: #ef5350;
}

.trade-list {
    max-height: 200px;
    overflow-y: auto;
}

.empty-state {
    color: #5a7a9a;
    font-size: 13px;
    text-align: center;
    padding: 20px;
}

.backtest-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.bt-card {
    background: #0d1b2a;
    border: 1px solid #1e3a5a;
    border-radius: 4px;
    padding: 6px 8px;
    text-align: center;
}

.bt-card .bt-value {
    font-size: 14px;
    font-weight: 700;
    color: #e0e6f0;
}

.bt-card .bt-label {
    font-size: 10px;
    color: #5a7a9a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.balance-large {
    font-size: 24px;
    font-weight: 700;
    color: #42a5f5;
    text-align: center;
    padding: 4px 0;
}

.info-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: 2px 0;
}

.info-row .info-label {
    color: #5a7a9a;
}

.info-row .info-value {
    color: #e0e6f0;
    font-family: monospace;
}

.btn-live {
    background: #00695c;
    border-color: #00695c;
    color: white;
}

.btn-live:hover:not(:disabled) {
    background: #00897b;
}

.btn-live.active {
    background: #c62828;
    border-color: #c62828;
}

.btn-live.active:hover:not(:disabled) {
    background: #d32f2f;
}

.symbol-select {
    padding: 8px 12px;
    border: 1px solid #1e3a5a;
    border-radius: 4px;
    background: #1a2a3a;
    color: #e0e6f0;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.symbol-select:hover {
    border-color: #42a5f5;
}

.symbol-select:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.strategy-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #1e3a5a;
    border-radius: 4px;
    background: #1a2a3a;
    color: #e0e6f0;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.strategy-select optgroup {
    color: #5a7a9a;
    font-style: normal;
    font-size: 11px;
}

.strategy-select option {
    color: #e0e6f0;
    background: #1a2a3a;
}

.strategy-select:hover {
    border-color: #42a5f5;
}

.live-badge {
    display: none;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: #c62828;
    padding: 2px 8px;
    border-radius: 3px;
    margin-left: 10px;
    letter-spacing: 1px;
    animation: pulse-badge 1.5s ease-in-out infinite;
    vertical-align: middle;
}

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

.conn-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
}

.conn-dot.connected {
    background: #26a69a;
    box-shadow: 0 0 6px #26a69a;
}

.conn-dot.disconnected {
    background: #ef5350;
    box-shadow: 0 0 6px #ef5350;
}

#liveStatus {
    display: none;
    align-items: center;
    gap: 4px;
}

#botLiveStatus {
    display: none;
    align-items: center;
    gap: 4px;
}

#aiStatus {
    display: none;
    align-items: center;
    gap: 4px;
}

.ai-badge {
    font-size: 9px;
    font-weight: 700;
    color: #0a0e17;
    background: #7c4dff;
    padding: 1px 5px;
    border-radius: 3px;
    letter-spacing: 0.5px;
}

#speedControl:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #0a0e17;
}

::-webkit-scrollbar-thumb {
    background: #1e3a5a;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #2a4a6a;
}
