@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&display=swap');

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

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background: #060612;
    color: #e0e0e0;
    min-height: 100vh;
    overflow-x: hidden;
}

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

/* HEADER */
.header {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #0a0a2e 0%, #1a0a3e 50%, #0a0a2e 100%);
    border-radius: 20px;
    padding: 30px 40px;
    margin-bottom: 30px;
    border: 1px solid rgba(0, 212, 255, 0.15);
}

.header-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(0, 212, 255, 0.08) 0%, transparent 50%);
    animation: glowMove 8s ease-in-out infinite;
}

@keyframes glowMove {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-20%, 10%); }
}

.header-content {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

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

.logo-icon {
    font-size: 2em;
    filter: drop-shadow(0 0 10px rgba(0, 212, 255, 0.5));
}

.header h1 {
    font-size: 2em;
    font-weight: 800;
    background: linear-gradient(135deg, #00d4ff, #00ff88);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.clock {
    color: #666;
    font-size: 0.9em;
    font-family: 'Courier New', monospace;
}

.status-badge {
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.8em;
    letter-spacing: 1px;
}

.status-badge.running {
    background: rgba(0, 255, 136, 0.15);
    color: #00ff88;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.status-badge.stopped {
    background: rgba(255, 68, 68, 0.15);
    color: #ff4444;
    border: 1px solid rgba(255, 68, 68, 0.3);
}

.mode-badge {
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.8em;
    background: rgba(0, 212, 255, 0.15);
    color: #00d4ff;
    border: 1px solid rgba(0, 212, 255, 0.3);
    letter-spacing: 1px;
}

/* CARDS */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 25px;
}

.card {
    background: linear-gradient(145deg, #0f0f25, #18183a);
    padding: 20px 24px;
    border-radius: 16px;
    border: 1px solid rgba(42, 42, 94, 0.5);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    opacity: 0.6;
}

.card-balance::before { background: linear-gradient(90deg, #00d4ff, #0088ff); }
.card-pnl::before { background: linear-gradient(90deg, #00ff88, #00cc6a); }
.card-total::before { background: linear-gradient(90deg, #ff6b35, #ff4444); }
.card-trades::before { background: linear-gradient(90deg, #ffd700, #ffaa00); }
.card-positions::before { background: linear-gradient(90deg, #00d4ff, #00ff88); }
.card-profit::before { background: linear-gradient(90deg, #a855f7, #6366f1); }

.card:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 212, 255, 0.3);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.card-icon {
    font-size: 1.6em;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.15);
    flex-shrink: 0;
}

.card-body { flex: 1; min-width: 0; }

.card-label {
    color: #888;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 4px;
}

.card-value {
    font-size: 1.6em;
    font-weight: 800;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.card-sub {
    color: #666;
    font-size: 0.8em;
    margin-top: 2px;
}

.positive { color: #00ff88 !important; }
.negative { color: #ff4444 !important; }
.green { color: #00ff88; }
.red { color: #ff4444; }

/* CONTROLS */
.controls {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 10px;
    font-size: 0.9em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-start {
    background: linear-gradient(135deg, #00ff88, #00cc6a);
    color: #000;
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.2);
}
.btn-start:hover {
    box-shadow: 0 6px 25px rgba(0, 255, 136, 0.4);
    transform: translateY(-2px);
}

.btn-stop {
    background: linear-gradient(135deg, #ff4444, #cc0000);
    color: #fff;
    box-shadow: 0 4px 15px rgba(255, 68, 68, 0.2);
}
.btn-stop:hover {
    box-shadow: 0 6px 25px rgba(255, 68, 68, 0.4);
    transform: translateY(-2px);
}

.btn-reset {
    background: rgba(255,255,255,0.05);
    color: #888;
    border: 1px solid rgba(255,255,255,0.1);
}
.btn-reset:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.auto-refresh {
    margin-left: auto;
    color: #666;
    font-size: 0.85em;
}

.auto-refresh span {
    color: #00d4ff;
    font-weight: 700;
}

/* SECTIONS */
.section {
    background: #0f0f25;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 25px;
    border: 1px solid rgba(42, 42, 94, 0.5);
}

.section h2 {
    color: #00d4ff;
    font-size: 1.1em;
    font-weight: 700;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(42, 42, 94, 0.5);
    display: flex;
    align-items: center;
    gap: 8px;
}

.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

/* TABLES */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(26, 26, 62, 0.5);
}

th {
    color: #666;
    font-weight: 600;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(255,255,255,0.02);
}

tr:hover td {
    background: rgba(0, 212, 255, 0.03);
}

.empty {
    text-align: center;
    color: #444;
    padding: 30px !important;
    font-style: italic;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.75em;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.badge-long { background: rgba(0, 255, 136, 0.15); color: #00ff88; }
.badge-short { background: rgba(255, 68, 68, 0.15); color: #ff4444; }
.badge-tp { background: rgba(0, 255, 136, 0.15); color: #00ff88; }
.badge-sl { background: rgba(255, 68, 68, 0.15); color: #ff4444; }
.badge-trailing { background: rgba(255, 165, 0, 0.15); color: #ffa500; }
.badge-timeout { background: rgba(255, 255, 255, 0.1); color: #888; }
.badge-info { background: rgba(0, 212, 255, 0.15); color: #00d4ff; }

/* TOP GAINERS */
.gainers-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gainer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    transition: background 0.2s;
}

.gainer-item:hover { background: rgba(0, 212, 255, 0.05); }

.gainer-sym {
    font-weight: 600;
    flex: 1;
    font-size: 0.9em;
}

.gainer-chg {
    font-weight: 700;
    font-size: 0.9em;
    min-width: 70px;
    text-align: right;
}

.gainer-vol {
    color: #666;
    font-size: 0.8em;
    min-width: 70px;
    text-align: right;
}

/* PERFORMANCE */
.perf-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.perf-item {
    background: rgba(255,255,255,0.02);
    padding: 14px 18px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(42, 42, 94, 0.3);
}

.perf-label { color: #888; font-size: 0.85em; }
.perf-value { font-weight: 700; font-size: 1.1em; }

/* FOOTER */
.footer {
    text-align: center;
    padding: 20px;
    color: #444;
    border-top: 1px solid rgba(42, 42, 94, 0.3);
    font-size: 0.85em;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .cards { grid-template-columns: 1fr 1fr; }
    .grid-2col { grid-template-columns: 1fr; }
    .card-value { font-size: 1.3em; }
    .header h1 { font-size: 1.4em; }
    .header-content { flex-direction: column; align-items: flex-start; }
    .perf-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .cards { grid-template-columns: 1fr; }
}

/* ACTIVITY FEED */
.activity-feed {
    max-height: 260px;
    overflow-y: auto;
    font-size: 0.82em;
    font-family: 'Courier New', monospace;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    padding: 8px;
}

.activity-item {
    padding: 5px 6px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.activity-time {
    color: #555;
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 0.9em;
}

.activity-msg { color: #ccc; word-break: break-word; }
.activity-msg.signal { color: #00d4ff; }
.activity-msg.trade { color: #00ff88; }
.activity-msg.close { color: #ffa500; }
.activity-msg.error { color: #ff4444; }
.activity-msg.info { color: #888; }

/* SIGNAL PREVIEW */
.signal-preview {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.signal-item {
    padding: 8px 12px;
    margin: 4px 0;
    border-radius: 8px;
    background: rgba(0,212,255,0.05);
    border-left: 3px solid #00d4ff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    transition: background 0.2s;
}

.signal-item:hover { background: rgba(0,212,255,0.1); }

.signal-item .sym { font-weight: 700; color: #fff; min-width: 80px; }
.signal-item .conf { font-size: 0.75em; padding: 2px 8px; border-radius: 4px; font-weight: 700; }
.signal-item .conf.HIGH { background: rgba(0,255,136,0.15); color: #00ff88; }
.signal-item .conf.MEDIUM { background: rgba(255,165,0,0.15); color: #ffa500; }
.signal-item .conf.LOW { background: rgba(255,255,255,0.08); color: #888; }
.signal-item .strat { color: #666; font-size: 0.75em; flex: 1; text-align: right; }

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

/* STRATEGY TABLE */
#stratBody td {
    padding: 8px 10px;
    font-size: 0.85em;
    font-variant-numeric: tabular-nums;
}

#stratBody tr:hover td {
    background: rgba(0,212,255,0.04);
}

#stratBody td:first-child {
    color: #00d4ff;
    font-weight: 600;
}

.thead-strat th {
    background: rgba(0,212,255,0.05) !important;
    color: #00d4ff !important;
}

.strat-empty {
    text-align: center;
    color: #444;
    padding: 30px !important;
    font-style: italic;
}

/* SETTINGS PANEL */
.settings-panel {
    background: rgba(255,255,255,0.02);
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid rgba(42,42,94,0.3);
    overflow: hidden;
}

.settings-toggle {
    padding: 12px 20px;
    font-size: 0.9em;
    cursor: pointer;
    color: #00d4ff;
    font-weight: 600;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-toggle:hover { background: rgba(0,212,255,0.05); }

.settings-body {
    padding: 16px 20px;
    border-top: 1px solid rgba(42,42,94,0.3);
    display: grid;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.setting-item label {
    font-size: 0.7em;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.setting-item input {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(42,42,94,0.5);
    border-radius: 6px;
    padding: 6px 10px;
    color: #fff;
    font-size: 1em;
    font-weight: 600;
    width: 100%;
}

.setting-item input:focus {
    outline: none;
    border-color: #00d4ff;
}

/* CLOSE POSITION BUTTON */
.btn-close-pos {
    background: rgba(255,68,68,0.15);
    color: #ff4444;
    border: 1px solid rgba(255,68,68,0.3);
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.75em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-close-pos:hover {
    background: rgba(255,68,68,0.25);
}

/* RISK CARDS */
#riskCards .card {
    padding: 14px 16px;
    min-height: 0;
}

#riskCards .card-value {
    font-size: 1.3em;
}
