/* ============================================================
   CSS Design System — API Tester Web Terminal
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface2: #1c2128;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #7d8590;
  --accent: #58a6ff;
  --accent2: #79c0ff;
  --green: #3fb950;
  --yellow: #d29922;
  --red: #f85149;
  --purple: #bc8cff;
  --orange: #ffa657;

  --get: #3fb950;
  --post: #58a6ff;
  --put: #d29922;
  --delete: #f85149;
  --patch: #bc8cff;
  --stress: #ffa657;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --font-ui: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  overflow: hidden;
}

/* ── Header ─────────────────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.logo-icon {
  font-size: 20px;
}

.logo-accent {
  color: var(--accent);
}

.header-badges {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.badge-link {
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}

.badge-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.dot-green {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

/* ── Main Layout ────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: calc(100vh - 56px);
  overflow: hidden;
}

/* ── Sidebar ────────────────────────────────────────── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  overflow-y: auto;
  gap: 4px;
}

.sidebar-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.sidebar-subtitle {
  color: #8b949e;
  font-size: 13px;
  margin-bottom: 16px;
}

.arch-proof {
  margin-top: 16px;
  margin-bottom: 24px;
  padding: 12px 16px;
  background: rgba(88, 166, 255, 0.1);
  border-left: 3px solid #58a6ff;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.5;
  color: #c9d1d9;
}

.arch-proof strong {
  color: #58a6ff;
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
}

.demo-group {
  margin-bottom: 20px;
}

.demo-group-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
  padding-left: 4px;
}

.demo-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  margin-bottom: 4px;
}

.demo-btn:hover {
  background: var(--surface2);
  border-color: var(--border);
  transform: translateX(2px);
}

.demo-btn:active {
  transform: translateX(4px) scale(0.98);
}

.demo-btn.running {
  animation: pulse-btn 1s infinite;
}

@keyframes pulse-btn {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

.method-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.4px;
  flex-shrink: 0;
  min-width: 52px;
  text-align: center;
}

.method-badge.get {
  background: rgba(63, 185, 80, .15);
  color: var(--get);
}

.method-badge.post {
  background: rgba(88, 166, 255, .15);
  color: var(--post);
}

.method-badge.put {
  background: rgba(210, 153, 34, .15);
  color: var(--put);
}

.method-badge.delete {
  background: rgba(248, 81, 73, .15);
  color: var(--delete);
}

.method-badge.patch {
  background: rgba(188, 140, 255, .15);
  color: var(--patch);
}

.method-badge.stress {
  background: rgba(255, 166, 87, .15);
  color: var(--stress);
}

.method-badge.collection {
  background: rgba(120, 210, 190, .15);
  color: #78d2be;
}

.method-badge.help {
  background: rgba(200, 200, 200, .10);
  color: #aaa;
}

.method-badge.env {
  background: rgba(100, 200, 255, .15);
  color: #64c8ff;
}

.demo-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
}

.sidebar-footer {
  margin-top: auto;
  font-size: 10px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 12px;
  line-height: 1.5;
}

/* ── Terminal Area ──────────────────────────────────── */
.terminal-area {
  display: flex;
  flex-direction: column;
  background: #010409;
  overflow: hidden;
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  flex-shrink: 0;
}

.terminal-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.dot-btn {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-btn.red {
  background: #ff5f57;
}

.dot-btn.yellow {
  background: #ffbd2e;
}

.dot-btn.green {
  background: #28c840;
}

.terminal-title {
  flex: 1;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.clear-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--font-ui);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.clear-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

#terminal {
  flex: 1;
  overflow: hidden;
  padding: 12px 8px 4px 8px;
}

/* ── Input Bar ──────────────────────────────────────── */
.terminal-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface2);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.prompt-prefix {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--green);
  white-space: nowrap;
  font-weight: 500;
}

.cmd-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 7px 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.cmd-input::placeholder {
  color: var(--text-muted);
}

.cmd-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, .12);
}

.run-btn {
  background: linear-gradient(135deg, var(--accent), #1f6feb);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 18px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  white-space: nowrap;
}

.run-btn:hover {
  opacity: 0.88;
}

.run-btn:active {
  transform: scale(0.97);
}

.run-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Status Bar ─────────────────────────────────────── */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 16px;
  font-size: 11px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.conn-connecting {
  color: var(--yellow);
}

.conn-connected {
  color: var(--green);
}

.conn-error {
  color: var(--red);
}

.status-hint {
  color: var(--text-muted);
}

.status-hint kbd {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 10px;
}

/* ── Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 768px) {

  html,
  body {
    overflow: auto;
  }

  .layout {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 16px;
    overflow-y: visible;
    max-height: 320px;
    overflow-y: auto;
  }

  .terminal-area {
    height: 65vh;
  }

  .terminal-header {
    display: none;
  }
}