/* Matrix-inspired terminal presentation. Layout belongs to dashboard.css. */

:root[data-theme="matrix"] {
  color-scheme: dark;
  --background: #020705;
  --surface: #06110b;
  --surface-emphasis: #0a1a10;
  --text: #b8ffc7;
  --muted: #79c78a;
  --border: #1f6f35;
  --accent: #43d968;
  --accent-strong: #72f58f;
  --success: #72f58f;
  --warning: #f1d66f;
  --danger: #ff8a8a;
  --focus: #d4ff62;
  --shadow: 0 0 1.2rem rgb(67 217 104 / 0.08);
  --radius-small: 0.2rem;
  --radius-large: 0.25rem;
  --term-accent: #72f58f;
  --term-dim: #245e32;
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", monospace;
}

:root[data-theme="matrix"] body {
  background:
    repeating-linear-gradient(
      180deg,
      rgb(67 217 104 / 0.04) 0,
      rgb(67 217 104 / 0.04) 1px,
      transparent 1px,
      transparent 6px
    ),
    repeating-linear-gradient(
      90deg,
      rgb(67 217 104 / 0.02) 0,
      rgb(67 217 104 / 0.02) 1px,
      transparent 1px,
      transparent 3rem
    ),
    radial-gradient(circle at 50% -10%, rgb(67 217 104 / 0.11), transparent 42rem),
    var(--background);
}

:root[data-theme="matrix"] .site-header {
  position: relative;
  border: 1px solid var(--term-dim);
  border-left: 0.3rem solid var(--accent);
  border-radius: 0;
  background:
    linear-gradient(90deg, rgb(67 217 104 / 0.07), transparent 18rem),
    var(--surface);
  box-shadow:
    inset 0 0 1.4rem rgb(67 217 104 / 0.025),
    var(--shadow);
}

:root[data-theme="matrix"] .site-header::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--term-accent), transparent);
  box-shadow: 0 0 0.8rem rgb(67 217 104 / 0.42);
}

:root[data-theme="matrix"] .brand h1,
:root[data-theme="matrix"] .overview h2,
:root[data-theme="matrix"] .panel h2 {
  color: var(--text);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

:root[data-theme="matrix"] .eyebrow,
:root[data-theme="matrix"] .panel-kicker {
  color: var(--muted);
  letter-spacing: 0.13em;
}

:root[data-theme="matrix"] .status-badge {
  border: 1px solid currentcolor;
  border-radius: 0;
  background: #020a05;
  box-shadow:
    inset 0 0 0.7rem rgb(67 217 104 / 0.08),
    0 0 0.6rem rgb(67 217 104 / 0.1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

:root[data-theme="matrix"] .status-badge[data-state="loading"] {
  animation: matrix-status-pulse 1.5s steps(2, end) infinite;
}

:root[data-theme="matrix"] .workspace-shell {
  border: 1px solid var(--term-dim);
  border-radius: 0;
  background:
    linear-gradient(135deg, rgb(67 217 104 / 0.045), transparent 16rem),
    #020a05;
  box-shadow:
    inset 0 0 2rem rgb(67 217 104 / 0.03),
    0 0 1.4rem rgb(0 0 0 / 0.55);
}

:root[data-theme="matrix"] .workspace-tabs {
  border: 1px solid var(--term-dim);
  border-radius: 0;
  background:
    repeating-linear-gradient(
      90deg,
      rgb(67 217 104 / 0.035) 0 1px,
      transparent 1px 1.5rem
    ),
    #041008;
}

:root[data-theme="matrix"] .workspace-tabs button {
  border: 1px solid var(--term-dim);
  border-radius: 0;
  color: var(--muted);
  background: #06110b;
  box-shadow: none;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition:
    border-color 100ms linear,
    color 100ms linear,
    text-shadow 100ms linear;
}

:root[data-theme="matrix"] .workspace-tabs button::before {
  display: inline-block;
  width: 0.42rem;
  height: 0.42rem;
  margin-right: 0.42rem;
  border-right: 0.12rem solid var(--term-dim);
  border-bottom: 0.12rem solid var(--term-dim);
  content: "";
  transform: rotate(-45deg);
}

:root[data-theme="matrix"] .workspace-tabs button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--text);
  background: rgb(67 217 104 / 0.06);
}

:root[data-theme="matrix"] .workspace-tabs button[aria-selected="true"] {
  border-color: var(--term-accent);
  color: var(--term-accent);
  background: rgb(67 217 104 / 0.1);
  box-shadow:
    inset 0 0 0.8rem rgb(67 217 104 / 0.08),
    0 0 0.55rem rgb(67 217 104 / 0.12);
  text-shadow: 0 0 0.55rem rgb(114 245 143 / 0.3);
}

:root[data-theme="matrix"] .workspace-tabs button[aria-selected="true"]::before {
  border-color: var(--term-accent);
}

:root[data-theme="matrix"] .workspace-deck {
  border: 1px solid var(--term-dim);
  border-radius: 0;
  background: rgb(2 10 5 / 0.9);
  box-shadow: inset 0 0 1.8rem rgb(67 217 104 / 0.025);
}

:root[data-theme="matrix"] [data-workspace-pane] {
  border-color: var(--term-dim);
  background:
    linear-gradient(180deg, rgb(67 217 104 / 0.02), transparent 12rem),
    var(--surface);
}

:root[data-theme="matrix"] .panel {
  position: relative;
  border: 1px solid var(--term-dim);
  border-radius: 0;
  background:
    linear-gradient(180deg, rgb(67 217 104 / 0.025), transparent 10rem),
    #020a05;
  box-shadow:
    inset 0 0 1.5rem rgb(67 217 104 / 0.025),
    0 0 1.2rem rgb(0 0 0 / 0.45);
}

:root[data-theme="matrix"] .panel::before {
  position: absolute;
  top: 0.5rem;
  right: 0.65rem;
  width: 3.5rem;
  height: 0.35rem;
  content: "";
  background: repeating-linear-gradient(
    90deg,
    rgb(114 245 143 / 0.42) 0 0.2rem,
    transparent 0.2rem 0.42rem
  );
}

:root[data-theme="matrix"] .panel::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--term-accent), transparent);
  box-shadow: 0 0 0.7rem rgb(67 217 104 / 0.28);
}

:root[data-theme="matrix"] .panel-header {
  margin-right: 5.2rem;
  border-bottom: 1px solid var(--term-dim);
}

:root[data-theme="matrix"] .panel-header h2,
:root[data-theme="matrix"] .primary-value,
:root[data-theme="matrix"] .technical-value,
:root[data-theme="matrix"] .status-list dd {
  text-shadow: 0 0 0.55rem rgb(67 217 104 / 0.16);
}

:root[data-theme="matrix"] #radio-activity-panel {
  border: 2px solid var(--term-accent);
  outline: 1px solid #174822;
  outline-offset: 0.2rem;
  background:
    repeating-linear-gradient(
      180deg,
      transparent 0 4px,
      rgb(67 217 104 / 0.035) 4px 5px
    ),
    radial-gradient(circle at 50% 0, rgb(67 217 104 / 0.11), transparent 24rem),
    #020a05;
  box-shadow:
    inset 0 0 2.2rem rgb(67 217 104 / 0.045),
    0 0 1rem rgb(67 217 104 / 0.16);
}

:root[data-theme="matrix"] #radio-activity-panel .primary-value {
  color: var(--term-accent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-shadow: 0 0 0.9rem rgb(114 245 143 / 0.28);
}

:root[data-theme="matrix"] #radio-activity-panel .secondary-value {
  color: var(--text);
}

:root[data-theme="matrix"] .radio-view-controls,
:root[data-theme="matrix"] .radio-field-groups,
:root[data-theme="matrix"] .radio-field-group,
:root[data-theme="matrix"] .scanner-control-group,
:root[data-theme="matrix"] .recording-item {
  border-color: var(--term-dim);
  border-radius: 0;
  background: rgb(67 217 104 / 0.025);
}

:root[data-theme="matrix"] .radio-view-controls {
  border-left: 0.25rem solid var(--term-accent);
}

:root[data-theme="matrix"] .radio-field-group h3 {
  color: var(--term-accent);
}

:root[data-theme="matrix"] .status-list > div,
:root[data-theme="matrix"] .radio-field-list > div {
  border-bottom: 1px dashed var(--border);
}

:root[data-theme="matrix"] button,
:root[data-theme="matrix"] .recording-action,
:root[data-theme="matrix"] select {
  border-color: var(--accent);
  border-radius: 0;
  color: #020705;
  background: var(--accent);
  box-shadow: none;
}

:root[data-theme="matrix"] button:hover:not(:disabled),
:root[data-theme="matrix"] .recording-action:hover {
  border-color: var(--accent-strong);
  color: #020705;
  background: var(--accent-strong);
  box-shadow: 0 0 0.65rem rgb(67 217 104 / 0.2);
}

:root[data-theme="matrix"] #audio-stop,
:root[data-theme="matrix"] #scanner-reconnect,
:root[data-theme="matrix"] #recording-stop,
:root[data-theme="matrix"] #recordings-refresh {
  color: var(--term-accent);
  background: transparent;
}

@keyframes matrix-status-pulse {
  50% {
    opacity: 0.62;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root[data-theme="matrix"] *,
  :root[data-theme="matrix"] *::before,
  :root[data-theme="matrix"] *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}

@media (forced-colors: active) {
  :root[data-theme="matrix"] {
    --background: Canvas;
    --surface: Canvas;
    --surface-emphasis: Canvas;
    --text: CanvasText;
    --muted: CanvasText;
    --border: CanvasText;
    --accent: LinkText;
    --accent-strong: Highlight;
    --focus: Highlight;
    --term-accent: CanvasText;
    --term-dim: CanvasText;
  }

  :root[data-theme="matrix"] .site-header,
  :root[data-theme="matrix"] .workspace-shell,
  :root[data-theme="matrix"] .workspace-tabs,
  :root[data-theme="matrix"] .workspace-deck,
  :root[data-theme="matrix"] [data-workspace-pane],
  :root[data-theme="matrix"] .panel,
  :root[data-theme="matrix"] #radio-activity-panel,
  :root[data-theme="matrix"] .radio-view-controls,
  :root[data-theme="matrix"] .radio-field-groups {
    border-color: CanvasText;
    outline-color: CanvasText;
    color: CanvasText;
    background: Canvas;
    box-shadow: none;
    text-shadow: none;
  }

  :root[data-theme="matrix"] .site-header::after,
  :root[data-theme="matrix"] .panel::before,
  :root[data-theme="matrix"] .panel::after {
    content: none;
  }

  :root[data-theme="matrix"] .workspace-tabs button[aria-selected="true"] {
    color: HighlightText;
    background: Highlight;
    outline: 2px solid Highlight;
    text-shadow: none;
  }
}
