/**
 * Diagnostic Terminal Stylesheet (Rule 10 Diagnostic Logging Standard).
 * Dark Slate Terminal Aesthetic with Fira Code monospace typography.
 */

:root {
  --term-bg: #0d1117;
  --term-surface: #161b22;
  --term-border: #30363d;
  --term-text: #c9d1d9;
  --term-dim: #8b949e;
  --term-debug: #8b949e;
  --term-info: #58a6ff;
  --term-warn: #d29922;
  --term-error: #f85149;
  --term-critical: #ff7b72;
  --term-accent: #2ea043;
}

.diagnostic-terminal-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 340px;
  background: var(--term-bg);
  border-top: 2px solid var(--term-border);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: "Fira Code", "Cascadia Code", "SFMono-Regular", Consolas, Menlo, monospace;
  font-size: 12px;
  color: var(--term-text);
}

/* Hidden, not just slid away: its shadow and header otherwise peek at the bottom edge. */
.diagnostic-terminal-drawer:not(.visible) {
  visibility: hidden;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s 0.28s;
}

.diagnostic-terminal-drawer.visible {
  transform: translateY(0);
}

.terminal-header {
  height: 38px;
  background: var(--term-surface);
  border-bottom: 1px solid var(--term-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  user-select: none;
}

.terminal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.5px;
  color: #f0f6fc;
}

.terminal-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--term-accent);
  box-shadow: 0 0 6px var(--term-accent);
}

.terminal-shortcut {
  color: var(--term-dim);
  font-size: 11px;
}

.terminal-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.term-select {
  background: var(--term-bg);
  color: var(--term-text);
  border: 1px solid var(--term-border);
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
}

.term-btn {
  background: var(--term-bg);
  color: var(--term-text);
  border: 1px solid var(--term-border);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.term-btn:hover {
  background: #21262d;
  border-color: #8b949e;
}

.term-btn.term-close {
  color: var(--term-error);
}

.terminal-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 12px;
  line-height: 1.5;
  user-select: text;
  word-break: break-word;
}

.term-line {
  padding: 2px 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.term-time {
  color: var(--term-dim);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.term-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}

.badge-debug { background: #21262d; color: var(--term-debug); }
.badge-info { background: rgba(88, 166, 255, 0.15); color: var(--term-info); }
.badge-warn { background: rgba(210, 153, 34, 0.18); color: var(--term-warn); }
.badge-error { background: rgba(248, 81, 73, 0.2); color: var(--term-error); }
.badge-critical { background: var(--term-critical); color: #fff; }

.term-module {
  color: #79c0ff;
  font-weight: 600;
  flex-shrink: 0;
}

.term-msg {
  color: var(--term-text);
  flex: 1;
}

.term-line.level-warn .term-msg { color: var(--term-warn); }
.term-line.level-error .term-msg { color: var(--term-error); font-weight: 600; }
.term-line.level-critical .term-msg { color: var(--term-critical); font-weight: 700; }

/* Custom Terminal Scrollbar */
.terminal-body::-webkit-scrollbar {
  width: 6px;
}
.terminal-body::-webkit-scrollbar-track {
  background: var(--term-bg);
}
.terminal-body::-webkit-scrollbar-thumb {
  background: var(--term-border);
  border-radius: 3px;
}
