:root {
  --bg: #0a0a0f;
  --surface: #11111a;
  --surface2: #16161f;
  --surface3: #1c1c28;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --accent: #7b6ef6;
  --accent2: #e8c56d;
  --accent-dim: rgba(123,110,246,0.12);
  --text: #e8e6f0;
  --muted: #6b6880;
  --muted2: #9996aa;
  --get: #4ade80;
  --post: #7b6ef6;
  --put: #fbbf24;
  --delete: #f87171;
  --sidebar-w: 260px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Syne', sans-serif;
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.sidebar-header {
  padding: 1.4rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.sidebar-logo { display: flex; align-items: center; gap: 0.6rem; }
.logo-icon { color: var(--accent); font-size: 1.2rem; }
.logo-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  letter-spacing: 0.1em;
}
.sidebar-toggle {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 1rem; display: none;
}

.api-info {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.api-badge {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  padding: 0.2rem 0.5rem;
  border-radius: 2px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(123,110,246,0.25);
  margin-bottom: 0.75rem;
}
.api-base {
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.3rem;
}
.api-url {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--muted2);
}

.sidebar-nav {
  flex: 1;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}
.nav-group { display: flex; flex-direction: column; gap: 0.2rem; }
.nav-group-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 0.5rem;
  margin-bottom: 0.4rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: 5px;
  text-decoration: none;
  color: var(--muted2);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  transition: all 0.2s;
}
.nav-item:hover { background: rgba(255,255,255,0.03); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--text); }

.method-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 500;
  padding: 0.15rem 0.4rem;
  border-radius: 2px;
  min-width: 32px;
  text-align: center;
  flex-shrink: 0;
}
.method-badge.get    { background: rgba(74,222,128,0.12); color: var(--get);    border: 1px solid rgba(74,222,128,0.2); }
.method-badge.post   { background: rgba(123,110,246,0.12); color: var(--post);  border: 1px solid rgba(123,110,246,0.2); }
.method-badge.put    { background: rgba(251,191,36,0.12);  color: var(--put);   border: 1px solid rgba(251,191,36,0.2); }
.method-badge.delete { background: rgba(248,113,113,0.12); color: var(--delete);border: 1px solid rgba(248,113,113,0.2); }

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}
.back-link {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.08em;
  transition: color 0.2s;
}
.back-link:hover { color: var(--accent); }

/* ── Main wrapper ──────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,10,15,0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar-left { display: flex; align-items: center; gap: 1rem; }
.menu-btn {
  background: none; border: none; color: var(--muted2);
  font-size: 1.2rem; cursor: pointer; display: none;
}
.topbar-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
}
.topbar-method { font-size: 0.8rem; font-weight: 500; }
.topbar-endpoint { font-size: 0.82rem; color: var(--muted2); }

.auth-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--muted);
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
}
.status-dot.off  { background: var(--muted); }
.status-dot.on   { background: var(--get); box-shadow: 0 0 6px var(--get); }

/* ── Playground ────────────────────────────────────────── */
.playground {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  gap: 0;
  border-bottom: 1px solid var(--border);
}

/* ── Panel ─────────────────────────────────────────────── */
.panel { display: flex; flex-direction: column; border-right: 1px solid var(--border); }
.response-panel { border-right: none; }

.panel-header {
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.01);
}
.panel-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--muted);
}
.url-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
}
.url-method { font-weight: 500; }
.url-path { color: var(--muted2); font-size: 0.68rem; }

/* ── Tabs ──────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
}
.tab {
  background: none; border: none;
  color: var(--muted);
  font-family: 'Syne', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.75rem 0;
  margin-right: 1.5rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-content { display: none; flex: 1; overflow: auto; }
.tab-content.active { display: flex; flex-direction: column; }

/* ── Code editor ───────────────────────────────────────── */
.code-editor {
  flex: 1;
  padding: 1.25rem 1.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--text);
  outline: none;
  white-space: pre;
  overflow: auto;
  min-height: 220px;
  background: var(--surface2);
  caret-color: var(--accent);
}

.headers-list, .params-list {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.header-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
}
.header-key { color: var(--accent2); }
.header-val { color: var(--muted2); word-break: break-all; }
.empty-tab { color: var(--muted); font-size: 0.8rem; padding: 0.5rem 0; }

/* ── Panel footer ──────────────────────────────────────── */
.panel-footer {
  padding: 0.9rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.schema-hint {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: var(--muted);
  flex: 1;
}

.send-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent);
  color: #fff;
  border: 1.5px solid var(--accent);
  padding: 0.6rem 1.4rem;
  font-family: 'Syne', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.send-btn:hover { background: transparent; color: var(--accent); }
.send-btn.loading { opacity: 0.6; pointer-events: none; }

/* ── Response ──────────────────────────────────────────── */
.response-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.status-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
}
.status-2xx { background: rgba(74,222,128,0.12); color: var(--get); }
.status-4xx { background: rgba(248,113,113,0.12); color: var(--delete); }
.status-5xx { background: rgba(251,191,36,0.12);  color: var(--put); }
.response-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--muted);
}

.response-body {
  flex: 1;
  overflow: auto;
  background: var(--surface2);
}
.response-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 220px;
  color: var(--muted);
  gap: 0.75rem;
}
.response-empty-icon { font-size: 2rem; opacity: 0.2; }
.response-empty p { font-size: 0.82rem; }

.json-output {
  padding: 1.25rem 1.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  line-height: 1.75;
  white-space: pre;
  overflow: auto;
}
.json-key    { color: var(--accent2); }
.json-string { color: var(--get); }
.json-number { color: #f9a8d4; }
.json-bool   { color: var(--accent); }
.json-null   { color: var(--muted2); }

/* ── Task manager ──────────────────────────────────────── */
.task-manager {
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.tm-header {
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.tm-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.08em;
}
.tm-sub { font-size: 0.72rem; color: var(--muted); }
.tm-list { max-height: 180px; overflow-y: auto; }
.tm-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  transition: background 0.15s;
}
.tm-item:last-child { border-bottom: none; }
.tm-item:hover { background: rgba(255,255,255,0.02); }
.tm-check {
  width: 16px; height: 16px;
  border-radius: 3px;
  border: 1.5px solid var(--border2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--get);
}
.tm-check.done { background: rgba(74,222,128,0.12); border-color: var(--get); }
.tm-text { flex: 1; }
.tm-text.done { text-decoration: line-through; color: var(--muted); }
.tm-priority {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  padding: 0.15rem 0.45rem;
  border-radius: 2px;
}
.prio-high   { background: rgba(248,113,113,0.1); color: var(--delete); border: 1px solid rgba(248,113,113,0.2); }
.prio-medium { background: rgba(251,191,36,0.1);  color: var(--put);    border: 1px solid rgba(251,191,36,0.2); }
.prio-low    { background: rgba(74,222,128,0.1);  color: var(--get);    border: 1px solid rgba(74,222,128,0.2); }
.tm-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  color: var(--muted);
}

/* ── Docs strip ────────────────────────────────────────── */
.docs-strip {
  padding: 2rem 1.75rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.docs-content {
  max-width: 900px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.doc-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem;
}
.doc-card-title {
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.doc-card p {
  font-size: 0.76rem;
  color: var(--muted2);
  line-height: 1.65;
}
.doc-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.65rem 0.9rem;
  margin-top: 0.75rem;
  color: var(--muted2);
  overflow-x: auto;
  white-space: pre;
}

/* ── Toast ─────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 2rem; right: 2rem;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-left: 3px solid var(--accent);
  color: var(--text);
  padding: 0.9rem 1.4rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  z-index: 999;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: block; }
  .menu-btn { display: block; }
  .main-wrapper { margin-left: 0; }
  .playground { grid-template-columns: 1fr; }
  .panel { border-right: none; border-bottom: 1px solid var(--border); }
}
