/* ============================================
   工具集合站 - 全局样式表
   设计：简洁、现代、移动优先
   ============================================ */

/* ---- CSS 变量 ---- */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --max-width: 960px;
}

/* ---- 全局重置 ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue",
               Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
}

/* ---- 容器 ---- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---- 头部导航 ---- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.site-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-logo .logo-icon {
  font-size: 1.5rem;
}

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

.site-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
}

.site-nav a:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.site-nav a.active {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

/* ---- 面包屑 ---- */
.breadcrumb {
  padding: 16px 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.breadcrumb span {
  margin: 0 6px;
}

/* ---- 主页 Hero ---- */
.hero {
  text-align: center;
  padding: 48px 20px 32px;
}

.hero h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 24px;
}

/* ---- 搜索栏 ---- */
.search-box {
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 14px 48px 14px 20px;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: 50px;
  background: var(--surface);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.search-box .search-icon {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: var(--text-secondary);
  pointer-events: none;
}

/* ---- 分类区块 ---- */
.section {
  padding: 0 0 40px;
  scroll-margin-top: 80px;
}

.section.active-section {
  background: rgba(37, 99, 235, 0.08);
  border-radius: 12px;
  padding-left: 16px;
  padding-right: 16px;
  transition: background 0.3s;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.section-title .icon {
  font-size: 1.4rem;
}

/* ---- 工具卡片网格 ---- */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.tool-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.tool-card .card-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  background: var(--primary-light);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-card .card-body h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}

.tool-card .card-body p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ---- 工具页布局 ---- */
.tool-page {
  padding: 16px 0 40px;
}

.tool-page h1 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.tool-page .intro {
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-size: 1rem;
}

/* ---- 计算器卡片 ---- */
.calc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 32px;
  box-shadow: var(--shadow);
}

.calc-card .input-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.calc-card .input-group {
  display: flex;
  flex-direction: column;
}

.calc-card label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.calc-card input,
.calc-card select {
  padding: 11px 14px;
  font-size: 1rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
  background: #f8fafc;
}

.calc-card input:focus,
.calc-card select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  background: var(--surface);
}

.btn-calc {
  display: block;
  width: 100%;
  padding: 14px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  letter-spacing: 0.5px;
}

.btn-calc:hover {
  background: var(--primary-hover);
}

.btn-calc:active {
  transform: scale(0.98);
}

.btn-reset {
  display: block;
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-reset:hover {
  background: #f1f5f9;
  color: var(--text);
}

/* ---- 结果区域 ---- */
.result-box {
  margin-top: 20px;
  padding: 20px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  text-align: center;
  display: none;
}

.result-box.show {
  display: block;
}

.result-box .result-amount {
  font-size: 2rem;
  font-weight: 800;
  color: var(--success);
}

.result-box .result-detail {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 6px;
}

.result-box .result-table {
  width: 100%;
  margin-top: 16px;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.result-box .result-table th,
.result-box .result-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #dcfce7;
  text-align: left;
}

.result-box .result-table th {
  font-weight: 600;
  color: var(--text);
  background: #dcfce7;
}

/* ---- 内容区 ---- */
.content-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
}

.content-section h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-light);
  color: var(--text);
}

.content-section h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 16px 0 8px;
  color: var(--text);
}

.content-section p {
  margin-bottom: 12px;
  color: #334155;
}

.content-section .formula {
  background: #f8fafc;
  border-left: 4px solid var(--primary);
  padding: 12px 16px;
  margin: 12px 0;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 0 8px 8px 0;
}

.content-section ul, .content-section ol {
  margin: 8px 0 16px 20px;
}

.content-section li {
  margin-bottom: 6px;
  color: #334155;
}

/* ---- FAQ ---- */
.faq-item {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-item h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.faq-item p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ---- 相关工具 ---- */
.related-tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.related-tools a {
  display: block;
  padding: 12px 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}

.related-tools a:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

/* ---- 提示/警告框 ---- */
.note {
  padding: 12px 16px;
  border-radius: 8px;
  margin: 12px 0;
  font-size: 0.9rem;
}

.note-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.note-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

/* ---- 页脚 ---- */
.site-footer {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

.site-footer a {
  color: var(--primary);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* ---- 反馈区域 ---- */
.feedback-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 0;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}

.feedback-section h3 {
  font-size: 1rem;
  margin-bottom: 12px;
  color: var(--text);
}

.feedback-section ol {
  margin: 0 0 16px 20px;
  line-height: 2;
  color: var(--text-secondary);
}

.feedback-section .feedback-email {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  padding: 8px 20px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  transition: all 0.2s;
}

.feedback-section .feedback-email:hover {
  background: var(--primary);
  color: #fff;
  text-decoration: none;
}

/* ---- 回到顶部 ---- */
.back-to-top {
  display: block;
  text-align: center;
  padding: 12px;
  color: var(--primary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  margin-top: 20px;
}

/* ---- 语言切换器 ---- */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 500;
}

.lang-switcher label {
  color: var(--text-secondary);
  white-space: nowrap;
}

.lang-switcher select {
  padding: 6px 10px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  min-width: 100px;
  appearance: auto;
  -webkit-appearance: auto;
}

.lang-switcher select:focus {
  border-color: var(--primary);
}

/* ---- 隐藏（搜索过滤用） ---- */
.hidden {
  display: none !important;
}

.no-results {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
  font-size: 1rem;
  grid-column: 1 / -1;
}

/* ---- 响应式 ---- */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 1.5rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .tools-grid {
    grid-template-columns: 1fr;
  }

  .calc-card .input-row {
    grid-template-columns: 1fr;
  }

  .calc-card {
    padding: 20px;
  }

  .content-section {
    padding: 20px;
  }

  .result-box .result-amount {
    font-size: 1.5rem;
  }

  .site-header .container {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-nav {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .site-nav a {
    white-space: nowrap;
    font-size: 0.8rem;
    padding: 5px 10px;
  }

  .related-tools {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 12px;
  }

  .hero {
    padding: 32px 12px 24px;
  }

  .calc-card {
    padding: 16px;
  }

  .content-section {
    padding: 16px;
  }
}
