/* iToolsPro 全站基础样式（SaaS · Header + Sidebar 版） */
:root {
  --bg: #F8FAFC;
  --bg-elevated: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F1F5F9;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;

  --text: #1E293B;
  --text-secondary: #475569;
  --muted: #94A3B8;

  --primary: #6366F1;
  --primary-hover: #4F46E5;
  --primary-soft: #EEF2FF;
  --primary-fade: rgba(99, 102, 241, 0.08);

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.08);
  --shadow-focus: 0 0 0 3px rgba(99, 102, 241, 0.15);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  --transition: 0.15s ease;
  --container: 1100px;
  --sidebar-width: 240px;
  --header-height: 56px;
}

/* 暗色主题（仅切换中性色与表面色，主色保持不变） */
html[data-theme="dark"] {
  --bg: #0B1220;
  --bg-elevated: #111827;
  --surface: #111827;
  --surface-2: #1E293B;
  --border: #1F2937;
  --border-strong: #334155;
  --text: #F1F5F9;
  --text-secondary: #CBD5E1;
  --muted: #64748B;
  --primary-soft: rgba(99, 102, 241, 0.16);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Source Han Sans CN", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.55;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  padding-top: var(--header-height);
  padding-left: var(--sidebar-width);
  transition: background var(--transition), color var(--transition);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.04 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

a { color: inherit; text-decoration: none; }

/* ============ 顶部 Header ============ */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  z-index: 60;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
html[data-theme="dark"] .app-header {
  background: rgba(15, 23, 42, 0.7);
}
.app-header.scrolled {
  border-bottom-color: var(--border);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02), var(--shadow-xs);
}
.app-header-inner {
  height: 100%;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
  color: var(--text);
  flex-shrink: 0;
  width: calc(var(--sidebar-width) - 20px);
}
.brand-logo {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: linear-gradient(135deg, #6366F1 0%, #818CF8 100%);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.25);
}

/* 顶栏搜索框 */
.header-search {
  position: relative;
  flex: 0 1 360px;
  max-width: 420px;
  margin: 0 auto;
}
.header-search input[type="text"] {
  width: 100%;
  height: 34px;
  padding: 0 70px 0 44px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.86rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}
.header-search input::placeholder { color: var(--muted); }
.header-search input[type="text"]:hover { border-color: var(--border-strong); }
.header-search input[type="text"]:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: var(--shadow-focus);
}
.header-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  pointer-events: none;
}
.header-search-icon svg, .sidebar-search-icon svg {
  width: 100%; height: 100%; display: block;
  stroke: currentColor; stroke-width: 2;
  fill: none; stroke-linecap: round; stroke-linejoin: round;
}
.header-search-kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  padding: 1px 6px;
  font-size: 0.68rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  background: var(--surface);
  pointer-events: none;
}
.header-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  max-height: 320px;
  overflow-y: auto;
  display: none;
}
.header-search-results.show { display: block; }
.hsr-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.86rem;
  cursor: pointer;
  transition: var(--transition);
}
.hsr-item:hover { background: var(--surface-2); }
.hsr-item.disabled { opacity: 0.5; cursor: not-allowed; }
.hsr-icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid; place-items: center;
  font-size: 0.86rem; font-weight: 600;
  flex-shrink: 0;
}
.hsr-body {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  gap: 2px;
}
.hsr-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hsr-desc {
  font-size: 0.76rem;
  color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hsr-empty {
  padding: 18px 12px;
  text-align: center;
  font-size: 0.84rem;
  color: var(--muted);
}

/* 顶栏右侧操作 */
.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}
.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg {
  width: 18px; height: 18px;
  stroke: currentColor; stroke-width: 1.8;
  fill: none; stroke-linecap: round; stroke-linejoin: round;
}

.btn-lang {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: var(--transition);
  font-family: inherit;
  flex-shrink: 0;
}
.btn-lang:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

/* ============ 左侧 Sidebar ============ */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background: var(--bg);
  border-right: 1px solid var(--border);
  z-index: 50;
  display: flex;
  flex-direction: column;
}
.sidebar-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  overflow-y: auto;
}

/* 侧边栏搜索 */
.sidebar-search {
  position: relative;
  margin: 0 6px 12px;
}
.sidebar-search input[type="text"] {
  width: 100%;
  height: 32px;
  padding: 0 10px 0 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}
.sidebar-search input::placeholder { color: var(--muted); }
.sidebar-search input[type="text"]:hover { border-color: var(--border-strong); }
.sidebar-search input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}
.sidebar-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--muted);
  pointer-events: none;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.side-group {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.side-group-items { display: flex; flex-direction: column; gap: 2px; }
.side-group-title {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 14px 6px;
}

.side-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.side-item:hover {
  background: var(--surface-2);
  color: var(--text);
}
.side-item.active {
  background: var(--primary-soft);
  color: var(--primary);
}
.side-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}
.side-item.disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
.side-item.disabled:hover {
  background: transparent;
  color: var(--text-secondary);
}
.side-item .si-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 600;
  flex-shrink: 0;
}
.side-item.active .si-icon {
  background: var(--primary);
  color: #fff;
}
.side-item .si-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-item .si-badge {
  height: 18px;
  display: inline-flex;
  align-items: center;
  font-size: 0.66rem;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.side-item .si-badge.new {
  background: var(--primary-soft);
  color: var(--primary);
}
.side-item.top { margin-bottom: 4px; }

.sidebar-empty {
  display: none;
  padding: 16px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px 6px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}
.side-foot-link {
  font-size: 0.78rem;
  color: var(--text-secondary);
  transition: var(--transition);
}
.side-foot-link:hover { color: var(--primary); }
.sidebar-version {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* 移动端 */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 70;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-sm);
}
.sidebar-toggle span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--text-secondary);
  border-radius: 2px;
}
.sidebar-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 49;
  opacity: 0;
  transition: opacity var(--transition);
}
.sidebar-mask.show { opacity: 1; }

@media (max-width: 960px) {
  body { padding-left: 0; }
  .app-header-inner { padding-left: 56px; gap: 12px; }
  .brand { width: auto; }
  .header-search { flex: 1; max-width: none; }
  .sidebar {
    top: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform var(--transition);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: flex; }
  .sidebar-mask.show { display: block; }
  body.sidebar-open { overflow: hidden; }
}

/* ============ 通用组件 ============ */
.app-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 28px 16px;
  color: var(--muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
  margin-top: 60px;
  background: transparent;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 18px;
  height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  font-family: inherit;
  letter-spacing: -0.005em;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(99,102,241,0.2);
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(99,102,241,0.28);
}
.btn-default {
  background: var(--surface);
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-default:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}

main, section, footer, .page, .page-title { position: relative; z-index: 1; }

/* SEO / AGO 友好的语义化说明区块（爬虫与 AI Agent 可读） */
.seo-section {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 24px auto;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.7;
}
.seo-section h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}
.seo-section h3 {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  margin: 16px 0 8px;
}
.seo-section p { margin: 0 0 10px; }
.seo-section ul { padding-left: 20px; margin: 0 0 10px; }
.seo-section li { margin: 4px 0; }
.seo-section code {
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.86em;
  font-family: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}
.seo-section strong { color: var(--text); }
@media (max-width: 960px) {
  .seo-section { margin: 16px; padding: 16px; }
}

/* ===== 工具页通用「Hero + 特性卡片 + 适用场景」结构 ===== */
.wc-intro {
  padding: 36px 32px 32px;
  margin: 28px auto;
  max-width: 1100px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.wc-intro::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(520px 260px at 0% 0%, rgba(99,102,241,0.08), transparent 65%),
    radial-gradient(420px 220px at 100% 0%, rgba(236,72,153,0.06), transparent 70%);
}

/* Hero 区：左插画 + 右文字 */
.wc-hero {
  position: relative;
  display: grid;
  grid-template-columns: 160px 1fr;
  align-items: center;
  gap: 32px;
  padding-bottom: 28px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.wc-hero-visual {
  width: 160px;
  height: 140px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, var(--primary-soft), rgba(99,102,241,0.04));
  border-radius: 22px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.6);
  animation: floaty 4.5s ease-in-out infinite;
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.wc-hero-body { min-width: 0; }
.wc-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  padding: 4px 12px;
  background: var(--primary-soft);
  border-radius: 999px;
  margin-bottom: 14px;
}
.wc-headline {
  font-size: clamp(1.7rem, 2.6vw, 2.1rem);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.18;
  margin-bottom: 14px;
}
.wc-headline .accent {
  background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 55%, #EC4899 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* 中文正文：主信息层 */
.wc-tagline {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-secondary);
  margin: 0 0 8px;
  max-width: 640px;
}
.wc-tagline mark.kw,
.wc-tagline strong {
  background: transparent;
  color: var(--primary);
  font-weight: 600;
  padding: 0;
}

/* 英文：弱化为辅助信息 */
.wc-tagline-en {
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--muted);
  font-style: italic;
  max-width: 640px;
}
.wc-tagline-en strong { color: var(--text-secondary); font-style: normal; }

/* 三大特性卡片：横向 1×3 网格 */
.wc-feature-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}
.wc-feature {
  position: relative;
  padding: 22px 20px 18px;
  background: #F9FAFB;
  border: 1px solid var(--border);
  border-radius: 16px;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition), background var(--transition);
  overflow: hidden;
}
.wc-feature::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
  background: linear-gradient(90deg, #6366F1, #8B5CF6, #EC4899);
  opacity: 0;
  transition: opacity var(--transition);
}
html[data-theme="dark"] .wc-feature {
  background: rgba(255, 255, 255, 0.03);
}
.wc-feature:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.08);
  border-color: rgba(99, 102, 241, 0.4);
  background: var(--surface);
}
.wc-feature:hover::before { opacity: 1; }
.wc-feature-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  color: #fff;
  margin-bottom: 14px;
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.25);
}
.wc-feature-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.wc-feature-desc {
  font-size: 0.84rem;
  line-height: 1.7;
  color: var(--text-secondary);
}
.wc-feature-desc code {
  background: var(--primary-soft);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.86em;
  color: var(--primary);
  font-family: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}

/* 适用场景：独占一行 + 胶囊 */
.wc-usecases {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}
.wc-usecase-label {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 8px;
}
.wc-usecase {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  transition: var(--transition);
  cursor: default;
}
.wc-usecase:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-1px);
}

@media (max-width: 860px) {
  .wc-intro { padding: 24px 20px; }
  .wc-hero {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .wc-hero-visual { width: 96px; height: 88px; border-radius: 16px; }
  .wc-hero-visual svg { width: 88px; height: auto; }
  .wc-feature-grid { grid-template-columns: 1fr; }
}
