/* === 在线工具箱 - 全局样式 === */
:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --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: 1200px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === 导航 === */
.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}
.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.nav-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-logo .icon { font-size: 1.5rem; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--primary); }

/* === 主容器 === */
main {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}

/* === 面包屑 === */
.breadcrumb {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}
.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
}
.breadcrumb a:hover { color: var(--primary); }

/* === 页头 === */
.page-header {
  text-align: center;
  margin-bottom: 3rem;
}
.page-header h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.75rem;
}
.page-header p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* === 工具网格 === */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
  cursor: pointer;
}
.tool-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.tool-card .card-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}
.tool-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.tool-card p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* === 工具页面 === */
.tool-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}
.tool-container h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.tool-container .desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* === 表单元素 === */
textarea, input[type="text"], input[type="url"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  background: var(--bg);
  color: var(--text);
  resize: vertical;
  transition: border-color 0.2s;
}
textarea:focus, input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
textarea { min-height: 200px; }
label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
}

button, .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
button:hover, .btn:hover { background: var(--primary-dark); }
button:active { transform: scale(0.98); }
button.secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}
button.secondary:hover {
  background: var(--border);
}
button.success { background: var(--success); }
button.warning { background: var(--warning); color: #000; }

.btn-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

/* === 结果区域 === */
.result-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-top: 1rem;
  min-height: 60px;
  word-break: break-all;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
}

/* === 卡片面板 === */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.panel h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* === 状态提示 === */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  font-size: 0.875rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 999;
}
.toast.show { opacity: 1; }

/* === 页脚 === */
footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

/* === 响应式 === */
@media (max-width: 768px) {
  main { padding: 1.5rem 1rem; }
  .page-header h1 { font-size: 1.6rem; }
  .tools-grid { grid-template-columns: 1fr; }
  .tool-container { padding: 1.25rem; }
  .nav-inner { height: 52px; }
}

/* === 工具特定样式 === */

/* 二维码 */
.qr-wrapper { text-align: center; padding: 1.5rem 0; }
.qr-wrapper canvas, .qr-wrapper img { border-radius: 12px; box-shadow: var(--shadow); }
.qr-input-group { display: flex; gap: 0.75rem; }
.qr-input-group input { flex: 1; }

/* 图片压缩 */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-secondary);
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary);
  background: rgba(59,130,246,0.04);
}
.drop-zone .dz-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.drop-zone p { font-size: 0.9rem; }
.preview-area { margin-top: 1.5rem; }
.preview-area img { max-width: 100%; max-height: 400px; border-radius: 8px; }
.preview-area .info { font-size: 0.85rem; color: var(--text-secondary); margin-top: 0.5rem; }

/* 文件输入隐藏 */
input[type="file"] { display: none; }

/* 颜色转换 */
.color-preview {
  width: 100%;
  height: 80px;
  border-radius: 8px;
  margin: 1rem 0;
  border: 1px solid var(--border);
}
.color-inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.color-inputs .field { }
.color-inputs label { margin-bottom: 0.25rem; }
.color-inputs input { padding: 0.5rem 0.75rem; font-size: 0.9rem; }

/* JSON 语法高亮 */
.json-highlight {
  background: #1e293b;
  color: #e2e8f0;
  padding: 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.7;
  white-space: pre-wrap;
}
.json-key { color: #93c5fd; }
.json-string { color: #86efac; }
.json-number { color: #fdba74; }
.json-boolean { color: #c4b5fd; }
.json-null { color: #fca5a5; }

/* 响应式工具 */
@media (max-width: 480px) {
  .qr-input-group { flex-direction: column; }
  .drop-zone { padding: 2rem 1rem; }
  .color-inputs { grid-template-columns: 1fr; }
}
