/* ToolBox - 全局样式 */

/* === CSS 变量 === */
:root {
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-light: #DBEAFE;
  --accent: #10B981;
  --accent-hover: #059669;
  --bg: #F8FAFC;
  --card-bg: #FFFFFF;
  --text: #1E293B;
  --text-secondary: #64748B;
  --border: #E2E8F0;
  --radius: 12px;
  --radius-sm: 8px;
  --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);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --max-width: 1200px;
  --header-height: 64px;
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
button { cursor: pointer; font-family: inherit; }
textarea, input, select { font-family: inherit; }

/* === Header === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.logo:hover { text-decoration: none; }
.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}
.nav { display: flex; gap: 32px; align-items: center; }
.nav a {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s;
}
.nav a:hover, .nav a.active { color: var(--primary); text-decoration: none; }

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

/* === Main === */
.site-main {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px;
  width: 100%;
}

/* === Footer === */
.site-footer {
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  margin-top: auto;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 14px;
  color: var(--text-secondary);
}
.footer-links { display: flex; gap: 24px; }
.footer-links a { color: var(--text-secondary); font-size: 14px; }
.footer-links a:hover { color: var(--primary); }

/* === Cards === */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card-body { padding: 24px; }

/* Tool card grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.tool-card {
  display: block;
  color: inherit;
  text-decoration: none;
}
.tool-card:hover { text-decoration: none; color: inherit; }
.tool-card .card-body { display: flex; flex-direction: column; gap: 12px; }
.tool-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.tool-icon.blue { background: #DBEAFE; color: #2563EB; }
.tool-icon.green { background: #D1FAE5; color: #059669; }
.tool-icon.purple { background: #EDE9FE; color: #7C3AED; }
.tool-icon.orange { background: #FEF3C7; color: #D97706; }
.tool-icon.red { background: #FEE2E2; color: #DC2626; }
.tool-icon.cyan { background: #CFFAFE; color: #0891B2; }
.tool-card h3 { font-size: 17px; font-weight: 700; }
.tool-card p { font-size: 14px; color: var(--text-secondary); line-height: 1.5; }

/* Blog card grid */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}
.blog-card {
  display: block;
  color: inherit;
  text-decoration: none;
}
.blog-card:hover { text-decoration: none; color: inherit; }
.blog-card .card-body { display: flex; flex-direction: column; gap: 12px; }
.blog-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 10px;
  border-radius: 99px;
  align-self: flex-start;
}
.blog-card h3 { font-size: 17px; font-weight: 700; line-height: 1.4; }
.blog-card p { font-size: 14px; color: var(--text-secondary); line-height: 1.5; }
.blog-card .date { font-size: 13px; color: var(--text-secondary); }

/* === Section titles === */
.section-title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 20px;
  color: var(--text);
}
.section-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: -12px;
  margin-bottom: 20px;
}

/* === Hero (homepage) === */
.hero {
  text-align: center;
  padding: 60px 0 40px;
}
.hero h1 {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 12px;
  line-height: 1.3;
}
.hero h1 span { color: var(--primary); }
.hero p {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 28px;
}
.search-box {
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}
.search-box input {
  width: 100%;
  padding: 14px 20px 14px 48px;
  border: 2px solid var(--border);
  border-radius: 99px;
  font-size: 16px;
  background: var(--card-bg);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.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;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 18px;
}

/* === Tool page layout === */
.tool-page-header {
  padding: 32px 0 20px;
}
.tool-page-header h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
}
.tool-page-header p {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 640px;
}
.tool-container {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 32px;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  border: none;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); text-decoration: none; color: #fff; box-shadow: var(--shadow-md); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); text-decoration: none; color: #fff; }
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); text-decoration: none; color: var(--primary); }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-lg { padding: 16px 32px; font-size: 17px; }

/* === Upload zone === */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--bg);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.upload-zone .upload-icon {
  font-size: 48px;
  margin-bottom: 12px;
  color: var(--text-secondary);
}
.upload-zone h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}
.upload-zone p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* === Blog article === */
.article-header {
  padding: 40px 0 24px;
}
.article-header h1 {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.4;
  margin-bottom: 12px;
}
.article-meta {
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.article-content {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 32px;
  margin-bottom: 32px;
  max-width: 800px;
}
.article-content h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 32px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.article-content h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 24px 0 12px;
}
.article-content p {
  margin-bottom: 16px;
  line-height: 1.8;
  color: #334155;
}
.article-content ul, .article-content ol {
  margin-bottom: 16px;
  padding-left: 24px;
  line-height: 1.8;
  color: #334155;
}
.article-content li { margin-bottom: 8px; }
.article-content code {
  background: #F1F5F9;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
}
.article-content pre {
  background: #1E293B;
  color: #E2E8F0;
  padding: 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.6;
}
.article-content blockquote {
  border-left: 4px solid var(--primary);
  padding: 12px 20px;
  margin-bottom: 16px;
  background: var(--primary-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text);
}
.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}
.article-content th, .article-content td {
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
  font-size: 14px;
}
.article-content th {
  background: var(--bg);
  font-weight: 600;
}

/* === Tool embedded in article === */
.tool-embed {
  background: var(--bg);
  border: 2px solid var(--primary-light);
  border-radius: var(--radius);
  padding: 24px;
  margin: 24px 0;
}
.tool-embed-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tool-embed-link {
  font-size: 14px;
  color: var(--primary);
  font-weight: 600;
}

/* === Related articles === */
.related-section { margin-bottom: 40px; }

/* === Responsive === */
@media (max-width: 768px) {
  .nav { display: none; }
  .nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    gap: 16px;
    box-shadow: var(--shadow-md);
  }
  .nav-toggle { display: block; }
  .hero h1 { font-size: 26px; }
  .hero p { font-size: 15px; }
  .hero { padding: 36px 0 24px; }
  .site-main { padding: 16px; }
  .tools-grid { grid-template-columns: 1fr; }
  .blog-grid { grid-template-columns: 1fr; }
  .article-content { padding: 20px; }
  .tool-container { padding: 20px; }
  .footer-inner { flex-direction: column; text-align: center; }
}

@media (min-width: 769px) {
  .nav-toggle { display: none !important; }
}
