/* ============================================================
   Lottery AI Prediction - Dark Theme + Glassmorphism
   ============================================================ */

/* ============ CSS VARIABLES ============ */
:root {
  --bg-base: #0a0e1a;
  --bg-surface: rgba(15, 23, 42, 0.8);
  --bg-card: rgba(30, 41, 59, 0.6);
  --bg-card-hover: rgba(30, 41, 59, 0.8);
  --glass-border: rgba(148, 163, 184, 0.1);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-green: #10b981;
  --accent-orange: #f59e0b;
  --accent-red: #ef4444;
  --accent-pink: #ec4899;

  --gradient-primary: linear-gradient(135deg, #3b82f6, #8b5cf6);
  --gradient-success: linear-gradient(135deg, #10b981, #06b6d4);
  --gradient-warning: linear-gradient(135deg, #f59e0b, #ef4444);
  --gradient-mn: linear-gradient(135deg, #f59e0b, #ef4444);
  --gradient-mt: linear-gradient(135deg, #3b82f6, #06b6d4);
  --gradient-mb: linear-gradient(135deg, #8b5cf6, #ec4899);
}

/* ============ RESET & BASE ============ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated background gradients */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(
      ellipse at 20% 50%,
      rgba(59, 130, 246, 0.08) 0%,
      transparent 50%
    ),
    radial-gradient(
      ellipse at 80% 20%,
      rgba(139, 92, 246, 0.08) 0%,
      transparent 50%
    ),
    radial-gradient(
      ellipse at 50% 80%,
      rgba(16, 185, 129, 0.05) 0%,
      transparent 50%
    );
  z-index: 0;
  pointer-events: none;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

/* ============ HEADER ============ */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 1.5rem;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.header-left .logo {
  font-size: 1.5rem;
}
.header-left h1 {
  font-size: 1.25rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.header-right::-webkit-scrollbar { display: none; }
.header-date {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: right;
  white-space: nowrap;
}
.header-time {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-blue);
  white-space: nowrap;
}
.header-btn {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s;
  backdrop-filter: blur(10px);
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
.header-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
.header-btn.danger {
  color: var(--accent-red);
}
.header-btn.danger:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* V13: Admin Nav Responsive Breakpoints */
@media (max-width: 1200px) {
  .header-right { gap: 0.25rem; }
  .header-btn { padding: 0.3rem 0.45rem; font-size: 0.7rem; }
}
@media (max-width: 900px) {
  .header-btn { padding: 0.25rem 0.35rem; font-size: 0.65rem; border-radius: 6px; }
  .header-date { font-size: 0.72rem; }
  .header-time { font-size: 0.85rem; }
  .header-left h1 { font-size: 1rem; }
}
@media (max-width: 768px) {
  .header {
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
  }
  .header-left { justify-content: center; }
  .header-right {
    width: 100%;
    justify-content: center;
    padding-bottom: 0.25rem;
  }
}

/* ============ DATA WARNING BANNER ============ */
.data-warning-banner {
  padding: 0.5rem 1rem;
  margin: 0 1rem 0.75rem;
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.5);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-primary);
}
.data-warning-banner a {
  color: var(--accent-blue);
  text-decoration: underline;
}

/* ============ MODEL BAR ============ */
.model-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(20px);
}
.model-bar label {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.model-select {
  flex: 1;
  max-width: 320px;
  padding: 0.5rem 0.75rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
}
.model-select option {
  background: #1e293b;
}
.model-badge {
  font-size: 0.7rem;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-weight: 600;
}
.model-badge.top {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
}
.date-picker-inline {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.date-input {
  padding: 0.5rem 0.75rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  color-scheme: dark;
}
.btn-today {
  padding: 0.5rem 0.75rem;
  background: var(--gradient-primary);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.btn-today:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* Backtest indicator */
.backtest-indicator {
  display: none;
  padding: 0.4rem 0.75rem;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 8px;
  font-size: 0.75rem;
  color: var(--accent-orange);
  font-weight: 500;
}
.backtest-indicator.show {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* ============ REGION TABS ============ */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
  user-select: none;
}
.tab::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  transition: all 0.3s;
}
.tab:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* Tab active states by region color */
.tab.active-mn {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--accent-orange);
}
.tab.active-mn::before {
  background: var(--gradient-mn);
}

.tab.active-mt {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: var(--accent-blue);
}
.tab.active-mt::before {
  background: var(--gradient-mt);
}

.tab.active-mb {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.3);
  color: var(--accent-purple);
}
.tab.active-mb::before {
  background: var(--gradient-mb);
}

.tab .tab-icon {
  font-size: 1.1rem;
}
.tab .tab-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
}
.tab .tab-wr {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
}
.tab .tab-wr.good {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
}
.tab .tab-wr.ok {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-orange);
}

/* ============ TAB CONTENT ============ */
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}
.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============ STATS BAR ============ */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.stat-item {
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  text-align: center;
  backdrop-filter: blur(20px);
}
.stat-item .stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}
.stat-item .stat-value {
  font-size: 1.3rem;
  font-weight: 800;
}
.stat-item .stat-value.green {
  color: var(--accent-green);
}
.stat-item .stat-value.blue {
  color: var(--accent-blue);
}
.stat-item .stat-value.orange {
  color: var(--accent-orange);
}
.stat-item .stat-value.purple {
  color: var(--accent-purple);
}
.stat-item .stat-detail {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ============ CONTENT GRID (2 cols) ============ */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

/* ============ CARDS ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  overflow: hidden;
  backdrop-filter: blur(20px);
  transition: all 0.3s;
}
.card:hover {
  border-color: rgba(148, 163, 184, 0.2);
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--glass-border);
}
.card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.card-body {
  padding: 1.25rem;
}

/* ============ PREDICTION NUMBERS ============ */
.prediction-numbers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.6rem;
}
.pred-num {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.4rem 0.7rem;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 10px;
  min-width: 48px;
  transition: all 0.2s;
}
.pred-num:hover {
  transform: translateY(-2px);
  background: rgba(59, 130, 246, 0.15);
}
.pred-num .number {
  font-size: 1.2rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.pred-num .conf {
  font-size: 0.6rem;
  color: var(--text-muted);
  font-weight: 500;
}
.pred-num.hit {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
}
.pred-num.hit .number {
  background: var(--gradient-success);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Prediction metadata grid */
.pred-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}
.pred-meta-item {
  padding: 0.35rem 0.6rem;
  background: rgba(15, 23, 42, 0.4);
  border-radius: 8px;
}
.pred-meta-item .label {
  font-size: 0.7rem;
  color: var(--text-muted);
}
.pred-meta-item .value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Verdict area */
.prediction-verdict {
  margin-top: 0.6rem;
  padding: 0.5rem 0.75rem;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 10px;
  text-align: center;
}
.prediction-verdict.skip {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.2);
}
.prediction-verdict.lose {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
}
.verdict-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.verdict-action {
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.verdict-reason {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}
.verdict-confidence {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ============ RESULT CARD ============ */
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.05);
}
.result-row:last-child {
  border-bottom: none;
}
.result-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.result-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}
.result-value.highlight {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 1.1rem;
}

/* ============ BUTTONS ============ */
.btn-update {
  width: 100%;
  padding: 0.75rem;
  background: var(--gradient-primary);
  border: none;
  border-radius: 10px;
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0.75rem;
  font-family: inherit;
}
.btn-update:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
}
.btn-update:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn-update.mn {
  background: var(--gradient-mn);
}
.btn-update.mn:hover {
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
}
.btn-update.mt {
  background: var(--gradient-mt);
}
.btn-update.mt:hover {
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
}
.btn-update.mb {
  background: var(--gradient-mb);
}
.btn-update.mb:hover {
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
}

.btn-predict {
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: 10px;
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0.5rem;
  font-family: inherit;
}
.btn-predict.mn {
  background: var(--gradient-mn);
}
.btn-predict.mt {
  background: var(--gradient-mt);
}
.btn-predict.mb {
  background: var(--gradient-mb);
}
.btn-predict:hover {
  transform: translateY(-1px);
}
.btn-predict:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ============ STATUS BADGES ============ */
.status-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  display: inline-block;
}
.status-badge.pending {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-orange);
}
.status-badge.win {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
}
.status-badge.lose {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
}
.status-badge.partial {
  background: rgba(234, 179, 8, 0.15);
  color: #eab308;
}
.status-badge.skip {
  background: rgba(100, 116, 139, 0.15);
  color: var(--text-muted);
}

/* ============ VERDICT BADGES ============ */
.verdict-chot {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
}
.verdict-skip {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-orange);
}

/* ============ EMPTY STATE ============ */
.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}
.empty-state .icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}
.empty-state p {
  font-size: 0.85rem;
}

/* ============ HISTORY TABLE ============ */
.history-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  overflow: hidden;
  backdrop-filter: blur(20px);
}
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--glass-border);
  flex-wrap: wrap;
  gap: 0.5rem;
}
.history-header h3 {
  font-size: 0.9rem;
  font-weight: 600;
}
.history-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.filter-select {
  padding: 0.4rem 0.6rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-family: inherit;
}
.filter-select option {
  background: #1e293b;
}

.history-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  border-bottom: 1px solid var(--glass-border);
}

table {
  width: 100%;
  border-collapse: collapse;
}
th {
  padding: 0.7rem 1rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
}
td {
  padding: 0.65rem 1rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(148, 163, 184, 0.05);
}
tr:hover td {
  background: rgba(59, 130, 246, 0.03);
}
tr.win-row td {
  background: rgba(16, 185, 129, 0.03);
}
tr.lose-row td {
  background: rgba(239, 68, 68, 0.03);
}
tr.partial-row td {
  background: rgba(234, 179, 8, 0.03);
}

.td-numbers {
  font-weight: 700;
  color: var(--text-primary);
}
.td-win {
  color: var(--accent-green);
  font-weight: 600;
}
.td-lose {
  color: var(--accent-red);
}

.region-tag {
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  display: inline-block;
}
.region-tag.mn {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-orange);
}
.region-tag.mt {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
}
.region-tag.mb {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-purple);
}

.btn-delete-row {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s;
}
.btn-delete-row:hover {
  background: rgba(239, 68, 68, 0.15);
}
.btn-delete-batch {
  padding: 0.4rem 0.75rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 6px;
  color: var(--accent-red);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.btn-delete-batch:hover {
  background: rgba(239, 68, 68, 0.2);
}
.btn-delete-batch:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Model badge in table — type-specific colors */
.model-tag {
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.68rem;
  font-weight: 600;
  display: inline-block;
  white-space: nowrap;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
/* AI models — vibrant blue-purple */
.model-tag.model-ai {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
/* ML strong — teal-green */
.model-tag.model-ml {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  color: #0a2e1a;
}
/* ML weak (WR 40-50%) — orange warning with ⚠️ */
.model-tag.model-weak {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: white;
  border: 2px solid #fb923c;
  position: relative;
  padding: 2px 6px;
}
/* ML very weak (WR <40%) — red danger with ⛔ + pulsing border */
.model-tag.model-very-weak {
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  color: white;
  border: 2px solid #fbbf24;
  position: relative;
  padding: 2px 6px;
  animation: weakPulse 2s ease-in-out infinite;
}
@keyframes weakPulse {
  0%, 100% { border-color: #fbbf24; box-shadow: 0 0 4px rgba(251,191,36,0.3); }
  50% { border-color: #ef4444; box-shadow: 0 0 8px rgba(239,68,68,0.5); }
}
/* Warning icon inside badge — larger and visible */
.warn-icon {
  font-size: 0.75rem;
  margin-right: 1px;
}
/* WR percentage text inside badge */
.wr-pct {
  font-size: 0.6rem;
  opacity: 0.9;
  margin-left: 2px;
  font-weight: 400;
}
/* Combo top — gold */
.model-tag.model-combo-top {
  background: linear-gradient(135deg, #f7971e 0%, #ffd200 100%);
  color: #3a2800;
}
/* Combo no-token — warm orange */
.model-tag.model-combo {
  background: linear-gradient(135deg, #e65c00 0%, #f9d423 100%);
  color: #3a1800;
}
/* Ensemble — cyan */
.model-tag.model-ensemble {
  background: linear-gradient(135deg, #00b4db 0%, #0083b0 100%);
}

/* ============ LOADING OVERLAY ============ */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 14, 26, 0.8);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
}
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(59, 130, 246, 0.2);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.loading-text {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ============ TOAST NOTIFICATIONS ============ */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  backdrop-filter: blur(20px);
  color: var(--text-primary);
  font-size: 0.85rem;
  animation: slideIn 0.3s ease;
  max-width: 400px;
  box-shadow: var(--glass-shadow);
}
.toast.success {
  border-left: 3px solid var(--accent-green);
}
.toast.error {
  border-left: 3px solid var(--accent-red);
}
.toast.warning {
  border-left: 3px solid var(--accent-orange);
}
.toast-icon {
  font-size: 1rem;
}
.toast-message {
  flex: 1;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.2);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.3);
}

/* ============ CHECKBOX ============ */
input[type="checkbox"] {
  accent-color: var(--accent-blue);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* ============ TABLE SCROLL WRAPPER ============ */
.table-scroll-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-scroll-wrapper table {
  min-width: 700px;
}

/* ============ HISTORY DATE FILTER ============ */
.filter-date {
  width: 130px;
  font-size: 0.75rem;
}
.filter-date-arrow {
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0 2px;
  flex-shrink: 0;
}

/* ============ QUALITY PANEL BASE ============ */
.quality-panel {
  margin: 0 0 12px;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(124,58,237,0.12), rgba(79,70,229,0.08));
  border: 1px solid rgba(124,58,237,0.25);
  border-radius: 14px;
  display: none;
}
.quality-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 8px;
}
.quality-panel-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: #a78bfa;
}
.quality-panel-subtitle {
  font-size: 0.6rem;
  color: #64748b;
}
.quality-panel-close {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  min-width: 32px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.quality-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.quality-region-card {
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.06);
  min-width: 0;
}

/* ============ RESPONSIVE — TABLET (≤768px) ============ */
@media (max-width: 768px) {
  .app {
    padding: 0 0.75rem 1.5rem;
  }
  .content-grid {
    grid-template-columns: 1fr;
  }
  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  .stat-item {
    padding: 0.5rem 0.6rem;
  }
  .stat-item .stat-label {
    font-size: 0.6rem;
  }
  .stat-item .stat-value {
    font-size: 1rem;
  }
  .model-bar {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
  }
  .model-select {
    max-width: 100%;
    flex: 1 1 auto;
  }
  .date-picker-inline {
    margin-left: 0;
    width: 100%;
  }
  .header {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
  }
  .header-right {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
  }
  .header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.55rem 0.4rem;
    font-size: 0.75rem;
    min-height: 44px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
  }
  /* Tabs: horizontal scroll, not vertical stack */
  .tabs {
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0.4rem;
    padding-bottom: 0.25rem;
  }
  .tabs::-webkit-scrollbar {
    display: none;
  }
  .tab {
    min-width: 0;
    flex: 1 0 auto;
    padding: 0.65rem 0.6rem;
    font-size: 0.8rem;
    gap: 0.3rem;
  }
  .tab .tab-time {
    font-size: 0.6rem;
  }
  .tab .tab-wr {
    font-size: 0.6rem;
    padding: 0.1rem 0.35rem;
  }
  /* Quality panel */
  .quality-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .quality-panel {
    margin: 0 0 10px;
    padding: 10px 12px;
  }
  .quality-panel-subtitle {
    display: none;
  }
  .history-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .history-filters {
    width: 100%;
  }
  th {
    padding: 0.5rem 0.6rem;
    font-size: 0.6rem;
  }
  td {
    padding: 0.45rem 0.6rem;
    font-size: 0.72rem;
  }
  .card-body {
    padding: 0.75rem;
  }
  .card-header {
    padding: 0.6rem 0.75rem;
  }
  .pred-num .number {
    font-size: 1rem;
  }
  .verdict-title {
    font-size: 0.85rem;
  }
  .verdict-action {
    font-size: 0.7rem;
  }
}

/* ============ RESPONSIVE — LARGE PHONE (≤600px) ============ */
@media (max-width: 600px) {
  .header-left h1 {
    font-size: 1.1rem;
  }
  .header-btn {
    font-size: 0.7rem;
    padding: 0.5rem 0.3rem;
    border-radius: 8px;
  }
  .model-bar label {
    white-space: normal;
    font-size: 0.75rem;
  }
  .model-select {
    font-size: 0.8rem;
  }
  .model-badge {
    font-size: 0.6rem;
    padding: 0.2rem 0.5rem;
  }
  .tab {
    padding: 0.55rem 0.5rem;
    font-size: 0.75rem;
  }
  .tab .tab-icon {
    font-size: 0.95rem;
  }
  .card-title {
    font-size: 0.78rem;
  }
  .pred-num {
    min-width: 42px;
    padding: 0.3rem 0.5rem;
  }
  .pred-meta {
    gap: 0.25rem;
  }
  .pred-meta-item .label {
    font-size: 0.6rem;
  }
  .pred-meta-item .value {
    font-size: 0.78rem;
  }
  .data-warning-banner {
    margin: 0 0 0.5rem;
    font-size: 0.78rem;
    padding: 0.4rem 0.75rem;
  }
  .history-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
  }
  .filter-select {
    width: 100% !important;
    font-size: 0.7rem;
  }
  .filter-date {
    width: 100% !important;
  }
  .filter-date-arrow {
    display: none;
  }
  .history-actions {
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
  }
  .btn-delete-batch {
    font-size: 0.68rem;
    padding: 0.35rem 0.5rem;
  }
}

/* ============ RESPONSIVE — SMALL PHONE (≤480px) ============ */
@media (max-width: 480px) {
  .app {
    padding: 0 0.5rem 1rem;
  }
  .header {
    padding: 0.6rem 0;
    margin-bottom: 0.75rem;
  }
  .header-left .logo {
    font-size: 1.2rem;
  }
  .header-left h1 {
    font-size: 1rem;
  }
  .header-right {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.3rem;
  }
  .header-btn {
    font-size: 0.65rem;
    padding: 0.45rem 0.25rem;
    min-height: 42px;
    border-radius: 8px;
    line-height: 1.2;
    white-space: normal;
    word-break: break-word;
  }
  .model-bar {
    padding: 0.5rem 0.6rem;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
    border-radius: 10px;
  }
  .model-bar label {
    font-size: 0.7rem;
  }
  .model-select {
    font-size: 0.75rem;
    padding: 0.4rem 0.5rem;
  }
  .date-input {
    font-size: 0.75rem;
    padding: 0.4rem 0.5rem;
  }
  .btn-today {
    font-size: 0.7rem;
    padding: 0.4rem 0.6rem;
  }
  .tabs {
    margin-bottom: 0.75rem;
  }
  .tab {
    padding: 0.5rem 0.45rem;
    font-size: 0.72rem;
    border-radius: 10px;
    gap: 0.2rem;
  }
  .tab .tab-icon {
    font-size: 0.85rem;
  }
  .tab .tab-wr {
    font-size: 0.55rem;
    padding: 0.08rem 0.3rem;
  }
  .stats-bar {
    gap: 0.4rem;
    margin-bottom: 0.75rem;
  }
  .stat-item {
    padding: 0.4rem 0.5rem;
    border-radius: 10px;
  }
  .stat-item .stat-label {
    font-size: 0.55rem;
    letter-spacing: 0.3px;
  }
  .stat-item .stat-value {
    font-size: 0.9rem;
  }
  .stat-item .stat-detail {
    font-size: 0.6rem;
  }
  .content-grid {
    gap: 0.75rem;
    margin-bottom: 0.75rem;
  }
  .card {
    border-radius: 12px;
  }
  .card-header {
    padding: 0.5rem 0.6rem;
  }
  .card-title {
    font-size: 0.72rem;
  }
  .card-body {
    padding: 0.6rem;
  }
  .pred-num {
    min-width: 38px;
    padding: 0.25rem 0.4rem;
    border-radius: 8px;
  }
  .pred-num .number {
    font-size: 0.9rem;
  }
  .pred-num .conf {
    font-size: 0.5rem;
  }
  .prediction-verdict {
    padding: 0.4rem 0.6rem;
  }
  .verdict-title {
    font-size: 0.8rem;
  }
  .verdict-action {
    font-size: 0.65rem;
  }
  .verdict-reason {
    font-size: 0.65rem;
  }
  .quality-panel {
    padding: 8px 10px;
    border-radius: 10px;
  }
  .quality-panel-title {
    font-size: 0.8rem;
  }
  .quality-region-card {
    padding: 10px;
    border-radius: 10px;
  }
  /* Table */
  th {
    padding: 0.4rem 0.4rem;
    font-size: 0.55rem;
  }
  td {
    padding: 0.35rem 0.4rem;
    font-size: 0.65rem;
  }
  .region-tag {
    font-size: 0.6rem;
    padding: 0.1rem 0.3rem;
  }
  .model-tag {
    font-size: 0.6rem;
    padding: 1px 6px;
  }
  .status-badge {
    font-size: 0.6rem;
    padding: 0.15rem 0.4rem;
  }
  .btn-delete-row {
    font-size: 0.65rem;
    padding: 0.2rem 0.35rem;
  }
  .toast {
    max-width: 300px;
    font-size: 0.78rem;
    padding: 0.5rem 0.75rem;
  }
  .toast-container {
    right: 0.5rem;
    top: 0.5rem;
    left: 0.5rem;
  }
  .empty-state .icon {
    font-size: 2rem;
  }
  .empty-state p {
    font-size: 0.78rem;
  }
  .history-header h3 {
    font-size: 0.8rem;
  }
  .btn-update, .btn-predict {
    font-size: 0.78rem;
    padding: 0.6rem;
  }
  .backtest-indicator {
    font-size: 0.68rem;
    padding: 0.3rem 0.6rem;
  }
}

/* ============ V11: OWNER-FACING CLEAN PREDICTION CARDS ============ */

/* Card base */
.v11-card {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 12px;
}

.v11-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.v11-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.v11-icon-lo2 { background: linear-gradient(135deg, rgba(124,58,237,0.25), rgba(59,130,246,0.2)); }
.v11-icon-lo3 { background: linear-gradient(135deg, rgba(245,158,11,0.25), rgba(239,68,68,0.15)); }
.v11-icon-xien { background: linear-gradient(135deg, rgba(16,185,129,0.2), rgba(59,130,246,0.15)); }

.v11-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.v11-card-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

/* Big Number */
.v11-big-number {
  text-align: center;
  font-size: 56px;
  font-weight: 800;
  color: var(--text-primary);
  padding: 12px 0;
  letter-spacing: 4px;
}

/* Confidence badge */
.v11-confidence {
  text-align: center;
  margin-top: 4px;
}
.v11-conf-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.v11-conf-high {
  background: rgba(245,158,11,0.15);
  color: #fbbf24;
  border: 1px solid rgba(245,158,11,0.3);
}
.v11-conf-mid {
  background: rgba(16,185,129,0.12);
  color: #34d399;
  border: 1px solid rgba(16,185,129,0.25);
}
.v11-conf-low {
  background: rgba(148,163,184,0.1);
  color: #94a3b8;
  border: 1px solid rgba(148,163,184,0.2);
}

.v11-pair-info {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* V12: Hero 1-Số Card */
.v12-card-hero {
  background: linear-gradient(135deg, rgba(124,58,237,0.12), rgba(59,130,246,0.08));
  border: 1px solid rgba(124,58,237,0.2);
}
.v12-icon-1so {
  background: linear-gradient(135deg, rgba(245,158,11,0.3), rgba(234,179,8,0.2));
}
.v12-hero-number {
  text-align: center;
  font-size: 72px;
  font-weight: 800;
  color: var(--text-primary);
  padding: 16px 0 8px;
  letter-spacing: 6px;
  text-shadow: 0 0 30px rgba(124,58,237,0.2);
}

/* V12: 2-Số Pair Display */
.v12-pair-display {
  text-align: center;
  padding: 14px 0;
}
.v12-pair-num {
  display: inline-block;
  font-size: 42px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 2px;
}
.v12-pair-sep {
  display: inline-block;
  font-size: 24px;
  font-weight: 400;
  color: var(--text-muted);
  margin: 0 12px;
  vertical-align: middle;
}

/* V12: 3-Số (3 Càng) */
.v12-three-digit {
  text-align: center;
  font-size: 44px;
  font-weight: 800;
  color: #f59e0b;
  padding: 12px 0;
  letter-spacing: 4px;
}
.v12-three-pending {
  opacity: 0.4;
  color: var(--text-muted);
}

/* V12: Xiên separate card (centered) */
.v12-icon-xien2 { background: linear-gradient(135deg, rgba(16,185,129,0.2), rgba(59,130,246,0.15)); }
.v12-xien-center {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 2px;
  padding: 12px 0;
}

/* Xiên Layout (legacy, kept for fallback) */
.v11-xien-row {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}
.v11-xien-box {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}
.v11-xien-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.v11-xien-numbers {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 2px;
}
.v11-xien-sep {
  color: var(--text-muted);
  margin: 0 4px;
  font-weight: 400;
}
.v11-xien-na {
  color: var(--text-muted);
  opacity: 0.5;
}

/* Result banners */
.v11-banner {
  text-align: center;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}
.v11-banner-win {
  background: linear-gradient(135deg, rgba(16,185,129,0.15), rgba(5,150,105,0.1));
  color: #34d399;
  border: 1px solid rgba(16,185,129,0.3);
}
.v11-banner-lose {
  background: linear-gradient(135deg, rgba(239,68,68,0.12), rgba(185,28,28,0.08));
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.3);
}
.v11-banner-partial {
  background: linear-gradient(135deg, rgba(234,179,8,0.12), rgba(245,158,11,0.08));
  color: #fbbf24;
  border: 1px solid rgba(234,179,8,0.3);
}

/* Status bar */
.v11-status-bar {
  text-align: center;
  padding: 8px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}
.v11-status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  margin-right: 4px;
  vertical-align: middle;
}

/* ============ V12: RESPONSIVE ============ */
@media (max-width: 600px) {
  .v12-hero-number { font-size: 56px; }
  .v12-pair-num { font-size: 34px; }
  .v12-three-digit { font-size: 36px; }
  .v12-xien-center { font-size: 24px; }
  .v11-xien-numbers { font-size: 20px; }
  .v11-card { padding: 16px; }
  .v11-banner { font-size: 12px; }
}
@media (max-width: 480px) {
  .v12-hero-number { font-size: 48px; letter-spacing: 3px; }
  .v12-pair-num { font-size: 28px; }
  .v12-pair-sep { font-size: 18px; margin: 0 8px; }
  .v12-three-digit { font-size: 30px; }
  .v12-xien-center { font-size: 20px; }
  .v11-xien-numbers { font-size: 18px; }
  .v11-xien-row { gap: 8px; }
  .v11-xien-box { padding: 10px; }
  .v11-xien-label { font-size: 10px; }
  .v11-card { padding: 14px; margin-bottom: 10px; }
  .v11-card-icon { width: 32px; height: 32px; font-size: 16px; }
  .v11-card-title { font-size: 14px; }
}

/* V12: Tham khảo badge */
.v12-thamkhao-badge {
  display: inline-block;
  margin: 8px auto 0;
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.25);
  text-align: center;
  width: fit-content;
}


/* LIGHT MODE OVERRIDES */
body {
    background-color: #f4f7f6 !important;
    color: #333 !important;
}
.card, .prediction-card, .dashboard-card {
    background-color: #ffffff !important;
    color: #2c3e50 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
    border: 1px solid #e0e0e0 !important;
}
.navbar {
    background-color: #ffffff !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
}
.navbar-brand, .nav-link {
    color: #333 !important;
}
table {
    color: #333 !important;
}
.text-light {
    color: #333 !important;
}
.text-white {
    color: #333 !important;
}
.table-dark {
    background-color: #fff !important;
    color: #333 !important;
}
h1, h2, h3, h4, h5, h6 {
    color: #2c3e50 !important;
}
input, select, textarea {
    background-color: #fff !important;
    color: #333 !important;
    border: 1px solid #ccc !important;
}
.badge {
    color: #fff !important;
}
/* Ensure specific badges keep contrast */
.bg-info { background-color: #17a2b8 !important; }
.bg-primary { background-color: #007bff !important; }
.bg-success { background-color: #28a745 !important; }
.bg-danger { background-color: #dc3545 !important; }
