/* ===== 互联网路书 · 样式 ===== */
:root {
  --bg: #f5f7fa; --surface: #fff; --surface2: #f0f2f5;
  --border: #e2e5ea; --text: #1a1d26; --text2: #7b8494;
  --accent: #3b6de0; --accent-hover: #2a56b8;
  --green: #16a34a; --green-bg: #dcfce7;
  --amber: #ca8a04; --amber-bg: #fefce8;
  --radius: 14px;
}
[data-theme="dark"] {
  --bg: #0d1117; --surface: #161b22; --surface2: #1c2128;
  --border: #30363d; --text: #c9d1d9; --text2: #8b949e;
  --accent: #58a6ff; --accent-hover: #79b8ff;
  --green: #3fb950; --green-bg: rgba(63,185,80,0.15);
  --amber: #d29922; --amber-bg: rgba(210,153,34,0.15);
}
[data-theme="pink"] {
  --bg: #fef5f7; --surface: #fff; --surface2: #fde8ed;
  --border: #f2c4ce; --text: #3d2c33; --text2: #8e6b79;
  --accent: #e8788a; --accent-hover: #d46073;
  /* 抹茶绿替代传统绿，和粉色主题统一 */
  --green: #8cb369; --green-bg: rgba(140,179,105,0.15);
  /* 暖金色替代琥珀色 */
  --amber: #c9a84c; --amber-bg: rgba(201,168,76,0.15);
}
/* ===== 多巴胺主题：荧光粉 + 电光蓝 + 亮橙 ===== */
[data-theme="dopamine"] {
  /* 高饱和度撞色：荧光粉 + 电光蓝 + 荧光绿 + 亮橙 */
  --bg: #f0f2ff; --surface: #fff; --surface2: #ffe5f0;
  --border: #6699ff; --text: #0d0030; --text2: #665588;
  /* 荧光粉：炸眼的霓虹粉 */
  --accent: #ff006e; --accent-hover: #e00060;
  /* 荧光绿：纯度拉满 */
  --green: #00ff55; --green-bg: rgba(0,255,85,0.20);
  /* 亮橙：电光橙黄 */
  --amber: #ff9900; --amber-bg: rgba(255,153,0,0.20);
}
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Noto Sans SC", sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

/* ===== 顶部导航 ===== */
header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.header-inner { max-width: 1400px; margin: 0 auto; padding: 12px 32px; display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 700; color: #888; text-decoration: none; }
.logo-icon { width: 32px; height: 32px; background: var(--accent); border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.user-area { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: #888; }
.user-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 14px; color: #fff; }
.login-btn {
  background: transparent; border: 1.5px solid #ddd; color: #888;
  border-radius: 8px; padding: 5px 14px; font-size: 13px; cursor: pointer; transition: all 0.2s;
}
.login-btn:hover { border-color: var(--accent); color: var(--accent); }
.theme-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid #ddd;
  background: transparent; cursor: pointer; font-size: 15px; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; color: #888;
}
.theme-btn:hover { border-color: var(--accent); color: var(--accent); transform: rotate(15deg); }

/* ===== 搜索区 ===== */
.hero { text-align: center; padding: 140px 48px 52px; }
.hero-title { font-size: 52px; font-weight: 800; margin-bottom: 10px; letter-spacing: -1px; }
.hero-title span { color: var(--accent); }
.hero-sub { font-size: 14px; color: var(--text2); opacity: 0.4; margin-bottom: 36px; letter-spacing: 0.5px; }
.search-wrap { position: relative; max-width: 720px; margin: 0 auto; }
.search-box {
  display: flex; align-items: center; background: var(--surface); border: 3px solid var(--border);
  border-radius: 50px; padding: 5px 7px 5px 18px; transition: all 0.25s;
  box-shadow: 0 8px 48px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.04);
}
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 12px 56px rgba(59,109,224,0.18), 0 4px 12px rgba(59,109,224,0.06);
}
.search-input { flex: 1; border: none; background: transparent; font-size: 18px; padding: 14px 0; outline: none; color: var(--text); min-width: 0; }
.search-input::placeholder { color: #999; }
/* 搜索框内引导图标 */
.search-icon { color: #999; font-size: 20px; margin-right: 10px; flex-shrink: 0; line-height: 1; display: flex; align-items: center; justify-content: center; }
/* 热门搜索标签 */
.search-hot-tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: linear-gradient(135deg, #fff3e0, #ffe0b2);
  border: 1px solid #ffcc80; border-radius: 20px;
  padding: 4px 12px; font-size: 12px; color: #e65100; font-weight: 600;
  flex-shrink: 0; margin-right: 8px; cursor: pointer; transition: all 0.2s;
  white-space: nowrap; user-select: none; line-height: 1;
}
.search-hot-tag:hover { background: linear-gradient(135deg, #ffe0b2, #ffcc80); }
.search-btn {
  background: var(--accent); color: #fff; border: none; border-radius: 50px;
  padding: 12px 32px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.search-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
.suggest-list { position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 8px 32px rgba(0,0,0,0.08); display: none; overflow: hidden; z-index: 10; }
.suggest-list.active { display: block; }
.suggest-item { padding: 10px 18px; display: flex; align-items: center; gap: 10px; cursor: pointer; transition: background 0.1s; }
.suggest-item:hover, .suggest-item.active { background: var(--surface2); }
.suggest-name { font-size: 14px; font-weight: 600; color: var(--text); }
.suggest-url { font-size: 12px; color: var(--text2); margin-top: 1px; }

/* ===== 内容区 ===== */
.content { max-width: 1400px; margin: 0 auto; padding: 0 32px 60px; }

/* 分类标签 */
.cats { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; margin-bottom: 24px; }
.cat {
  background: transparent; border: none;
  color: var(--text2); opacity: 0.65; border-radius: 6px; padding: 5px 12px;
  font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; gap: 4px; position: relative;
}
.cat:hover { opacity: 1; color: var(--text); }
.cat.active { opacity: 1; color: var(--accent); font-weight: 700; }
.cat.active::after {
  content: ''; position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
  width: 20px; height: 2.5px; background: var(--accent); border-radius: 2px;
}

/* 搜索结果 */
.search-results { display: none; margin-bottom: 36px; }
.search-results.visible { display: block; }
.results-meta { font-size: 14px; color: var(--text2); margin-bottom: 16px; }
.results-meta strong { color: var(--text); }

/* 分区标题 */
.section-title {
  font-size: 20px; font-weight: 700; margin-bottom: 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.section-title span { display: flex; align-items: center; gap: 6px; }
.title-actions { display: flex; align-items: center; gap: 8px; }
.add-btn {
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.add-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
.add-btn.sm { padding: 5px 12px; font-size: 12px; background: var(--surface2); color: var(--text2); }
.add-btn.sm:hover { background: var(--border); color: var(--text); }

/* 卡片网格 */
.sites-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.site-card {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 14px; position: relative; display: flex; flex-direction: column; gap: 6px;
  text-decoration: none; color: inherit; transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.site-card:hover { border-color: var(--accent); box-shadow: 0 4px 16px rgba(0,0,0,0.08); transform: translateY(-2px); }
.card-actions { position: absolute; top: 7px; right: 7px; display: flex; align-items: center; gap: 3px; z-index: 5; opacity: 0; transition: opacity 0.15s; }
.site-card:hover .card-actions { opacity: 1; }
.card-action-btn {
  width: 22px; height: 22px; border-radius: 6px; border: 1px solid transparent;
  font-size: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; background: var(--surface2); color: var(--text2); line-height: 1;
}
.card-action-btn:hover { transform: scale(1.15); background: var(--surface); border-color: var(--border); }
.card-action-btn.pin.active { background: var(--amber-bg); border-color: #fde68a; color: var(--amber); }
.card-action-btn.fav.active { background: #fef3c7; border-color: #fcd34d; color: #d97706; }
.pin-badge {
  position: absolute; top: 5px; left: 7px;
  font-size: 10px; opacity: 0.5;
}
.card-top { display: flex; align-items: center; }
.card-favicon { width: 34px; height: 34px; border-radius: 9px; background: var(--surface2); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.card-name { font-size: 14px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.card-desc { font-size: 12px; color: var(--text2); line-height: 1.4; min-height: 0; }
.card-url { display: none; }
.card-official {
  display: inline-block;
  font-size: 11px; font-weight: 700;
  color: var(--green);
  background: var(--green-bg);
  padding: 3px 8px;
  border-radius: 20px;
  margin-top: 4px;
}

/* 置顶分割线 */
.pin-divider {
  grid-column: 1 / -1;
  font-size: 11px; font-weight: 600; color: var(--text2);
  margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border);
  text-align: center;
}

/* 展开更多按钮 */
.expand-all-btn {
  display: block; width: 100%; max-width: 280px; margin: 18px auto 0;
  background: transparent; border: 1.5px dashed var(--border); color: var(--text2);
  border-radius: 10px; padding: 10px 0; font-size: 13px; cursor: pointer;
  transition: all 0.2s; text-align: center;
}
.expand-all-btn:hover { border-color: var(--accent); color: var(--accent); }

/* 空状态 */
.empty-state { text-align: center; padding: 48px 0; grid-column: 1 / -1; }
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { color: var(--text2); font-size: 15px; margin: 0; }

/* 收藏夹登录提示 */
.fav-login-hint {
  background: var(--surface2); border: 1.5px dashed var(--border); border-radius: var(--radius);
  padding: 16px 20px; margin-bottom: 20px; display: flex; align-items: center; gap: 12px; cursor: pointer;
  transition: all 0.2s;
}
.fav-login-hint:hover { border-color: var(--accent); }
.fav-login-hint .hint-icon { font-size: 20px; }
.fav-login-hint .hint-text { flex: 1; }
.fav-login-hint .hint-title { font-size: 14px; font-weight: 600; color: var(--text); }
.fav-login-hint .hint-desc { font-size: 12px; color: var(--text2); }
.fav-login-hint .hint-btn { font-size: 13px; color: var(--accent); font-weight: 600; }

/* 文件夹 */
.folder-card {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; display: flex; flex-direction: column;
}
.folder-header { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.folder-name { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
.folder-name .icon { font-size: 20px; }
.folder-actions { display: flex; gap: 6px; }
.folder-action-btn { font-size: 14px; cursor: pointer; color: var(--text2); opacity: 0.4; transition: opacity 0.15s; }
.folder-action-btn:hover { opacity: 1; color: var(--accent); }
.folder-sites { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.folder-card.collapsed .folder-sites { display: none; }
.folder-toggle { font-size: 12px; color: var(--text2); margin-left: 4px; transition: transform 0.2s; }
.folder-card.collapsed .folder-toggle { transform: rotate(-90deg); }

footer { text-align: center; padding: 24px; font-size: 12px; color: var(--text2); opacity: 0.5; border-top: 1px solid var(--border); margin-top: 20px; }

/* 弹窗 */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 60; align-items: center; justify-content: center; padding: 16px; }
.modal-overlay.active { display: flex; }
.modal-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); max-width: 460px; width: 100%; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; }
.modal-close { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--border); background: transparent; font-size: 18px; cursor: pointer; color: var(--text2); display: flex; align-items: center; justify-content: center; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-group input, .form-group select {
  width: 100%; background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 10px 14px; font-size: 14px; color: var(--text);
  outline: none; transition: all 0.2s;
}
.form-group input:focus, .form-group select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,109,224,0.1); }
.form-group select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237b8494' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.modal-btns { display: flex; gap: 10px; margin-top: 20px; }
.modal-btns button { flex: 1; padding: 10px 0; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.modal-btns .btn-primary { background: var(--accent); color: #fff; border: none; }
.modal-btns .btn-primary:hover { background: var(--accent-hover); }
.modal-btns .btn-secondary { background: var(--surface2); color: var(--text2); border: 1.5px solid var(--border); }

/* ===== Bookmarklet 安装引导 ===== */
.bm-install {
  background: var(--surface); border: 1.5px dashed var(--accent);
  border-radius: var(--radius); padding: 20px 24px;
  margin-bottom: 20px; display: flex;
  align-items: center; gap: 16px;
}
.bm-install-icon { font-size: 32px; flex-shrink: 0; }
.bm-install-text { flex: 1; min-width: 0; }
.bm-install-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.bm-install-desc { font-size: 13px; color: var(--text2); line-height: 1.5; }
.bm-install-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #fff;
  border: none; border-radius: 8px;
  padding: 9px 18px; font-size: 13px; font-weight: 700;
  cursor: grab; text-decoration: none; white-space: nowrap;
  transition: all 0.2s; user-select: none;
}
.bm-install-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
.bm-install-btn:active { cursor: grabbing; transform: scale(0.97); }
.bm-install-dismiss { font-size: 18px; color: var(--text2); cursor: pointer; padding: 4px; opacity: 0.5; transition: opacity 0.15s; }
.bm-install-dismiss:hover { opacity: 1; }

/* ===== 登录弹窗 ===== */
.login-tabs { display: flex; gap: 4px; margin-bottom: 20px; }
.login-tab { flex: 1; padding: 10px; text-align: center; font-size: 14px; font-weight: 600; border-radius: 10px; cursor: pointer; border: 1.5px solid var(--border); background: transparent; color: var(--text2); transition: all 0.2s; }
.login-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.login-tips { font-size: 12px; color: var(--text2); margin-top: 12px; text-align: center; }
.login-motto-inline { font-size: 11px; color: #aaa; font-weight: 400; white-space: nowrap; margin-left: 6px; }

/* ===== 导入浏览器收藏夹 ===== */
.import-guide { background: var(--bg); border-radius: 10px; padding: 16px; margin-bottom: 20px; }
.import-guide-title { font-size: 14px; font-weight: 600; margin: 0 0 12px 0; color: var(--text); }
.import-guide-item { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px; font-size: 13px; color: var(--text2); line-height: 1.6; }
.import-guide-item:last-of-type { margin-bottom: 0; }
.import-guide-badge { flex-shrink: 0; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.import-guide-badge.chrome-badge { background: #e8f5e9; color: #2e7d32; }
.import-guide-badge.edge-badge { background: #e3f2fd; color: #1565c0; }
.import-guide-badge.firefox-badge { background: #fff3e0; color: #e65100; }
.import-guide-note { font-size: 13px; color: var(--text2); margin: 12px 0 0 0; }
.import-file-area { text-align: center; padding: 12px 0 0 0; }
.import-support { font-size: 12px; color: var(--text2); margin-top: 8px; }

.import-preview-info { font-size: 13px; color: var(--text2); margin-bottom: 12px; text-align: center; }
.import-preview-actions { display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; }
.import-preview-list { max-height: 50vh; overflow-y: auto; }
.import-group { margin-bottom: 12px; }
.import-group-header { font-size: 13px; font-weight: 600; color: var(--text); padding: 6px 8px; background: var(--bg); border-radius: 8px; margin-bottom: 6px; }
.import-group-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px; }
.import-item { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; cursor: pointer; transition: background 0.15s; }
.import-item:hover { background: var(--bg); }
.import-item input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--accent); flex-shrink: 0; }
.import-item-icon { font-size: 15px; flex-shrink: 0; }
.import-item-name { font-size: 13px; color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-item-url { display: none; }
.import-duplicate-note { font-size: 12px; color: var(--text2); text-align: center; margin-top: 12px; }

/* ===== 访问统计弹窗 ===== */
#statsContent { font-size: 13px; }
#statsContent * { box-sizing: border-box; }

@media (max-width: 600px) {
  .header-inner { padding: 12px 16px; }
  .hero { padding: 64px 16px 32px; }
  .hero-title { font-size: 30px; }
  .search-input { font-size: 15px; padding: 11px 0; }
  .search-box { padding: 3px 5px 3px 18px; }
  .search-btn { padding: 9px 20px; font-size: 14px; }
  .content { padding: 0 16px 40px; max-width: 100%; }
  .sites-grid { grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); }
}
