/* NavMark — 主样式 v2 */

:root {
  --bg: #ffffff;
  --bg-secondary: #f1f3f4;
  --text: #202124;
  --text-secondary: #5f6368;
  --border: #dadce0;
  --card-bg: #ffffff;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.1);
  --card-hover-shadow: 0 2px 8px rgba(0,0,0,0.15);
  --accent: #1a73e8;
  --accent-hover: #1557b0;
  --danger: #d93025;
  --success: #188038;
  --warning: #f9ab00;
  --input-bg: #ffffff;
  --overlay: rgba(0,0,0,0.4);
  --pinned-bg: #e8f0fe;
  --nav-bg: #ffffff;
  --dropdown-bg: #ffffff;
  --dropdown-hover: #f1f3f4;
  --btn-bg: #f1f3f4;
  --btn-text: #202124;
  --badge-bg: #e8f0fe;
  --badge-text: #1a73e8;
}

[data-theme="dark"] {
  --bg: #1a1a2e;
  --bg-secondary: #16213e;
  --text: #e8eaed;
  --text-secondary: #9aa0a6;
  --border: #3c4043;
  --card-bg: #16213e;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.3);
  --card-hover-shadow: 0 2px 8px rgba(0,0,0,0.5);
  --accent: #8ab4f8;
  --accent-hover: #aecbfa;
  --danger: #f28b82;
  --success: #81c995;
  --warning: #fdd663;
  --input-bg: #2d2d44;
  --overlay: rgba(0,0,0,0.6);
  --pinned-bg: #1e3a5f;
  --nav-bg: #16213e;
  --dropdown-bg: #16213e;
  --dropdown-hover: #1a3a5f;
  --btn-bg: #2d2d44;
  --btn-text: #e8eaed;
  --badge-bg: #1e3a5f;
  --badge-text: #8ab4f8;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

.main-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px;
  overflow-x: hidden;
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 56px;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-nav-left {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 4px;
}

.nav-links a {
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s;
}

.nav-links a:hover { background: var(--bg-secondary); }
.nav-links a.active { background: var(--accent); color: white; }

.top-nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.user-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--btn-bg);
  color: var(--btn-text);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.user-btn:hover { box-shadow: var(--card-shadow); }

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--dropdown-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 160px;
  display: none;
  z-index: 100;
}

.dropdown-menu.show { display: block; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  color: var(--text) !important;
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover { background: var(--dropdown-hover); }
.dropdown-item:first-child { border-radius: 8px 8px 0 0; }
.dropdown-item:last-child { border-radius: 0 0 8px 8px; }

/* ============ Main Content ============ */
.main-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--btn-bg);
  color: var(--btn-text);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  text-decoration: none;
}

.btn:hover { box-shadow: var(--card-hover-shadow); }
.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 6px; border: none; background: none; cursor: pointer; color: var(--text-secondary); font-size: 16px; }
.btn-icon:hover { color: var(--text); }

/* ============ Search (Google style) ============ */
.search-section {
  text-align: center;
  padding: 40px 16px 24px;
}

.search-logo {
  font-size: 40px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 20px;
}

.search-bar {
  max-width: 584px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-bar input {
  flex: 1;
  padding: 12px 20px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: box-shadow 0.2s;
}

.search-bar input:focus {
  box-shadow: 0 1px 6px rgba(32,33,36,0.28);
  border-color: transparent;
}

/* ============ Bookmark cards ============ */
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 20px 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bookmark-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
  margin-bottom: 20px;
}

.bookmark-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
  cursor: pointer;
}

.bookmark-card:hover {
  box-shadow: var(--card-hover-shadow);
  transform: translateY(-1px);
}

.folder-grid {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.folder-card {
  padding: 20px 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
}

.folder-card:hover {
  background: var(--bg-secondary);
  border-color: var(--accent);
}

.bookmark-card .icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.bookmark-card .title {
  font-size: 11px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* Pinned */
.pinned-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.pinned-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 64px;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}

.pinned-item:hover { transform: scale(1.1); }

.pinned-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--pinned-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.pinned-label { font-size: 11px; text-align: center; }

/* ============ Article list ============ */
.article-list { display: flex; flex-direction: column; gap: 6px; }

.article-item {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  cursor: pointer;
  transition: all 0.2s;
}

.article-item:hover { box-shadow: var(--card-shadow); }

.article-item .title {
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}

.article-item .url { font-size: 11px; color: var(--success); margin-top: 2px; }

.article-item .note {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
  padding: 6px 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
}

/* ============ Notes ============ */
.note-list { display: flex; flex-direction: column; gap: 6px; }

.note-card {
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  cursor: pointer;
  transition: all 0.2s;
}
.note-card:hover { box-shadow: var(--card-shadow); }
.note-card.pinned { border-left: 3px solid var(--danger); background: var(--pinned-bg); }
.article-item.pinned { border-left: 3px solid var(--danger); background: var(--pinned-bg); border-radius: 8px; padding-left: 4px; }
.note-card.loading { border-color: var(--accent); background: var(--bg-secondary); box-shadow: 0 0 0 1px var(--accent); }
.note-card .loading-overlay { position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:rgba(255,255,255,0.85);border-radius:8px;z-index:1; }
.note-card { position:relative; }

.note-card .title {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
}

.note-card .preview {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-card .meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* Popular icon wrapper + badge */
.popular-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  position: relative;
}

.popular-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: bold;
  border-radius: 8px;
  padding: 1px 5px;
  line-height: 1.4;
  pointer-events: none;
}

/* Hide scrollbar for popular row but keep scrolling */
#popular-row::-webkit-scrollbar { display: none; }

/* ============ Forms ============ */
.form-group { margin-bottom: 14px; }

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-secondary);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
}

.form-group textarea {
  min-height: 160px;
  resize: vertical;
  font-family: monospace;
  font-size: 13px;
}

/* ============ Modal ============ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}

.modal {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  width: 95vw;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.2);
}

.modal .form-group input,
.modal .form-group select,
.modal .form-group textarea {
  max-width: 100%;
  box-sizing: border-box;
}

/* ============ Note editor ============ */
.note-editor-modal .modal {
  width: 100vw;
  max-width: 100vw;
  max-height: 100vh;
  border-radius: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.modal-overlay.note-editor-modal {
  padding: 0;
  align-items: stretch;
}
.note-editor-modal .modal > div {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.note-editor-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px 20px 16px;
  overflow: hidden;
}
.note-editor-body .form-group { margin-bottom: 6px; }
.note-editor-body textarea {
  flex: 1;
  min-height: 100px;
  resize: none;
  font-size: 14px;
  line-height: 1.6;
}

.note-editor-body textarea { background: var(--bg); color: var(--text); border: 1px solid var(--border); }

/* Focus mode — hide everything but textarea + preview + toolbar */
.note-editor-body.focus-mode .form-group,
.note-editor-body.focus-mode label,
.note-editor-body.focus-mode .modal-actions,
.note-editor-body.focus-mode div[style*="flex:1;min-height"] { display: none; }

.note-editor-body.focus-mode { padding: 0; }
.note-editor-body.focus-mode textarea,
.note-editor-body.focus-mode .note-preview {
  position: fixed;
  top: 42px; left: 0; right: 0; bottom: 0;
  height: auto;
  border-radius: 0 !important;
  padding: 16px;
  z-index: 210;
  font-size: 16px;
  overflow-y: auto;
}
.note-editor-body.focus-mode textarea {
  border: none !important;
}
.note-editor-body.focus-mode .note-toolbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 211;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--border);
}

/* Markdown toolbar */
.note-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
  background: var(--bg-secondary);
  align-items: center;
  user-select: none;
}
.note-toolbar button {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}
.note-toolbar button:hover { background: var(--hover-bg); }
.note-toolbar .sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

/* Preview toggle */
.preview-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-left: auto;
}
.preview-toggle button {
  width: auto;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 0;
}
.preview-toggle button.active {
  background: var(--accent);
  color: #fff;
}
/* 按钮文字标签 — 竖屏移动端隐藏以节省空间 */
@media (orientation: portrait) {
  .preview-toggle button .btn-label { display: none; }
}

/* Preview pane */
.note-preview {
  flex: 1;
  min-height: 100px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.7;
  background: var(--card-bg);
  height: 0;
  min-height: 100px;
}
.note-preview h1 { font-size: 22px; margin: 12px 0 8px; }
.note-preview h2 { font-size: 18px; margin: 10px 0 6px; }
.note-preview h3 { font-size: 16px; margin: 8px 0 4px; }
.note-preview p { margin: 6px 0; }
.note-preview code {
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 13px;
}
.note-preview pre {
  background: var(--bg-secondary);
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
}
.note-preview pre code { background: none; padding: 0; }
.note-preview blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  color: var(--text-secondary);
  margin: 8px 0;
}
.note-preview ul, .note-preview ol { padding-left: 20px; margin: 6px 0; }
.note-preview a { color: var(--accent); }
.note-preview img { max-width: 100%; border-radius: 4px; }

@media (max-width: 600px) {
  .note-editor-body { padding: 8px 12px 12px; }
  .modal { width: 100vw; max-width: 100vw; border-radius: 12px 12px 0 0; margin-top: auto; padding: 16px; max-height: 85vh; }
  .modal-overlay { align-items: flex-end; }
  /* Note editor full-screen overrides for mobile */
  .modal-overlay.note-editor-modal { align-items: stretch; padding: 0; }
  .modal-overlay.note-editor-modal .modal { width: 100vw; max-width: 100vw; max-height: 100vh; border-radius: 0; margin-top: 0; padding: 0; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  color: var(--text);
}

.modal-header h2 { font-size: 17px; font-weight: 600; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

/* ============ Admin panel ============ */
.admin-panel {
  display: flex;
  gap: 16px;
}

.admin-sidebar {
  width: 260px;
  flex-shrink: 0;
}

.admin-main { flex: 1; }

.folder-tree { list-style: none; }

.folder-tree li {
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
}

.folder-tree li:hover { background: var(--bg-secondary); }
.folder-tree li.active { background: var(--accent); color: white; }
.folder-tree li .count { margin-left: auto; font-size: 11px; color: var(--text-secondary); }

.tree-folder:hover { background: var(--bg-secondary); }
.tree-folder.active { background: var(--accent); color: white; }
.tree-folder.active .tree-count { color: rgba(255,255,255,0.8) !important; }
.tree-folder:hover .drag-handle,
.article-item:hover .drag-handle { opacity: 0.8 !important; }

/* ============ Split layout ============ */
.split-layout {
  display: flex;
  gap: 16px;
}

.split-left { width: 240px; flex-shrink: 0; }
.split-right { flex: 1; }

/* ============ Page header ============ */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 8px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}

/* ============ Settings ============ */
.settings-section { margin-bottom: 28px; }

.settings-section h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  color: var(--text);
}

.settings-row span { font-size: 14px; color: var(--text); }

/* ============ Filter bar ============ */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.filter-bar select,
.filter-bar input {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.filter-bar input:focus,
.filter-bar select:focus {
  border-color: var(--accent);
}

/* ============ Empty state ============ */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-secondary);
}

.empty-state .icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; margin-bottom: 6px; color: var(--text); }
.empty-state p { font-size: 13px; }

/* ============ Toast ============ */
.toast {
  position: fixed;
  top: 16px;
  right: 16px;
  padding: 10px 18px;
  border-radius: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: var(--card-hover-shadow);
  color: var(--text);
  z-index: 300;
  font-size: 14px;
  animation: slideIn 0.3s ease;
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.info { border-color: var(--accent); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============ Checkbox group ============ */
.checkbox-group {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}

/* ============ Import zone ============ */
.import-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-secondary);
}

.import-zone:hover { border-color: var(--accent); background: var(--bg-secondary); }

/* ============ Stats ============ */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.stat-card {
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  text-align: center;
  color: var(--text);
}

.stat-card .num { font-size: 24px; font-weight: 700; color: var(--accent); }
.stat-card .label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ============ Toggle Switch ============ */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--border); border-radius: 22px;
  transition: background 0.3s;
}
.slider::before {
  content: ''; position: absolute; height: 16px; width: 16px;
  left: 3px; bottom: 3px; background: #fff; border-radius: 50%;
  transition: transform 0.3s;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* ============ Mobile hamburger ============ */
.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
}

/* ============ Responsive ============ */
@media (max-width: 768px) {
  .hamburger { display: block; }

  .nav-links {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 49;
  }

  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 12px; }

  .bookmark-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }

  .admin-panel { flex-direction: column; }
  .admin-sidebar { width: 100%; }

  .split-layout { flex-direction: column; }
  .split-left { width: 100%; }

  .search-section { padding: 24px 8px 16px; }
  .search-logo { font-size: 32px; }
}

/* ============ Tree toolbar ============ */
.tree-toolbar {
  display: none;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Locked modal — prevents close during async operations */
.modal-overlay.locked .btn-icon,
.modal-overlay.locked .btn:not(.btn-primary) { opacity: 0.5; pointer-events: none; }

/* ============ Drop Zone ============ */
.drop-zone {
  max-width: 500px;
  margin: 12px auto;
  padding: 16px;
  text-align: center;
  border: 2px dashed var(--border);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg);
  transition: all 0.2s ease;
  cursor: default;
  user-select: none;
}
.drop-zone:hover {
  border-color: var(--accent);
  background: var(--badge-bg);
}
.drop-zone-active {
  border-color: var(--accent) !important;
  background: var(--badge-bg) !important;
  box-shadow: 0 0 0 3px rgba(26,115,232,0.15);
  color: var(--accent);
  transform: scale(1.02);
}

/* ============ Help Panel ============ */
.help-panel {
  max-width: 700px;
  margin: 16px auto;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.6;
}
.help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-secondary);
  font-weight: 600;
  font-size: 15px;
  border-bottom: 1px solid var(--border);
}
.help-body {
  padding: 16px;
}
.help-body p { margin-bottom: 8px; }
.help-body ol { margin: 6px 0 12px 20px; padding: 0; }
.help-body ol li { margin-bottom: 4px; }

.help-method {
  display: flex;
  gap: 12px;
  margin: 20px 0;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.help-method-icon {
  font-size: 24px;
  flex-shrink: 0;
  width: 36px;
  text-align: center;
}
.help-method-content { flex: 1; }
.help-method-content h4 {
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--accent);
}
.help-method-content p { font-size: 13px; margin-bottom: 6px; }

.help-steps {
  margin: 8px 0;
}
.help-steps p { font-weight: 500; margin-bottom: 4px; }
.help-steps ol { margin: 4px 0 8px 18px; }
.help-steps ol li { margin-bottom: 3px; font-size: 13px; }

.help-substep {
  font-weight: 500 !important;
  margin-top: 10px !important;
  margin-bottom: 4px !important;
}

.help-tip {
  background: var(--badge-bg);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  margin-top: 8px !important;
  border-left: 3px solid var(--accent);
}

/* ============ Bookmarklet Install Modal ============ */
.help-install {
  padding: 8px 0;
}
.help-install p { margin-bottom: 8px; font-size: 14px; }
.help-install ol { margin: 6px 0 12px 20px; }
.help-install ol li { margin-bottom: 6px; }

/* ============ Add buttons row ============ */
.add-buttons {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 20px 0;
}

/* ============ Pulse animation for "downloading" indicator ============ */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
