/* 云盘搜搜 — 极简风格 */
:root {
  --c-brand: #6366f1;
  --c-brand-hover: #4f46e5;
  --c-brand-light: #eef2ff;
  --c-bg: #f8fafc;
  --c-surface: #ffffff;
  --c-surface-hover: #f1f5f9;
  --c-text: #0f172a;
  --c-text-secondary: #64748b;
  --c-text-muted: #94a3b8;
  --c-border: #e2e8f0;
  --c-border-light: #f1f5f9;
  --c-input-bg: #ffffff;
  --c-input-border: #cbd5e1;
  --c-shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --c-shadow: 0 1px 3px rgba(0,0,0,0.06);
  --c-shadow-lg: 0 10px 25px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-full: 999px;
  --ease: cubic-bezier(0.4,0,0.2,1);
  --max-w: 1200px;
}

:root[data-theme="dark"] {
  --c-brand-light: #1e1b4b;
  --c-bg: #0f172a;
  --c-surface: #1e293b;
  --c-surface-hover: #334155;
  --c-text: #f1f5f9;
  --c-text-secondary: #94a3b8;
  --c-text-muted: #64748b;
  --c-border: #334155;
  --c-border-light: #1e293b;
  --c-input-bg: #1e293b;
  --c-input-border: #475569;
  --c-shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --c-shadow: 0 4px 6px rgba(0,0,0,0.3);
  --c-shadow-lg: 0 10px 25px rgba(0,0,0,0.4);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --c-brand-light: #1e1b4b;
    --c-bg: #0f172a;
    --c-surface: #1e293b;
    --c-surface-hover: #334155;
    --c-text: #f1f5f9;
    --c-text-secondary: #94a3b8;
    --c-text-muted: #64748b;
    --c-border: #334155;
    --c-border-light: #1e293b;
    --c-input-bg: #1e293b;
    --c-input-border: #475569;
    --c-shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --c-shadow: 0 4px 6px rgba(0,0,0,0.3);
    --c-shadow-lg: 0 10px 25px rgba(0,0,0,0.4);
  }
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--c-bg); color: var(--c-text); line-height: 1.6;
  min-height: 100vh; display: flex; flex-direction: column;
  transition: background .3s var(--ease), color .3s var(--ease);
}

a { color: var(--c-brand); text-decoration: none; }
a:hover { color: var(--c-brand-hover); }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input { font-family: inherit; font-size: inherit; }

.hidden { display: none !important; }
.gradient-text {
  background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
  transition: all .15s var(--ease); line-height: 1.4;
}
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-primary { background: var(--c-brand); color: #fff; }
.btn-primary:hover { background: var(--c-brand-hover); color: #fff; }
.btn-ghost { color: var(--c-text-secondary); }
.btn-ghost:hover { background: var(--c-surface-hover); color: var(--c-text); }

/* header */
.header {
  position: sticky; top: 0; z-index: 100;
  background: var(--c-surface); border-bottom: 1px solid var(--c-border);
  backdrop-filter: blur(12px);
}
.header-inner {
  max-width: var(--max-w); margin: 0 auto; padding: 0 20px; height: 60px;
  display: flex; align-items: center; gap: 20px;
}
.logo { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.logo-icon { width: 28px; height: 28px; }
.logo-text { font-size: 18px; font-weight: 700; color: var(--c-text); }
.logo:hover .logo-text { color: var(--c-brand); }
.nav { display: flex; gap: 2px; flex: 1; }
.nav-link {
  padding: 6px 14px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; color: var(--c-text-secondary);
  text-decoration: none; transition: all .15s var(--ease);
}
.nav-link:hover, .nav-link.active { background: var(--c-brand-light); color: var(--c-brand); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.theme-btn {
  width: 32px; height: 32px; border-radius: 6px;
  font-size: 16px; color: var(--c-text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all .15s var(--ease); background: var(--c-surface-hover);
}
.theme-btn:hover, .theme-btn.active { color: var(--c-brand); background: var(--c-surface); }
.auth-buttons { display: flex; gap: 6px; }

.user-menu { display: flex; align-items: center; gap: 8px; }
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--c-brand);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.user-name { font-size: 13px; font-weight: 500; }

/* mobile */
.mobile-menu-btn { display: none; font-size: 22px; color: var(--c-text-secondary); }
.mobile-nav { display: none; }
@media (max-width: 768px) {
  .nav, .auth-buttons { display: none; }
  .mobile-menu-btn { display: flex; }
  .mobile-nav {
    flex-direction: column; padding: 8px 20px 16px;
    border-top: 1px solid var(--c-border); background: var(--c-surface);
  }
  .mobile-nav.show { display: flex; }
  .mobile-nav a {
    padding: 12px 0; font-size: 15px; color: var(--c-text-secondary);
    border-bottom: 1px solid var(--c-border-light); text-decoration: none;
  }
  .mobile-nav a:hover, .mobile-nav a.active { color: var(--c-brand); }
}

/* hero */
.hero {
  max-width: var(--max-w); margin: 0 auto; padding: 60px 20px 32px; text-align: center;
}
.hero-title { font-size: 42px; font-weight: 800; letter-spacing: -1px; margin-bottom: 8px; }
.hero-subtitle { font-size: 16px; color: var(--c-text-secondary); margin-bottom: 28px; }

@media (max-width: 640px) {
  .hero { padding: 40px 16px 24px; }
  .hero-title { font-size: 28px; }
  .hero-subtitle { font-size: 14px; }
}

/* search */
.search-box-wrapper { max-width: 580px; margin: 0 auto; position: relative; }
.search-box {
  display: flex; align-items: center; background: var(--c-input-bg);
  border: 2px solid var(--c-input-border); border-radius: var(--radius);
  transition: all .2s var(--ease); box-shadow: var(--c-shadow);
}
.search-box:focus-within { border-color: var(--c-brand); box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }
.search-input-icon { color: var(--c-text-muted); margin-left: 16px; flex-shrink: 0; }
.search-input {
  flex: 1; border: none; outline: none; padding: 14px 12px;
  font-size: 16px; background: transparent; color: var(--c-text);
}
.search-input::placeholder { color: var(--c-text-muted); }
.search-btn {
  padding: 8px 20px; margin: 4px; border-radius: var(--radius-sm);
  background: var(--c-brand); color: #fff; font-size: 14px; font-weight: 600;
  transition: all .15s var(--ease); flex-shrink: 0;
}
.search-btn:hover { background: var(--c-brand-hover); }
.search-suggestions {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius-sm); box-shadow: var(--c-shadow-lg);
  z-index: 50; max-height: 260px; overflow-y: auto;
}
.suggestion-item { display: block; padding: 10px 18px; font-size: 14px; color: var(--c-text-secondary); cursor: pointer; text-decoration: none; }
.suggestion-item:hover { background: var(--c-surface-hover); }

/* platforms */
.platform-filters { display: flex; justify-content: center; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.platform-tag {
  padding: 5px 14px; border-radius: var(--radius-full); font-size: 13px; font-weight: 500;
  color: var(--c-text-secondary); border: 1.5px solid var(--c-border);
  cursor: pointer; transition: all .15s var(--ease); background: var(--c-surface);
}
.platform-tag:hover { border-color: var(--c-brand); color: var(--c-brand); }
.platform-tag.active { background: var(--c-brand); color: #fff; border-color: var(--c-brand); }

/* hot section */
.section-hot { max-width: var(--max-w); margin: 0 auto; padding: 12px 20px 24px; }
.hot-keywords { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.hot-tag {
  padding: 5px 14px; border-radius: var(--radius-full); font-size: 13px;
  background: var(--c-surface); border: 1px solid var(--c-border);
  color: var(--c-text-secondary); text-decoration: none; transition: all .15s var(--ease);
}
.hot-tag:hover { border-color: var(--c-brand); color: var(--c-brand); background: var(--c-brand-light); }

/* resources */
.section-resources { max-width: var(--max-w); margin: 0 auto; padding: 0 20px 32px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title { font-size: 18px; font-weight: 700; }
.section-more { font-size: 13px; color: var(--c-text-muted); }
.section-more:hover { color: var(--c-brand); }

.resource-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }

.resource-card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 16px;
  transition: all .2s var(--ease); display: flex; flex-direction: column; gap: 8px;
}
.resource-card:hover { border-color: var(--c-brand); box-shadow: var(--c-shadow-lg); transform: translateY(-1px); }
.resource-card-title { font-size: 15px; font-weight: 600; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.resource-card-title a { color: var(--c-text); }
.resource-card-title a:hover { color: var(--c-brand); }
.resource-card-desc { font-size: 12px; color: var(--c-text-muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.resource-card-meta {
  display: flex; gap: 12px; font-size: 12px; color: var(--c-text-muted);
  padding-top: 8px; border-top: 1px solid var(--c-border-light);
}
.resource-card-actions { display: flex; gap: 6px; padding-top: 2px; }
.resource-card-actions .btn { font-size: 12px; padding: 5px 10px; flex: 1; }

/* ad */
.ad-slot { max-width: var(--max-w); margin: 0 auto 8px; padding: 0 20px; }
.ad-container { background: var(--c-surface); border: 1px dashed var(--c-border); border-radius: var(--radius-sm); padding: 10px 16px; text-align: center; }
.ad-badge { font-size: 11px; color: var(--c-text-muted); margin-right: 8px; }
.ad-content { font-size: 13px; color: var(--c-text-muted); }

/* footer */
.footer { margin-top: auto; text-align: center; padding: 24px 20px; border-top: 1px solid var(--c-border); background: var(--c-surface); }
.footer-copy { font-size: 13px; color: var(--c-text-muted); margin-bottom: 6px; }
.footer-links { font-size: 12px; }
.footer-links a { color: var(--c-text-muted); margin: 0 2px; }
.footer-links a:hover { color: var(--c-brand); }

/* loading */
.loading-state { grid-column: 1/-1; text-align: center; padding: 48px 0; color: var(--c-text-muted); }
.loader { display: inline-block; width: 28px; height: 28px; border: 3px solid var(--c-border); border-top-color: var(--c-brand); border-radius: 50%; animation: spin .6s linear infinite; margin-bottom: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* toast */
.toast-container { position: fixed; top: 80px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 10px 18px; border-radius: var(--radius-sm); font-size: 14px; color: #fff; box-shadow: var(--c-shadow-lg); max-width: 360px; animation: toastIn .3s var(--ease); }
.toast.success { background: #059669; }
.toast.error { background: #dc2626; }
@keyframes toastIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }

/* page layouts */
.page-container { max-width: var(--max-w); margin: 0 auto; padding: 32px 20px; }
.page-hero { text-align: center; padding: 32px 20px 20px; max-width: var(--max-w); margin: 0 auto; }
.page-hero h1 { font-size: 28px; font-weight: 800; margin-bottom: 6px; }
.page-hero p { font-size: 15px; color: var(--c-text-secondary); }

/* form */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.form-input { width: 100%; padding: 10px 14px; border: 1.5px solid var(--c-input-border); border-radius: var(--radius-sm); font-size: 14px; background: var(--c-input-bg); color: var(--c-text); outline: none; transition: all .15s var(--ease); }
.form-input:focus { border-color: var(--c-brand); box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }
.form-hint, .form-error { font-size: 12px; margin-top: 4px; }
.form-hint { color: var(--c-text-muted); }
.form-error { color: #ef4444; }
.form-textarea { min-height: 100px; resize: vertical; }

/* auth */
.auth-container { max-width: 400px; margin: 48px auto; padding: 0 20px; }
.auth-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 32px; box-shadow: var(--c-shadow); }
.auth-card h2 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.auth-card .auth-subtitle { font-size: 14px; color: var(--c-text-secondary); margin-bottom: 24px; }

/* legal pages */
.legal-page { max-width: 760px; margin: 0 auto; padding: 40px 20px; }
.legal-page h1 { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.legal-page .legal-date { font-size: 13px; color: var(--c-text-muted); margin-bottom: 24px; }
.legal-page h2 { font-size: 18px; font-weight: 600; margin: 24px 0 10px; }
.legal-page p, .legal-page li { font-size: 15px; line-height: 1.8; color: var(--c-text-secondary); margin-bottom: 10px; }
.legal-page ul { margin: 6px 0 14px 18px; }

/* search results */
.search-results-header { max-width: var(--max-w); margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.results-count { font-size: 14px; color: var(--c-text-secondary); }
.sort-options { display: flex; gap: 2px; }
.sort-option { padding: 4px 12px; border-radius: var(--radius-full); font-size: 13px; color: var(--c-text-secondary); cursor: pointer; transition: all .15s var(--ease); }
.sort-option:hover { color: var(--c-text); background: var(--c-surface-hover); }
.sort-option.active { color: var(--c-brand); background: var(--c-brand-light); font-weight: 600; }

.results-list { max-width: var(--max-w); margin: 0 auto; padding: 0 20px 32px; display: flex; flex-direction: column; gap: 10px; }
.result-item {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius-sm); padding: 16px 18px;
  transition: all .15s var(--ease); display: flex; gap: 14px; align-items: flex-start;
}
.result-item:hover { border-color: var(--c-brand); box-shadow: var(--c-shadow); }
.result-icon-col { flex-shrink: 0; padding-top: 2px; }
.cloud-icon { display: block; border-radius: 5px; }
.result-content { flex: 1; min-width: 0; }
.result-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; color: var(--c-text); flex-wrap: wrap; }
.result-badge-type {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600; background: var(--c-brand-light);
  color: var(--c-brand); white-space: nowrap; flex-shrink: 0;
}
.result-url {
  display: flex; align-items: center; gap: 6px; margin-bottom: 6px;
  font-size: 12px; color: var(--c-text-muted);
}
.url-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-text-secondary); display: block; max-width: 100%; }
.result-desc { font-size: 13px; color: var(--c-text-muted); margin-bottom: 6px; }
.result-meta { display: flex; gap: 14px; font-size: 12px; color: var(--c-text-muted); flex-wrap: wrap; }
.result-actions { display: flex; gap: 4px; flex-shrink: 0; flex-wrap: wrap; align-items: flex-start; }

/* pagination (kept as alias, actual styles below) */

/* empty */
.empty-state { text-align: center; padding: 60px 20px; color: var(--c-text-muted); }
.empty-state .empty-icon { font-size: 44px; margin-bottom: 10px; }
.empty-state .empty-text { font-size: 15px; }

/* filter bar */
.filter-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.filter-btn {
  padding: 5px 14px; border-radius: var(--radius-full); font-size: 13px; font-weight: 500;
  color: var(--c-text-secondary); border: 1.5px solid var(--c-border);
  cursor: pointer; transition: all .15s var(--ease); background: var(--c-surface);
}
.filter-btn:hover { border-color: var(--c-brand); color: var(--c-brand); }
.filter-btn.active { background: var(--c-brand); color: #fff; border-color: var(--c-brand); }
.filter-btn.disabled { opacity: .35; cursor: default; }
.filter-btn.disabled:hover { border-color: var(--c-border); color: var(--c-text-secondary); }

/* misc */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 3px; }

@media (max-width: 640px) {
  .resource-grid { grid-template-columns: 1fr; }
  .result-item { flex-direction: column; }
  .result-actions { width: 100%; justify-content: flex-end; }
}

/* ===== 警告横幅 ===== */
.warning-banner {
  padding: 10px 16px;
  background: var(--c-surface);
  border: 1px solid #f59e0b;
  border-left: 4px solid #f59e0b;
  border-radius: 6px;
  font-size: 13px;
  color: var(--c-text-secondary);
  margin-bottom: 12px;
  line-height: 1.5;
}

/* ===== 分页 ===== */
.pagination-wrap {
  margin-top: 24px;
  text-align: center;
}

.pagination-info {
  font-size: 13px;
  color: var(--c-text-secondary);
  margin-bottom: 12px;
}

.pagination-btns {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  background: var(--c-surface);
  color: var(--c-text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.page-btn:hover:not(:disabled) {
  border-color: #6366f1;
  color: #6366f1;
}

.page-btn.active {
  background: #6366f1;
  color: #fff;
  border-color: #6366f1;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(99,102,241,0.3);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-ellipsis {
  padding: 0 2px;
  color: var(--c-text-muted);
  font-size: 13px;
}

/* ===== 按钮加载状态 ===== */
.btn-loader {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: -2px;
  margin-right: 4px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 搜索标题加载点动画 */
.loading-dots::after {
  content: '';
  animation: dots 1.2s steps(3, end) infinite;
}

@keyframes dots {
  0%   { content: ''; }
  33%  { content: '.'; }
  66%  { content: '..'; }
  100% { content: '...'; }
}

/* ===== 后台刷新提示 ===== */
.refresh-hint {
  padding: 8px 16px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  font-size: 13px;
  color: #0369a1;
  margin-bottom: 12px;
  line-height: 1.5;
}

[data-theme="dark"] .refresh-hint {
  background: #0c1f2b;
  border-color: #1e3a5f;
  color: #7dd3fc;
}
