/* XessHarbor Reporter 日志查看器 — macOS 简白磨砂玻璃（上传模式） */

:root {
  --accent: #0a84ff;
  --accent-soft: rgba(10, 132, 255, 0.12);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #a1a1a6;
  --hairline: rgba(0, 0, 0, 0.085);
  --hover: rgba(0, 0, 0, 0.045);
  --lv-info: #0a84ff;
  --lv-warning: #ff9f0a;
  --lv-error: #ff453a;
  --lv-debug: #8e8e93;
  --lv-fatal: #bf5af2;
  --lv-success: #30d158;
  --mono: "SF Mono", ui-monospace, "Cascadia Code", Consolas, "Courier New", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
          "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}

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

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  font-family: var(--sans);
  color: var(--text);
  background: linear-gradient(165deg, #f6f8fc 0%, #eef1f7 55%, #e9edf5 100%);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  display: flex;
  align-items: center;
  justify-content: center;
}

::selection { background: rgba(10, 132, 255, 0.22); }

/* ---- 背景：柔和色斑，供磨砂玻璃折射 ---- */
.backdrop { position: fixed; inset: 0; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(110px); }
.b1 { width: 560px; height: 560px; left: -140px; top: -180px; background: #c9dcff; opacity: 0.55; }
.b2 { width: 480px; height: 480px; right: -120px; top: 12%; background: #ffdce8; opacity: 0.5; }
.b3 { width: 520px; height: 520px; left: 28%; bottom: -260px; background: #d9f2e2; opacity: 0.45; }

/* ---- 窗口 ---- */
.window {
  position: relative;
  width: min(1240px, calc(100vw - 48px));
  height: min(880px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.6);
  -webkit-backdrop-filter: blur(32px) saturate(1.7);
  backdrop-filter: blur(32px) saturate(1.7);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.65) inset,
    0 0 0 0.5px rgba(0, 0, 0, 0.1),
    0 32px 90px -18px rgba(45, 60, 105, 0.32);
  overflow: clip; /* clip 而非 hidden：窗口不成为滚动容器，侧滑面板不会顶出 scrollLeft */
}

body.dragging .window { outline: 2px dashed var(--accent); outline-offset: -6px; }

/* ---- 标题栏 ---- */
.titlebar {
  flex: none;
  height: 46px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-bottom: 0.5px solid var(--hairline);
}
.traffic { display: flex; gap: 8px; width: 72px; }
.tl { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.14); }
.tl.red { background: #ff5f57; }
.tl.yellow { background: #febc2e; }
.tl.green { background: #28c840; }
.title {
  flex: 1;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: rgba(60, 60, 67, 0.72);
  letter-spacing: 0.1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.titlebar-spacer { width: 72px; }

/* ---- 工具栏 ---- */
.toolbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 0.5px solid var(--hairline);
  background: rgba(255, 255, 255, 0.38);
}
.spacer { flex: 1; }

.open-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  font: 500 12px/1 var(--sans);
  color: var(--text);
  border: none;
  padding: 7px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.055);
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
.open-btn:hover { background: rgba(0, 0, 0, 0.09); }
.open-btn:active { background: rgba(0, 0, 0, 0.13); }
.open-btn:focus-visible { box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }

.file-wrap select {
  appearance: none;
  -webkit-appearance: none;
  max-width: 240px;
  font: 500 12px/1 var(--sans);
  color: var(--text);
  padding: 6px 26px 6px 12px;
  border: none;
  border-radius: 8px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%236e6e73' d='M4.2 6.3a.75.75 0 0 1 1.06 0L8 9.06l2.74-2.76a.75.75 0 1 1 1.06 1.06l-3.27 3.3a.75.75 0 0 1-1.06 0L4.2 7.36a.75.75 0 0 1 0-1.06Z'/%3E%3C/svg%3E")
    no-repeat right 9px center / 12px,
    rgba(0, 0, 0, 0.055);
  cursor: pointer;
  outline: none;
  text-overflow: ellipsis;
}
.file-wrap select:focus { box-shadow: 0 0 0 3px var(--accent-soft); }

.icon-btn {
  flex: none;
  width: 27px;
  height: 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: rgba(0, 0, 0, 0.06); color: var(--text); }
.icon-btn:active { background: rgba(0, 0, 0, 0.1); }
.icon-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

/* 等级过滤 chips */
.chips { display: flex; gap: 4px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 500 12px/1 var(--sans);
  color: var(--text-2);
  border: none;
  padding: 6px 11px;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.chip:hover { background: rgba(0, 0, 0, 0.05); }
.chip.active {
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.06), 0 1px 4px rgba(0, 0, 0, 0.1);
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.chip .count { color: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }

/* 搜索框 */
.search {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 250px;
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.055);
  color: var(--text-3);
  transition: box-shadow 0.15s, background 0.15s;
}
.search:focus-within {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font: 400 12px/1.2 var(--sans);
  color: var(--text);
}
.search input::placeholder { color: var(--text-3); }
.search kbd {
  font: 500 10px/1 var(--mono);
  color: var(--text-3);
  border: 0.5px solid rgba(0, 0, 0, 0.14);
  border-radius: 4px;
  padding: 2px 5px;
  background: rgba(255, 255, 255, 0.6);
}
.search:focus-within kbd { display: none; }

/* ---- 日志列表 ---- */
.list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0 14px;
  outline: none;
  scroll-behavior: auto;
}
.list::-webkit-scrollbar { width: 9px; }
.list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.16);
  border-radius: 999px;
  border: 2.5px solid transparent;
  background-clip: content-box;
}
.list::-webkit-scrollbar-thumb:hover { background-color: rgba(0, 0, 0, 0.3); background-clip: content-box; }

.row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 8px;
  padding: 5.5px 10px;
  border-radius: 8px;
  cursor: default;
}
.row:hover { background: var(--hover); }
.row.selected { background: var(--accent-soft); }

.row .time {
  flex: none;
  width: 88px;
  font: 400 11px/1.5 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
}
.lv-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; align-self: center; }
.lv-info { background: var(--lv-info); }
.lv-warning { background: var(--lv-warning); }
.lv-error { background: var(--lv-error); }
.lv-debug { background: var(--lv-debug); }
.lv-fatal { background: var(--lv-fatal); }

.row .event {
  flex: none;
  font: 500 10.5px/1 var(--mono);
  letter-spacing: 0.2px;
  color: #515154;
  background: rgba(0, 0, 0, 0.055);
  padding: 3px 7px;
  border-radius: 5px;
}
.row .msg {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list.wrap .row .msg { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }

.row.lv-warning-row .msg { color: #8f5b00; }
.row.lv-error-row .msg,
.row.lv-fatal-row .msg { color: #c22a21; }

.render-note {
  margin: 4px 18px 2px;
  font-size: 11px;
  color: var(--text-3);
}

/* ---- 拖放/空状态 ---- */
.dropzone {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--text-3);
  margin: 10px;
  border: 1.5px dashed rgba(0, 0, 0, 0.14);
  border-radius: 12px;
  transition: border-color 0.15s, background 0.15s;
}
body.dragging .dropzone {
  border-color: var(--accent);
  background: rgba(10, 132, 255, 0.05);
}
.empty-icon { opacity: 0.5; margin-bottom: 2px; color: var(--text-2); }
.empty-title { font-size: 14px; font-weight: 600; color: var(--text-2); }
.empty-sub { font-size: 12px; max-width: 420px; text-align: center; line-height: 1.6; }
.empty-sub.hint { margin-top: 10px; font-size: 11px; color: var(--text-3); }

.mini-btn {
  border: none;
  font: 500 12px/1 var(--sans);
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 7px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.mini-btn:hover { background: rgba(10, 132, 255, 0.2); }

/* ---- 详情侧滑面板 ---- */
.detail {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 92%);
  display: flex;
  flex-direction: column;
  background: rgba(252, 252, 253, 0.82);
  -webkit-backdrop-filter: blur(40px) saturate(1.6);
  backdrop-filter: blur(40px) saturate(1.6);
  border-left: 0.5px solid var(--hairline);
  box-shadow: -24px 0 70px rgba(30, 40, 80, 0.1);
  transform: translateX(105%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0.3, 1);
  z-index: 20;
}
.detail.open { transform: translateX(0); }

.d-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px 11px;
  border-bottom: 0.5px solid var(--hairline);
}
.d-head-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.d-head-title strong {
  font: 600 12.5px/1.3 var(--mono);
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.d-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; padding-bottom: 12px; }
.d-body::-webkit-scrollbar { width: 9px; }
.d-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.16);
  border-radius: 999px;
  border: 2.5px solid transparent;
  background-clip: content-box;
}

.d-fields { padding: 4px 16px 8px; }
.d-field {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 10px;
  padding: 7.5px 0;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.055);
}
.d-field:last-child { border-bottom: none; }
.d-field .k { font-size: 11.5px; color: var(--text-2); overflow-wrap: anywhere; }
.d-field .v { font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.d-field .v.mono { font-family: var(--mono); font-size: 11.5px; }
.d-field .v.msg-v { color: var(--text); }

.d-json-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
}
.d-json {
  flex: 1;
  min-height: 120px;
  margin: 0 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.045);
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.05);
  font: 400 11px/1.6 var(--mono);
  color: #3a3a3c;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
}

/* ---- 状态栏 ---- */
.statusbar {
  flex: none;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border-top: 0.5px solid var(--hairline);
  background: rgba(255, 255, 255, 0.38);
  font-size: 11px;
  color: var(--text-2);
}
#statsInfo { font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .search { width: 170px; }
  .search kbd { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
