/* ═══════════════════════════════════════════════════════════
   ODDS Market Maker — Dashboard Theme
   Dark mode, modern, data-dense
   ═══════════════════════════════════════════════════════════ */

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #161b22;
    --bg-card: #1c2128;
    --bg-input: #21262d;
    --border: #30363d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent: #58a6ff;
    --accent-hover: #79c0ff;
    --green: #3fb950;
    --green-bg: rgba(63, 185, 80, 0.12);
    --red: #f85149;
    --red-bg: rgba(248, 81, 73, 0.12);
    --yellow: #d29922;
    --yellow-bg: rgba(210, 153, 34, 0.12);
    --purple: #bc8cff;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    width: 240px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-brand {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
}

.sidebar-brand h1 {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.3px;
}

.sidebar-brand .mode-badge {
    display: inline-block;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mode-badge.dry-run {
    background: var(--yellow-bg);
    color: var(--yellow);
    border: 1px solid rgba(210, 153, 34, 0.3);
}

.mode-badge.live {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid rgba(248, 81, 73, 0.3);
}

.sidebar nav { flex: 1; }

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.sidebar nav a:hover {
    background: rgba(88, 166, 255, 0.06);
    color: var(--text-primary);
}

.sidebar nav a.active {
    color: var(--accent);
    background: rgba(88, 166, 255, 0.1);
    border-left-color: var(--accent);
}

.sidebar nav a .icon { font-size: 18px; width: 22px; text-align: center; }

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}

.sidebar-footer .status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-dot.running { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.stopped { background: var(--red); box-shadow: 0 0 6px var(--red); }

/* ── Main Content ────────────────────────────────────────── */
.main-content {
    margin-left: 240px;
    padding: 24px 32px;
    flex: 1;
    min-width: 0;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 22px;
    font-weight: 600;
}

.page-header .last-update {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ── Stat Cards Grid ─────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow);
}

.stat-card .label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.stat-card .value {
    font-size: 26px;
    font-weight: 700;
    font-family: var(--font-mono);
    line-height: 1.2;
}

.stat-card .sub {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.value.positive { color: var(--green); }
.value.negative { color: var(--red); }
.value.neutral  { color: var(--text-primary); }
.value.accent   { color: var(--accent); }

/* ── Charts ──────────────────────────────────────────────── */
.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.chart-card h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.chart-card canvas {
    width: 100% !important;
    max-height: 280px;
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

/* ── Tables ──────────────────────────────────────────────── */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 24px;
}

.table-card .table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.table-card .table-header h3 {
    font-size: 14px;
    font-weight: 600;
}

.table-card table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table-card thead th {
    text-align: left;
    padding: 10px 16px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    background: rgba(0,0,0,0.15);
}

.table-card tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 12px;
}

.table-card tbody tr:last-child td { border-bottom: none; }

.table-card tbody tr:hover {
    background: rgba(88, 166, 255, 0.04);
}

/* ── Badges ──────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge.back {
    background: rgba(88, 166, 255, 0.15);
    color: var(--accent);
    border: 1px solid rgba(88, 166, 255, 0.3);
}

.badge.lay {
    background: rgba(248, 81, 73, 0.12);
    color: var(--red);
    border: 1px solid rgba(248, 81, 73, 0.3);
}

.badge.simulated {
    background: var(--yellow-bg);
    color: var(--yellow);
    border: 1px solid rgba(210, 153, 34, 0.3);
}

.badge.placed {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid rgba(63, 185, 80, 0.3);
}

/* ── Settings Form ───────────────────────────────────────── */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.settings-section h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

/* ── Search Controls ───────────────────────────────────── */
.search-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

.search-autocomplete {
    position: relative;
    flex: 1;
}

.search-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.18);
}

.search-help {
    font-size: 12px;
    color: var(--text-muted);
}

.search-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    z-index: 200;
    max-height: 280px;
    overflow-y: auto;
}

.search-suggestions.hidden {
    display: none;
}

.suggestion-item {
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.suggestion-item:last-child {
    border-bottom: 0;
}

.suggestion-item:hover {
    background: rgba(88, 166, 255, 0.1);
}

.suggestion-text {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-kind {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* ── Filter Dropdowns ────────────────────────────────────── */
.filter-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
    margin-bottom: 8px;
}

.filter-select {
    flex: 1;
    min-width: 160px;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 10px;
    font-size: 13px;
    cursor: pointer;
    appearance: auto;
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.18);
}

.filter-select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-mono);
    outline: none;
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

.form-group .hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn {
    padding: 8px 20px;
    border-radius: 6px;
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-danger {
    background: transparent;
    color: var(--red);
    border-color: var(--red);
}

.btn-danger:hover {
    background: var(--red-bg);
}

.btn-success {
    background: transparent;
    color: var(--green);
    border-color: var(--green);
}

.btn-success:hover {
    background: var(--green-bg);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
}

.btn-secondary:hover {
    border-color: var(--text-secondary);
}

/* ── Toast Notification ──────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.toast.success {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid rgba(63, 185, 80, 0.3);
}

.toast.error {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid rgba(248, 81, 73, 0.3);
}

/* ── Sport filter pills ──────────────────────────────────── */
.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.filter-pills .pill {
    padding: 4px 12px;
    border-radius: 14px;
    font-size: 12px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.filter-pills .pill.active {
    background: rgba(88, 166, 255, 0.12);
    color: var(--accent);
    border-color: rgba(88, 166, 255, 0.3);
}

.filter-pills .pill:hover {
    border-color: var(--text-secondary);
}

/* ── Toggle Switch ───────────────────────────────────────── */
.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle {
    position: relative;
    width: 44px;
    height: 24px;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle .slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: all 0.2s;
}

.toggle .slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    bottom: 2px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: all 0.2s;
}

.toggle input:checked + .slider { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .slider::before { transform: translateX(20px); background: white; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1200px) {
    .charts-row { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-brand h1, .sidebar nav a span, .sidebar-footer span { display: none; }
    .sidebar nav a { justify-content: center; padding: 12px; }
    .main-content { margin-left: 60px; padding: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Animations ──────────────────────────────────────────── */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pulse { animation: pulse 2s ease-in-out infinite; }
