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

body { font-family: Arial, sans-serif; background: #f0f2f5; padding: 20px; }

.container { max-width: 1400px; margin: 0 auto; }

header {
    background: white; padding: 20px; border-radius: 8px;
    margin-bottom: 20px; display: flex; justify-content: space-between;
    align-items: center; flex-wrap: wrap; gap: 15px;
}

h1 { color: #333; font-size: 24px; }

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

.balance-display {
    background: #e8f5e9; padding: 8px 15px; border-radius: 20px;
    display: flex; align-items: center; gap: 8px;
}

.balance-label { font-size: 12px; color: #666; }
.balance-value { font-size: 16px; font-weight: bold; color: #2e7d32; }

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

.status-dot {
    width: 12px; height: 12px; border-radius: 50%; background: #f44336;
}

.status-dot.connected { background: #4CAF50; }
.status-dot.trading { background: #ff9800; animation: pulse 1s infinite; }

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

.dashboard { display: grid; grid-template-columns: 340px 1fr; gap: 20px; }

.config-panel, .trading-panel {
    background: white; padding: 20px; border-radius: 8px;
}

h2 { margin-bottom: 20px; color: #333; font-size: 18px; }
h3 { margin: 15px 0 10px; color: #555; font-size: 14px; }

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

label { display: block; margin-bottom: 5px; font-weight: bold; color: #555; font-size: 13px; }

select, input {
    width: 100%; padding: 8px; border: 1px solid #ddd;
    border-radius: 4px; font-size: 14px;
}

.predictions-title { margin-top: 20px; }

.predictions-grid {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px;
    margin-bottom: 15px;
}

.prediction-input label { font-size: 11px; margin-bottom: 3px; }
.prediction-input input { padding: 6px; text-align: center; font-weight: bold; }

.button-group {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
    margin-top: 20px;
}

.button-group button:first-child { grid-column: span 2; }

button {
    padding: 10px; border: none; border-radius: 4px;
    cursor: pointer; font-weight: bold; color: white;
    transition: all 0.2s;
}

button:disabled { opacity: 0.5; cursor: not-allowed; }
button:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 2px 5px rgba(0,0,0,0.2); }

.btn-connect { background: #2196F3; }
.btn-start { background: #4CAF50; }
.btn-pause { background: #ff9800; }
.btn-stop { background: #f44336; }
.btn-reset { background: #9e9e9e; }

.trading-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px;
}

.opened-counter {
    background: #e3f2fd; padding: 8px 15px; border-radius: 20px;
    font-size: 13px; display: flex; align-items: center; gap: 8px;
}

.counter-value {
    font-size: 18px; font-weight: bold; color: #1976d2;
}

.positions-grid {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px;
}

.position-card {
    border: 2px solid #ddd; border-radius: 8px; padding: 12px;
    text-align: center; font-size: 13px; transition: all 0.3s;
}

.position-card.active { border-color: #2196F3; background: #f0f8ff; }
.position-card.won { border-color: #4CAF50; background: #f0fff0; }
.position-card.lost { border-color: #f44336; background: #fff0f0; }
.position-card.recovery { border-color: #ff9800; background: #fff8e1; }
.position-card.completed { border-color: #9c27b0; background: #f3e5f5; }

.prediction { font-size: 22px; font-weight: bold; margin: 8px 0; }

.profit { font-size: 14px; font-weight: bold; }
.profit.positive { color: #4CAF50; }
.profit.negative { color: #f44336; }

.recovery-badge {
    background: #ff9800; color: white; padding: 2px 8px;
    border-radius: 4px; font-size: 10px; margin-top: 5px;
    display: inline-block;
}

/* Trade Log */
.trade-log-section {
    margin-top: 20px; border-top: 1px solid #eee; padding-top: 15px;
}

.trade-log {
    max-height: 200px; overflow-y: auto; background: #f8f9fa;
    border-radius: 6px; padding: 10px;
}

.trade-log-empty {
    text-align: center; color: #999; font-size: 13px; padding: 20px;
}

.trade-log-entry {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 10px; border-bottom: 1px solid #e0e0e0;
    font-size: 12px; font-family: monospace;
}

.trade-log-entry:last-child { border-bottom: none; }

.trade-log-entry.WIN { background: #e8f5e9; }
.trade-log-entry.LOSS { background: #ffebee; }

.trade-log-time { color: #666; min-width: 80px; }
.trade-log-pos { font-weight: bold; min-width: 60px; }
.trade-log-pred { min-width: 60px; }
.trade-log-stake { min-width: 60px; }
.trade-log-result { font-weight: bold; min-width: 50px; }
.trade-log-profit { font-weight: bold; min-width: 70px; text-align: right; }
.trade-log-recovery { color: #ff9800; font-size: 10px; }

.statistics {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 15px; margin-top: 20px;
}

.stat-box {
    text-align: center; padding: 15px;
    background: #f8f9fa; border-radius: 8px;
}

.stat-label { font-size: 12px; color: #666; }
.stat-value { font-size: 20px; font-weight: bold; margin-top: 5px; }

.log-panel {
    background: white; padding: 20px; border-radius: 8px;
    margin-top: 20px;
}

.log-container {
    max-height: 300px; overflow-y: auto; background: #1e1e1e;
    padding: 15px; border-radius: 4px; font-family: monospace;
    font-size: 12px; color: #fff;
}

.log-entry { padding: 5px; border-bottom: 1px solid #333; }
.log-entry.info { color: #64b5f6; }
.log-entry.success { color: #81c784; }
.log-entry.warning { color: #ffb74d; }
.log-entry.error { color: #e57373; }

.account-toggle {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 20px; justify-content: center;
}

.switch {
    position: relative; display: inline-block; width: 50px; height: 24px;
}

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

.slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0;
    bottom: 0; background-color: #ccc; transition: .4s; border-radius: 24px;
}

.slider:before {
    position: absolute; content: ""; height: 18px; width: 18px;
    left: 3px; bottom: 3px; background-color: white;
    transition: .4s; border-radius: 50%;
}

input:checked + .slider { background-color: #4CAF50; }
input:checked + .slider:before { transform: translateX(26px); }

@media (max-width: 768px) {
    .dashboard { grid-template-columns: 1fr; }
    .positions-grid { grid-template-columns: repeat(2, 1fr); }
    .predictions-grid { grid-template-columns: repeat(3, 1fr); }
}