/* ============================================
   JifangClaw 龙虾导航 - Claude (Anthropic) Style
   Warm parchment, terracotta accent, editorial serif
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ===== CSS VARIABLES ===== */
:root {
  /* Surfaces */
  --bg-primary: #f5f4ed;
  --bg-secondary: #faf9f5;
  --bg-card: #ffffff;
  --bg-sidebar: #faf9f5;
  --bg-header: rgba(245,244,237,0.92);
  --bg-footer: #141413;
  /* Text */
  --text-primary: #141413;
  --text-secondary: #5e5d59;
  --text-muted: #87867f;
  /* Accent */
  --accent: #c96442;
  --accent-hover: #d97757;
  --accent-light: rgba(201,100,66,0.08);
  /* Borders */
  --border-light: #f0eee6;
  --border-warm: #e8e6dc;
  --border-dark: #30302e;
  /* Shadows */
  --shadow-ring: 0px 0px 0px 1px rgba(0,0,0,0.06);
  --shadow-card: rgba(0,0,0,0.05) 0px 4px 24px;
  --shadow-hover: 0px 0px 0px 1px #d1cfc5, rgba(0,0,0,0.08) 0px 8px 32px;
  /* Layout */
  --sidebar-width: 200px;
  --header-height: 68px;
  /* Typography */
  --font-serif: Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  /* Tags */
  --tag-free-bg: rgba(22,163,74,0.08);
  --tag-free-text: #16a34a;
  --tag-free-border: rgba(22,163,74,0.2);
  --tag-paid-bg: rgba(201,100,66,0.08);
  --tag-paid-text: #c96442;
  --tag-paid-border: rgba(201,100,66,0.2);
  --tag-cloud-bg: rgba(56,152,236,0.08);
  --tag-cloud-text: #3898ec;
  --tag-cloud-border: rgba(56,152,236,0.2);
  --tag-local-bg: rgba(147,51,234,0.08);
  --tag-local-text: #9333ea;
  --tag-local-border: rgba(147,51,234,0.2);
  --tag-open-bg: rgba(13,148,136,0.08);
  --tag-open-text: #0d9488;
  --tag-open-border: rgba(13,148,136,0.2);
}

/* ===== DARK MODE ===== */
[data-theme="dark"] {
  --bg-primary: #141413;
  --bg-secondary: #1a1a18;
  --bg-card: #1e1e1c;
  --bg-sidebar: #1a1a18;
  --bg-header: rgba(20,20,19,0.92);
  --bg-footer: #0a0a09;
  --text-primary: #faf9f5;
  --text-secondary: #b0aea5;
  --text-muted: #706f6a;
  --accent: #d97757;
  --accent-hover: #e89070;
  --accent-light: rgba(217,119,87,0.12);
  --border-light: #30302e;
  --border-warm: #30302e;
  --border-dark: #30302e;
  --shadow-ring: 0px 0px 0px 1px rgba(255,255,255,0.06);
  --shadow-card: rgba(0,0,0,0.3) 0px 4px 24px;
  --shadow-hover: 0px 0px 0px 1px rgba(255,255,255,0.1), rgba(0,0,0,0.4) 0px 8px 32px;
  --tag-free-bg: rgba(74,222,128,0.1);
  --tag-free-text: #4ade80;
  --tag-free-border: rgba(74,222,128,0.2);
  --tag-paid-bg: rgba(217,119,87,0.1);
  --tag-paid-text: #d97757;
  --tag-paid-border: rgba(217,119,87,0.2);
  --tag-cloud-bg: rgba(96,165,250,0.1);
  --tag-cloud-text: #60a5fa;
  --tag-cloud-border: rgba(96,165,250,0.2);
  --tag-local-bg: rgba(192,132,252,0.1);
  --tag-local-text: #c084fc;
  --tag-local-border: rgba(192,132,252,0.2);
  --tag-open-bg: rgba(94,234,212,0.1);
  --tag-open-text: #5eead4;
  --tag-open-border: rgba(94,234,212,0.2);
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }
button { font-family: var(--font-sans); cursor: pointer; }

/* ===== HEADER ===== */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  padding: 0 32px;
  z-index: 1000;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.logo .blue { color: var(--text-primary); }
.logo .red { color: var(--accent); }

.header-nav { display: flex; gap: 2px; }
.header-nav a {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.header-nav a:hover { color: var(--text-primary); background: var(--accent-light); }
.header-nav a.active { color: var(--text-primary); }

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
  max-width: 560px;
  margin: 0 auto;
}

.search-box { width: 100%; max-width: 480px; }

.search-engine-toggle {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}
.search-engine-toggle button {
  background: none;
  border: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px 10px;
  border-radius: 6px;
  transition: all 0.15s;
}
.search-engine-toggle button.active {
  color: var(--text-primary);
  background: var(--accent-light);
}

.search-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-warm);
  border-radius: 12px;
  padding: 0 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0px 0px 0px 3px rgba(201,100,66,0.1);
}
.search-input-wrap input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  font-weight: 400;
  padding: 10px 8px;
  color: var(--text-primary);
  font-family: var(--font-sans);
}
.search-input-wrap input::placeholder { color: var(--text-muted); }
.search-icon { color: var(--text-muted); font-size: 14px; }

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

.theme-toggle, .lang-toggle {
  background: var(--bg-secondary);
  border: 1px solid var(--border-warm);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.theme-toggle:hover, .lang-toggle:hover {
  color: var(--text-primary);
  border-color: var(--border-dark);
}

.login-btn {
  background: var(--accent);
  color: #faf9f5;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
}
.login-btn:hover { background: var(--accent-hover); }

/* ===== LAYOUT ===== */
.layout {
  display: flex;
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  overflow-y: auto;
  padding: 20px 0;
  z-index: 100;
}

.sidebar-menu { display: flex; flex-direction: column; gap: 2px; }

.sidebar-item {
  display: flex;
  align-items: center;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  border-radius: 0;
  margin: 0 8px;
  border-radius: 8px;
}
.sidebar-item:hover {
  color: var(--text-primary);
  background: var(--accent-light);
}
.sidebar-item.active {
  color: var(--accent);
  background: var(--accent-light);
  font-weight: 600;
}
.sidebar-item .sidebar-icon { margin-right: 8px; font-size: 14px; }

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 48px 5vw 36px;
  width: calc(100% - var(--sidebar-width));
}

/* Tag filter bar */
.tag-filter-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 40px;
  flex-wrap: wrap;
  align-items: center;
}
.tag-filter-bar .filter-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-right: 4px;
}
.tag-filter-btn {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border-warm);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.tag-filter-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-dark);
}
.tag-filter-btn.active {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

/* ===== SECTION ===== */
.section { margin-bottom: 48px; }
.section.hidden { display: none; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-warm);
}

.section-title {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.section-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border-warm);
  padding: 3px 10px;
  border-radius: 12px;
}

.section-sort { display: flex; gap: 4px; }
.sort-btn {
  padding: 5px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border-warm);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.sort-btn:hover { color: var(--text-primary); border-color: var(--border-dark); }
.sort-btn.active {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

/* ===== CARD GRID ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(22%, 1fr));
  gap: 12px;
}

.card {
  display: flex;
  align-items: center;
  padding: 16px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-ring);
  transition: all 0.2s ease;
  position: relative;
  cursor: pointer;
}
.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
  border-color: var(--border-warm);
}
.card.hidden { display: none; }

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin-right: 14px;
  overflow: hidden;
}

.card-body { flex: 1; min-width: 0; }

.card-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.card-desc {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  line-height: 1.5;
}

.card-tags { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  border: 1px solid;
}
.tag-free { background: var(--tag-free-bg); color: var(--tag-free-text); border-color: var(--tag-free-border); }
.tag-paid { background: var(--tag-paid-bg); color: var(--tag-paid-text); border-color: var(--tag-paid-border); }
.tag-cloud { background: var(--tag-cloud-bg); color: var(--tag-cloud-text); border-color: var(--tag-cloud-border); }
.tag-local { background: var(--tag-local-bg); color: var(--tag-local-text); border-color: var(--tag-local-border); }
.tag-open { background: var(--tag-open-bg); color: var(--tag-open-text); border-color: var(--tag-open-border); }

.card-fav {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  transition: color 0.15s, transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.card-fav:hover { color: var(--accent); transform: scale(1.15); }
.card-fav.active { color: var(--accent); }

.card-new-badge {
  position: absolute;
  top: -2px;
  right: 32px;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

/* ===== FLOATING TOOLBAR ===== */
.float-toolbar {
  position: fixed;
  right: 24px;
  bottom: 100px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 999;
}
.float-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  box-shadow: var(--shadow-card);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
}
.float-btn:hover {
  color: var(--accent);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

/* ===== BOOKMARK BANNER ===== */
.bookmark-banner {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  text-align: center;
  padding: 64px 32px;
  margin-left: var(--sidebar-width);
}
.bookmark-banner h2 {
  font-family: var(--font-serif);
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 500;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
  color: var(--text-primary);
  line-height: 1.15;
}
.bookmark-banner p {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.6;
}
.bookmark-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #faf9f5;
  border: none;
  border-radius: 10px;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.bookmark-btn:hover { background: var(--accent-hover); }

/* ===== FOOTER ===== */
.footer {
  background: var(--bg-footer);
  color: #87867f;
  padding: 56px 40px 28px;
  margin-left: var(--sidebar-width);
}

.footer-content {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
}

.footer-brand h3 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  color: #faf9f5;
  margin-bottom: 12px;
}
.footer-brand h3 .blue { color: #faf9f5; }
.footer-brand h3 .red { color: var(--accent); }
.footer-brand p {
  font-size: 14px;
  line-height: 1.7;
  color: #706f6a;
  max-width: 360px;
}

.footer-qr { text-align: center; }
.footer-qr h4 {
  color: #faf9f5;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 12px;
}
.qr-placeholder {
  width: 120px;
  height: 120px;
  border: 1px dashed #30302e;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5e5d59;
  font-size: 12px;
  margin: 0 auto;
}

.footer-bottom {
  max-width: 1100px;
  margin: 28px auto 0;
  padding-top: 20px;
  border-top: 1px solid #30302e;
  text-align: center;
  font-size: 12px;
  color: #5e5d59;
}
.footer-disclaimer {
  max-width: 1100px;
  margin: 10px auto 0;
  text-align: center;
  font-size: 11px;
  color: #4d4c48;
}

/* ===== NO RESULTS ===== */
.no-results {
  display: none;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}
.no-results.visible { display: block; }
.no-results .emoji { font-size: 48px; margin-bottom: 16px; opacity: 0.6; }
.no-results p { font-size: 16px; font-weight: 500; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-warm); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== MOBILE ===== */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-warm);
  border-radius: 8px;
  font-size: 18px;
  color: var(--text-primary);
  padding: 4px 10px;
}

@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s; }
  .sidebar.open { transform: translateX(0); box-shadow: 8px 0 24px rgba(0,0,0,0.1); }
  .main-content { margin-left: 0; padding: 24px 4vw; width: 100%; }
  .footer, .bookmark-banner { margin-left: 0; }
  .mobile-menu-toggle { display: block; }
  .header-nav { display: none; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(45%, 1fr)); }
  .footer-content { grid-template-columns: 1fr; gap: 32px; }
}

@media (max-width: 640px) {
  .header { padding: 0 16px; }
  .header-center { max-width: none; }
  .card-grid { grid-template-columns: 1fr; }
  .float-toolbar { right: 12px; bottom: 80px; }
  .bookmark-banner { padding: 40px 16px; }
  .bookmark-banner h2 { font-size: 28px; }
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(4px);
  z-index: 99;
}
.sidebar-overlay.visible { display: block; }
