@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500&display=swap');

body { font-family: 'Inter', system-ui, sans-serif; }
.font-mono { font-family: 'JetBrains Mono', monospace; }

.ambient-bg {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 60% 40% at 50% -10%, rgba(16, 185, 129, 0.10), transparent 70%),
    radial-gradient(ellipse 40% 30% at 100% 20%, rgba(6, 182, 212, 0.08), transparent 70%),
    radial-gradient(ellipse 30% 25% at 0% 60%, rgba(99, 102, 241, 0.06), transparent 70%);
}

.text-gradient {
  background: linear-gradient(135deg, #34d399 0%, #22d3ee 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Markdown rendering */
#report h1 { font-size: 1.875rem; font-weight: 800; margin: 2rem 0 1rem; color: #f1f5f9; border-bottom: 1px solid #334155; padding-bottom: 0.5rem; }
#report h2 { font-size: 1.5rem; font-weight: 700; margin: 2.5rem 0 1rem; color: #e2e8f0; padding-top: 1rem; border-top: 1px solid #1e293b; }
#report h3 { font-size: 1.125rem; font-weight: 700; margin: 1.5rem 0 0.5rem; color: #cbd5e1; }
#report p, #report li { color: #cbd5e1; line-height: 1.7; }
#report ul { list-style: disc; padding-left: 1.5rem; margin: 0.75rem 0; }
#report ol { list-style: decimal; padding-left: 1.5rem; margin: 0.75rem 0; }
#report strong { color: #f1f5f9; font-weight: 600; }
#report code { background: #1e293b; color: #a7f3d0; padding: 0.125rem 0.375rem; border-radius: 0.25rem; font-size: 0.875em; }
#report pre { background: #0f172a; border: 1px solid #1e293b; padding: 1rem; border-radius: 0.5rem; overflow-x: auto; margin: 1rem 0; }
#report pre code { background: transparent; padding: 0; color: #e2e8f0; font-size: 0.8125rem; }
#report table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.875rem; }
#report th { background: #1e293b; color: #e2e8f0; text-align: left; padding: 0.5rem 0.75rem; border: 1px solid #334155; font-weight: 600; }
#report td { padding: 0.5rem 0.75rem; border: 1px solid #1e293b; color: #cbd5e1; vertical-align: top; }
#report blockquote { border-left: 3px solid #475569; padding-left: 1rem; color: #94a3b8; margin: 1rem 0; font-style: italic; }
#report hr { border: 0; border-top: 1px solid #1e293b; margin: 2rem 0; }

.pulse-dot { animation: pulseDot 1.4s ease-in-out infinite; }
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.risk-bar-fill { transition: width 0.6s ease, background 0.4s ease; }

#submit-btn:hover:not(:disabled) {
  box-shadow: 0 8px 32px -8px rgba(16, 185, 129, 0.5);
}

.preset-chip { transition: all 0.15s ease; }
.preset-chip:hover { border-color: #10b981; color: #34d399; }

/* Toggle for advanced fields */
.toggle-advanced {
  background: transparent;
  color: #94a3b8;
  font-size: 0.8125rem;
  padding: 0.5rem 0;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  transition: color 0.15s ease;
}
.toggle-advanced:hover { color: #34d399; }
.toggle-advanced .chevron { transition: transform 0.2s ease; display: inline-block; }
.toggle-advanced.expanded .chevron { transform: rotate(180deg); }

/* Live status — current task line */
.task-row {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 1.25rem;
}
.task-orb {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(6, 182, 212, 0.15));
  border: 1px solid rgba(16, 185, 129, 0.3);
  position: relative;
}
.task-orb::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 9999px;
  border: 2px solid transparent;
  border-top-color: #34d399;
  animation: spin 1.2s linear infinite;
}
.task-orb.done::after { animation: none; border-top-color: transparent; }
.task-orb.error::after { animation: none; border-color: #f87171; }
@keyframes spin { to { transform: rotate(360deg); } }

.task-meta {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-bottom: 0.25rem;
}
.task-meta .step-pill {
  background: #0f172a;
  border: 1px solid #1e293b;
  color: #cbd5e1;
  padding: 0.0625rem 0.5rem;
  border-radius: 9999px;
  font-family: 'JetBrains Mono', monospace;
}

.task-name {
  font-size: 0.875rem;
  color: #e2e8f0;
  font-weight: 500;
  line-height: 1.4;
}
.task-detail {
  margin-top: 0.25rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: #64748b;
  word-break: break-all;
  max-height: 2.6em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.alerts-row {
  border-top: 1px solid #1e293b;
  padding: 0.625rem 1.25rem;
  font-size: 0.75rem;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.05);
  display: none;
}
.alerts-row.visible { display: block; }

/* Executive summary card */
.exec-summary {
  border: 1px solid #1e293b;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.6), rgba(2, 6, 23, 0.4));
  border-radius: 0.875rem;
  padding: 1.5rem;
}
.exec-summary h3 {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  margin-bottom: 0.75rem;
}
.exec-summary .summary-text {
  color: #e2e8f0;
  line-height: 1.6;
  font-size: 0.9375rem;
}

.findings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-top: 1.5rem;
}
@media (min-width: 768px) {
  .findings-grid { grid-template-columns: 1fr 1fr; }
}
.findings-block h4 {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  margin-bottom: 0.5rem;
}
.findings-list { display: flex; flex-direction: column; gap: 0.5rem; }
.finding-item {
  border-left: 2px solid #334155;
  padding: 0.25rem 0 0.25rem 0.75rem;
  color: #cbd5e1;
  font-size: 0.8125rem;
  line-height: 1.5;
}
.finding-item.flag { border-left-color: #f87171; }
.finding-item.leak { border-left-color: #fbbf24; }

/* Full report disclosure */
.report-disclosure {
  margin-top: 2rem;
  border-top: 1px solid #1e293b;
  padding-top: 1.5rem;
}
.disclosure-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  color: #94a3b8;
  font-size: 0.875rem;
  padding: 0.5rem 0;
  transition: color 0.15s ease;
}
.disclosure-toggle:hover { color: #34d399; }
.disclosure-toggle .chevron { transition: transform 0.2s ease; display: inline-block; }
.disclosure-toggle.expanded .chevron { transform: rotate(180deg); }

/* Download dropdown */
.download-group {
  position: relative;
  display: inline-flex;
  align-items: stretch;
}
.btn-download {
  background: #10b981;
  color: #052e16;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.625rem 1rem;
  border-radius: 0.5rem 0 0 0.5rem;
  transition: background 0.15s ease;
}
.btn-download:hover { background: #34d399; }
.btn-download-chevron {
  background: #10b981;
  color: #052e16;
  padding: 0 0.625rem;
  border-radius: 0 0.5rem 0.5rem 0;
  border-left: 1px solid rgba(5, 46, 22, 0.25);
  transition: background 0.15s ease;
  display: inline-flex;
  align-items: center;
}
.btn-download-chevron:hover { background: #34d399; }
.download-menu {
  position: absolute;
  top: calc(100% + 0.375rem);
  right: 0;
  min-width: 11rem;
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 0.5rem;
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.6);
  padding: 0.375rem;
  z-index: 50;
  display: none;
}
.download-menu.visible { display: block; }
.download-menu button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.625rem;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  color: #cbd5e1;
  transition: background 0.1s ease;
}
.download-menu button:hover { background: #1e293b; color: #f1f5f9; }
.download-menu .format-tag {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6875rem;
  color: #64748b;
}

/* Research progress cards */
.research-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.625rem;
}
@media (min-width: 768px) {
  .research-grid { grid-template-columns: repeat(5, 1fr); }
}

.dim-card {
  border: 1px solid #1e293b;
  background: rgba(15, 23, 42, 0.4);
  border-radius: 0.625rem;
  padding: 0.75rem 0.875rem;
  position: relative;
  transition: border-color 0.2s ease, background 0.2s ease;
  min-height: 6rem;
  display: flex;
  flex-direction: column;
}
.dim-card .dim-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-bottom: 0.5rem;
  font-weight: 600;
  padding-right: 1.25rem;
}
.dim-card .dim-status {
  position: absolute;
  top: 0.625rem;
  right: 0.625rem;
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1;
}
.dim-card .dim-summary {
  font-size: 0.75rem;
  color: #94a3b8;
  line-height: 1.45;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dim-card[data-state="pending"] { opacity: 0.55; }
.dim-card[data-state="pending"] .dim-status {
  border: 1px dashed #475569;
}

.dim-card[data-state="running"] {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.05);
}
.dim-card[data-state="running"] .dim-status {
  border: 2px solid rgba(16, 185, 129, 0.3);
  border-top-color: #34d399;
  animation: spin 1.2s linear infinite;
}

.dim-card[data-state="ok"] {
  border-color: rgba(16, 185, 129, 0.35);
}
.dim-card[data-state="ok"] .dim-status {
  background: #10b981;
  color: #052e16;
}

.dim-card[data-state="timeout"] {
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.04);
}
.dim-card[data-state="timeout"] .dim-status {
  background: #f59e0b;
  color: #422006;
}

.dim-card[data-state="error"] {
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.04);
}
.dim-card[data-state="error"] .dim-status {
  background: #f87171;
  color: #450a0a;
}

/* Status orb color variants for state transitions */
.task-orb.summarizing::after { border-top-color: #fbbf24; }

/* Streaming chunk containers */
.streaming-chunk[data-state="pending"] { display: none; }
.streaming-chunk[data-state="streaming"]::after {
  content: '▍';
  display: inline-block;
  color: #34d399;
  margin-left: 0.125rem;
  animation: blink 1s steps(2) infinite;
  vertical-align: baseline;
}
@keyframes blink { 50% { opacity: 0; } }

/* Reduced-motion respect */
@media (prefers-reduced-motion: reduce) {
  .pulse-dot, .task-orb::after, .dim-card[data-state="running"] .dim-status, .streaming-chunk[data-state="streaming"]::after { animation: none; }
  .risk-bar-fill, .preset-chip, .btn-download, .toggle-advanced .chevron, .disclosure-toggle .chevron, .dim-card { transition: none; }
}

/* PDF / printable mode — recolors the report for white paper */
#report.printable, #report.printable * {
  background: #ffffff !important;
  color: #1f2937 !important;
  border-color: #d1d5db !important;
}
#report.printable h1, #report.printable h2, #report.printable h3 { color: #0f172a !important; }
#report.printable strong { color: #000000 !important; }
#report.printable code { background: #f3f4f6 !important; color: #047857 !important; }
#report.printable pre { background: #f9fafb !important; border-color: #e5e7eb !important; }
#report.printable th { background: #f3f4f6 !important; color: #111827 !important; }
#report.printable blockquote { color: #4b5563 !important; border-color: #9ca3af !important; }

@media print {
  body * { visibility: hidden; }
  #report, #report * { visibility: visible; }
  #report { position: absolute; inset: 0; padding: 1rem; background: white; color: black; }
  .ambient-bg { display: none !important; }
}
