/* ================= 基础布局 ================= */
:root {
    --sidebar-width: 240px;
    --topbar-height: 76px;
    --sidebar-bg: #ffffff;
    --primary: #4361ee;
    --brand-color: #4f46e5;
}
/*:root {
    --sidebar-width: 240px;
    --topbar-height: 76px;      !* 顶部栏高度（已加大） *!
    --sidebar-bg: #1f2937;
    --primary: #4361ee;
}*/
/*:root {
    --sidebar-width: 240px;
    --topbar-height: 60px;
    --brand-color: #4f46e5;
    --bg: #f5f6fa;
    --sidebar-bg: #ffffff;
    --border: #e8e8ef;
}*/
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f4f6fb;
    color: #1f2937;
}

.layout { display: flex; min-height: 100vh; }
.brand-text{
    color: var(--brand-color);
}
/* ================= 侧栏 ================= */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #e5e7eb;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1040;
    transition: margin-left .28s ease;
}
.sidebar-brand {
    height: var(--topbar-height);   /* 与顶部栏等高对齐 */
    display: flex; align-items: center; gap: 10px;
    padding: 0 20px;
    font-size: 1.25rem; font-weight: 700; color: #fff;
    /*border-bottom: 1px solid rgba(255,255,255,.08);*/
    border-bottom: 1px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
}
.sidebar-brand i { color: var(--primary); font-size: 1.5rem; }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
/* ===== 适用于 .sidebar-nav 的滚动条样式 ===== */

.sidebar-nav {
    /* 标准属性：Firefox 和新版 Chrome 支持 */
    scrollbar-width: thin;                /* 细滚动条 */
    scrollbar-color: #b0b8c4 transparent; /* 滑块颜色 轨道透明 */
}

/* WebKit 内核浏览器（Chrome, Edge, Safari）精细定制 */
.sidebar-nav::-webkit-scrollbar {
    /*width: 6px;                          !* 滚动条宽度 *!*/
}

/* 隐藏上下箭头按钮 */
.sidebar-nav::-webkit-scrollbar-button {
    display: none;                       /* 彻底移除箭头 */
}

/* 轨道背景透明（与左侧背景一致） */
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;             /* 透出父容器背景色 */
}

/* 滑块颜色及圆角 */
.sidebar-nav::-webkit-scrollbar-thumb {
    background: #b0b8c4;                 /* 自定义颜色（可换） */
    border-radius: 3px;                  /* 圆角使更柔和 */
}

/* 滑块悬停效果 */
.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: #8e96a0;                 /* 悬停加深 */
}
/*.nav-link {
    display: flex; align-items: center;
    padding: 11px 14px; margin-bottom: 4px;
    !*color: #c7cad1;*!
    text-decoration: none;
    border-radius: 10px; font-size: .95rem;
    transition: background .15s, color .15s;
}*/
/*.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-link.active { background: var(--primary); color: #fff; }
.nav-link .badge { font-size: .7rem; }*/

.nav-group-title {
    font-size: .75rem; text-transform: uppercase;
    color: #7b8794; padding: 14px 14px 6px;
    letter-spacing: .05em;
}
/* ====== 分组标题（可点击触发器） ====== */
.nav-group-title {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    /*color: #1e293b;*/
    letter-spacing: 0.3px;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease, color 0.2s ease;
    gap: 8px;
}
.nav-group-title:hover {
    background: #f1f4f9;
    color: #0d6efd;
}
.nav-group-title:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}
/* ====== 箭头图标 ====== */
.arrow-icon {
    display: inline-block;
    font-size: 0.65rem;
    line-height: 1;
    transition: transform 0.3s ease;
    color: #6c7a8d;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}
/* 展开状态：箭头向下（默认） */
.nav-group-title:not(.collapsed) .arrow-icon {
    transform: rotate(0deg);
    color: #0d6efd;
}
/* 折叠状态：箭头向右（旋转 -90deg） */
.nav-group-title.collapsed .arrow-icon {
    transform: rotate(-90deg);
    color: #6c7a8d;
}

/* ====== 导航链接列表（折叠容器） ====== */
.nav-group .collapse {
    padding-left: 8px;
}
/* ====== 导航链接 ====== */
.nav-link {
    display: block;
    padding: 7px 12px 7px 36px;
    font-size: 0.875rem;
    color: #475569;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
    position: relative;
}
.nav-link:focus,.nav-link:hover{
    color: #475569;
}
.nav-link:hover {
    background: #f1f4f9;
    color: #0d6efd;
    padding-left: 42px;
}
.nav-link.active {
    background: #e9f0ff;
    color: #0d6efd;
    font-weight: 500;
}
.nav-link.active::before {
    content: '';
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 16px;
    background: #0d6efd;
    border-radius: 4px;
}
.collapse {
    transition: height 0.25s ease;
}

.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.08); }

/* ================= 主内容 ================= */
.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex; flex-direction: column;
    transition: margin-left .28s ease;
}

/* ================= 顶部栏（加大） ================= */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex; align-items: center;
    padding: 0 24px; gap: 20px;
    /*position: sticky; top: 0; z-index: 1030;*/
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-weight: 600; font-size: 1.1rem; color: #374151; }

.btn-toggle {
    border: none; background: #f1f3f9;
    width: 42px; height: 42px; border-radius: 10px;
    font-size: 1.4rem; color: #4b5563; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.btn-toggle:hover { background: #e2e8f0; }

/* 搜索框 */
.topbar-search { flex: 1; max-width: 560px; }
.search-wrapper { position: relative; }
.search-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: #9ca3af; font-size: 1.05rem;
}
.search-input {
    height: 46px; border-radius: 12px;
    border: 1.5px solid #e5e7eb;
    padding: 0 42px; font-size: .95rem;
    background: #f8fafc;
}
.search-input:focus { border-color: var(--primary); background: #fff; box-shadow: none; }
.btn-clear {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    border: none; background: #e5e7eb; color: #6b7280;
    width: 26px; height: 26px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}

/* 搜索建议下拉 */
.search-suggestions {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0;
    background: #fff; border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,.12);
    border: 1px solid #e5e7eb; overflow: hidden;
    display: none; z-index: 1050;
}
.search-suggestions.show { display: block; }
.suggestion-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 16px; cursor: pointer; transition: background .12s;
}
.suggestion-item:hover, .suggestion-item.active { background: #f1f5ff; }
.suggestion-item i { color: var(--primary); font-size: 1.1rem; }
.suggestion-item .sug-title { font-weight: 500; font-size: .9rem; }
.suggestion-item .sug-desc { font-size: .78rem; color: #9ca3af; }
.suggestion-item .sug-cat {
    margin-left: auto; font-size: .72rem; color: #6b7280;
    background: #f1f3f9; padding: 2px 8px; border-radius: 6px;
}
.suggestion-item mark { background: #fff3cd; color: inherit; border-radius: 3px; padding: 0 2px; }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.btn-fav {
    display: flex; align-items: center; gap: 4px;
    height: 42px; padding: 0 16px; border-radius: 10px;
    background: #fff; border: 1.5px solid #e5e7eb; color: #ef4444;
    text-decoration: none; font-weight: 500; font-size: .9rem;
    transition: background .15s;
}
.btn-fav:hover { background: #fef2f2; }
.fav-count {
    background: #ef4444; color: #fff;
    font-size: .72rem; min-width: 20px; height: 20px;
    border-radius: 10px; display: flex; align-items: center; justify-content: center;
    padding: 0 5px; margin-left: 2px;
}

/* ================= 内容区 ================= */
/*.content { padding: 28px 32px; }*/
.content { padding: 24px 28px; }

.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.page-title { font-size: 1.6rem; font-weight: 700; }
.page-sub { color: #6b7280; font-size: .9rem; margin-top: 4px; }

.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip {
    padding: 7px 16px; border-radius: 20px; font-size: .88rem;
    background: #fff; border: 1px solid #e5e7eb; color: #4b5563; text-decoration: none;
    transition: all .15s;
}
.filter-chip:hover { border-color: var(--primary); color: var(--primary); }
.filter-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ================= 工具卡片 ================= */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
}
.tool-card {
    position: relative;
    background: #fff; border-radius: 14px;
    padding: 22px 20px; cursor: pointer;
    border: 1px solid #eef0f4;
    transition: transform .15s, box-shadow .15s;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(67,97,238,.12); }
.tool-icon {
    width: 48px; height: 48px; border-radius: 12px;
    background: #eef2ff; color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; margin-bottom: 14px;
}
.tool-title { font-size: 1rem; font-weight: 600; margin-bottom: 6px; }
.tool-desc { font-size: .82rem; color: #6b7280; line-height: 1.4; min-height: 36px; }
.tool-cat {
    display: inline-block; margin-top: 10px;
    font-size: .72rem; color: #6b7280; background: #f1f3f9;
    padding: 3px 10px; border-radius: 6px;
}

/* 收藏星标 */
.fav-star {
    position: absolute; top: 14px; right: 14px;
    border: none; background: transparent; cursor: pointer;
    font-size: 1.25rem; color: #d1d5db; z-index: 2;
    transition: transform .15s, color .15s;
}
.fav-star:hover { transform: scale(1.15); }
.fav-star.active { color: #f59e0b; }

/* 搜索框左侧：首页图标 */
.btn-home {
    display: flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; border-radius: 10px;
    background: #f1f3f9; color: #4b5563; font-size: 1.25rem;
    text-decoration: none; transition: background .15s, color .15s;
}
.btn-home:hover { background: var(--primary); color: #fff; }

/* 语言切换 */
.lang-switch .btn-lang {
    display: flex; align-items: center; gap: 6px;
    height: 42px; padding: 0 14px; border-radius: 10px;
    background: #fff; border: 1.5px solid #e5e7eb; color: #374151;
    font-size: .9rem; font-weight: 500; cursor: pointer; transition: background .15s;
}
.lang-switch .btn-lang:hover { background: #f1f5ff; border-color: var(--primary); }
.lang-switch .btn-lang .bi-translate { color: var(--primary); font-size: 1.1rem; }
.lang-switch .btn-lang .bi-chevron-down { font-size: .75rem; color: #9ca3af; }
.lang-switch .dropdown-menu { border-radius: 10px; border: 1px solid #e5e7eb; box-shadow: 0 8px 24px rgba(0,0,0,.1); }
.lang-switch .dropdown-item { font-size: .9rem; cursor: pointer; }
.lang-switch .dropdown-item .fi { margin-right: 6px; }
.lang-switch .dropdown-item-text { font-size: .75rem; }

/* 卡片入场动画 */
.tool-card { animation: cardIn .2s ease both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.no-result {
    grid-column: 1 / -1; text-align: center; padding: 60px 0; color: #9ca3af;
}
.no-result i { font-size: 3rem; margin-bottom: 12px; }

/* ================= 折叠状态（PC） ================= */
body.sidebar-collapsed .sidebar { margin-left: calc(var(--sidebar-width) * -1); }
body.sidebar-collapsed .main { margin-left: 0; }

/* ================= 移动端 ================= */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0; background: rgba(0,0,0,.4);
    z-index: 1035;
}
@media (max-width: 991.98px) {
    .sidebar {
        margin-left: calc(var(--sidebar-width) * -1);   /* 默认隐藏 */
        box-shadow: 4px 0 24px rgba(0,0,0,.15);
    }
    .sidebar.mobile-show { margin-left: 0; }
    .sidebar-overlay.show { display: block; }
    .main { margin-left: 0; }
    .content { padding: 20px 16px; }
    .topbar { padding: 0 14px; gap: 10px; }
    .topbar-search { max-width: none; }
}

/* 隐藏无结果的网格 */
.tools-grid:empty + .no-result { display: block; }

/* toast.css - 自定义提示框，类名前缀 my-toast，避免与 Bootstrap 冲突 */

.my-toast-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  width: auto;
  max-width: 90vw;
  pointer-events: none;
}

.my-toast {
  pointer-events: auto;
  background: #1e293b;
  color: #f1f5f9;
  padding: 14px 20px;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  line-height: 1.5;
  opacity: 0;
  transform: scale(0.96) translateY(0);
  transition: opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
}

.my-toast.show {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.my-toast.hide {
  opacity: 0;
  transform: scale(0.92) translateY(0);
}

/* 主题变体 */
.my-toast-success {
  background: #065f46;
  border-color: rgba(52, 211, 153, 0.2);
}
.my-toast-success .my-toast-icon { color: #34d399; }

.my-toast-warning {
  background: #78350f;
  border-color: rgba(251, 191, 36, 0.2);
}
.my-toast-warning .my-toast-icon { color: #fbbf24; }

.my-toast-danger {
  background: #7f1d1d;
  border-color: rgba(248, 113, 113, 0.2);
}
.my-toast-danger .my-toast-icon { color: #f87171; }

.my-toast-info {
  background: #1e3a5f;
  border-color: rgba(96, 165, 250, 0.2);
}
.my-toast-info .my-toast-icon { color: #60a5fa; }

.my-toast-icon {
  flex-shrink: 0;
  font-size: 22px;
  line-height: 1;
  width: 28px;
  text-align: center;
}

.my-toast-content {
  flex: 0 1 auto;
  word-break: break-word;
}

.my-toast-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  color: #cbd5e1;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}
.my-toast-close:active {
  background: rgba(255, 255, 255, 0.18);
}

/* 响应式 */
@media (max-width: 480px) {
  .my-toast {
    padding: 12px 16px;
    font-size: 14px;
    border-radius: 12px;
  }
  .my-toast-icon {
    font-size: 20px;
    width: 24px;
  }
  .my-toast-container {
    max-width: 92vw;
  }
}
/* ===== 返回顶部按钮 ===== */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 24px;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: #3b82f6;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s;
  opacity: 0;
  transform: translateY(20px) scale(0.9);
  pointer-events: none;
  z-index: 999;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.back-to-top:hover {
  background: #2563eb;
  transform: translateY(-2px) scale(1.05);
}

.back-to-top:active {
  transform: scale(0.92);
  background: #1d4ed8;
}

.back-to-top svg {
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

/* 暗色适配 */
@media (prefers-color-scheme: dark) {
  .back-to-top {
    background: #4f8cf7;
    box-shadow: 0 4px 16px rgba(79, 140, 247, 0.3);
  }
  .back-to-top:hover {
    background: #3b82f6;
  }
}

/* 移动端响应式 */
@media (max-width: 480px) {
  .back-to-top {
    bottom: 20px;
    right: 16px;
    width: 44px;
    height: 44px;
  }
  .back-to-top svg {
    width: 20px;
    height: 20px;
  }
}

/* 小屏设备安全区域适配 */
@supports (padding: max(0px)) {
  .back-to-top {
    bottom: max(20px, env(safe-area-inset-bottom, 20px));
    right: max(16px, env(safe-area-inset-right, 16px));
  }
}
/* ================= 内容区底部栏 ================= */
.content-footer {
    margin-top: 40px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 14px 14px 0 0;
    padding: 18px 24px;
}
.footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.footer-left, .footer-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.footer-right{margin-right: 28px}
.footer-left .bi-tools { color: var(--primary); font-size: 1.1rem; }
.footer-brand { font-weight: 600; color: #374151; font-size: .92rem; }
.footer-sep { color: #d1d5db; margin: 0 2px; }
.footer-copy { color: #6b7280; font-size: .82rem; }
.footer-link {
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 9px;
    background: #f1f3f9; color: #4b5563; font-size: .95rem; text-decoration: none;
    transition: background .15s, color .15s;
}
.footer-link:hover { background: var(--primary); color: #fff; }
.footer-extra { color: #9ca3af; font-size: .78rem; }
@media (max-width: 991.98px) {
    .content-footer { padding: 14px 16px; }
    .footer-inner { flex-direction: column; align-items: flex-start; }
}