/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-from: #dbeafe;
  --bg-to:   #ede9fe;
  --card-bg: rgba(255, 255, 255, 0.82);
  --card-border: rgba(255, 255, 255, 0.9);
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --accent: #3b82f6;
  --accent-light: #eff6ff;
  --tag-ok: #22c55e;
  --tag-ok-bg: #f0fdf4;
  --tag-warn: #f59e0b;
  --tag-warn-bg: #fffbeb;
  --tag-unknown: #94a3b8;
  --tag-unknown-bg: #f8fafc;
  --radius-card: 18px;
  --radius-btn: 10px;
  --shadow-card: 0 8px 40px rgba(59, 130, 246, 0.10), 0 2px 8px rgba(0,0,0,0.06);
  --transition: 0.18s ease;
}

html { font-size: 15px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-from) 0%, var(--bg-to) 100%);
  padding: 40px 16px 60px;
}

/* ===== Animated background blobs ===== */
.bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.bg::before, .bg::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  animation: blobFloat 12s ease-in-out infinite alternate;
}
.bg::before {
  width: 520px; height: 520px;
  background: radial-gradient(circle, #93c5fd, #c4b5fd);
  top: -120px; left: -100px;
}
.bg::after {
  width: 420px; height: 420px;
  background: radial-gradient(circle, #a5f3fc, #86efac);
  bottom: -100px; right: -80px;
  animation-delay: -6s;
}
@keyframes blobFloat {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, 20px) scale(1.06); }
}

/* ===== Layout ===== */
.wrapper {
  position: relative; z-index: 1;
  width: 100%; max-width: 680px;
  display: flex; flex-direction: column; align-items: center; gap: 20px;
}

/* ===== Header ===== */
.site-header { text-align: center; }
.site-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}
.site-desc {
  margin-top: 6px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

/* ===== Card ===== */
.card {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  overflow: hidden;
}

/* ===== Toolbar ===== */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  gap: 8px;
  flex-wrap: wrap;
}

.categories {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cat-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 13px;
  border: none;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  background: transparent;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}
.cat-btn:hover { background: #f1f5f9; color: var(--text-primary); }
.cat-btn.active {
  background: var(--accent);
  color: #fff;
}
.cat-btn .count {
  font-size: 0.72rem;
  opacity: 0.8;
}

.toolbar-right { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border: none; border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.icon-btn:hover { background: #f1f5f9; color: var(--text-primary); }
.icon-btn.active { background: var(--accent-light); color: var(--accent); }

/* ===== Search Bar ===== */
.search-bar {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  background: #f8fafc;
}
.search-bar.open { display: flex; }
.search-bar svg { flex-shrink: 0; color: var(--text-muted); }
.search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.9rem;
  color: var(--text-primary);
  outline: none;
}
.search-bar input::placeholder { color: var(--text-muted); }
.clear-btn {
  border: none; background: none;
  color: var(--text-muted);
  cursor: pointer; font-size: 0.8rem;
  padding: 2px 4px; border-radius: 4px;
  transition: color var(--transition);
}
.clear-btn:hover { color: var(--text-primary); }

/* ===== Bookmark List ===== */
.bookmark-list { padding: 4px 0; }

.bookmark-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 18px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  transition: background var(--transition);
  cursor: pointer;
}
.bookmark-item:last-child { border-bottom: none; }
.bookmark-item:hover { background: rgba(59, 130, 246, 0.04); }

.bm-favicon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: #f1f5f9;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid rgba(0,0,0,0.06);
}
.bm-favicon img {
  width: 22px; height: 22px;
  object-fit: contain;
}

.bm-info { flex: 1; min-width: 0; }
.bm-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bm-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bm-tag {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 20px;
}
.bm-tag.ok   { color: var(--tag-ok);      background: var(--tag-ok-bg); }
.bm-tag.warn { color: var(--tag-warn);     background: var(--tag-warn-bg); }
.bm-tag.unknown { color: var(--tag-unknown); background: var(--tag-unknown-bg); }

/* ===== Empty State ===== */
.empty-state {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.empty-state svg { margin-bottom: 12px; opacity: 0.4; }

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid rgba(0,0,0,0.05);
  font-size: 0.8rem;
  color: var(--text-muted);
}
.page-info { }
.page-btns { display: flex; gap: 6px; }

.page-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 5px 14px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 8px;
  background: #fff;
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
}
.page-btn:hover:not(:disabled) { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-btn:disabled { opacity: 0.38; cursor: not-allowed; }

/* ===== Footer ===== */
.site-footer {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

/* ===== Highlight match ===== */
mark {
  background: #fef08a;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
  body { padding: 24px 10px 48px; }
  .site-title { font-size: 1.4rem; }
  .toolbar { padding: 10px 14px; }
  .bookmark-item { padding: 11px 14px; gap: 10px; }
  .bm-favicon { width: 32px; height: 32px; border-radius: 8px; }
  .pagination { padding: 10px 14px; }
}
