/* Milon API Console - Dark Theme */
:root {
  --bg: #0a0e1a;
  --bg-2: #0d1220;
  --card: #131826;
  --card-2: #1a2033;
  --border: #2a3548;
  --text: #e1e8f0;
  --text-dim: #8b9bb4;
  --accent: #4f8cff;
  --accent-dim: #2a5db8;
  --success: #4ade80;
  --error: #f87171;
  --warning: #fbbf24;
  --method-get: #4ade80;
  --method-post: #4f8cff;
  --method-put: #fbbf24;
  --method-delete: #f87171;
  --topbar-h: 52px;
  --sidebar-w: 260px;
  --history-h: 40px;
  --mono: "JetBrains Mono","Fira Code","SF Mono",Consolas,"Courier New",monospace;
  --sans: -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",Roboto,sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
#app { display: flex; flex-direction: column; height: 100vh; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3a4a66; }.topbar {
  height: var(--topbar-h);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.brand { display: flex; align-items: center; gap: 8px; }
.brand-logo {
  font-size: 22px; font-weight: 700; color: var(--accent);
  line-height: 1; text-shadow: 0 0 12px rgba(79,140,255,0.5);
}
.brand-title { font-size: 15px; font-weight: 600; letter-spacing: 0.3px; color: var(--text); }
.icon-btn {
  background: transparent; border: 1px solid transparent; color: var(--text-dim);
  width: 32px; height: 32px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.15s ease;
}
.icon-btn:hover { background: var(--card-2); color: var(--text); border-color: var(--border); }
.network-selector { display: flex; align-items: center; gap: 6px; }
.network-label { font-size: 12px; color: var(--text-dim); }
.network-select {
  background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 5px 28px 5px 10px; font-size: 12px; font-family: var(--sans);
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238b9bb4' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 8px center;
  min-width: 120px; transition: border-color 0.15s ease;
}
.network-select:hover { border-color: var(--accent); }
.network-select:focus { outline: none; border-color: var(--accent); }.main-layout { flex: 1; display: flex; min-height: 0; overflow: hidden; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--bg-2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; transition: margin-left 0.2s ease;
}
.sidebar.collapsed { margin-left: calc(-1 * var(--sidebar-w)); }
.sidebar-header {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
}
.sidebar-header > span {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-dim);
}
.endpoint-search {
  background: var(--card); border: 1px solid var(--border); border-radius: 5px;
  padding: 5px 8px; font-size: 12px; color: var(--text); font-family: var(--sans); width: 100%;
}
.endpoint-search::placeholder { color: var(--text-dim); }
.endpoint-search:focus { outline: none; border-color: var(--accent); }
.endpoint-tree { flex: 1; overflow-y: auto; padding: 6px 0; }
.endpoint-group { margin-bottom: 4px; }
.group-title {
  padding: 8px 14px 4px; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-dim); user-select: none;
}
.endpoint-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px;
  cursor: pointer; border-left: 2px solid transparent; transition: background 0.12s ease, border-color 0.12s ease;
}
.endpoint-item:hover { background: var(--card); }
.endpoint-item.active { background: var(--card-2); border-left-color: var(--accent); }
.endpoint-method {
  font-family: var(--mono); font-size: 9px; font-weight: 700; width: 30px; flex-shrink: 0; text-align: center;
}
.endpoint-method.GET { color: var(--method-get); }
.endpoint-method.POST { color: var(--method-post); }
.endpoint-method.PUT { color: var(--method-put); }
.endpoint-method.DELETE { color: var(--method-delete); }
.endpoint-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.endpoint-name {
  font-family: var(--mono); font-size: 11px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.endpoint-desc {
  font-size: 10px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}.editor-pane {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  background: var(--bg); border-right: 1px solid var(--border);
}
.editor-header {
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; background: var(--bg-2);
}
.endpoint-info { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.method-badge {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  padding: 3px 8px; border-radius: 4px; background: var(--card-2); color: var(--text-dim); flex-shrink: 0;
}
.method-badge.GET { color: var(--method-get); background: rgba(74,222,128,0.12); }
.method-badge.POST { color: var(--method-post); background: rgba(79,140,255,0.12); }
.method-badge.PUT { color: var(--method-put); background: rgba(251,191,36,0.12); }
.method-badge.DELETE { color: var(--method-delete); background: rgba(248,113,113,0.12); }
.endpoint-path {
  font-family: var(--mono); font-size: 12px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.endpoint-summary { font-size: 11px; color: var(--text-dim); padding-left: 8px; border-left: 1px solid var(--border); }
.editor-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px;
  border-radius: 5px; border: 1px solid var(--border); background: var(--card); color: var(--text);
  font-size: 12px; font-family: var(--sans); cursor: pointer; transition: all 0.15s ease;
}
.btn:hover { background: var(--card-2); border-color: #3a4a66; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: #5f9aff; border-color: #5f9aff; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { background: transparent; }
.editor-body { flex: 1; overflow-y: auto; padding: 16px; }
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; color: var(--text-dim); gap: 12px;
}
.empty-icon { font-size: 42px; opacity: 0.4; }
.empty-state p { font-size: 13px; }
.param-section { margin-bottom: 18px; }
.param-section-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-dim); margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.param-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.param-label { font-family: var(--mono); font-size: 12px; color: var(--accent); width: 110px; flex-shrink: 0; }
.param-input {
  flex: 1; background: var(--card); border: 1px solid var(--border); border-radius: 5px;
  padding: 6px 10px; font-size: 12px; color: var(--text); font-family: var(--mono); transition: border-color 0.15s ease;
}
.param-input::placeholder { color: var(--text-dim); }
.param-input:focus { outline: none; border-color: var(--accent); }.body-editor {
  width: 100%; min-height: 240px; background: var(--card); border: 1px solid var(--border);
  border-radius: 6px; padding: 10px 12px; font-family: var(--mono); font-size: 12px;
  color: var(--text); resize: vertical; line-height: 1.6; tab-size: 2;
}
.body-editor:focus { outline: none; border-color: var(--accent); }
.body-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.body-format-hint { font-size: 11px; color: var(--text-dim); }
.body-format-btn {
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  font-size: 11px; padding: 3px 8px; border-radius: 4px; cursor: pointer;
}
.body-format-btn:hover { color: var(--text); border-color: var(--accent); }
.response-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.response-header {
  padding: 0 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; background: var(--bg-2);
  height: 40px; flex-shrink: 0;
}
.response-tabs { display: flex; gap: 2px; height: 100%; align-items: stretch; }
.tab {
  background: transparent; border: none; color: var(--text-dim); font-size: 12px; padding: 0 12px;
  cursor: pointer; border-bottom: 2px solid transparent; transition: color 0.15s ease, border-color 0.15s ease;
  font-family: var(--sans);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.response-meta { font-size: 11px; color: var(--text-dim); display: flex; align-items: center; gap: 8px; }
.meta-placeholder { color: var(--text-dim); }
.status-code { font-weight: 700; font-family: var(--mono); }
.status-code.success { color: var(--success); }
.status-code.error { color: var(--error); }
.status-code.warn { color: var(--warning); }
.response-body { flex: 1; overflow: hidden; position: relative; }
.tab-panel { display: none; height: 100%; overflow: auto; padding: 14px; }
.tab-panel.active { display: block; }
.response-empty { color: var(--text-dim); font-size: 13px; text-align: center; padding: 40px 0; }.json-viewer {
  font-family: var(--mono); font-size: 12px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-all;
}
.json-key { color: #7aa2ff; }
.json-string { color: #4ade80; }
.json-number { color: #fbbf24; }
.json-boolean { color: #c084fc; }
.json-null { color: #8b9bb4; }
.json-punct { color: var(--text-dim); }
.headers-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.headers-table th, .headers-table td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.headers-table th {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-dim); background: var(--bg-2);
}
.headers-table td { font-family: var(--mono); color: var(--text); }
.headers-table td:first-child { color: var(--accent); width: 40%; word-break: break-all; }
.headers-table td:last-child { word-break: break-all; }
.raw-viewer {
  font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-all; color: var(--text);
}
.loading-overlay {
  position: absolute; inset: 0; background: rgba(10,14,26,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 5; backdrop-filter: blur(2px);
}
.spinner {
  width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error-box {
  border: 1px solid var(--error); background: rgba(248,113,113,0.08); border-radius: 6px;
  padding: 12px 14px; color: var(--error); font-size: 12px; font-family: var(--mono);
  white-space: pre-wrap; word-break: break-all;
}.history-bar {
  height: var(--history-h); background: var(--bg-2); border-top: 1px solid var(--border);
  flex-shrink: 0; position: relative; display: flex; flex-direction: column;
}
.history-toggle {
  background: transparent; border: none; color: var(--text-dim); font-size: 12px; padding: 0 16px;
  height: var(--history-h); cursor: pointer; display: flex; align-items: center; gap: 8px;
  font-family: var(--sans); width: 100%; text-align: left;
}
.history-toggle:hover { color: var(--text); }
.history-count {
  background: var(--card-2); color: var(--text-dim); font-size: 10px;
  padding: 1px 7px; border-radius: 10px; font-family: var(--mono);
}
.chevron { transition: transform 0.2s ease; margin-left: auto; }
.history-bar.expanded .chevron { transform: rotate(180deg); }
.history-panel {
  display: none; position: absolute; bottom: var(--history-h); left: 0; right: 0;
  max-height: 240px; overflow-y: auto; background: var(--bg-2);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); z-index: 20;
}
.history-bar.expanded .history-panel { display: block; }
.history-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px; cursor: pointer;
  border-bottom: 1px solid var(--border); font-size: 12px;
}
.history-item:hover { background: var(--card); }
.history-item .h-method { font-family: var(--mono); font-size: 10px; font-weight: 700; width: 34px; flex-shrink: 0; }
.history-item .h-method.GET { color: var(--method-get); }
.history-item .h-method.POST { color: var(--method-post); }
.history-item .h-path { font-family: var(--mono); color: var(--text); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item .h-status { font-family: var(--mono); font-size: 11px; flex-shrink: 0; }
.history-item .h-status.success { color: var(--success); }
.history-item .h-status.error { color: var(--error); }
.history-item .h-time { color: var(--text-dim); font-size: 11px; flex-shrink: 0; }
.history-empty { padding: 24px; text-align: center; color: var(--text-dim); font-size: 12px; }
.toast {
  position: fixed; bottom: 60px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--card-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 16px; font-size: 12px; opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease; z-index: 100; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--error); }@media (max-width: 980px) {
  :root { --sidebar-w: 220px; }
  .endpoint-summary { display: none; }
}
@media (max-width: 768px) {
  .sidebar {
    position: absolute; top: var(--topbar-h); bottom: var(--history-h); left: 0; z-index: 30;
    box-shadow: 4px 0 20px rgba(0,0,0,0.4);
  }
  .sidebar.collapsed { margin-left: calc(-1 * var(--sidebar-w) - 4px); }
  .brand-title { display: none; }
  .response-pane { border-right: none; }
  .editor-header { flex-direction: column; align-items: stretch; }
  .editor-actions { justify-content: flex-end; }
  .param-label { width: 90px; }
}
@media (max-width: 560px) {
  .main-layout { flex-direction: column; }
  .editor-pane, .response-pane { flex: none; height: 50%; }
  .endpoint-summary { display: none; }
}