/* ============================================================
   tools.css — 工具站专用组件（在设计系统 main.css 之上叠加）
   依赖 main.css 中的 design tokens 与 .btn / .container 等基础类。
   ============================================================ */

/* ---------- 页面骨架 ---------- */
.tool-main {
  margin-top: var(--header-height);
  padding: 2rem 0 4rem;
}

.tool-hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1rem 1.5rem;
  text-align: center;
}

.tool-hero h1 {
  font-size: clamp(1.9rem, 4.4vw, 3rem);
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 60%, var(--accent-secondary) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tool-hero p {
  max-width: 720px;
  margin: 0 auto 1rem;
  font-size: 1.05rem;
  color: var(--text-secondary);
}

.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid rgba(0, 212, 255, 0.35);
  background: rgba(0, 212, 255, 0.08);
  border-radius: var(--radius-full);
  color: #67e8f9;
  font-size: 0.82rem;
  font-weight: 600;
}

.privacy-badge svg { width: 15px; height: 15px; }

.tool-section {
  max-width: 980px;
  margin: 0 auto 2.5rem;
  padding: 0 1rem;
}

.tool-section > h2 {
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  margin-bottom: 1rem;
}

/* ---------- 工具卡片 ---------- */
.tool-card {
  max-width: 880px;
  margin: 0 auto;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
}

.tool-card.tool-busy { opacity: 0.85; }

/* ---------- 拖拽区 ---------- */
.dz {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 2.25rem 1rem;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: rgba(7, 11, 23, 0.5);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
  text-align: center;
}

.dz:hover,
.dz:focus-visible {
  border-color: var(--accent);
  background: rgba(0, 212, 255, 0.06);
  outline: none;
}

.dz.dz-over {
  border-color: var(--accent);
  background: rgba(0, 212, 255, 0.12);
  transform: scale(1.01);
}

.dz-icon { width: 40px; height: 40px; color: var(--accent); }
.dz-label { color: var(--text-primary); font-weight: 700; font-size: 1.05rem; margin: 0; }
.dz-hint { color: var(--text-muted); font-size: 0.85rem; margin: 0; }

.dz-list { margin: 0.9rem 0 0; display: flex; flex-direction: column; gap: 0.5rem; }

.dz-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.dz-item.dz-dragging { opacity: 0.4; }
.dz-item.dz-over-item { border-color: var(--accent); }
.dz-grip { color: var(--text-muted); cursor: grab; font-size: 1rem; line-height: 1; }
.dz-pos {
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(0, 212, 255, 0.14);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
}
.dz-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }
.dz-size { color: var(--text-muted); font-size: 0.8rem; white-space: nowrap; }
.dz-remove {
  border: none;
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  transition: background 0.2s ease;
}
.dz-remove:hover { background: rgba(239, 68, 68, 0.25); }

/* ---------- 选项区 ---------- */
.tool-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.opt-field { display: flex; flex-direction: column; gap: 0.4rem; }
.opt-field > span { font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); }
.opt-field em { color: var(--text-muted); font-style: normal; font-weight: 400; }

.opt-field input[type='text'],
.opt-field input[type='number'],
.opt-field select,
.opt-field textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
}

.opt-field input:focus,
.opt-field select:focus,
.opt-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.12);
  outline: none;
}

.opt-field input[type='range'] { width: 100%; accent-color: var(--accent); }

.opt-check { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: var(--text-secondary); }
.opt-check input { accent-color: var(--accent); width: 16px; height: 16px; }

/* 折叠的次要选项 */
.tool-advanced {
  grid-column: 1 / -1;
  margin-top: 0.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(7, 11, 23, 0.4);
}
.tool-advanced > summary {
  padding: 0.7rem 0.9rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
.tool-advanced > summary::-webkit-details-marker { display: none; }
.tool-advanced > summary::after { content: '+'; color: var(--accent); font-weight: 700; }
.tool-advanced[open] > summary::after { content: '−'; }
.tool-advanced-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  padding: 0 0.9rem 0.95rem;
}

/* ---------- 进度 ---------- */
.tool-progress { margin-top: 1.25rem; }
.tool-progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-secondary);
  overflow: hidden;
}
.tool-progress-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
  transition: width 0.25s ease;
}
.tool-progress-label { margin: 0.5rem 0 0; font-size: 0.82rem; color: var(--text-muted); }

/* ---------- 操作按钮 / 状态 ---------- */
.tool-actions { margin-top: 1.25rem; display: flex; justify-content: center; }
.tool-run { min-width: 220px; }
.tool-run.is-busy { opacity: 0.6; cursor: progress; }

.tool-status { margin: 0.9rem 0 0; text-align: center; font-size: 0.9rem; min-height: 1.2em; }
.tool-status-error { color: #f87171; }
.tool-status-ok { color: #34d399; }

/* ---------- 结果列表 ---------- */
.tool-results {
  max-width: 880px;
  margin: 1.5rem auto 0;
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid rgba(0, 212, 255, 0.28);
  border-radius: 14px;
}
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.results-head h3 { font-size: 1.1rem; margin: 0; }
.results-list { display: flex; flex-direction: column; gap: 0.6rem; }
.result-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}
.result-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }
.result-size { color: var(--text-muted); font-size: 0.8rem; white-space: nowrap; }

/* ---------- 内容壳：步骤 / FAQ / 来源 ---------- */
.guide-steps { counter-reset: step; display: flex; flex-direction: column; gap: 1rem; }
.guide-step {
  position: relative;
  padding: 1rem 1rem 1rem 3.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.guide-step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 1rem;
  top: 1rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  color: var(--bg-primary);
  font-weight: 800;
  font-size: 0.85rem;
}
.guide-step h3 { font-size: 1rem; margin-bottom: 0.3rem; }
.guide-step p { font-size: 0.92rem; margin: 0; }

.pitfall-list { display: flex; flex-direction: column; gap: 0.75rem; }
.pitfall-item {
  padding: 1rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--warning, #f59e0b);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.pitfall-item h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}
.pitfall-item h3::before {
  content: '!';
  flex: none;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.16);
  color: var(--warning, #f59e0b);
  font-size: 0.72rem;
  font-weight: 800;
}
.pitfall-item p { font-size: 0.9rem; margin: 0; color: var(--text-secondary); }

.faq-list { display: flex; flex-direction: column; gap: 0.6rem; }
.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.faq-item summary {
  padding: 0.9rem 1rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-primary);
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; color: var(--accent); font-weight: 700; }
.faq-item[open] summary::after { content: '−'; }
.faq-item .faq-body { padding: 0 1rem 1rem; color: var(--text-secondary); font-size: 0.92rem; }

.tool-meta {
  max-width: 980px;
  margin: 0 auto 2.5rem;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--accent);
  background: rgba(0, 212, 255, 0.05);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.tool-meta strong { color: var(--text-primary); }
.tool-meta a { word-break: break-word; }

/* ---------- 反馈框 ---------- */
.fb-form { display: flex; flex-direction: column; gap: 1rem; }
.fb-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.fb-field { display: flex; flex-direction: column; gap: 0.4rem; }
.fb-field > span { font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); }
.fb-field em { color: var(--text-muted); font-style: normal; font-weight: 400; }
.fb-field input,
.fb-field select,
.fb-field textarea {
  width: 100%;
  padding: 0.7rem 0.8rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
}
.fb-field input:focus,
.fb-field select:focus,
.fb-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.12);
  outline: none;
}
.fb-turnstile { min-height: 0; }
.fb-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.fb-status { font-size: 0.88rem; }
.fb-ok { color: #34d399; }
.fb-error { color: #f87171; }

/* ---------- 变现占位（广告位） ---------- */
.ad-slot {
  max-width: 980px;
  margin: 0 auto 2.5rem;
  padding: 1.25rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- 相关工具 ---------- */
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}
.related-card {
  display: block;
  padding: 0.9rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.related-card:hover { border-color: var(--accent); transform: translateY(-2px); color: inherit; }
.related-card strong { display: block; color: var(--text-primary); font-size: 0.95rem; margin-bottom: 0.2rem; }
.related-card span { color: var(--text-muted); font-size: 0.8rem; }

/* ---------- 首页工具目录 ---------- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}
.tool-grid-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.tool-grid-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
}
.tool-grid-card .tg-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(0, 212, 255, 0.12);
  color: var(--accent);
  font-size: 1.25rem;
}
.tool-grid-card h3 { font-size: 1.05rem; color: var(--text-primary); margin: 0; }
.tool-grid-card p { font-size: 0.88rem; color: var(--text-secondary); margin: 0; }
.tool-grid-card .tg-cta { margin-top: auto; font-size: 0.85rem; font-weight: 700; color: var(--accent); }

.section-head-block { max-width: var(--max-width); margin: 0 auto 1.25rem; padding: 0 1rem; }
.section-head-block h2 { font-size: clamp(1.4rem, 3vw, 2rem); margin-bottom: 0.35rem; }
.section-head-block p { color: var(--text-secondary); font-size: 0.95rem; }

/* ---------- 账户栏 ---------- */
.ab-email {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}
.ab-signout { white-space: nowrap; }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .fb-row { grid-template-columns: 1fr; }
  .tool-card { padding: 1.1rem; }
  .results-head { flex-direction: column; align-items: flex-start; }
  .result-item { flex-wrap: wrap; }
}