/* API Response Mocker — tool styles */

/* ── Toolbar ── */
.mock-toolbar {
  flex-shrink: 0; height: 44px; padding: 0 16px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid #e2e8f0; background: #f8fafc;
  overflow: hidden;
}

.btn-sm  { padding: 4px 10px; font-size: 12px; }
.btn-xs  { padding: 3px 8px;  font-size: 11px; }

.mock-tabs {
  flex: 1; display: flex; gap: 4px; overflow-x: auto; min-width: 0;
  scrollbar-width: none; align-items: center;
}
.mock-tabs::-webkit-scrollbar { display: none; }

.mock-tab {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border: 1px solid #e2e8f0; border-radius: 6px;
  background: #fff; cursor: pointer; font-size: 12px; color: #475569;
  transition: none; max-width: 200px; white-space: nowrap; overflow: hidden;
}
.mock-tab:hover { background: #f1f5f9; opacity: 1; }
.mock-tab.active { border-color: #2563eb; background: #eff6ff; color: #1e293b; }

.tab-method {
  font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 3px;
  text-transform: uppercase; flex-shrink: 0; line-height: 1.4;
}
.method-get     { background: #dcfce7; color: #15803d; }
.method-post    { background: #dbeafe; color: #1d4ed8; }
.method-put     { background: #ffedd5; color: #c2410c; }
.method-delete  { background: #fee2e2; color: #b91c1c; }
.method-patch   { background: #ede9fe; color: #6d28d9; }
.method-head    { background: #f1f5f9; color: #475569; }
.method-options { background: #ccfbf1; color: #0f766e; }

.tab-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Main split ── */
.mock-panels {
  flex: 1; min-height: 0; display: flex; flex-direction: row; overflow: hidden;
}

/* ── Mock Editor (left) ── */
.mock-editor {
  width: 340px; flex-shrink: 0; display: flex; flex-direction: column;
  border-right: 2px solid #e2e8f0; overflow: hidden; background: #fff;
}

#editorForm {
  flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}

.editor-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px; padding: 40px; color: #94a3b8;
  font-size: 13px; text-align: center;
}

.editor-section {
  flex-shrink: 0; padding: 10px 14px; border-bottom: 1px solid #f1f5f9;
}
.editor-section.grow {
  flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
}

.editor-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.7px; text-transform: uppercase;
  color: #94a3b8; margin-bottom: 6px;
  display: flex; justify-content: space-between; align-items: center;
}

.editor-row {
  display: flex; gap: 6px; align-items: center; margin-bottom: 6px;
}
.editor-row:last-child { margin-bottom: 0; }

.full-input {
  width: 100%; padding: 5px 9px; border: 1px solid #e2e8f0; border-radius: 6px;
  font-size: 12px; outline: none; color: #1e293b; background: #fff;
}
.full-input:focus { border-color: #2563eb; }

.method-select {
  width: 86px; flex-shrink: 0; padding: 5px 6px;
  border: 1px solid #e2e8f0; border-radius: 6px;
  font-size: 12px; font-weight: 700; background: #f8fafc;
  color: #1e293b; cursor: pointer; outline: none;
}
.method-select:focus { border-color: #2563eb; }

.path-input {
  flex: 1; padding: 5px 9px; border: 1px solid #e2e8f0; border-radius: 6px;
  font-size: 12px; font-family: 'Fira Code', 'Cascadia Code', monospace;
  outline: none; color: #1e293b; background: #fff; min-width: 0;
}
.path-input:focus { border-color: #2563eb; }

.field-group { display: flex; flex-direction: column; gap: 3px; align-items: center; }
.field-label { font-size: 10px; color: #94a3b8; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

.num-input {
  width: 72px; padding: 5px 6px; border: 1px solid #e2e8f0; border-radius: 6px;
  font-size: 12px; outline: none; color: #1e293b; background: #fff;
  text-align: center; font-family: 'Fira Code', monospace;
}
.num-input:focus { border-color: #2563eb; }

.status-preview {
  flex: 1; text-align: center; padding: 4px 8px; border-radius: 5px;
  font-size: 12px; font-weight: 700; font-family: 'Fira Code', monospace;
}

/* Status badge colors (shared with response panel) */
.status-2xx { background: #dcfce7; color: #15803d; }
.status-3xx { background: #fef9c3; color: #854d0e; }
.status-4xx { background: #fee2e2; color: #b91c1c; }
.status-5xx { background: #fce7f3; color: #9d174d; }
.status-1xx { background: #f1f5f9; color: #475569; }

/* KV rows */
.kv-rows { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.kv-row  { display: flex; gap: 4px; align-items: center; }

.kv-key {
  flex: 1; padding: 4px 7px; border: 1px solid #e2e8f0; border-radius: 5px;
  font-size: 11px; outline: none; color: #7c3aed; min-width: 0;
  font-family: 'Fira Code', monospace; background: #fff;
}
.kv-val {
  flex: 1.3; padding: 4px 7px; border: 1px solid #e2e8f0; border-radius: 5px;
  font-size: 11px; outline: none; color: #475569; min-width: 0; background: #fff;
}
.kv-key:focus, .kv-val:focus { border-color: #2563eb; }

.kv-del {
  width: 22px; height: 22px; padding: 0; flex-shrink: 0;
  border: 1px solid #e2e8f0; border-radius: 4px;
  background: transparent; color: #cbd5e1; font-size: 15px; line-height: 1;
  cursor: pointer;
}
.kv-del:hover { color: #dc2626; border-color: #fca5a5; background: #fff5f5; opacity: 1; }

.add-kv-btn {
  font-size: 11px; padding: 3px 8px; border: 1px dashed #cbd5e1;
  border-radius: 4px; background: transparent; color: #94a3b8; cursor: pointer;
}
.add-kv-btn:hover { border-color: #94a3b8; color: #475569; opacity: 1; }

.link-btn {
  font-size: 10px; padding: 2px 6px; border: 1px solid #e2e8f0; border-radius: 4px;
  background: #f8fafc; color: #64748b; cursor: pointer;
}
.link-btn:hover { color: #2563eb; opacity: 1; }

/* Response body textarea in mock editor */
.mock-body-wrap {
  flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
}
.mock-body-wrap textarea {
  flex: 1; min-height: 0; width: 100%; padding: 10px 12px;
  border: none; outline: none; resize: none;
  font-family: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', monospace;
  font-size: 12px; color: #1e293b; background: #fafafa; line-height: 1.65;
  border-top: 1px solid #f1f5f9;
}
.mock-body-wrap textarea:focus { background: #fff; }

/* Editor bottom actions */
.editor-actions {
  flex-shrink: 0; padding: 8px 14px; border-top: 1px solid #e2e8f0;
  display: flex; gap: 6px; background: #f8fafc;
}

/* ── Right side ── */
.mock-right {
  flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden;
}

/* ── Request panel ── */
.request-panel {
  flex-shrink: 0; display: flex; flex-direction: column;
  border-bottom: 2px solid #e2e8f0; height: 220px;
}

.rp-header {
  flex-shrink: 0; padding: 0 16px; height: 44px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid #e2e8f0; background: #f8fafc;
}

.panel-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.8px;
  text-transform: uppercase; color: #94a3b8; flex-shrink: 0;
}

.req-bar {
  display: flex; gap: 6px; align-items: center; flex: 1;
}

.req-path {
  flex: 1; padding: 5px 10px; border: 1px solid #e2e8f0; border-radius: 6px;
  font-size: 13px; font-family: 'Fira Code', monospace; outline: none;
  color: #1e293b; background: #fff; min-width: 0;
}
.req-path:focus { border-color: #2563eb; }

.req-tabs {
  flex-shrink: 0; display: flex; padding: 0 16px;
  border-bottom: 1px solid #e2e8f0; background: #fafafa;
}
.req-tab-btn {
  padding: 5px 10px; border: none; background: transparent;
  font-size: 11px; font-weight: 500; color: #94a3b8; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.req-tab-btn:hover { color: #475569; opacity: 1; }
.req-tab-btn.active { color: #2563eb; border-bottom-color: #2563eb; font-weight: 600; }

.req-content {
  flex: 1; min-height: 0; overflow-y: auto; padding: 8px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.req-content::-webkit-scrollbar { width: 5px; }
.req-content::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 3px; }

.req-content textarea {
  flex: 1; min-height: 60px; width: 100%; padding: 8px 10px;
  border: 1px solid #e2e8f0; border-radius: 6px; resize: none; outline: none;
  font-family: 'Fira Code', monospace; font-size: 12px; color: #1e293b;
  background: #fff; line-height: 1.6;
}
.req-content textarea:focus { border-color: #2563eb; }

/* ── Response panel ── */
.response-panel {
  flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
}

.res-bar {
  flex-shrink: 0; padding: 0 16px; height: 40px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid #e2e8f0; background: #f8fafc;
}
.res-bar-spacer { flex: 1; }

.res-status-badge {
  font-size: 12px; font-weight: 700; padding: 2px 8px;
  border-radius: 4px; font-family: 'Fira Code', monospace;
}

.res-time {
  font-size: 11px; color: #94a3b8;
  font-family: 'Fira Code', monospace;
}

.res-tabs {
  flex-shrink: 0; display: flex; padding: 0 16px;
  border-bottom: 1px solid #e2e8f0; background: #fafafa;
}
.res-tab-btn {
  padding: 5px 10px; border: none; background: transparent;
  font-size: 11px; font-weight: 500; color: #94a3b8; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.res-tab-btn:hover { color: #475569; opacity: 1; }
.res-tab-btn.active { color: #2563eb; border-bottom-color: #2563eb; font-weight: 600; }

.res-content {
  flex: 1; min-height: 0; overflow: auto; padding: 14px 16px;
  background: #fafafa;
}
.res-content::-webkit-scrollbar { width: 6px; height: 6px; }
.res-content::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

.res-pre {
  white-space: pre-wrap; word-break: break-all;
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px; line-height: 1.7; color: #1e293b;
}

.res-empty {
  color: #94a3b8; font-size: 13px; font-family: inherit;
}
.res-empty code { background: #f1f5f9; padding: 1px 5px; border-radius: 3px; font-family: 'Fira Code', monospace; }

.res-header-row {
  display: flex; gap: 8px; padding: 4px 0;
  border-bottom: 1px solid #f1f5f9; font-size: 12px;
  font-family: 'Fira Code', monospace;
}
.res-header-key { color: #7c3aed; font-weight: 600; min-width: 160px; flex-shrink: 0; }
.res-header-sep { color: #94a3b8; flex-shrink: 0; }
.res-header-val { color: #475569; word-break: break-all; }

/* JSON syntax highlighting */
.hl-key  { color: #7c3aed; font-weight: 600; }
.hl-str  { color: #15803d; }
.hl-num  { color: #b45309; }
.hl-bool { color: #1d4ed8; }
.hl-null { color: #94a3b8; }

/* ── Status bar ── */
.status-bar { flex-shrink: 0; height: 26px; padding: 0 16px; display: flex; align-items: center; border-top: 1px solid #e2e8f0; background: #f8fafc; }
.status-bar span { font-size: 11px; color: #94a3b8; }

/* ── Article pages override (don't apply tool overflow:hidden) ── */
body.page-article { height: auto; overflow-y: auto; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15,23,42,0.45); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}

.modal {
  background: #fff; border-radius: 12px; width: 640px; max-width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18); display: flex; flex-direction: column;
  max-height: 80vh; overflow: hidden;
}

.modal-header {
  flex-shrink: 0; padding: 16px 20px 0;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 15px; font-weight: 700; color: #1e293b; }
.modal-close {
  width: 28px; height: 28px; border: none; background: #f1f5f9;
  border-radius: 6px; font-size: 18px; line-height: 1; cursor: pointer; color: #64748b;
}
.modal-close:hover { background: #e2e8f0; color: #1e293b; opacity: 1; }

.modal-tabs {
  flex-shrink: 0; display: flex; padding: 12px 20px 0; gap: 2px;
  border-bottom: 1px solid #e2e8f0; margin: 0;
}
.modal-tab {
  padding: 6px 12px; border: none; background: transparent;
  font-size: 12px; font-weight: 500; color: #94a3b8; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.modal-tab:hover { color: #475569; opacity: 1; }
.modal-tab.active { color: #2563eb; border-bottom-color: #2563eb; font-weight: 600; }

.modal-content {
  flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px 20px;
  display: flex; flex-direction: column; gap: 12px;
}

.modal-desc {
  font-size: 13px; color: #475569; line-height: 1.6;
}
.modal-desc code {
  background: #f1f5f9; padding: 1px 5px; border-radius: 4px;
  font-family: 'Fira Code', monospace; font-size: 12px; color: #1e293b;
}

.modal-code-wrap {
  border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; flex: 1;
  background: #0f172a;
}
.modal-code {
  padding: 14px 16px; font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: 11.5px; color: #e2e8f0; line-height: 1.7;
  white-space: pre-wrap; word-break: break-all; overflow: auto;
  max-height: 300px; background: transparent;
}
.modal-code-url {
  background: #f8fafc; color: #2563eb; font-size: 11px;
  max-height: 80px; word-break: break-all;
}
.modal-code-url.modal-code { color: #2563eb; }

.modal-actions {
  flex-shrink: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.modal-hint {
  font-size: 11px; color: #94a3b8;
}
.modal-hint code {
  background: #f1f5f9; padding: 1px 5px; border-radius: 3px;
  font-family: 'Fira Code', monospace; color: #475569; font-size: 11px;
}
.modal-hint-block {
  font-size: 12px; color: #64748b; line-height: 1.5;
  padding: 10px 14px; background: #f8fafc; border-radius: 8px;
  border: 1px dashed #cbd5e1;
}

/* Bookmarklet */
.modal-bookmarklet-wrap {
  display: flex; justify-content: center; padding: 20px;
}
.bookmarklet-btn {
  display: inline-block; padding: 10px 20px; background: #2563eb; color: #fff;
  border-radius: 8px; font-size: 14px; font-weight: 600; text-decoration: none;
  cursor: grab; border: 2px dashed #93c5fd; box-shadow: 0 4px 12px rgba(37,99,235,0.25);
  user-select: none;
}
.bookmarklet-btn:hover { background: #1d4ed8; opacity: 1; }

/* Export/Import */
.modal-export-btns {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.btn-file-label {
  display: inline-flex; align-items: center; cursor: pointer;
  padding: 4px 10px; font-size: 12px;
  border: 1px solid #e2e8f0; border-radius: 6px;
  background: transparent; color: #64748b; font-weight: 500;
}
.btn-file-label:hover { color: #1e293b; background: #f8fafc; }
