/* ============================================================
   丰码站长工具 — 样式表
   朴素 · 简洁 · 干净
   纯白背景，灰调文字，少量蓝色点缀
   兼容 Chrome / Firefox / Edge 最新版本
   ============================================================ */

/* ========== CSS 变量 ========== */
:root {
  --bg: #ffffff;
  --bg-gray: #f7f8fa;
  --bg-subtle: #f0f2f5;
  --text: #1a1a2e;
  --text-secondary: #5a6072;
  --text-muted: #9399a8;
  --border: #e2e5ec;
  --border-light: #eef0f4;
  --blue: #2d6cdf;
  --blue-light: #eef4ff;
  --blue-dark: #1d4ed8;
  --green: #0f9d6a;
  --green-light: #ecfdf5;
  --red: #e35050;
  --yellow: #d4940b;
  --radius: 2px;
  --radius-lg: 2px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", "Consolas", "Monaco", monospace;
}

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

html {
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); }

/* ========== 站点标题 (.site-header) ========== */
.site-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 30px 0;
  max-width: 1200px;
  margin: 0 auto;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--blue);
  border-radius: var(--radius);
  flex-shrink: 0;
  color: #fff;
  text-decoration: none;
}
.site-logo:hover { opacity: 0.9; }

.site-title {
  font-size: 1.25rem;
  font-weight: 650;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}
.site-title:hover { color: var(--blue); }
.site-title .brand { color: var(--blue); }

.site-count {
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-shrink: 0;
  padding: 2px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
}

.header-search {
  flex: 1;
  max-width: 400px;
  margin: 0 auto;
  position: relative;
}
.header-search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-60%);
  color: var(--text-muted);
  pointer-events: none;
}
.header-search input {
  width: 100%;
  height: 34px;
  padding: 0 12px 0 30px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s;
}
.header-search input:focus {
  border-color: var(--blue);
}
.header-search input::placeholder { color: var(--text-muted); }

/* ---- 导航栏 / 工具栏 ---- */
.nav-strip {
  background: var(--bg-gray);
  border-top: 1px solid var(--border-light);
  padding: 0 24px;
}
.toolbar {
  background: var(--bg-gray);
  border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border-light);
  padding: 0 24px;
}
.nav-strip-inner, .toolbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
}
.nav-links {
  display: flex;
  gap: 4px;
  padding: 8px 0;
  overflow-x: auto;
}
.nav-links::-webkit-scrollbar { height: 0; }
.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s;
}
.nav-link:hover {
  color: var(--text);
  background: rgba(0,0,0,0.04);
}
.nav-link.active {
  color: var(--blue);
  background: rgba(45,108,223,0.08);
  font-weight: 600;
}

/* ---- 工具页面布局 ---- */
.tool-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 0;
  animation: fadeIn 0.25s ease;
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
#tool-container { flex: 1; min-width: 0; }
.tool-cat { font-size: 0.78rem; color: var(--text-muted); flex-shrink: 0; }

/* 相关工具侧边栏 */
#related-tools { width: 200px; flex-shrink: 0; position: sticky; top: 20px; }
.related-sidebar {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.related-heading {
  padding: 10px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-gray);
}
.related-list { padding: 6px; }
.related-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-size: 0.82rem;
  transition: all 0.15s;
}
.related-item:hover { background: var(--blue-light); color: var(--blue); }
.related-item-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.related-item:hover .related-item-icon { color: var(--blue); }
.related-item-name { line-height: 1.4; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 768px) {
  .site-header { padding: 20px 16px; }
  .nav-strip { padding: 0 12px; }
  .toolbar { padding: 0 12px; }
  .tool-wrap { padding: 16px 14px 32px; flex-direction: column; }
  #related-tools { width: 100%; position: static; }
}

/* Back button (used by tool pages) */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 0;
  margin-bottom: 14px;
  font-size: 0.8rem;
  font-family: var(--font);
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s ease;
}

.back-btn:hover {
  color: var(--blue);
}

/* 返回按钮 */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 0;
  margin-bottom: 14px;
  font-size: 0.8rem;
  font-family: var(--font);
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s ease;
}

.back-btn:hover {
  color: var(--blue);
}

/* 工具容器 */
.tool-container {
  /* 工具模块渲染到此，无额外约束 */
}

/* ========== 加载中 ========== */
.loading-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 12px;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-view p {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

/* ========== 错误视图 ========== */
.error-view {
  text-align: center;
  padding: 48px 20px;
}

.error-icon {
  color: var(--text-muted);
  margin-bottom: 10px;
}

.error-view h3 {
  font-size: 1rem;
  margin-bottom: 6px;
  color: var(--text);
}

.error-view p {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

/* ================================================================
   组件样式（工具模块使用）
   ================================================================ */

/* ---- 工具卡片（工具内部生成） ---- */
.tool-card-outer {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.tool-card-outer + .tool-card-outer { margin-top: 12px; }

/* ---- 工具标题 ---- */
.tool-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.tool-body {
  padding: 18px 20px;
}

/* ---- 输入组 ---- */
.input-group {
  margin-bottom: 12px;
}

.input-group:last-child { margin-bottom: 0; }

.input-group label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ---- 按钮 ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 20px;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  outline: none;
  white-space: nowrap;
  user-select: none;
  line-height: 1.5;
}

.btn:hover {
  background: var(--bg-gray);
  border-color: #d1d5db;
}

.btn:active { transform: scale(0.97); }

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.btn-primary:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

.btn-success {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.btn-success:hover {
  filter: brightness(0.92);
}

.btn-danger {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}

.btn-danger:hover {
  filter: brightness(0.92);
}

.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-lg { padding: 10px 24px; font-size: 0.95rem; }

/* ---- 输入框 / 文本域 ---- */
.input,
.textarea {
  width: 100%;
  padding: 7px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s ease;
  line-height: 1.5;
}

.input { height: 34px; }

.input:focus,
.textarea:focus {
  border-color: var(--blue);
  outline: 1px solid var(--blue);
}

.input::placeholder,
.textarea::placeholder { color: var(--text-muted); }

.textarea {
  resize: vertical;
  min-height: 100px;
  font-family: var(--font-mono);
}

.input-mono { font-family: var(--font-mono); }

/* ---- 结果显示框 ---- */
.result-box {
  background: var(--bg-gray);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 36px;
  line-height: 1.6;
  max-height: 360px;
  overflow-y: auto;
}

.result-box:empty::before {
  content: "（结果将显示在这里）";
  color: var(--text-muted);
  font-family: var(--font);
  font-style: italic;
}

/* ---- 标签 / Badge ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  font-size: 0.72rem;
  font-weight: 500;
  border-radius: var(--radius);
  background: var(--bg-gray);
  color: var(--text-secondary);
  white-space: nowrap;
  line-height: 1.5;
}

.badge-blue  { background: var(--blue-light);  color: var(--blue); }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-yellow{ background: #fffbeb; color: #f59e0b; }
.badge-red   { background: #fef2f2; color: #ef4444; }

/* ---- 提示信息 ---- */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-gray);
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-bottom: 12px;
  line-height: 1.5;
}

.alert-info    { border-color: #bfdbfe; background: var(--blue-light);  color: var(--blue); }
.alert-success { border-color: #a7f3d0; background: var(--green-light); color: var(--green); }
.alert-warning { border-color: #fde68a; background: #fffbeb; color: #f59e0b; }
.alert-error   { border-color: #fecaca; background: #fef2f2; color: #ef4444; }

/* ---- 子选项卡 ---- */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  gap: 0;
}

.tab-item {
  padding: 6px 14px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
  user-select: none;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font);
}

.tab-item:hover { color: var(--text); }

.tab-item.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 500;
}

/* ---- 复制按钮 ---- */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  font-size: 0.75rem;
  font-family: var(--font);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.copy-btn:hover {
  color: var(--text);
  border-color: var(--blue);
  background: var(--blue-light);
}

.copy-btn.copied {
  color: var(--green);
  border-color: var(--green);
  background: var(--green-light);
}

/* ---- 状态指示灯 ---- */
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.status-dot.online  { background: var(--green); }
.status-dot.offline { background: #ef4444; }
.status-dot.warning { background: #f59e0b; }

/* ========== 工具辅助布局 ========== */
.tool-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.tool-row:last-child { margin-bottom: 0; }

.tool-col { flex: 1; min-width: 0; }

.tool-actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.tool-actions-right { justify-content: flex-end; }

/* ========== 工具类 ========== */
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-small  { font-size: 0.76rem; }
.font-mono   { font-family: var(--font-mono); }

.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }

/* ================================================================
   首页专属样式
   ================================================================ */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 0;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.tool-card {
  display: flex;
  gap: 14px;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}
.tool-card:hover {
  border-color: var(--blue);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  transform: translateY(-1px);
}
.tool-card.hidden { display: none; }

.tool-card-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-gray);
  border-radius: var(--radius);
  color: var(--text-secondary);
}
.tool-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.tool-card-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.tool-card-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tool-card-cat {
  margin-top: 7px;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 2px 8px;
  background: var(--bg-gray);
  border-radius: 4px;
  align-self: flex-start;
}
.tool-card-hot {
  position: absolute;
  top: 12px;
  right: 10px;
  font-size: 0.6rem;
  font-weight: 700;
  color: #fff;
  padding: 2px 8px;
  background: #ef4444;
  border-radius: var(--radius);
  letter-spacing: 0.5px;
  line-height: 1.5;
}

.grid-empty {
  display: none;
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.grid-empty.visible { display: block; }

@media (max-width: 768px) {
  .site-header { padding: 20px 16px; }
  .nav-strip { padding: 0 12px; }
  .main-content { padding: 24px 16px 20px; }
  .tool-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
  .tool-card { padding: 12px; }
  .tool-card-name { font-size: 0.9rem; }
  .tool-card-desc { font-size: 0.85rem; }
}
@media (max-width: 480px) {
  .tool-grid { grid-template-columns: 1fr 1fr; }
}

/* ================================================================
   网站底部 (.site-footer)
   深色背景 · 大气专业
   ================================================================ */
.site-footer {
  background: #1a1a2e;
  color: #a0a5b5;
  padding: 40px 24px 36px;
  margin-top: 40px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
}
.footer-grid {
  display: flex;
  justify-content: space-between;
  gap: 40px;
}
.footer-brand-col {
  flex: 0 0 280px;
}
.footer-brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.footer-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--blue);
  border-radius: var(--radius);
}
.footer-brand-row span {
  font-size: 1.05rem;
  font-weight: 650;
  color: #e8eaf0;
}
.footer-desc {
  font-size: 0.82rem;
  color: #7a7f9a;
  line-height: 1.6;
  margin-bottom: 6px;
}
.footer-meta {
  font-size: 0.75rem;
  color: #5a5f7a;
}

.footer-links-col {
  display: flex;
  gap: 40px;
}
.footer-link-group {
  min-width: 100px;
}
.footer-link-group h4 {
  font-size: 0.78rem;
  font-weight: 600;
  color: #c8cbd8;
  margin-bottom: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.footer-grid-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.footer-grid-links a {
  display: block;
  font-size: 0.8rem;
  color: #7a7f9a;
  text-decoration: none;
  padding: 5px 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  text-align: center;
  transition: all 0.15s;
}
.footer-grid-links a:hover {
  color: #fff;
  background: rgba(107,122,255,0.1);
  border-color: rgba(107,122,255,0.2);
}

.footer-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin: 24px 0 0;
}
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  font-size: 0.75rem;
  color: #5a5f7a;
}

@media (max-width: 768px) {
  .site-footer { padding: 28px 16px 24px; margin-top: 28px; }
  .footer-grid { flex-direction: column; gap: 24px; }
  .footer-brand-col { flex: none; }
  .footer-links-col { gap: 24px; flex-wrap: wrap; }
  .footer-grid-links { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .footer-grid-links a { padding: 4px 8px; font-size: 0.75rem; }
  .footer-bottom { flex-direction: column; gap: 6px; text-align: center; }
}
