/* ===== XHBlogs Design System ===== */
/* 匹配 Tailwind glassmorphism 风格 — bg-white/40 dark:bg-slate-800/50 backdrop-blur-md */

/* ─── 1. Design Tokens ─── */
:root {
  --font-sans: 'Noto Serif SC', 'PingFang SC', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', Consolas, monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;

  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.75;

  /* ⭐ XHBlogs 配色：indigo accent + slate text */
  --primary: #6366f1;
  --primary-light: rgba(99,102,241,0.12);
  --primary-dark: #4f46e5;
  --accent: #a855f7;
  --accent-light: rgba(168,85,247,0.12);

  /* ⭐ XHBlogs 毛玻璃卡片：bg-white/40 dark:bg-slate-800/50 */
  --bg: rgba(248,250,252,0.55);
  --card-bg: rgba(255,255,255,0.4);
  --card-bg-hover: rgba(255,255,255,0.6);
  --card-border: rgba(255,255,255,0.4);

  /* ⭐ XHBlogs 文字色：text-slate-900 / dark:text-white */
  --text: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;

  --border: rgba(226,232,240,0.6);
  --border-hover: rgba(99,102,241,0.4);

  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;
  --info: #6366f1;

  /* ⭐ XHBlogs 大圆角：rounded-3xl = 24px */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 50%;

  --glass-blur: 12px;
  --glass-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.05);
  --glass-shadow-hover: 0 4px 6px rgba(0,0,0,0.07), 0 10px 24px rgba(0,0,0,0.08);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.06);
  --shadow-xl: 0 10px 25px rgba(0,0,0,0.08);

  --space-1: 4px; --space-2: 8px; --space-3: 12px;
  --space-4: 16px; --space-5: 20px; --space-6: 24px;
  --space-8: 32px; --space-10: 40px; --space-12: 48px;
  --space-16: 64px;

  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;

  --z-base: 1; --z-sticky: 20; --z-overlay: 40; --z-modal: 100; --z-toast: 999;
}

/* ⭐ XHBlogs 暗色模式：dark:bg-slate-800/50 dark:text-white */
[data-theme="dark"] {
  --primary: #818cf8;
  --primary-light: rgba(129,140,248,0.15);
  --primary-dark: #6366f1;
  --accent: #c084fc;
  --accent-light: rgba(192,132,252,0.12);

  --bg: rgba(15,23,42,0.65);
  --card-bg: rgba(30,41,59,0.5);
  --card-bg-hover: rgba(30,41,59,0.7);
  --card-border: rgba(255,255,255,0.1);

  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;

  --border: rgba(51,65,85,0.6);
  --border-hover: rgba(129,140,248,0.4);

  --glass-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 4px 12px rgba(0,0,0,0.15);
  --glass-shadow-hover: 0 4px 6px rgba(0,0,0,0.25), 0 10px 24px rgba(0,0,0,0.2);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.15);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.18);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.2);
  --shadow-xl: 0 10px 25px rgba(0,0,0,0.25);
}

/* ─── 2. Reset ─── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ─── 3. Base ─── */
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: linear-gradient(135deg, rgba(248,250,252,0.3), rgba(241,245,249,0.3));
  color: var(--text);
  min-height: 100vh;
  line-height: var(--leading-relaxed);
  -webkit-font-smoothing: antialiased;
  transition: background 0.5s, color 0.3s;
}
[data-theme="dark"] body {
  background: linear-gradient(135deg, rgba(15,23,42,0.5), rgba(2,6,23,0.5));
}

/* ─── 4. ⭐ 毛玻璃卡片 (XHBlogs signature) ─── */
.glass {
  background: var(--card-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--card-border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--glass-shadow);
  transition: all var(--duration-normal) var(--ease-in-out);
}
.glass:hover {
  background: var(--card-bg-hover);
  box-shadow: var(--glass-shadow-hover);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

/* ─── 5. Container ─── */
.container { max-width: 900px; margin: 0 auto; padding: var(--space-5); }
.container-wide { max-width: 1200px; margin: 0 auto; padding: var(--space-5); }
.container-narrow { max-width: 680px; margin: 0 auto; padding: var(--space-5); }

/* ─── 6. Focus ─── */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--radius-sm); }

/* ─── 7. Reduced Motion ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ─── 8. Keyframes ─── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes fadeInOut {
  0% { opacity: 0; transform: translateY(-10px); }
  10% { opacity: 1; transform: translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* ─── 9. Typography ─── */
h1, h2, h3, h4 { line-height: var(--leading-tight); font-weight: 900; color: var(--text); letter-spacing: -0.02em; }
h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
p { line-height: var(--leading-relaxed); }
a { color: var(--primary); text-decoration: none; transition: color var(--duration-fast); }
a:hover { color: var(--primary-dark); }

/* ─── 10. Header ─── */
.header { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-6); flex-wrap: wrap; }
.header h1 { font-size: var(--text-2xl); font-weight: 900; }
.header-center { text-align: center; padding: var(--space-10) 0 var(--space-6); }
.header-center h1 { font-size: var(--text-4xl); font-weight: 900; margin-bottom: var(--space-2); letter-spacing: 0.05em; }
.header-center p { color: var(--text-secondary); font-size: var(--text-base); }

/* ─── 11. Back Link ─── */
.back-link {
  display: inline-flex; align-items: center; gap: var(--space-1);
  color: var(--primary); text-decoration: none; font-size: var(--text-sm); font-weight: 700;
  padding: 6px 14px;
  background: var(--card-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  transition: all var(--duration-fast);
}
.back-link:hover { background: var(--card-bg-hover); border-color: var(--primary); text-decoration: none; }

/* ─── 12. ⭐ Tool Area (XHBlogs 卡片) ─── */
.tool-area {
  background: var(--card-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--card-border);
  border-radius: var(--radius-2xl);
  padding: 28px;
  box-shadow: var(--glass-shadow);
}

/* ─── 13. Buttons ─── */
.btn {
  padding: 10px 20px; min-height: 44px;
  border: none; border-radius: var(--radius-lg);
  cursor: pointer; font-size: var(--text-sm); font-weight: 700;
  transition: all var(--duration-normal) var(--ease-in-out);
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-1); text-decoration: none; line-height: 1;
  font-family: inherit; letter-spacing: 0.01em;
}
.btn-primary {
  background: var(--primary); color: #fff;
  box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}
.btn-primary:hover {
  background: var(--primary-dark); transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99,102,241,0.4);
}
.btn-outline {
  background: transparent; border: 1px solid var(--border); color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-accent {
  background: var(--accent); color: #fff;
  box-shadow: 0 2px 8px rgba(168,85,247,0.3);
}
.btn-accent:hover {
  filter: brightness(1.1); transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(168,85,247,0.4);
}
.btn-sm { padding: 6px 14px; min-height: 36px; font-size: var(--text-xs); border-radius: var(--radius-md); }
.btn-lg { padding: 14px 28px; min-height: 48px; font-size: var(--text-base); border-radius: var(--radius-xl); }
.btn:disabled, .btn[disabled] { opacity: 0.38; cursor: not-allowed; pointer-events: none; }
.btn-group { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-4); }

/* ─── 14. Form Elements ─── */
textarea, input[type="text"], input[type="number"], input[type="url"],
input[type="email"], input[type="date"], input[type="time"],
input[type="datetime-local"], input[type="password"], select {
  width: 100%; padding: 10px 16px; min-height: 44px;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  font-size: var(--text-sm); background: var(--card-bg); color: var(--text);
  outline: none; font-family: inherit;
  transition: all var(--duration-fast);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
textarea:focus, input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
textarea { min-height: 120px; resize: vertical; line-height: var(--leading-normal); }
input:disabled, textarea:disabled, select:disabled { opacity: 0.38; cursor: not-allowed; }

/* ─── 15. Labels ─── */
label {
  font-size: var(--text-xs); color: var(--text-secondary);
  margin-bottom: var(--space-1); display: block; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
}

/* ─── 16. Layout Helpers ─── */
.row { display: flex; gap: var(--space-3); margin-bottom: var(--space-4); }
.row > * { flex: 1; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-3); margin-bottom: var(--space-4); }
.section { margin-bottom: var(--space-6); }
.section-title {
  font-size: var(--text-sm); font-weight: 700; color: var(--text);
  margin-bottom: var(--space-2); display: flex; align-items: center; gap: var(--space-1);
}

/* ─── 17. Output Area ─── */
.output-area {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--space-4);
  min-height: 120px; font-size: var(--text-sm);
  line-height: var(--leading-normal); white-space: pre-wrap;
  word-break: break-word; font-family: inherit; margin-top: var(--space-2);
}
.output-area.mono { font-family: var(--font-mono); font-size: var(--text-xs); }

/* ─── 18. Toast ─── */
.toast {
  position: fixed; top: 20px; right: 20px;
  padding: 14px 24px; min-height: 44px;
  border-radius: var(--radius-lg);
  background: var(--success); color: #fff;
  font-size: var(--text-sm); font-weight: 700;
  z-index: var(--z-toast);
  animation: fadeInOut 3.5s var(--ease-out);
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: var(--space-2);
}
.toast.error { background: var(--error); }
.toast.warning { background: var(--warning); }
.toast.info { background: var(--info); }

/* ─── 19. ⭐ Theme Toggle (XHBlogs 风格) ─── */
.theme-toggle {
  position: fixed; top: 20px; right: 20px;
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text);
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; z-index: var(--z-sticky);
  transition: all var(--duration-normal);
  box-shadow: var(--glass-shadow);
}
.theme-toggle:hover { border-color: var(--primary); box-shadow: var(--glass-shadow-hover); }
.theme-toggle svg { width: 18px; height: 18px; }

/* ─── 20. Status Text ─── */
.text-error { color: var(--error); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-muted { color: var(--text-secondary); font-size: var(--text-sm); }

/* ─── 21. Code Block ─── */
.code-block {
  background: #1e1e2e; color: #cdd6f4;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg); overflow-x: auto;
  font-family: var(--font-mono); font-size: var(--text-xs);
  line-height: var(--leading-normal); margin: var(--space-2) 0;
}

/* ─── 22. Skeleton Loading ─── */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--card-bg) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ─── 23. Empty State ─── */
.empty-state { text-align: center; padding: var(--space-12) var(--space-4); color: var(--text-secondary); }
.empty-state .icon-xl { margin-bottom: var(--space-4); opacity: 0.5; }
.empty-state p { font-size: var(--text-sm); }

/* ─── 24. Tab / Mode Button ─── */
.mode-btn {
  padding: 10px 18px; min-height: 44px;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  cursor: pointer; font-size: var(--text-sm); font-weight: 700; color: var(--text-secondary);
  background: transparent; transition: all var(--duration-fast);
}
.mode-btn:hover { border-color: var(--primary); color: var(--primary); }
.mode-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ─── 25. Progress Bar ─── */
.progress { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin: var(--space-2) 0; }
.progress-fill { height: 100%; background: var(--primary); width: 0; transition: width 0.3s var(--ease-out); border-radius: 2px; }

/* ─── 26. Hint ─── */
.hint { font-size: var(--text-xs); color: var(--text-secondary); margin-top: var(--space-1); margin-bottom: var(--space-2); }

/* ─── 27. Checkbox / Radio ─── */
.check-group { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-3); }
.check-item {
  display: flex; align-items: center; gap: var(--space-1);
  padding: 8px 14px; min-height: 44px;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  cursor: pointer; font-size: var(--text-xs);
  transition: all var(--duration-fast);
  background: var(--card-bg);
  backdrop-filter: blur(4px);
}
.check-item:hover { border-color: var(--primary); }
.check-item.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

/* ─── 28. Input Group ─── */
.input-group { display: flex; gap: 0; margin-bottom: var(--space-3); }
.input-group input { border-radius: var(--radius-lg) 0 0 var(--radius-lg); }
.input-group .btn { border-radius: 0 var(--radius-lg) var(--radius-lg) 0; white-space: nowrap; }

/* ─── 29. Preview Box ─── */
.preview-box {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--space-4);
  margin-top: var(--space-3); text-align: center;
  min-height: 60px; display: flex; align-items: center; justify-content: center;
}

/* ─── 30. Range Slider ─── */
input[type="range"] {
  width: 100%; height: 6px; -webkit-appearance: none;
  background: var(--border); border-radius: 3px; outline: none; padding: 0; border: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px;
  border-radius: var(--radius-full); background: var(--primary);
  cursor: pointer; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
input[type="color"] {
  width: 40px; height: 40px; padding: 2px;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  cursor: pointer; background: var(--card-bg);
}

/* ─── 31. Footer ─── */
.footer { text-align: center; padding: var(--space-10) 0; color: var(--text-secondary); font-size: var(--text-xs); }
.footer a { color: var(--primary); }

/* ─── 32. Responsive ─── */
@media (max-width: 640px) {
  .container, .container-wide, .container-narrow { padding: var(--space-3); }
  .row { flex-direction: column; gap: var(--space-2); }
  .row-3 { grid-template-columns: 1fr; }
  .header-center h1 { font-size: var(--text-2xl); }
  .header-center p { font-size: var(--text-sm); }
  .tool-area { padding: var(--space-4); border-radius: var(--radius-xl); }
  .btn-group { flex-direction: column; }
  .btn-group .btn { width: 100%; }
  .theme-toggle { top: 12px; right: 12px; width: 36px; height: 36px; }
}
