/* QuantFox Dashboard Hot-Patch — Realdark visual upgrade
   Trigger: applies whenever the SPA's realdark theme is on (sidebar has
   .ant-layout-sider-realdark) AND the body has the .qf-realdark-on class
   that quantfox-dashboard.js toggles after detection.

   Source design tokens: /css/qf-tokens.css
   Targets observed via probe_dashboard_dom.py against the live SPA. */

:root {
  --qf-card-dark: rgba(15, 23, 42, 0.62);
  --qf-card-line: rgba(56, 189, 248, 0.16);
  --qf-card-line-strong: rgba(56, 189, 248, 0.42);
  --qf-bg-app-dark: #020617;
  --qf-sidebar-bg: #0d1421;
  --qf-grad-primary: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
  --qf-grad-glow: 0 0 24px rgba(56, 189, 248, 0.18), 0 0 40px rgba(99, 102, 241, 0.10);
}

/* ============================================================
   GLOBAL SHELL — only when realdark theme is active
   ============================================================ */
body.qf-realdark-on,
body.qf-realdark-on #app,
body.qf-realdark-on .ant-layout {
  background-color: var(--qf-bg-app-dark) !important;
  color: #f8fafc;
}

/* ============================================================
   SIDEBAR — unify to #0d1421, refined active state with sky border + glow
   ============================================================ */
body.qf-realdark-on .ant-layout-sider-realdark,
body.qf-realdark-on .ant-pro-sider-menu-sider {
  background: var(--qf-sidebar-bg) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.04) !important;
}
body.qf-realdark-on .ant-layout-sider-realdark .ant-menu,
body.qf-realdark-on .ant-layout-sider-realdark .ant-menu-dark,
body.qf-realdark-on .ant-layout-sider-realdark .ant-menu-sub {
  background: transparent !important;
  color: #cbd5e1 !important;
}
body.qf-realdark-on .ant-layout-sider-realdark .ant-menu-item,
body.qf-realdark-on .ant-layout-sider-realdark .ant-menu-submenu-title {
  color: #cbd5e1 !important;
  border-radius: 8px;
  margin: 4px 8px !important;
  width: calc(100% - 16px) !important;
  transition: background .15s ease, box-shadow .15s ease, color .15s ease, border-color .15s ease;
}
body.qf-realdark-on .ant-layout-sider-realdark .ant-menu-item:hover,
body.qf-realdark-on .ant-layout-sider-realdark .ant-menu-submenu-title:hover {
  background: rgba(56, 189, 248, 0.08) !important;
  color: #e0f2fe !important;
}
/* Active state — sky border + inner glow (overrides the broken mint bg
   that the SPA currently sets to rgb(230,255,251)) */
body.qf-realdark-on .ant-layout-sider-realdark .ant-menu-item-selected,
body.qf-realdark-on .ant-layout-sider-realdark .ant-menu-submenu-selected > .ant-menu-submenu-title {
  background: rgba(56, 189, 248, 0.14) !important;
  color: #38bdf8 !important;
  border-left: 2px solid #38bdf8 !important;
  box-shadow:
    inset 0 0 0 1px rgba(56, 189, 248, 0.30),
    inset 0 0 18px rgba(56, 189, 248, 0.18) !important;
}
body.qf-realdark-on .ant-layout-sider-realdark .ant-menu-item-selected a,
body.qf-realdark-on .ant-layout-sider-realdark .ant-menu-item-selected .anticon {
  color: #38bdf8 !important;
}

/* ============================================================
   HEADER — match sidebar tone
   ============================================================ */
body.qf-realdark-on .ant-layout-header {
  background: var(--qf-sidebar-bg) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

/* ============================================================
   CARDS — glass treatment for ant-card AND project's custom *-card classes
   ============================================================ */
body.qf-realdark-on .ant-card,
body.qf-realdark-on .workspace-card,
body.qf-realdark-on .profile-card,
body.qf-realdark-on .credits-card,
body.qf-realdark-on .referral-card,
body.qf-realdark-on .edit-card,
body.qf-realdark-on .type-card,
body.qf-realdark-on .stat-card,
body.qf-realdark-on .action-card {
  background: var(--qf-card-dark) !important;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--qf-card-line) !important;
  border-radius: 16px !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.30);
  color: #e2e8f0;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
body.qf-realdark-on .ant-card:hover,
body.qf-realdark-on .workspace-card:hover,
body.qf-realdark-on .type-card:hover,
body.qf-realdark-on .stat-card:hover {
  border-color: var(--qf-card-line-strong) !important;
  box-shadow: 0 14px 36px rgba(2, 132, 199, 0.30), var(--qf-grad-glow);
}
body.qf-realdark-on .ant-card-head {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
  color: #e2e8f0 !important;
  background: transparent !important;
}
body.qf-realdark-on .ant-card-head-title {
  font-weight: 600 !important;
  letter-spacing: 0.3px;
  color: #f1f5f9 !important;
}
body.qf-realdark-on .ant-card-body {
  background: transparent !important;
}

/* Highlight a single primary card when JS tags it (e.g. first stat card
   on a future dedicated dashboard route) */
body.qf-realdark-on .qf-primary-card {
  background:
    linear-gradient(135deg, rgba(14, 165, 233, 0.14) 0%, rgba(99, 102, 241, 0.14) 100%) !important;
  border: 1px solid rgba(56, 189, 248, 0.45) !important;
  box-shadow:
    0 0 40px rgba(56, 189, 248, 0.22),
    0 14px 36px rgba(2, 132, 199, 0.25) !important;
}
body.qf-realdark-on .qf-primary-card .ant-card-head-title,
body.qf-realdark-on .qf-primary-card .ant-statistic-title {
  background: linear-gradient(135deg, #ffffff, #7dd3fc) !important;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ============================================================
   STATISTIC + TABLE TEXT — keep light on dark glass
   ============================================================ */
body.qf-realdark-on .ant-statistic-title,
body.qf-realdark-on .ant-statistic-content,
body.qf-realdark-on .ant-statistic-content-value {
  color: #f8fafc !important;
}
body.qf-realdark-on .ant-table,
body.qf-realdark-on .ant-table-thead > tr > th,
body.qf-realdark-on .ant-table-tbody > tr > td {
  background: transparent !important;
  color: #e2e8f0 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}
body.qf-realdark-on .ant-table-tbody > tr:hover > td {
  background: rgba(56, 189, 248, 0.08) !important;
}

/* ============================================================
   AI MORNING BRIEF BANNER — injected by JS at top of landing content
   ============================================================ */
.qf-ai-brief-banner {
  background:
    radial-gradient(circle at 12% 20%, rgba(56,189,248,0.18) 0%, transparent 55%),
    radial-gradient(circle at 88% 80%, rgba(129,140,248,0.18) 0%, transparent 55%),
    linear-gradient(135deg, rgba(15,23,42,0.85), rgba(2,6,23,0.92));
  border: 1px solid rgba(129, 140, 248, 0.30);
  border-radius: 16px;
  padding: 20px 28px;
  margin: 0 0 20px 0;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 24px rgba(129, 140, 248, 0.18);
  position: relative;
  overflow: hidden;
  color: #f8fafc;
  animation: qfBriefSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.qf-ai-brief-banner::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #38bdf8 20%, #818cf8 80%, transparent);
}
.qf-ai-brief-content { min-width: 0; }
.qf-ai-brief-eyebrow {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 1.4px;
  color: #fb923c;
  margin: 0 0 6px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
}
.qf-ai-brief-eyebrow::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.7);
}
.qf-ai-brief-title {
  font-size: 20px;
  font-weight: 800;
  margin: 0 0 8px 0;
  background: linear-gradient(135deg, #ffffff 0%, #7dd3fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.25;
}
.qf-ai-brief-body {
  color: #cbd5e1;
  margin: 0 0 14px 0;
  font-size: 14px;
  line-height: 1.6;
  max-width: 760px;
}
.qf-ai-brief-body .qf-hl {
  background: rgba(56, 189, 248, 0.16);
  border-radius: 4px;
  padding: 1px 6px;
  color: #e0f2fe;
  font-weight: 600;
}
.qf-ai-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.qf-ai-chip {
  background: rgba(56, 189, 248, 0.10);
  border: 1px solid rgba(56, 189, 248, 0.28);
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #7dd3fc;
}
.qf-ai-chip.long  { color: #4ade80; border-color: rgba(74, 222, 128, 0.30); background: rgba(74, 222, 128, 0.10); }
.qf-ai-chip.short { color: #f87171; border-color: rgba(248, 113, 113, 0.30); background: rgba(248, 113, 113, 0.10); }
.qf-ai-brief-meta {
  text-align: right;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  color: #64748b;
  letter-spacing: 0.4px;
  white-space: nowrap;
}
.qf-ai-brief-meta .agents {
  color: #818cf8;
  font-weight: 600;
}
@keyframes qfBriefSlideIn {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .qf-ai-brief-banner {
    grid-template-columns: 1fr;
    padding: 16px 18px;
  }
  .qf-ai-brief-meta { text-align: left; }
}
