*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --sidebar-bg: #1a1d2e;
  --sidebar-text: #a0a8c0;
  --sidebar-active: #ffffff;
  --sidebar-active-bg: #2d3150;
  --sidebar-group: #5a6080;
  --accent: #4f6ef7;
  --accent-hover: #3a57e8;
  --text: #1a1d2e;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --green: #16a34a;
  --red: #dc2626;
  --yellow: #d97706;
  --badge-post-bg: #dbeafe;
  --badge-post-text: #1d4ed8;
  --radius: 8px;
  --font: 'Segoe UI', system-ui, sans-serif;
  --mono: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}

html, body { height: 100%; overflow: hidden; }

body {
  display: flex;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* ── Sidebar ── */
#sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid #2d3150;
}

.logo {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.5px;
}

.logo-sub {
  font-size: 11px;
  color: var(--sidebar-group);
  margin-top: 2px;
}

#nav { padding: 8px 0 20px; }

.nav-group { margin-top: 8px; }

.nav-group-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--sidebar-group);
  padding: 8px 16px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  color: var(--sidebar-text);
  cursor: pointer;
  font-size: 13px;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--sidebar-active);
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active);
  border-left-color: var(--accent);
  font-weight: 500;
}

.nav-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
  flex-shrink: 0;
}

.nav-item.active .nav-dot { opacity: 1; background: var(--accent); }

/* ── Main layout ── */
#main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  height: 100vh;
  overflow: hidden;
}

/* ── Panels ── */
#request-panel, #response-panel {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

#request-panel { border-right: 1px solid var(--border); }

.panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  flex-shrink: 0;
}

.panel-title-row {
  padding: 14px 20px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-title-row h2 { font-size: 15px; color: var(--text); }
.panel-title-row p  { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ── Badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: var(--badge-post-bg);
  color: var(--badge-post-text);
  font-family: var(--mono);
}

.badge.status-ok   { background: #dcfce7; color: var(--green); }
.badge.status-err  { background: #fee2e2; color: var(--red); }
.badge.hidden      { display: none; }

.url-text {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  word-break: break-all;
}

/* ── Request body textarea ── */
#request-body {
  flex: 1;
  width: 100%;
  padding: 16px 20px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  border: none;
  outline: none;
  resize: none;
  background: #fafafa;
  color: var(--text);
  overflow-y: auto;
}

#send-btn {
  flex-shrink: 0;
  margin: 12px 20px;
  padding: 10px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s;
}

#send-btn:hover  { background: var(--accent-hover); }
#send-btn:active { transform: scale(0.99); }

/* ── Response panel ── */
#response-images {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#response-images:empty { display: none; }

.img-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.img-block label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.img-block img {
  max-width: 160px;
  max-height: 160px;
  border: 1px solid var(--border);
  border-radius: 6px;
  image-rendering: pixelated;
  background: white;
}

#response-json {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg);
  color: var(--text);
}

.placeholder { color: var(--text-muted); font-style: italic; }

/* JSON syntax highlight */
.json-key     { color: #0550ae; }
.json-str     { color: #116329; }
.json-num     { color: #953800; }
.json-bool    { color: #8250df; }
.json-null    { color: #6e7781; }

/* ── Spinner ── */
.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.spinner.hidden { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
