/* ===== Toolso 公共样式 ===== */
:root {
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ===== Global Typography ===== */
body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Source Han Sans SC", "WenQuanYi Micro Hei", sans-serif;
  font-size: 17px;
  letter-spacing: 0.01em;
  line-height: 1.65;
}

/* Heading hierarchy */
h1, h2, h3, h4, h5 {
  letter-spacing: 0.015em;
  line-height: 1.35;
}
h1 { font-weight: 700; }
h2 { font-weight: 600; }

/* Keep monospace for code-like surfaces */
code, kbd, pre, samp { font-family: 'JetBrains Mono', Menlo, Monaco, Consolas, monospace; }

/* ===== 思源黑体 Noto Sans SC（免费商用 SIL OFL，本地 woff2） ===== */
@font-face {
  font-family: 'Noto Sans SC';
  src: url('../fonts/NotoSansSC-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Noto Sans SC';
  src: url('../fonts/NotoSansSC-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}


html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Tool card hover */
.tool-card {
  transition: transform 250ms var(--ease-out), box-shadow 250ms var(--ease-out), border-color 250ms var(--ease-out);
}
.tool-card:hover { transform: translateY(-4px); }
.tool-card:focus-within {
  box-shadow: 0 0 0 2px #2563eb, 0 12px 24px -4px rgba(0,0,0,0.08);
}

/* Form controls */
.field-input:focus,
.search-input:focus {
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.btn-primary {
  transition: background-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}
.btn-primary:hover { transform: translateY(-1px); }

.category-pill { transition: all 150ms ease; }
.nav-item { transition: background-color 150ms ease, color 150ms ease; }

/* Focus rings */
*:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}
.tool-card *:focus-visible { outline: none; }

/* Sidebar overlay */
.sidebar-overlay { transition: opacity 250ms ease; }

/* Sidebar collapse/expand transitions */
#sidebar { transition: width 300ms var(--ease-out), transform 300ms ease; }
[data-layout-main], .lg\:pl-64 { transition: padding-left 300ms var(--ease-out); }

/* Collapsed state (desktop only, ≥1024px) */
@media (min-width: 1024px) {
  body.sidebar-collapsed #sidebar { width: 4rem; }
  body.sidebar-collapsed #sidebar .sidebar-label { display: none; }
  body.sidebar-collapsed #sidebar .sidebar-header { justify-content: center; padding-left: 0; padding-right: 0; }
  body.sidebar-collapsed #sidebar .nav-item { justify-content: center; padding-left: 0; padding-right: 0; }
  body.sidebar-collapsed #sidebar .sidebar-footer { padding: 0.75rem 0; }
  body.sidebar-collapsed #sidebar .sidebar-toggle-btn { display: flex; }
  body.sidebar-collapsed #sidebar .sidebar-toggle-btn .toggle-text { display: none; }
  body.sidebar-collapsed [data-layout-main] { padding-left: 4rem; }
  body.sidebar-collapsed .lg\:pl-64 { padding-left: 4rem; }
}

/* Sidebar toggle button */
.sidebar-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.625rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  color: #6b7280;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}
.sidebar-toggle-btn:hover {
  background: #f3f4f6;
  color: #111827;
}
.dark .sidebar-toggle-btn { color: #9ca3af; }
.dark .sidebar-toggle-btn:hover { background: #1f2937; color: #f9fafb; }
.sidebar-toggle-btn svg { transition: transform 300ms var(--ease-out); }
body.sidebar-collapsed .sidebar-toggle-btn svg { transform: rotate(180deg); }

/* Back to toolbox link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #2563eb;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  text-decoration: none;
  transition: background-color 150ms ease, border-color 150ms ease;
  margin-bottom: 0.75rem;
}
.back-link:hover { background: #dbeafe; border-color: #bfdbfe; }
.back-link svg { width: 0.875rem; height: 0.875rem; }
.dark .back-link { color: #60a5fa; background: rgba(37,99,235,0.15); border-color: rgba(37,99,235,0.25); }
.dark .back-link:hover { background: rgba(37,99,235,0.25); }

/* Tool page layout — 内容居中，大屏自动避让侧边栏 */
.tool-container {
  width: 100%;
  max-width: 56rem;
  margin: 1.5rem auto 0;
  padding: 2.25rem;
  box-sizing: border-box;
  background: #fff;
  border-radius: 1.25rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03), 0 8px 24px rgba(0,0,0,0.05);
  border: 1px solid #f0f1f3;
}
.tool-container--wide {
  max-width: 80rem;
}

/* 大屏（≥1024px）侧边栏可见时，main 元素避让侧边栏，内容在剩余空间居中 */
@media (min-width: 1024px) {
  [data-layout-main] {
    padding-left: 16rem;
  }
}

.tool-header {
  margin-bottom: 1.5rem;
}
.tool-header h1 {
  font-size: 1.625rem !important;
  font-weight: 700 !important;
  color: #111827 !important;
  letter-spacing: -0.025em;
}
.tool-header p {
  color: #6b7280 !important;
  font-size: 0.9375rem !important;
  margin-top: 0.25rem;
}

.field-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid #e5e7eb;
  border-radius: 0.625rem;
  background: #fafbfc;
  color: #111827;
  font-size: 0.9375rem;
  transition: all 200ms ease;
}
.field-input:hover {
  border-color: #d1d5db;
  background: #fff;
}
.field-input:focus {
  outline: none;
  border-color: #2563eb;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.dark .field-input {
  background: #1f2937;
  border-color: #374151;
  color: #f9fafb;
}
.field-input:focus {
  outline: none;
  border-color: #2563eb;
}

textarea.field-input {
  min-height: 140px;
  resize: vertical;
  font-family: 'JetBrains Mono', Menlo, Monaco, Consolas, monospace;
}

/* Sidebar category hover popup */
.category-popup {
  position: fixed;
  z-index: 60;
  width: 230px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 20px 60px -12px rgba(0,0,0,0.18), 0 4px 16px -4px rgba(0,0,0,0.08);
  padding: 12px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-6px);
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-6px);
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms;
  pointer-events: none;
}
.dark .category-popup {
  background: #1f2937;
  border-color: #374151;
  box-shadow: 0 16px 48px -8px rgba(0,0,0,0.5), 0 4px 12px -2px rgba(0,0,0,0.3);
}
.category-popup.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
}
.category-popup__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid #f3f4f6;
}
.dark .category-popup__header { border-bottom-color: #374151; }
.category-popup__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.category-popup__title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #111827;
}
.dark .category-popup__title { color: #f9fafb; }
.category-popup__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.category-popup__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.875rem;
  color: #4b5563;
  text-decoration: none;
  cursor: pointer;
  transition: all 120ms ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.category-popup__item:hover,
.category-popup__item:focus {
  background: #eff6ff;
  color: #2563eb;
  outline: none;
}
.dark .category-popup__item { color: #d1d5db; }
.dark .category-popup__item:hover,
.dark .category-popup__item:focus {
  background: rgba(37,99,235,0.15);
  color: #60a5fa;
}
.category-popup__item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.7;
}

/* Special layout for "全部工具" category: 2 columns + scrollable */
.category-popup.is-all {
  width: 380px;
  max-height: 420px;
}
.category-popup.is-all .category-popup__list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 8px;
}
.category-popup.is-all .category-popup__item {
  font-size: 0.75rem;
  padding: 5px 6px;
}

/* Result/output box */
.result-box {
  padding: 0.75rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  font-family: 'JetBrains Mono', Menlo, Monaco, Consolas, monospace;
  font-size: 0.875rem;
  word-break: break-all;
  min-height: 60px;
}
.dark .result-box {
  background: #111827;
  border-color: #374151;
  color: #f9fafb;
}

/* Result row + copy button */
.result-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.copy-btn {
  opacity: 1;
  flex-shrink: 0;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  line-height: 1;
  color: #6b7280;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 150ms ease;
}
.copy-btn:hover {
  color: #2563eb;
  border-color: #bfdbfe;
  background: #eff6ff;
}
.dark .copy-btn {
  color: #9ca3af;
  background: #1f2937;
  border-color: #374151;
}
.dark .copy-btn:hover {
  color: #60a5fa;
  border-color: #1e40af;
  background: rgba(37, 99, 235, 0.15);
}
.copy-btn.copied {
  opacity: 1;
  color: #16a34a;
  border-color: #bbf7d0;
  background: #f0fdf4;
}
.dark .copy-btn.copied {
  color: #4ade80;
  border-color: #166534;
  background: rgba(22, 163, 74, 0.15);
}

/* Toast message */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  padding: 0.625rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: #fff;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateY(-10px);
  transition: all 200ms ease;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast.success { background: #16a34a; }
.toast.error { background: #dc2626; }
.toast.info { background: #2563eb; }

/* ===== 工具使用指南 优化样式 ===== */
.tool-guide {
  margin-top: 5rem !important;
  margin-bottom: 3rem;
}
.tool-guide > div {
  position: relative;
  border-radius: 0.75rem !important;
  box-shadow: none !important;
  overflow: hidden;
  padding: 1.25rem 1.5rem !important;
  background: #f9fafb !important;
  border: 1px solid #f3f4f6 !important;
}
.tool-guide > div::before {
  content: none;
}
.dark .tool-container {
  background: #1f2937 !important;
  border-color: #374151 !important;
}
.dark .tool-guide > div {
  box-shadow: none !important;
  background: #111827 !important;
  border-color: #1f2937 !important;
}
.tool-guide h2 {
  font-size: 0.9375rem !important;
  font-weight: 600 !important;
  padding-bottom: 0.625rem !important;
  margin-bottom: 0.875rem !important;
  border-bottom: 1px solid #e5e7eb !important;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #6b7280 !important;
}
.dark .tool-guide h2 { border-bottom-color: #374151 !important; }
.tool-guide h2::before {
  content: '';
  display: inline-block;
  width: 0.375rem; height: 0.375rem;
  background: #9ca3af;
  border-radius: 9999px;
  flex-shrink: 0;
}
.tool-guide .space-y-5 > div { margin-bottom: 1.25rem; }
.tool-guide .space-y-5 > div:last-child { margin-bottom: 0; }
.tool-guide h3 {
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  margin-bottom: 0.5rem !important;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #4b5563 !important;
}
.tool-guide h3 > span { display: none !important; }
.tool-guide h3::before {
  content: '';
  display: inline-block;
  width: 0.25rem; height: 0.25rem;
  border-radius: 9999px;
  border-radius: 0.5rem;
  flex-shrink: 0;
}
.tool-guide .space-y-5 > div:nth-child(1) h3::before {
  background: #eff6ff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%232563eb' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z'/%3E%3C/svg%3E");
  background-size: 1rem 1rem; background-position: center; background-repeat: no-repeat;
}
.tool-guide .space-y-5 > div:nth-child(2) h3::before {
  background: #ecfdf5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2310b981' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01'/%3E%3C/svg%3E");
  background-size: 1rem 1rem; background-position: center; background-repeat: no-repeat;
}
.tool-guide .space-y-5 > div:nth-child(3) h3::before {
  background: #fffbeb;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23f59e0b' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z'/%3E%3C/svg%3E");
  background-size: 1rem 1rem; background-position: center; background-repeat: no-repeat;
}
.tool-guide .space-y-5 > div:nth-child(4) h3::before {
  background: #faf5ff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%238b5cf6' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1'/%3E%3C/svg%3E");
  background-size: 1rem 1rem; background-position: center; background-repeat: no-repeat;
}
.tool-guide p {
  font-size: 0.875rem !important;
  line-height: 1.7 !important;
  color: #6b7280 !important;
}
.dark .tool-guide p { color: #d1d5db !important; }
.tool-guide ol { list-style: none !important; padding: 0 !important; margin: 0 !important; }
.tool-guide ol li {
  display: flex !important;
  align-items: flex-start !important;
  gap: 0.75rem !important;
  padding: 0.5rem 0 !important;
  font-size: 0.875rem !important;
  line-height: 1.6 !important;
  color: #4b5563 !important;
}
.dark .tool-guide ol li { color: #d1d5db !important; }
.tool-guide ol li > span:first-child {
  flex-shrink: 0 !important;
  width: 1.125rem !important; height: 1.125rem !important;
  border-radius: 9999px !important;
  font-size: 0.6875rem !important;
  background: linear-gradient(135deg, #2563eb, #7c3aed) !important;
  color: #fff !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin-top: 0.1rem !important;
}
.tool-guide .space-y-3 > div {
  background: #fff !important;
  border-radius: 0.5rem !important;
  padding: 0.625rem 0.875rem !important;
  border: 1px solid #f3f4f6 !important;
  border-left: 3px solid #f59e0b !important;
  transition: all 0.2s ease !important;
}
.tool-guide .space-y-3 > div:hover {
  background: #fffbeb !important;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.1) !important;
}
.dark .tool-guide .space-y-3 > div { background: #1f2937 !important; }
.dark .tool-guide .space-y-3 > div:hover { background: #374151 !important; }
.tool-guide .space-y-3 > div p:first-child {
  font-weight: 600 !important;
  color: #92400e !important;
  margin-bottom: 0.375rem !important;
}
.dark .tool-guide .space-y-3 > div p:first-child { color: #fbbf24 !important; }
.tool-guide .flex.flex-wrap.gap-2 a,
.tool-guide .flex.flex-wrap.gap-2 span {
  background: #f5f3ff !important;
  color: #7c3aed !important;
  border: 1px solid #ede9fe !important;
  border-radius: 0.5rem !important;
  padding: 0.375rem 0.875rem !important;
  font-size: 0.8125rem !important;
  font-weight: 500 !important;
  transition: all 0.2s ease !important;
  text-decoration: none !important;
}
.tool-guide .flex.flex-wrap.gap-2 a:hover {
  background: #7c3aed !important;
  color: #fff !important;
  border-color: #7c3aed !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25) !important;
}
.dark .tool-guide .flex.flex-wrap.gap-2 a,
.dark .tool-guide .flex.flex-wrap.gap-2 span {
  background: rgba(124, 58, 237, 0.15) !important;
  color: #c4b5fd !important;
  border-color: rgba(124, 58, 237, 0.3) !important;
}

/* 相关工具推荐 - 可点击链接样式 */
.tool-guide .related-tool-link {
  display: inline-block;
  padding: 0.375rem 0.875rem;
  font-size: 0.75rem;
  border-radius: 9999px;
  background: #f3f4f6;
  color: #4b5563;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}
.tool-guide .related-tool-link:hover {
  background: #7c3aed;
  color: #fff;
  border-color: #7c3aed;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
}
.dark .tool-guide .related-tool-link {
  background: #374151;
  color: #d1d5db;
}
.dark .tool-guide .related-tool-link:hover {
  background: #7c3aed;
  color: #fff;
}


/* ===== 全局字体放大覆盖 ===== */
.text-xs { font-size: 0.8125rem !important; }
.text-sm { font-size: 0.9375rem !important; }
.text-base { font-size: 1rem !important; }

/* tab 按钮 */
button[class*="text-xs"], button[class*="text-sm"] {
  font-size: 0.9375rem !important;
  padding-top: 0.5rem !important;
  padding-bottom: 0.5rem !important;
  padding-left: 0.75rem !important;
  padding-right: 0.75rem !important;
  line-height: 1.4 !important;
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
}

/* tab 栏整体高度 */
[class*="tab"], [role="tab"] {
  min-height: 2.5rem !important;
}

/* 输入框 placeholder */
input::placeholder, textarea::placeholder {
  font-size: 0.9375rem !important;
  color: #9ca3af !important;
}

/* 所有按钮稍微调大 */
button {
  font-size: 0.9375rem !important;
}

/* "查看全部"链接按钮 */
.view-all-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.875rem !important;
  font-weight: 500;
  color: #2563eb !important;
  background: #eff6ff;
  text-decoration: none !important;
  transition: all 150ms ease;
  flex-shrink: 0;
}
.view-all-link:hover {
  background: #dbeafe;
  transform: translateX(2px);
}

/* 下拉菜单文字 */
.dropdown-item, [class*="dropdown"] {
  font-size: 0.9375rem !important;
}
