/* ─────────────────────────────────────────────────────────
   Lucky UI — styles.css  (v2 PRO)
   Dark theme · responsive · EV color coding
───────────────────────────────────────────────────────── */

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

:root {
  --bg:           #0f1117;
  --surface:      #161925;
  --surface2:     #1e2235;
  --surface3:     #252a3d;
  --border:       #2d3355;
  --text:         #e2e8f0;
  --text-muted:   #64748b;
  --text-dim:     #94a3b8;
  --primary:      #6366f1;
  --primary-h:    #818cf8;
  --green:        #22c55e;
  --green-bg:     rgba(34,197,94,0.10);
  --green-strong: #16a34a;
  --red:          #ef4444;
  --red-bg:       rgba(239,68,68,0.10);
  --yellow:       #f59e0b;
  --yellow-bg:    rgba(245,158,11,0.10);
  --radius:       10px;
  --font:         'Inter', system-ui, -apple-system, sans-serif;
}

html { font-size: 15px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────── */

.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
}
.header-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 8px; }
.logo-icon { font-size: 1.3rem; }
.logo-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}
.logo-version {
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--primary);
  color: #fff;
  padding: 1px 5px;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 2px;
}
.header-meta { display: flex; align-items: center; gap: 12px; }
.meta-item { font-size: 0.78rem; color: var(--text-muted); }

/* ── WS Badge ────────────────────────────────────────── */
.ws-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.ws-badge.connected  { border-color: var(--green); color: var(--green); }
.ws-badge.connecting { border-color: var(--yellow); color: var(--yellow); }
.ws-badge.disconnected { border-color: var(--border); color: var(--text-muted); }
.ws-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.8s ease-in-out infinite;
}
.ws-badge.disconnected .ws-dot { animation: none; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }

/* ── Tabs ────────────────────────────────────────────── */
.tabs {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  padding: 0 16px;
}
.tab {
  padding: 12px 18px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary-h); border-bottom-color: var(--primary); }
.live-dot { color: var(--red); font-size: 0.65em; vertical-align: middle; }

/* ── Main / Panels ───────────────────────────────────── */
.main { padding: 20px 16px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Panel Header ────────────────────────────────────── */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}
.panel-header h2 {
  font-size: 1.05rem;
  font-weight: 600;
}
.panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.filter-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.filter-label select,
.filter-label input {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 0.82rem;
  font-family: var(--font);
  cursor: pointer;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.13s, opacity 0.13s;
  white-space: nowrap;
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border);
}
.btn:hover:not(:disabled) { background: var(--surface3); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-success { background: var(--green-bg); color: var(--green); border-color: var(--green); }
.btn-success:hover:not(:disabled) { background: rgba(34,197,94,.2); }
.btn-danger  { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,.2); }

/* ── Status Bar ──────────────────────────────────────── */
.status-bar {
  padding: 8px 12px;
  font-size: 0.82rem;
  border-radius: 7px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.status-bar:empty { display: none; }
.status-bar.loading { background: var(--surface2); color: var(--text-muted); }
.status-bar.loading::before {
  content: '';
  width: 12px; height: 12px;
  border: 2px solid var(--primary);
  border-top-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.status-bar.error   { background: var(--red-bg);   color: var(--red);   border: 1px solid var(--red); }
.status-bar.success { background: var(--green-bg); color: var(--green); }

/* ── Table Wrapper ───────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.data-table thead th {
  background: var(--surface2);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}
.data-table thead th[data-sort]:hover { color: var(--text); }
.data-table thead th.sort-asc::after  { content: " ↑"; color: var(--primary); }
.data-table thead th.sort-desc::after { content: " ↓"; color: var(--primary); }

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.data-table tbody tr:hover { background: var(--surface2); }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table td {
  padding: 9px 12px;
  color: var(--text);
  vertical-align: middle;
  white-space: nowrap;
}
.empty-row {
  text-align: center;
  color: var(--text-muted);
  padding: 32px !important;
  font-size: 0.85rem;
}
.match-col {
  white-space: normal !important;
  min-width: 160px;
  font-weight: 500;
}
.vs { color: var(--text-muted); font-size: 0.75em; }

/* ── EV Color Classes ────────────────────────────────── */
.ev-pos-strong { color: var(--green);  font-weight: 700; }
.ev-pos        { color: #86efac;       font-weight: 600; }
.ev-neutral    { color: var(--yellow); }
.ev-neg        { color: var(--red); }

/* ── Pick Badges ─────────────────────────────────────── */
.pick-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.pick-home  { background: rgba(99,102,241,.2); color: #818cf8; }
.pick-draw  { background: rgba(245,158,11,.2); color: #fbbf24; }
.pick-away  { background: rgba(34,197,94,.2);  color: #4ade80; }

/* ── Chart ───────────────────────────────────────────── */
.chart-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chart-container canvas { max-height: 248px; }

/* ── Win / Loss badges ───────────────────────────────── */
.badge-win  { background: var(--green-bg); color: var(--green); padding: 2px 7px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; }
.badge-loss { background: var(--red-bg);   color: var(--red);   padding: 2px 7px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; }
.badge-ns   { color: var(--text-muted); }

/* ── Badge (generic counter) ─────────────────────────── */
.badge {
  background: var(--surface3);
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 99px;
  vertical-align: middle;
}

/* ── Live Log ────────────────────────────────────────── */
.live-log {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 0.78rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.log-entry   { padding: 1px 0; }
.log-info    { color: var(--text-muted); }
.log-success { color: var(--green); }
.log-warn    { color: var(--yellow); }
.log-error   { color: var(--red); }

/* ── WS Status Text ──────────────────────────────────── */
.ws-status-full {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--surface2);
  color: var(--text-muted);
}

/* ── Live Table Flash ────────────────────────────────── */
@keyframes flash-in { from { background: rgba(99,102,241,.25); } to { background: transparent; } }
.live-new { animation: flash-in 0.8s ease-out forwards; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 600px) {
  .header-meta    { gap: 8px; }
  .panel-header   { flex-direction: column; align-items: flex-start; }
  .panel-actions  { width: 100%; justify-content: flex-start; }
  .chart-container { height: 200px; }
  .data-table { font-size: 0.75rem; }
  .data-table td, .data-table th { padding: 7px 8px; }
}

