/* SPECTRE Dark Theme - Modern Intelligence Platform */

:root {
  /* Custom color palette */
  --spectre-primary: #8b5cf6;
  --spectre-accent: #06b6d4;
  --spectre-success: #10b981;
  --spectre-warning: #f59e0b;
  --spectre-danger: #ef4444;
  --spectre-info: #3b82f6;
}

/* Dark mode enhancements */
[data-md-color-scheme="slate"] {
  --md-default-bg-color: #0f172a;
  --md-default-bg-color--light: #1e293b;
  --md-default-bg-color--lighter: #334155;
  --md-default-fg-color: #e2e8f0;
  --md-default-fg-color--light: #94a3b8;
  --md-primary-fg-color: #8b5cf6;
  --md-accent-fg-color: #06b6d4;
  --md-code-bg-color: #1e293b;
}

/* Modern Mermaid styling */
.mermaid {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
  border-radius: 12px;
  padding: 24px;
  margin: 20px 0;
  border: 1px solid #334155;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  position: relative;
}

/* FORCE ALL SVG TEXT TO BE WHITE/LIGHT */
.mermaid svg text,
.mermaid svg tspan,
.mermaid svg .label,
.mermaid svg .nodeLabel,
.mermaid svg .edgeLabel,
.mermaid svg .cluster-label,
.mermaid svg foreignObject,
.mermaid svg foreignObject * {
  fill: #f8fafc !important;
  color: #f8fafc !important;
}

/* Mermaid node styling */
.mermaid .node rect,
.mermaid .node circle,
.mermaid .node ellipse,
.mermaid .node polygon {
  fill: #1e293b !important;
  stroke: #8b5cf6 !important;
  stroke-width: 2px !important;
}

.mermaid .node .label {
  color: #f8fafc !important;
  font-family: 'Inter', sans-serif !important;
}

/* Mermaid edge styling */
.mermaid .edgePath .path {
  stroke: #06b6d4 !important;
  stroke-width: 2px !important;
}

.mermaid .edgeLabel {
  background-color: #1e293b !important;
  color: #94a3b8 !important;
}

/* Mermaid cluster/subgraph styling */
.mermaid .cluster rect {
  fill: rgba(139, 92, 246, 0.1) !important;
  stroke: #8b5cf6 !important;
  stroke-width: 2px !important;
  stroke-dasharray: 5, 5 !important;
  rx: 8px !important;
  ry: 8px !important;
}

.mermaid .cluster span {
  color: #c4b5fd !important;
  font-weight: 600 !important;
}

/* Sequence diagram styling - FORCE DARK THEME */
.mermaid .actor {
  fill: #1e293b !important;
  stroke: #8b5cf6 !important;
}

.mermaid .actor-line {
  stroke: #475569 !important;
}

.mermaid .messageLine0,
.mermaid .messageLine1 {
  stroke: #06b6d4 !important;
}

.mermaid .messageText {
  fill: #e2e8f0 !important;
}

.mermaid .activation0,
.mermaid .activation1,
.mermaid .activation2 {
  fill: #334155 !important;
  stroke: #8b5cf6 !important;
}

/* Force ALL sequence diagram text to be readable */
.mermaid text {
  fill: #e2e8f0 !important;
}

.mermaid text.actor {
  fill: #f8fafc !important;
  font-weight: 600 !important;
}

.mermaid .loopText,
.mermaid .loopText tspan {
  fill: #c4b5fd !important;
}

.mermaid .noteText,
.mermaid .noteText tspan {
  fill: #f8fafc !important;
}

.mermaid .labelText,
.mermaid .labelText tspan {
  fill: #e2e8f0 !important;
}

/* Sequence diagram boxes */
.mermaid rect.note {
  fill: #334155 !important;
  stroke: #8b5cf6 !important;
}

.mermaid rect.labelBox {
  fill: #1e293b !important;
  stroke: #8b5cf6 !important;
}

.mermaid .actor-box {
  fill: #1e293b !important;
  stroke: #8b5cf6 !important;
}

/* Loop/rect backgrounds - make lighter for contrast */
.mermaid rect.rect {
  fill: rgba(30, 41, 59, 0.95) !important;
  stroke: #475569 !important;
}

/* Section labels in loops */
.mermaid .labelText {
  fill: #c4b5fd !important;
  font-weight: 600 !important;
}

/* Flowchart special nodes */
.mermaid .node.default > rect {
  fill: linear-gradient(135deg, #1e293b 0%, #334155 100%) !important;
}

/* Decision diamonds */
.mermaid .node polygon {
  fill: #1e293b !important;
  stroke: #f59e0b !important;
}

/* Journey diagram */
.mermaid .section {
  fill: rgba(139, 92, 246, 0.2) !important;
}

/* Code blocks */
.md-typeset pre > code {
  background: #1e293b;
  border-radius: 8px;
  border: 1px solid #334155;
}

.md-typeset code {
  background: #334155;
  color: #06b6d4;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Admonitions */
.md-typeset .admonition {
  border-radius: 8px;
  border-left-width: 4px;
  background: #1e293b;
}

.md-typeset .admonition.info {
  border-color: #3b82f6;
}

.md-typeset .admonition.success {
  border-color: #10b981;
}

.md-typeset .admonition.warning {
  border-color: #f59e0b;
}

/* Tables */
.md-typeset table:not([class]) {
  background: #1e293b;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #334155;
}

.md-typeset table:not([class]) th {
  background: #334155;
  color: #e2e8f0;
  font-weight: 600;
}

.md-typeset table:not([class]) td {
  border-color: #334155;
}

.md-typeset table:not([class]) tr:hover td {
  background: rgba(139, 92, 246, 0.1);
}

/* Headers */
.md-typeset h1 {
  color: #f8fafc;
  font-weight: 700;
  border-bottom: 2px solid #8b5cf6;
  padding-bottom: 8px;
}

.md-typeset h2 {
  color: #e2e8f0;
  font-weight: 600;
}

/* Navigation */
.md-nav__link--active {
  color: #8b5cf6 !important;
  font-weight: 600;
}

/* Search */
.md-search__input {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
}

/* ASCII art boxes - monospace styling */
.md-typeset pre:has(code:not([class])) {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
}

/* Horizontal rules */
.md-typeset hr {
  border-color: #334155;
}

/* Links */
.md-typeset a {
  color: #06b6d4;
}

.md-typeset a:hover {
  color: #22d3ee;
}

/* Custom colored nodes in Mermaid */
.mermaid .node.success rect {
  fill: #10b981 !important;
}

.mermaid .node.warning rect {
  fill: #f59e0b !important;
}

.mermaid .node.danger rect {
  fill: #ef4444 !important;
}

/* Gradient backgrounds for special sections */
.md-typeset .admonition.tip {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, #1e293b 100%);
  border-color: #10b981;
}

/* Smooth transitions */
* {
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #1e293b;
}

::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* Grid Comparison Layout - Side by Side */
.grid-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 24px 0;
}

.grid-comparison .comparison-left,
.grid-comparison .comparison-right {
  background: #1e293b;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #334155;
}

.grid-comparison .comparison-left {
  border-left: 4px solid #ef4444;
}

.grid-comparison .comparison-right {
  border-left: 4px solid #10b981;
}

.grid-comparison .mermaid {
  margin: 12px 0;
  padding: 16px;
}

/* Responsive - stack on mobile */
@media (max-width: 768px) {
  .grid-comparison {
    grid-template-columns: 1fr;
  }
}

/* Journey Diagram - Fix text visibility */
.mermaid .journey-section .section-title,
.mermaid .section-title {
  fill: #f8fafc !important;
  color: #f8fafc !important;
}

.mermaid .taskText,
.mermaid .taskTextOutsideRight,
.mermaid .taskTextOutsideLeft {
  fill: #e2e8f0 !important;
  color: #e2e8f0 !important;
  font-size: 12px !important;
}

.mermaid .sectionTitle {
  fill: #c4b5fd !important;
  font-weight: 600 !important;
}

.mermaid text {
  fill: #e2e8f0 !important;
}

.mermaid .label text {
  fill: #e2e8f0 !important;
}

/* Sequence Diagram - Fix visibility */
.mermaid .actor {
  fill: #1e293b !important;
  stroke: #8b5cf6 !important;
  stroke-width: 2px !important;
}

.mermaid .actor text,
.mermaid text.actor {
  fill: #f8fafc !important;
  font-weight: 600 !important;
}

.mermaid .messageText {
  fill: #e2e8f0 !important;
  font-size: 13px !important;
}

.mermaid .loopText,
.mermaid .loopText tspan {
  fill: #94a3b8 !important;
}

.mermaid .labelText,
.mermaid .labelText tspan {
  fill: #c4b5fd !important;
}

.mermaid rect.note {
  fill: #334155 !important;
  stroke: #8b5cf6 !important;
}

.mermaid .noteText {
  fill: #e2e8f0 !important;
}

.mermaid line.loopLine {
  stroke: #475569 !important;
}

.mermaid rect.activation0,
.mermaid rect.activation1,
.mermaid rect.activation2 {
  fill: #334155 !important;
  stroke: #8b5cf6 !important;
}

/* Clickable Mermaid - Zoom on click */
.mermaid {
  cursor: zoom-in;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.mermaid:hover {
  box-shadow: 0 8px 25px rgba(139, 92, 246, 0.3);
}

/* Fullscreen overlay for diagrams */
.mermaid-fullscreen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.95);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  backdrop-filter: blur(4px);
}

.mermaid-fullscreen-overlay .mermaid-content {
  max-width: 95vw;
  max-height: 95vh;
  overflow: auto;
  background: #1e293b;
  border-radius: 16px;
  padding: 32px;
  border: 2px solid #8b5cf6;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.mermaid-fullscreen-overlay .mermaid-content svg {
  max-width: 100%;
  height: auto;
}

/* Close button for fullscreen */
.mermaid-fullscreen-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 32px;
  color: #94a3b8;
  cursor: pointer;
  transition: color 0.2s;
  z-index: 10000;
}

.mermaid-fullscreen-close:hover {
  color: #f8fafc;
}

/* Hint text */
.mermaid::after {
  content: "🔍 Click to enlarge";
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 11px;
  color: #64748b;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.mermaid:hover::after {
  opacity: 1;
}

/* ================================================
   UI MOCKUP COMPONENTS
   ================================================ */

/* Main mockup container */
.ui-mockup {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid #334155;
  border-radius: 12px;
  overflow: hidden;
  margin: 20px 0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

/* Window title bar */
.ui-mockup .window-bar {
  background: #0f172a;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #334155;
}

.ui-mockup .window-dots {
  display: flex;
  gap: 6px;
}

.ui-mockup .window-dots span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.ui-mockup .window-dots span:nth-child(1) { background: #ef4444; }
.ui-mockup .window-dots span:nth-child(2) { background: #f59e0b; }
.ui-mockup .window-dots span:nth-child(3) { background: #10b981; }

.ui-mockup .window-title {
  color: #94a3b8;
  font-size: 13px;
  margin-left: 12px;
}

/* Content area */
.ui-mockup .content {
  padding: 20px;
}

/* Search bar */
.ui-mockup .search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.ui-mockup .search-input {
  flex: 1;
  background: #0f172a;
  border: 1px solid #475569;
  border-radius: 8px;
  padding: 12px 16px;
  color: #f8fafc;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ui-mockup .search-input .icon {
  color: #64748b;
}

.ui-mockup .search-btn {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

/* Results header */
.ui-mockup .results-header {
  color: #94a3b8;
  font-size: 13px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #334155;
}

.ui-mockup .results-header strong {
  color: #06b6d4;
}

/* Result item */
.ui-mockup .result-item {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}

.ui-mockup .result-item:hover {
  border-color: #8b5cf6;
}

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

.ui-mockup .result-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #f8fafc;
  font-weight: 500;
}

.ui-mockup .result-title .icon {
  font-size: 18px;
}

.ui-mockup .result-badge {
  background: rgba(6, 182, 212, 0.2);
  color: #06b6d4;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.ui-mockup .result-matches {
  margin-left: 26px;
}

.ui-mockup .result-match {
  color: #94a3b8;
  font-size: 13px;
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ui-mockup .result-match::before {
  content: "└─";
  color: #475569;
}

.ui-mockup .result-match mark {
  background: rgba(139, 92, 246, 0.3);
  color: #c4b5fd;
  padding: 1px 4px;
  border-radius: 3px;
}

/* Filter bar */
.ui-mockup .filter-bar {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.ui-mockup .filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.ui-mockup .filter-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #94a3b8;
  font-size: 13px;
}

.ui-mockup .filter-value {
  background: #334155;
  padding: 4px 10px;
  border-radius: 4px;
  color: #e2e8f0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

/* Data table */
.ui-mockup .data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ui-mockup .data-table th {
  background: #334155;
  color: #94a3b8;
  padding: 10px 12px;
  text-align: left;
  font-weight: 500;
  border-bottom: 1px solid #475569;
}

.ui-mockup .data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #334155;
  color: #e2e8f0;
}

.ui-mockup .data-table tr:hover td {
  background: rgba(139, 92, 246, 0.1);
}

.ui-mockup .data-table .checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid #475569;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ui-mockup .data-table .checkbox.checked {
  background: #8b5cf6;
  border-color: #8b5cf6;
  color: white;
}

.ui-mockup .data-table .amount {
  color: #10b981;
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
}

.ui-mockup .data-table .flagged {
  color: #f59e0b;
}

/* Action buttons */
.ui-mockup .actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  justify-content: flex-end;
}

.ui-mockup .btn {
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.ui-mockup .btn-secondary {
  background: #334155;
  border: 1px solid #475569;
  color: #e2e8f0;
}

.ui-mockup .btn-primary {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  border: none;
  color: white;
}

.ui-mockup .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

/* Tabs */
.ui-mockup .tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid #334155;
  padding-bottom: 0;
}

.ui-mockup .tab {
  padding: 10px 16px;
  color: #94a3b8;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
}

.ui-mockup .tab.active {
  color: #8b5cf6;
  border-bottom-color: #8b5cf6;
}

.ui-mockup .tab:hover:not(.active) {
  color: #e2e8f0;
}

