/* Mark Six Analysis Platform - Dark Theme */
:root {
  --bg: #0d0d0d;
  --bg2: #1a1a1a;
  --bg3: #252525;
  --card: #1e1e1e;
  --border: #333;
  --text: #e8e8e8;
  --text-muted: #888;
  --red: #D42B30;
  --red-dark: #a01f23;
  --blue: #1565C0;
  --green: #2E7D32;
  --orange: #E65100;
  --purple: #6A1B9A;
  --gold: #F9A825;
  --success: #4caf50;
  --warning: #ff9800;
  --info: #2196F3;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--red); text-decoration: none; }
a:hover { color: var(--gold); }

/* Header */
.header {
  background: linear-gradient(135deg, #1a0000 0%, #2d0506 50%, #1a0000 100%);
  border-bottom: 2px solid var(--red);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-title h1 {
  font-size: 1.6rem;
  color: var(--red);
  font-weight: 700;
  letter-spacing: 1px;
}

.header-title p {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 2px;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.countdown-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.countdown-display {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
}

.last-updated {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Main layout */
.main-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.history-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.history-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.history-section-body[hidden] {
  display: none !important;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.card-title .icon { margin-right: 6px; }

/* Grid layouts */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

/* Lottery Balls */
.ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: default;
  user-select: none;
  transition: transform 0.15s;
  flex-shrink: 0;
}

.ball:hover { transform: scale(1.1); }

.ball-sm {
  width: 28px;
  height: 28px;
  font-size: 0.75rem;
}

.ball-lg {
  width: 44px;
  height: 44px;
  font-size: 1rem;
}

/* Ball color zones */
.ball-red { background: radial-gradient(circle at 35% 35%, #ff4444, var(--red)); color: white; box-shadow: 0 2px 6px rgba(212,43,48,0.5); }
.ball-blue { background: radial-gradient(circle at 35% 35%, #2196f3, var(--blue)); color: white; box-shadow: 0 2px 6px rgba(21,101,192,0.5); }
.ball-green { background: radial-gradient(circle at 35% 35%, #4caf50, var(--green)); color: white; box-shadow: 0 2px 6px rgba(46,125,50,0.5); }
.ball-orange { background: radial-gradient(circle at 35% 35%, #ff9800, var(--orange)); color: white; box-shadow: 0 2px 6px rgba(230,81,0,0.5); }
.ball-purple { background: radial-gradient(circle at 35% 35%, #9c27b0, var(--purple)); color: white; box-shadow: 0 2px 6px rgba(106,27,154,0.5); }
.ball-extra { background: radial-gradient(circle at 35% 35%, #ffd700, var(--gold)); color: #1a1a1a; box-shadow: 0 2px 8px rgba(249,168,37,0.7); border: 2px solid var(--gold); }

/* Ball grid for frequency analysis 7x7 */
.ball-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  padding: 8px 0;
}

.ball-grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.ball-grid-item .freq-label {
  font-size: 0.6rem;
  color: var(--text-muted);
}

/* Frequency heat coloring */
.ball-freq-0 { opacity: 0.3; }
.ball-freq-1 { opacity: 0.5; }
.ball-freq-2 { opacity: 0.65; }
.ball-freq-3 { opacity: 0.8; }
.ball-freq-4 { opacity: 0.9; }
.ball-freq-5 { opacity: 1; filter: brightness(1.15); }

/* Draw result display */
.draw-result {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.draw-balls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.draw-separator {
  color: var(--text-muted);
  font-size: 1.2rem;
  margin: 0 4px;
}

/* Latest draw panel */
.latest-draw-panel {
  background: linear-gradient(135deg, #1a0000 0%, var(--card) 100%);
  border: 1px solid var(--red-dark);
}

.latest-draw-meta {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.draw-id-badge {
  background: var(--red);
  color: white;
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.9rem;
}

.draw-date-text {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.snowball-badge {
  background: var(--gold);
  color: #1a1a1a;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Prize table */
.prize-mini-table {
  margin-top: 12px;
  font-size: 0.8rem;
}

.prize-mini-table table {
  width: 100%;
  border-collapse: collapse;
}

.prize-mini-table th {
  color: var(--text-muted);
  padding: 4px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}

.prize-mini-table td {
  padding: 4px 8px;
  border-bottom: 1px solid #222;
}

.prize-amount {
  color: var(--gold);
  font-weight: 600;
}

/* AI Recommendations Panel */
.ai-panel {
  border: 1px solid #3a1a1a;
  background: linear-gradient(135deg, #1a0d00 0%, var(--card) 100%);
}

.ai-panel .card-header { border-color: #3a1a1a; }

.ai-badge {
  background: linear-gradient(135deg, #ff6b35, var(--red));
  color: white;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.recommended-sets {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recommended-set {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
}

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

.strategy-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gold);
}

.confidence-badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.conf-high { background: rgba(76,175,80,0.2); color: var(--success); border: 1px solid var(--success); }
.conf-mid { background: rgba(255,152,0,0.2); color: var(--warning); border: 1px solid var(--warning); }
.conf-low { background: rgba(128,128,128,0.2); color: var(--text-muted); border: 1px solid var(--border); }

.set-reasoning {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

.data-anchors {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.anchor-chip {
  background: rgba(21,101,192,0.15);
  border: 1px solid rgba(21,101,192,0.3);
  color: #64b5f6;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
}

.avoid-numbers {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.avoid-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.avoid-ball {
  position: relative;
}

.avoid-ball::after {
  content: '✕';
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: 0.6rem;
  background: #333;
  border-radius: 50%;
  width: 12px;
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ff6b6b;
}

.risk-disclaimer {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 10px;
  padding: 6px;
  background: rgba(255,152,0,0.05);
  border: 1px solid rgba(255,152,0,0.1);
  border-radius: 4px;
}

/* Tabs */
.tabs-container { position: relative; }

.tabs-nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs-nav::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 8px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
  transition: all 0.2s;
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--red); border-bottom-color: var(--red); }

.tab-pane { display: none; padding-top: 14px; }
.tab-pane.active { display: block; }

/* Hot/Cold columns */
.hot-cold-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.hot-list, .cold-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hc-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hc-bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--bg3);
  overflow: hidden;
}

.hc-fill { height: 100%; border-radius: 3px; transition: width 0.5s; }
.hot-fill { background: linear-gradient(90deg, var(--red), var(--orange)); }
.cold-fill { background: linear-gradient(90deg, var(--blue), #5e92f3); }

.hc-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  width: 28px;
  text-align: right;
}

/* Charts */
.chart-container { position: relative; height: 260px; }
.chart-container-sm { position: relative; height: 200px; }

/* History table */
.history-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.history-table th {
  background: var(--bg3);
  padding: 8px 10px;
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.history-table td {
  padding: 7px 10px;
  border-bottom: 1px solid #1f1f1f;
  vertical-align: middle;
}

.history-table tr:hover td { background: rgba(255,255,255,0.02); }

.history-table .draw-balls { flex-wrap: nowrap; }

/* Pagination */
.pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 12px;
  flex-wrap: wrap;
}

.page-btn {
  padding: 5px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.page-btn:hover { background: var(--red); border-color: var(--red); }
.page-btn.active { background: var(--red); border-color: var(--red); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Status bar */
.status-bar {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 8px 24px;
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--text-muted);
  position: sticky;
  bottom: 0;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

.status-ok { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-warn { background: var(--warning); }
.status-err { background: var(--red); }

/* Buttons */
.btn {
  padding: 7px 14px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--red);
  color: white;
}

.btn-primary:hover { background: var(--red-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-provider {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  padding: 5px 10px;
}
.btn-provider:hover { background: var(--bg2); border-color: var(--text-muted); }
.btn-provider:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-provider.active {
  border-color: var(--red);
  color: var(--red);
  background: rgba(212,43,48,0.12);
}
.btn-provider.rate-limited {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-secondary {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--border); }

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Loading states */
.loading-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-muted);
  gap: 10px;
}

/* Gap bar chart */
.gap-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gap-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gap-num { width: 26px; text-align: right; font-size: 0.8rem; color: var(--text-muted); }
.gap-bar-wrap { flex: 1; height: 18px; background: var(--bg3); border-radius: 3px; overflow: hidden; position: relative; }
.gap-fill { height: 100%; background: linear-gradient(90deg, #4a0000, var(--red)); border-radius: 3px; transition: width 0.5s; }
.gap-value { width: 30px; font-size: 0.75rem; color: var(--gold); text-align: right; }
.gap-ball-wrap { width: 30px; display: flex; justify-content: center; }

/* Summary cards row */
.summary-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.summary-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  text-align: center;
}

.summary-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold);
}

.summary-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Error states */
.error-msg {
  color: var(--red);
  font-size: 0.8rem;
  padding: 8px;
  background: rgba(212,43,48,0.1);
  border: 1px solid rgba(212,43,48,0.3);
  border-radius: 4px;
}

/* Language switcher */
.lang-switcher {
  display: flex;
  gap: 4px;
}
.lang-btn {
  padding: 3px 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.active { border-color: var(--red); color: var(--red); background: rgba(212,43,48,0.1); }

/* Responsive */
@media (max-width: 768px) {
  .header { padding: 12px 16px; }
  .header-title h1 { font-size: 1.2rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hot-cold-grid { grid-template-columns: 1fr; }
  .main-container { padding: 10px; }
  .ball { width: 30px; height: 30px; font-size: 0.75rem; }
  .ball-lg { width: 36px; height: 36px; }
  .history-table td, .history-table th { padding: 6px; }
  .history-header-actions { width: 100%; justify-content: flex-start; }
  .countdown-display { font-size: 1rem; }
}

@media (max-width: 480px) {
  .tabs-nav .tab-btn { padding: 7px 10px; font-size: 0.78rem; }
  .ball-grid { grid-template-columns: repeat(7, 1fr); gap: 3px; }
}

/* Pool info panel */
.pool-next-draw {
  margin-top: 12px;
  padding-top: 10px;
}
.pool-divider {
  border-top: 1px solid var(--border);
  margin-bottom: 10px;
}
.pool-static-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.78rem;
  flex-wrap: wrap;
}
.pool-info-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pool-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.75rem;
}
.pool-label {
  color: var(--text-muted);
  white-space: nowrap;
}
.pool-value {
  text-align: right;
  color: var(--text);
  font-weight: 500;
}

/* Year Filter */
.year-filter-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.year-filter-select {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.8rem;
  cursor: pointer;
  appearance: auto;
}
.year-filter-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Members nav link in header */
.members-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  background: rgba(31,111,235,0.12);
  border: 1px solid rgba(31,111,235,0.35);
  border-radius: 20px;
  color: #58a6ff;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.members-nav-link:hover {
  background: rgba(31,111,235,0.22);
  border-color: #58a6ff;
}

/* ─── Logo Six Ball ─────────────────────────────────────────────── */
.logo-six-ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15em;
  height: 1.15em;
  background: #D42B30;
  color: #fff;
  border-radius: 50%;
  font-family: 'Georgia', serif;
  font-weight: bold;
  font-size: 0.88em;
  vertical-align: middle;
  margin-right: 5px;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(212,43,48,0.4);
  line-height: 1;
}
/* Bigger variant for the login page */
.login-logo .logo-six-ball {
  font-size: 2.6rem;
  width: 1.2em;
  height: 1.2em;
}
