:root {
    --bg: #0b0e11;
    --sidebar: #151a21;
    --card: #1e2329;
    --text: #eaecef;
    --text-dim: #848e9c;
    --green: #0ecb81;
    --red: #f6465d;
    --yellow: #f0b90b;
    --blue: #3b82f6;
    --border: #2b3139;
    --table-hover: #2a2f36;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', 'Segoe UI', sans-serif;
    margin: 0; padding: 0; height: 100vh; overflow: hidden;
}

.app-wrapper { display: flex; height: 100%; }

.sidebar {
    width: 240px; background-color: var(--sidebar);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column; padding: 20px;
    flex-shrink: 0;
}
.logo { font-size: 1.4rem; font-weight: 800; color: var(--yellow); margin-bottom: 40px; letter-spacing: 1px; }
.menu { list-style: none; padding: 0; }
.menu li {
    padding: 14px; margin-bottom: 8px; border-radius: 8px;
    cursor: pointer; color: var(--text-dim); transition: 0.2s; font-size: 0.95rem;
}
.menu li:hover, .menu li.active { background-color: var(--card); color: var(--text); }
.menu li i { margin-right: 12px; width: 20px; }
.logout { margin-top: auto; color: var(--red); cursor: pointer; padding: 14px; }

.main-content { flex-grow: 1; padding: 24px; overflow-y: auto; display: flex; flex-direction: column; }

.top-bar { display: flex; justify-content: space-between; margin-bottom: 24px; align-items: center; }
.breadcrumbs { font-size: 1.1rem; font-weight: 600; }
.status-dot { height: 10px; width: 10px; background-color: var(--text-dim); border-radius: 50%; display: inline-block; margin-left: 8px; }

/* TOGGLE SWITCH */
.trading-switch { display: flex; align-items: center; gap: 10px; font-weight: bold; font-size: 0.9rem; }
.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; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 4px; bottom: 4px; background-color: white; transition: .4s; }
input:checked + .slider { background-color: var(--green); }
input:checked + .slider:before { transform: translateX(26px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

.toolbar { display: flex; justify-content: space-between; margin-bottom: 20px; }
.tf-btn, .action-btn {
    background: var(--card); border: 1px solid var(--border);
    color: var(--text-dim); padding: 8px 16px; border-radius: 6px;
    cursor: pointer; margin-right: 8px; font-weight: 600; font-size: 0.85rem; transition: 0.2s;
}
.tf-btn:hover, .action-btn:hover { background: #2a2f36; }
.tf-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }

.metrics-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 20px; }
.card { background-color: var(--card); border-radius: 12px; padding: 20px; position: relative; }
.metric-card { display: flex; flex-direction: column; justify-content: center; }
.interactive-card { cursor: pointer; border: 1px solid transparent; transition: 0.2s; }
.interactive-card:hover { border-color: var(--blue); transform: translateY(-2px); }

.label { font-size: 0.75rem; color: var(--text-dim); font-weight: 700; letter-spacing: 0.5px; margin-bottom: 6px; }
.value { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.value-small { font-size: 1.2rem; font-weight: 700; color: var(--text); }
.subtext { font-size: 0.85rem; color: var(--text-dim); margin-top: 4px; }

.bot-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 30px; }
.stat-card { display: flex; align-items: center; gap: 20px; background-color: var(--card); border: 1px solid var(--border); padding: 24px; }
.icon-box { width: 56px; height: 56px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; }
.icon-box.green { background: rgba(14, 203, 129, 0.15); color: var(--green); }
.icon-box.blue { background: rgba(59, 130, 246, 0.15); color: var(--blue); }
.icon-box.yellow { background: rgba(240, 185, 11, 0.15); color: var(--yellow); }

.table-container { overflow-x: auto; border: 1px solid var(--border); }
.table-container h3 { margin-top: 0; margin-bottom: 20px; color: var(--yellow); font-size: 1.1rem; }
.history-table { width: 100%; border-collapse: collapse; }
.history-table th { text-align: left; padding: 16px; color: var(--text-dim); font-size: 0.8rem; text-transform: uppercase; border-bottom: 1px solid var(--border); background-color: rgba(0,0,0,0.2); }
.history-table td { padding: 16px; border-bottom: 1px solid var(--border); font-size: 0.95rem; color: var(--text); }
.history-table tr:hover { background-color: var(--table-hover); }

.badge { padding: 6px 10px; border-radius: 6px; font-size: 0.8rem; font-weight: 700; }
.badge-win { background: rgba(14, 203, 129, 0.2); color: var(--green); }
.badge-loss { background: rgba(246, 70, 93, 0.2); color: var(--red); }
.badge-long { color: var(--green); }
.badge-short { color: var(--red); }

.gauge-wrapper { position: relative; width: 100px; height: 50px; margin: 0 auto; overflow: hidden; }
.gauge-bg, .gauge-fill { position: absolute; top: 0; left: 0; width: 100px; height: 100px; border-radius: 50%; border: 10px solid #2b3139; box-sizing: border-box; }
.gauge-fill { border-color: transparent; border-top-color: var(--blue); transform: rotate(0deg); transition: transform 1s ease-out; }
.gauge-value { position: absolute; bottom: 0; width: 100%; text-align: center; font-weight: bold; font-size: 1.2rem; line-height: 1; }

.chart-container { flex-grow: 1; min-height: 500px; position: relative; padding: 10px; display: flex; flex-direction: column; }
.chart-wrapper { flex-grow: 1; width: 100%; height: 100%; position: relative; }
canvas#myChart { width: 100% !important; height: 100% !important; }

.custom-tooltip { position: absolute; background: rgba(20, 20, 20, 0.95); border: 1px solid var(--border); padding: 8px 12px; border-radius: 6px; pointer-events: none; font-size: 0.85rem; color: #fff; z-index: 100; box-shadow: 0 4px 12px rgba(0,0,0,0.5); }

.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.8); backdrop-filter: blur(8px); }
.modal-content { background-color: var(--card); margin: 8% auto; padding: 30px; border: 1px solid var(--border); width: 600px; border-radius: 16px; box-shadow: 0 20px 50px rgba(0,0,0,0.7); }
.close-modal { color: var(--text-dim); float: right; font-size: 28px; font-weight: bold; cursor: pointer; transition: 0.2s; }
.close-modal:hover { color: var(--text); }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.modal-box { background: #151a21; padding: 20px; border-radius: 12px; border: 1px solid var(--border); }
.modal-box h3 { margin-top: 0; font-size: 0.9rem; color: var(--yellow); margin-bottom: 15px; text-transform: uppercase; letter-spacing: 1px; }
.full-width { grid-column: span 2; }
.trade-setup { display: flex; flex-direction: column; gap: 12px; }
.setup-row { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #2b3139; padding-bottom: 8px; }
.confidence-meter { width: 100%; height: 8px; background: #2b3139; border-radius: 4px; overflow: hidden; margin-top: 10px; }
.conf-fill { height: 100%; background: var(--green); transition: width 0.5s; }

.text-green { color: var(--green) !important; }
.text-red { color: var(--red) !important; }
.text-yellow { color: var(--yellow) !important; }
