/**
 * 开发者工具箱 - 全局设计系统
 * 基于 UI UX Pro Max Developer Tools 规则：Minimalism + Flat，高对比、功能性、无 emoji 图标
 * 字体：IBM Plex Sans（正文）+ JetBrains Mono（代码）
 */

/* ========== 设计令牌（UI UX Pro Max: Progress teal + CTA orange） ========== */
:root {
  /* 品牌色：Teal 主色 + Orange CTA */
  --brand: #0D9488;
  --brand-hover: #0F766E;
  --brand-light: rgba(13, 148, 136, 0.08);
  --brand-ring: rgba(13, 148, 136, 0.35);
  --cta: #F97316;
  --cta-hover: #EA580C;
  --cta-light: rgba(249, 115, 22, 0.08);

  /* 背景 */
  --bg-page: #F8FAFC;
  --bg-page-gradient: linear-gradient(165deg, #F0FDFA 0%, #F8FAFC 50%, #F1F5F9 100%);
  --bg-card: #FFFFFF;
  --bg-input: #FFFFFF;
  --bg-muted: #F1F5F9;

  /* 卡片强调色 */
  --accent-json: #0D9488;
  --accent-timestamp: #F97316;
  --accent-timestamp-bg: rgba(249, 115, 22, 0.08);

  /* 边框 */
  --border: #E2E8F0;
  --border-focus: var(--brand);

  /* 文字（WCAG 4.5:1+） */
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;

  /* 圆角 */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 1rem;
  --radius-2xl: 1.25rem;

  /* 阴影 */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);

  /* 字体：Developer Tools 推荐 */
  --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;

  /* 动效时长（150–300ms） */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
}

/* ========== 基础重置 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  background-image: var(--bg-page-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* 尊重 prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========== 卡片 ========== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal);
}
.card:hover {
  box-shadow: var(--shadow-md);
}

.card-xl {
  border-radius: var(--radius-2xl);
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius-lg);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
  border: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}
.btn-primary:hover {
  background: var(--brand-hover);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.35);
}
.btn-primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-ring);
}

/* CTA 强调按钮（可选） */
.btn-cta {
  background: var(--cta);
  color: #fff;
}
.btn-cta:hover {
  background: var(--cta-hover);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.35);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg-muted);
  border-color: #CBD5E1;
}
.btn-secondary:focus-visible {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.btn-small {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: var(--radius-md);
}

/* ========== 输入框 / 文本域 ========== */
.input,
textarea.input-mono {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 15px;
  font-family: var(--font-mono);
  background: var(--bg-input);
  color: var(--text-primary);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}
.input::placeholder,
textarea.input-mono::placeholder {
  color: var(--text-muted);
}
.input:focus,
textarea.input-mono:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

textarea.input-mono {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

.code-area {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
}

/* ========== 页面通用结构 ========== */
.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* 页面头部（工具页） */
.page-header {
  background: var(--bg-card);
  padding: 20px 24px;
  border-radius: var(--radius-2xl);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal);
}
.page-header:hover {
  box-shadow: var(--shadow-md);
}
.page-header h1 {
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.page-header a {
  color: var(--brand);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}
.page-header a:hover {
  text-decoration: underline;
}
.page-header a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* 导航栏 */
.nav-bar {
  background: var(--bg-card);
  padding: 16px 20px;
  border-radius: var(--radius-2xl);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal);
}
.nav-bar:hover {
  box-shadow: var(--shadow-md);
}
.nav-bar h3 {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 10px;
}
.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.nav-links a {
  color: var(--brand);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
  cursor: pointer;
}
.nav-links a:hover {
  background: var(--brand-light);
}
.nav-links a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* 面板标题 */
.panel-title {
  color: var(--text-primary);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 12px;
}

/* 表单组 */
.input-group {
  margin-bottom: 20px;
}
.input-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
}
.hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* 错误 / 成功提示 */
.alert {
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  margin-top: 16px;
  display: none;
  line-height: 1.5;
}
.alert.show {
  display: block;
}
.alert-error {
  background: #FEF2F2;
  color: #B91C1C;
  border: 1px solid #FECACA;
}
.alert-success {
  background: #F0FDF4;
  color: #166534;
  border: 1px solid #BBF7D0;
}

/* 结果项 */
.result-item {
  background: var(--bg-muted);
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  border-left: 4px solid var(--brand);
}
.result-item label {
  display: block;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 6px;
  font-weight: 500;
}
.result-item .value {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 15px;
  word-break: break-all;
}

/* ========== 首页工具卡片（无 emoji，左侧色条 + SVG 图标区） ========== */
.tool-card {
  background: var(--bg-card);
  border-radius: var(--radius-2xl);
  padding: 28px 24px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  overflow: hidden;
}
.tool-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: var(--radius-2xl) 0 0 var(--radius-2xl);
  background: var(--brand);
}
.tool-card.tool-card--timestamp::before {
  background: var(--accent-timestamp);
}
.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.tool-card:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 4px;
}
.tool-card .tool-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  background: var(--brand-light);
  margin-bottom: 14px;
  color: var(--brand);
}
.tool-card.tool-card--timestamp .tool-icon-wrap {
  background: var(--accent-timestamp-bg);
  color: var(--accent-timestamp);
}
.tool-card .tool-icon-wrap svg {
  width: 28px;
  height: 28px;
}
.tool-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}
.tool-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.55;
}
.tool-card .arrow {
  margin-top: 12px;
  color: var(--brand);
  font-weight: 600;
  font-size: 0.9rem;
}
.tool-card.tool-card--timestamp .arrow {
  color: var(--accent-timestamp);
}

/* ========== 语言切换器 ========== */
/* ===== SEO 组件：面包屑导航 ===== */
.seo-breadcrumb {
  max-width: 1180px;
  margin: 0 auto 8px;
  padding: 0 4px;
}
.seo-breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.seo-breadcrumb li { display: flex; align-items: center; gap: 4px; }
.seo-breadcrumb li:not(:last-child)::after { content: "/"; color: var(--border); }
.seo-breadcrumb a {
  color: var(--brand);
  text-decoration: none;
  transition: color var(--transition-normal);
}
.seo-breadcrumb a:hover { text-decoration: underline; }

/* ===== SEO 组件：相关工具推荐 ===== */
.seo-related {
  max-width: 1180px;
  margin: 24px auto 0;
  padding: 0 4px;
}
.seo-related h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.seo-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.seo-related-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}
.seo-related-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.seo-related-card .rc-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--brand-light);
  color: var(--brand);
}
.seo-related-card .rc-icon svg { width: 18px; height: 18px; }
.seo-related-card .rc-text h3 { font-size: 0.88rem; font-weight: 600; color: var(--text-primary); }
.seo-related-card .rc-text p { font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; }

/* ===== SEO 组件：FAQ 区域 ===== */
.seo-faq {
  max-width: 1180px;
  margin: 24px auto 0;
  padding: 0 4px 24px;
}
.seo-faq h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.seo-faq details {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 8px;
  overflow: hidden;
}
.seo-faq summary {
  padding: 14px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.seo-faq summary::-webkit-details-marker { display: none; }
.seo-faq summary::after {
  content: "+";
  font-size: 1.1rem;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform var(--transition-normal);
}
.seo-faq details[open] summary::after { content: "−"; }
.seo-faq details p,
.seo-faq details div {
  padding: 0 16px 14px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.lang-switcher {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
}
.lang-switcher select {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal), background var(--transition-normal);
}
.lang-switcher select:hover {
  background: var(--bg-muted);
  border-color: #CBD5E1;
  box-shadow: var(--shadow-md);
}
.lang-switcher select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
