/* 顶部导航栏 */
.top-header, 
body > .nav {
  width: 100%;
  z-index: 1000;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  flex-shrink: 0;
  padding: 12px 32px;
  background: transparent;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-radius: 20px;
  height: 64px;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  box-shadow: 
    0 4px 6px -1px rgba(0, 0, 0, 0.1), 
    0 2px 4px -1px rgba(0, 0, 0, 0.06),
    inset 0 1px 1px rgba(255, 255, 255, 0.05);
  overflow: visible;
}

.nav-left, .nav-right, .nav-center {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: visible;
}

.nav-center {
  flex: 1;
  justify-content: center;
}

.nav-center .category-options {
  display: flex;
  flex-direction: row;
  gap: 4px;
  background: transparent;
  padding: 4px;
  border-radius: 14px;
  border: none;
}

.nav-center .category-option {
  padding: 0 16px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.nav-center .category-option:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.05);
}

.nav-center .category-option.active {
  background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.25);
}

/* 品牌 Logo 样式 */
.logo-icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-right: 0;
    position: relative;
    width: 2rem;
    height: 2rem;
    background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%); /* 绿蓝渐变背景 */
    border-radius: 10px; /* 标准圆角矩形外框 */
    border: none;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.25);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: none; /* 外框不再倾斜，保持正位圆角矩形 */
    flex-shrink: 0; /* 防止在窄屏下被压缩 */
}

.logo-icon-container::after {
    content: '';
    position: absolute;
    inset: -4px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.3) 0%, transparent 70%);
    opacity: 0.4;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.logo-shred {
    width: 0.1875rem; /* 3px */
    height: 0.75rem;  /* 12px */
    background: #ffffff; /* 改为白色，符合现有亮色风格 */
    border-radius: 2px;
    transition: all 0.3s ease;
    transform: skewX(-15deg); /* 仅内部"土豆丝"线条保持 15 度倾斜 */
}

.logo-shred-1 { height: 0.5rem; opacity: 0.6; }
.logo-shred-2 { height: 0.875rem; }
.logo-shred-3 { height: 0.375rem; opacity: 0.7; }

.top-logo:hover .logo-icon-container,
.nav-brand:hover .logo-icon-container {
    transform: translateY(-1px) scale(1.05); /* 稍微减小上移幅度，确保不触顶 */
    box-shadow: 0 6px 16px rgba(6, 182, 212, 0.4);
}

.top-logo:hover .logo-icon-container::after,
.nav-brand:hover .logo-icon-container::after {
    opacity: 0.7;
}

.top-logo:hover .logo-shred-1,
.nav-brand:hover .logo-shred-1 { 
    animation: shred-pulse-1 0.25s ease-in-out infinite alternate;
}
.top-logo:hover .logo-shred-2,
.nav-brand:hover .logo-shred-2 { 
    animation: shred-pulse-2 0.25s ease-in-out infinite alternate;
    animation-delay: 0.05s;
}
.top-logo:hover .logo-shred-3,
.nav-brand:hover .logo-shred-3 { 
    animation: shred-pulse-3 0.25s ease-in-out infinite alternate;
    animation-delay: 0.1s;
}

@keyframes shred-pulse-1 {
    0% { height: 0.5rem; opacity: 0.6; }
    100% { height: 0.875rem; opacity: 0.8; }
}

@keyframes shred-pulse-2 {
    0% { height: 0.875rem; opacity: 1; }
    100% { height: 0.5rem; opacity: 0.8; }
}

@keyframes shred-pulse-3 {
    0% { height: 0.375rem; opacity: 0.7; }
    100% { height: 0.625rem; opacity: 0.9; }
}

.logo-text {
  font-size: 1.25rem; /* 20px */
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #f1f5f9; /* 深色模式下使用亮色实色 */
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.logo-text span {
  color: inherit; /* 移除之前的绿色高亮，保持全文字颜色统一 */
  -webkit-text-fill-color: initial;
}

.top-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  cursor: pointer;
  overflow: visible;
  padding: 2px 0;
}

.top-logo .logo-icon {
  display: none;
}

.nav-spacer {
  flex: 1;
}

/* 按钮与选择器通用样式 */
.lang-selector {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.lang-btn, .theme-btn {
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: #f1f5f9;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  height: 40px;
  box-sizing: border-box;
  outline: none;
}

.nav .lang-btn .lang-label {
  display: none;
}

.lang-btn:hover, .theme-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

/* 文本图标样式 - 叠加模式 (文字在锁头上) */
.text-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-weight: 800;
  text-transform: uppercase;
  flex-shrink: 0;
  line-height: 1;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transition: all 0.2s ease;
  position: relative;
  width: 1em;   /* 匹配父容器字体大小 */
  height: 1em;  /* 保持正方形 */
}

.text-icon i {
  font-style: normal;
  font-size: 1.1em;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
  margin: 0;
  padding: 0;
}

/* 统一算法文本样式 */
.text-icon .algo-text {
  font-size: 0.36em;
  font-weight: 900;
  color: #ffffff;
  /* 恢复文字阴影，提高在黄色锁头上的可读性 */
  text-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.5), 0 0 2px rgba(0, 0, 0, 0.3);
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  line-height: 1;
  letter-spacing: -0.05em;
  z-index: 2;
  pointer-events: none;
  white-space: nowrap;
}

/* 加解密相关锁头图标文字大小与 AES 一致 (约 10px) */
.text-icon.is-locked .algo-text,
.text-icon.is-keyed .algo-text {
  font-size: 0.42em;
  font-weight: 800;
}

/* --- 第一类：纯锁头图标 (🔒) --- */
/* 适用：MD5, SHA, SM3 */
.text-icon.is-locked .algo-text {
  top: 68%; /* 调高文字位置，修复偏下问题 */
}

/* 🔒 底部留白较多，所有位置都需要轻微基础补偿 */
.text-icon.is-locked i {
  transform: translateY(-5%);
}

.logo .text-icon.is-locked {
  transform: translate(-1.5%, -0.5%); /* 之前 -3% 偏高了，调至 -0.5% 下移锁头位置 */
}

/* --- 第二类：带钥匙锁头 (🔐) --- */
/* 适用：RSA, SM2, SM4, AES, Base64 等 */
.text-icon.is-keyed .algo-text {
  top: 66%; /* 调高文字位置，修复偏下问题 */
  left: 45%; /* 继续向左调整至 45% */
}

/* 🔐 相对居中，只需极微补偿 */
.text-icon.is-keyed i {
  transform: translateY(-2%);
}

.logo .text-icon.is-keyed {
  transform: translate(-1.5%, -1%); /* 重新优化 Logo 区域位置 */
}

/* 侧边栏子项图标 - 确保与标准 Emoji (约 14px) 视觉对齐 */
.sub-item .text-icon {
  font-size: 14px; /* 稍微大于文字的 12px，以匹配 Emoji 的视觉体感 */
  width: 16px;
  background: transparent !important;
  box-shadow: none !important;
}

.sub-item:hover .text-icon i,
.sub-item.active .text-icon i {
  filter: drop-shadow(0 0 4px rgba(16, 185, 129, 0.4));
}

/* 页面头部 Logo 中的图标 */
.logo .text-icon {
  font-size: 18px; /* 稍微调大一点，从 16px 到 18px */
  width: 100%;
  height: 100%;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.logo .text-icon i {
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 首页卡片图标 - 严格匹配标准 24px 尺寸 */
.tool-card-icon .text-icon,
.related-tool-icon .text-icon {
  background: transparent !important;
  box-shadow: none !important;
  width: 100%;
  height: 100%;
}

.tool-card-icon .text-icon {
  font-size: 24px; /* 匹配 .tool-card-icon 的 24px */
}

.related-tool-icon .text-icon {
  font-size: 20px; /* 匹配 .related-tool-icon 的 1.25rem */
}

/* 亮色模式适配 - 叠加文字依然使用白色以保持在黄色锁头上的对比度 */
.light-theme .text-icon .algo-text {
  color: #ffffff;
  text-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.5), 0 0 2px rgba(0, 0, 0, 0.3);
}

/* 算法特定类名，统一使用黄色色值 */
.text-icon.md5 i,
.text-icon.sha i,
.text-icon.aes i,
.text-icon.rsa i,
.text-icon.sm2 i,
.text-icon.sm3 i,
.text-icon.sm4 i,
.text-icon.encrypt i,
.text-icon.base64 i,
.text-icon.pdf-base64 i,
.text-icon.rmb i {
  color: #facc15; /* 统一使用黄色 */
}

.lang-btn:active, .theme-btn:active {
  transform: translateY(0);
}

/* 移除已删除箭头的样式 */
.lang-btn .lang-arrow {
  display: none;
}

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 120px;
  border-radius: 12px;
  background: #020617;
  border: 1px solid #1f2937;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  padding: 6px;
  z-index: 1200;
  display: none;
}

.lang-menu.open {
  display: block !important;
}

.sidebar-footer .lang-menu {
  top: auto;
  bottom: 0;
  left: calc(100% + 12px);
  right: auto;
  box-shadow: 10px 0 25px -5px rgba(0, 0, 0, 0.5);
}

/* 统一亮色模式语言菜单样式 */
.light-theme .sidebar-footer .lang-menu,
.light-theme .lang-menu {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 10px 0 25px -5px rgba(0, 0, 0, 0.1);
}

.lang-option {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: #e5e7eb;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.lang-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.lang-option.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.13), rgba(6, 182, 212, 0.13));
  color: #10b981;
}

/* 导航搜索框 - Premium 样式 */
.nav-search {
  position: relative;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  padding: 0 12px 0 40px;
  width: 180px;
  height: 38px;
  display: flex;
  align-items: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: text;
}

.nav-search:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.45);
}

.nav-search:focus-within {
  width: 240px;
  background: rgba(18, 18, 18, 0.98);
  border-color: #10b981;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.nav-search .search-icon-wrapper {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #ffffff;
  pointer-events: none;
  transition: all 0.3s ease;
}

.nav-search:focus-within .search-icon-wrapper {
  color: #10b981;
}

.nav-search .search-icon-wrapper svg {
  width: 100%;
  height: 100%;
}

.nav-search input {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 14px;
  width: 100%;
  height: 100%;
  outline: none;
  padding: 0;
}

.nav-search input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

/* 亮色模式导航适配 */
.light-theme .nav-search {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.4);
}

.light-theme .nav-search:hover {
  background: rgba(255, 255, 255, 0.4);
  border-color: rgba(255, 255, 255, 0.5);
}

.light-theme .nav-search input {
  color: #064e3b;
}

.light-theme .nav-search input::placeholder {
  color: rgba(6, 78, 59, 0.6);
}

.light-theme .nav-search .search-icon-wrapper {
  color: #064e3b;
}
