/* ================================
   代码着色高亮工具 - 自定义样式
   ================================ */

:root {
  --bg: #FAFAF9;
  --bg-alt: #F5F5F4;
  --surface: #FFFFFF;
  --border: #E7E5E4;
  --border-strong: #D6D3D1;
  --text: #1E293B;
  --text-secondary: #52525B;
  --text-muted: #71717A;
  --primary: #8B5CF6;
  --primary-hover: #7C3AED;
  --primary-light: rgba(139, 92, 246, 0.08);
  --secondary: #F97316;
  --accent: #EC4899;
  --success: #059669;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Noto Sans SC', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Toast ── */
.toast {
  position: fixed; top: 24px; right: 24px;
  background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 100px;
  font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  z-index: 1000;
  transform: translateX(calc(100% + 40px));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.toast.show { transform: translateX(0); }
.toast-dot { width: 8px; height: 8px; background: var(--success); border-radius: 50%; }

/* ── Page ── */
.page { max-width: 960px; margin: 0 auto; padding: 0 32px; }

/* ── Custom scrollbar ── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #C4B5FD; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #8B5CF6; }

::selection { background: rgba(139, 92, 246, 0.2); color: #1E293B; }

/* ── Guide Section ── */
.guide-section {
  margin-top: 16px; margin-bottom: 64px;
  background: #ffffff; border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
}
.guide-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 14px 20px;
  background: none; border: none; cursor: pointer;
  transition: background 0.15s ease;
}
.guide-toggle:hover { background: var(--bg-alt); }
.guide-toggle-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; color: #1E293B;
}
.guide-toggle.open .toggle-arrow { transform: rotate(180deg); }
.toggle-arrow { transition: transform 0.2s ease; color: var(--text-muted); }
.guide-list { padding: 0 20px 20px; }
.guide-list.hidden { display: none; }
.guide-item { padding: 16px 0; border-top: 1px solid var(--border); }
.guide-item:first-child { border-top: 1px solid var(--border); }
.guide-item-title { font-size: 14px; font-weight: 600; color: #1E293B; margin-bottom: 6px; }
.guide-item-body { font-size: 13px; color: var(--text-secondary); line-height: 1.8; }
.guide-item-body kbd {
  padding: 1px 6px; background: var(--bg-alt);
  border: 1px solid var(--border-strong); border-radius: 4px;
  font-family: 'SF Mono', 'Cascadia Code', monospace; font-size: 12px; color: var(--text-secondary);
}

/* ══════════════════════════════════════════
   Tool Specific Styles
   ══════════════════════════════════════════ */

.tool-section { padding: 8px 0 24px; }

.toolbar {
  display: flex; gap: 10px; align-items: center; padding: 12px 0;
  flex-wrap: wrap;
}

.lang-select {
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit; font-size: 14px; font-weight: 500;
  color: var(--text); cursor: pointer; outline: none;
  transition: border-color 0.15s ease;
}
.lang-select:focus { border-color: var(--primary); }

.btn-highlight {
  padding: 10px 24px;
  background: var(--primary); border: 1px solid transparent;
  border-radius: 100px;
  font-family: inherit; font-size: 14px; font-weight: 600;
  color: white; cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);
}
.btn-highlight:hover { background: #7C3AED; box-shadow: 0 4px 12px rgba(0,0,0,0.10), 0 0 0 1px rgba(0,0,0,0.04); transform: translateY(-1px); }
.btn-highlight:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }

.btn-secondary {
  padding: 10px 20px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 100px;
  font-family: inherit; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); cursor: pointer;
  transition: all 0.15s ease; white-space: nowrap;
}
.btn-secondary:hover { background: var(--primary-light); border-color: rgba(139,92,246,0.25); color: var(--primary); }
.btn-secondary.active {
  background: var(--primary); border-color: var(--primary); color: white;
}

.code-input {
  width: 100%; min-height: 240px; padding: 16px;
  background: #1e1e1e; border: 1px solid #2a2a2a;
  border-radius: var(--radius);
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  font-size: 14px; line-height: 1.7; color: #d4d4d4;
  resize: vertical; outline: none;
  transition: all 0.2s ease;
}
.code-input:focus { border-color: var(--primary); }
.code-input::placeholder { color: #6a6a6a; }

.output-toolbar {
  display: flex; gap: 8px; align-items: center; padding: 12px 0 8px;
}
.output-label {
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
}

.code-output {
  width: 100%; min-height: 200px;
  background: #1e1e1e; border: 1px solid #2a2a2a;
  border-radius: var(--radius); overflow-x: auto;
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  font-size: 14px; line-height: 1.7;
}

.code-line {
  display: flex;
}
.code-line:hover {
  background: rgba(255,255,255,0.03);
}

.line-number {
  display: inline-block; width: 48px; min-width: 48px;
  text-align: right; padding-right: 16px;
  color: #555; font-size: 13px; user-select: none;
  border-right: 1px solid #2a2a2a;
}

.code-content {
  padding-left: 16px; color: #d4d4d4; white-space: pre;
}

/* Syntax Highlight Colors */
.hl-kw { color: #c586c0; }    /* keywords */
.hl-str { color: #ce9178; }   /* strings */
.hl-cm { color: #6a9955; font-style: italic; }  /* comments */
.hl-num { color: #b5cea8; }   /* numbers */
.hl-fn { color: #dcdcaa; }    /* functions */
.hl-op { color: #d4d4d4; }    /* operators */
.hl-type { color: #4ec9b0; }  /* types / classes */
.hl-attr { color: #9cdcfe; }  /* attributes */
.hl-tag { color: #569cd6; }   /* HTML/XML tags */
.hl-punct { color: #d4d4d4; }
.hl-builtin { color: #4ec9b0; } /* built-in functions */
.hl-regex { color: #d16969; }   /* regex */
.hl-sql-fn { color: #dcdcaa; }  /* SQL functions */
.hl-sql-kw { color: #569cd6; }  /* SQL keywords */

.tab-view {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-top: 16px; margin-bottom: 0;
}
.tab-btn {
  padding: 8px 18px; background: none; border: none;
  border-bottom: 2px solid transparent;
  font-family: inherit; font-size: 13px; font-weight: 500;
  color: var(--text-muted); cursor: pointer;
  transition: all 0.15s ease; margin-bottom: -1px;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--text); border-bottom-color: var(--primary); font-weight: 600; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .page { padding: 0 16px; }
  .toolbar { gap: 8px; }
  .lang-select { font-size: 13px; }
}
