/* ========================================================
   公共样式 common_tool.css
   所有工具页面共享，便于快速复用
   设计风格：橙棕色主题（#c98b30），简洁现代，响应式布局
   ======================================================== */

/* ===== 全局重置与基础样式 ===== */

/* 盒模型重置：所有元素使用border-box，消除默认margin和padding */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* 页面基础样式：字体、背景、颜色等 */
html, body {
  /* 字体栈：优先使用系统字体，兼容中英文显示 */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", Roboto, Helvetica, Arial, sans-serif;
  /* 背景色：浅灰色，柔和不刺眼 */
  background: #f5f7fa;
  /* 文字颜色：深灰色，保证可读性 */
  color: #1f2937;
  /* 禁止移动端文字自动缩放 */
  -webkit-text-size-adjust: 100%;
  /* 禁止移动端点击高亮 */
  -webkit-tap-highlight-color: transparent;
}

/* body布局：flex垂直排列，最小高度100vh，顶部留出导航条空间 */
body { display: flex; flex-direction: column; min-height: 100vh; padding-top: 60px; }

/* ===== 顶部固定导航条 ===== */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  min-height: 48px;
  background: #c98b30;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
  z-index: 1000;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 6px 10px;
  scrollbar-width: none;
}

/* 隐藏滚动条（Chrome/Safari） */
.top-nav::-webkit-scrollbar { display: none; }

/* 导航图标 */
.top-nav .nav-icon {
  /* 不收缩不放大 */
  flex: 0 0 auto;
  /* 图标大小 */
  font-size: 1.15rem;
  /* 图标颜色：白色 */
  color: #fff;
  /* 内边距和外边距调整 */
  padding: 0 8px 0 2px;
  margin-right: 6px;
  line-height: 1;
}

/* 导航链接 */
.top-nav a {
  /* 不收缩不放大 */
  flex: 0 0 auto;
  /* 块级显示 */
  display: inline-block;
  /* 文字颜色：白色 */
  color: #fff;
  /* 去除下划线 */
  text-decoration: none;
  /* 字体设置 */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", Roboto, Helvetica, Arial, sans-serif;
  font-size: .9rem;
  font-weight: bold;
  /* 内边距：上下4px，左右12px */
  padding: 4px 12px;
  /* 外边距：2px */
  margin: 2px;
  /* 过渡动画 */
  transition: all .15s;
  /* 相对定位（用于伪元素） */
  position: relative;
}

/* 导航链接分隔线（非最后一个链接右侧） */
.top-nav a:not(:last-child)::after {
  content: "";
  position: absolute;
  right: -4px;
  top: 15%;
  bottom: 15%;
  width: 1px;
  /* 半透明白色分隔线 */
  background: rgba(255,255,255,.3);
}

/* 导航链接左侧分隔线（第一个链接左侧） */
.top-nav a:first-child::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 15%;
  bottom: 15%;
  width: 1px;
  background: rgba(255,255,255,.3);
}

/* 导航链接悬停效果 */
.top-nav a:hover {
  color: rgba(255,255,255,.9);
  background: rgba(255,255,255,.12);
  border-radius: 4px;
}

/* 当前激活的导航链接 */
.top-nav a.active {
  color: #fff;
  font-weight: bold;
  background: rgba(255,255,255,.18);
  border-radius: 4px;
}

/* ===== 页面头部 header ===== */
header {
  /* 渐变背景：从浅米色到浅灰米色 */
  background: linear-gradient(180deg, #fafaf7 0%, #f0efe9 100%);
  /* 文字颜色：深灰色 */
  color: #1f2937;
  /* 内边距：上下18px，左右20px */
  padding: 18px 20px;
  /* 多层阴影效果：顶部内阴影、底部内阴影、外阴影 */
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.9),
    inset 0 -1px 0 rgba(0,0,0,.06),
    0 2px 6px rgba(0,0,0,.08);
  /* 底部边框 */
  border-bottom: 1px solid rgba(0,0,0,.08);
}

/* 页面标题 */
header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: .5px;
  /* 标题颜色：橙棕色主题色 */
  color: #c98b30;
}

/* 页面副标题/描述 */
header p {
  font-size: .8rem;
  opacity: .85;
  margin-top: 4px;
  color: #4b5563;
}

/* ===== 主体内容区 ===== */
main {
  /* 宽度100%，最大宽度760px，居中显示 */
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  /* 内边距：上下18px，左右16px，底部32px */
  padding: 18px 16px 32px;
}

/* ===== 卡片容器 ===== */
.card {
  /* 白色背景 */
  background: #fff;
  /* 圆角：10px */
  border-radius: 10px;
  /* 内边距：16px */
  padding: 16px;
  /* 底部外边距：14px */
  margin-bottom: 14px;
  /* 阴影：轻微外阴影 */
  box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}

/* 卡片标题 */
.card h2 {
  font-size: .95rem;
  color: #374151;
  margin-bottom: 12px;
  padding-bottom: 8px;
  /* 底部边框：浅灰色分割线 */
  border-bottom: 1px solid #eef0f3;
  font-weight: 600;
}

/* ===== 输入行 ===== */
.input-row {
  /* flex布局：横向排列 */
  display: flex;
  /* 元素间距：12px */
  gap: 12px;
  /* 垂直居中对齐 */
  align-items: center;
  /* 底部外边距：10px */
  margin-bottom: 10px;
}

/* 输入行中的select和input */
.input-row select, .input-row input {
  font-size: 1rem;
  /* 边框：浅灰色1px */
  border: 1px solid #d1d5db;
  /* 圆角：8px */
  border-radius: 8px;
  /* 内边距：上下10px，左右12px */
  padding: 10px 12px;
  background: #fff;
  color: #1f2937;
  /* 去除默认样式 */
  -webkit-appearance: none;
  appearance: none;
}

/* 下拉选择框 */
.input-row select {
  /* 固定宽度38% */
  flex: 0 0 38%;
  /* 自定义下拉箭头图标（SVG） */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='%236b7280' d='M6 8L2 4h8z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  /* 右侧留出箭头空间 */
  padding-right: 30px;
}

/* 输入框 */
.input-row input {
  /* 自动填充剩余空间 */
  flex: 1;
  /* 最小宽度0，允许收缩 */
  min-width: 0;
  /* 等宽字体，适合输入数字 */
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

/* 输入框和下拉框聚焦状态 */
.input-row input:focus, .input-row select:focus {
  /* 去除默认outline */
  outline: none;
  /* 边框颜色：橙棕色 */
  border-color: #f59e0b;
  /* 聚焦光环：橙棕色半透明 */
  box-shadow: 0 0 0 3px rgba(245,158,11,.15);
}

/* ===== 提示文字 ===== */
.hint {
  font-size: .75rem;
  color: #6b7280;
  margin-top: 8px;
  line-height: 1.5;
}

/* ===== 自定义下拉菜单（移动端适配） ===== */
.custom-select-wrapper {
  /* 相对定位 */
  position: relative;
  /* 固定宽度38% */
  flex: 0 0 38%;
  min-width: 0;
  /* 层级：高于其他元素 */
  z-index: 10;
}

/* 下拉菜单触发按钮 */
.custom-select-trigger {
  display: block;
  width: 100%;
  font-size: 1rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px 12px;
  padding-right: 36px;
  background: #fff;
  color: #1f2937;
  cursor: pointer;
  position: relative;
  /* 过渡动画 */
  transition: border-color .15s, box-shadow .15s;
}

/* 下拉菜单箭头（伪元素） */
.custom-select-trigger::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  /* 三角形箭头 */
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #6b7280;
  /* 禁止点击 */
  pointer-events: none;
  /* 旋转过渡 */
  transition: transform .15s;
}

/* 下拉菜单展开时箭头旋转180度 */
.custom-select-wrapper.open .custom-select-trigger::after {
  transform: translateY(-50%) rotate(180deg);
}

/* 触发按钮聚焦状态 */
.custom-select-trigger:focus {
  outline: none;
}

/* 下拉菜单聚焦状态（边框颜色和光环） */
.custom-select-wrapper.focused .custom-select-trigger {
  border-color: #c98b30;
  box-shadow: 0 0 0 3px rgba(201,139,48,.2);
}

/* 下拉菜单选项列表 */
.custom-select-options {
  /* 默认隐藏 */
  display: none;
  /* 绝对定位，位于触发按钮下方 */
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  /* 最大高度200px，超出滚动 */
  max-height: 200px;
  overflow-y: auto;
}

/* 下拉菜单展开时显示选项列表 */
.custom-select-wrapper.open .custom-select-options {
  display: block;
}

/* 下拉菜单选项 */
.custom-option {
  padding: 10px 12px;
  cursor: pointer;
  font-size: .95rem;
  color: #1f2937;
  transition: background .15s;
}

/* 第一个选项圆角 */
.custom-option:first-child {
  border-radius: 7px 7px 0 0;
}

/* 最后一个选项圆角 */
.custom-option:last-child {
  border-radius: 0 0 7px 7px;
}

/* 选项悬停和选中状态 */
.custom-option:hover,
.custom-option.selected {
  background: #fef3c7;
  color: #92400e;
}

/* 选项点击状态 */
.custom-option:active {
  background: #fde68a;
}

/* ===== 结果列表 ===== */
.result-list {
  /* flex垂直排列 */
  display: flex;
  flex-direction: column;
  /* 元素间距：10px */
  gap: 10px;
}

/* 结果项 */
.result-item {
  /* flex横向排列 */
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  /* 浅灰背景 */
  background: #f8fafc;
  border: 1px solid #eef0f3;
  border-radius: 8px;
  transition: background .15s;
}

/* 结果项点击状态 */
.result-item:active { background: #eef2f7; }

/* 结果标签 */
.result-label {
  /* 固定宽度88px */
  flex: 0 0 88px;
  font-size: .8rem;
  color: #6b7280;
  font-weight: 500;
}

/* 结果值 */
.result-value {
  /* 自动填充剩余空间 */
  flex: 1;
  /* 等宽字体，适合显示数字 */
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: .95rem;
  color: #111827;
  /* 允许换行 */
  word-break: break-all;
  /* 点击自动选中全部内容 */
  user-select: all;
}

/* ===== 通用按钮 ===== */

/* 转换/计算按钮 */
.convert-btn {
  /* 不收缩不放大 */
  flex: 0 0 auto;
  font-size: .95rem;
  color: #fff;
  /* 背景色：橙棕色主题色 */
  background: #c98b30;
  border: none;
  border-radius: 8px;
  padding: 10px 22px;
  cursor: pointer;
  transition: all .15s;
  /* 禁止换行 */
  white-space: nowrap;
  font-weight: 500;
}

/* 转换按钮悬停效果 */
.convert-btn:hover { opacity: .9; }

/* 转换按钮点击效果 */
.convert-btn:active { transform: translateY(1px); }

/* 清空按钮 */
.clear-btn {
  flex: 0 0 auto;
  font-size: .95rem;
  color: #6b7280;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px 22px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  font-weight: 500;
  margin-left: 8px;
}
.clear-btn:hover { background: #e5e7eb; }
.clear-btn:active { transform: translateY(1px); }

/* 复制按钮 */
.copy-btn {
  flex: 0 0 auto;
  font-size: .75rem;
  /* 文字颜色：橙棕色 */
  color: #c98b30;
  background: transparent;
  /* 边框：橙棕色1px */
  border: 1px solid #c98b30;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

/* 复制按钮悬停效果：背景和文字颜色互换 */
.copy-btn:hover { background: #c98b30; color: #fff; }

/* 复制按钮成功状态：黄色背景，深灰色文字 */
.copy-btn.copied { background: #facc15; border-color: #facc15; color: #333; }

/* ===== 错误提示 ===== */
.err-msg {
  /* 红色文字 */
  color: #dc2626;
  font-size: .8rem;
  margin-top: 8px;
  /* 默认隐藏 */
  display: none;
}

/* 错误提示显示状态 */
.err-msg.show { display: block; }

/* ===== 页脚 ===== */
footer {
  text-align: center;
  padding: 14px;
  font-size: .72rem;
  color: #6b7280;
}

/* ===== 移动端侧边栏导航 ===== */
.mobile-nav-toggle {
  display: none;
  position: fixed;
  z-index: 9999;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  padding: 10px 4px;
  border-radius: 18px;
  background: #c98b30;
  color: white;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
  text-align: center;
  box-shadow: 0 2px 10px rgba(201,139,48,.4);
  cursor: pointer;
  border: 2px solid rgba(255,255,255,.3);
  transition: all .3s ease;
  writing-mode: vertical-rl;
}
.mobile-nav-toggle:hover {
  background: #b87a20;
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 4px 15px rgba(201,139,48,.5);
}
.mobile-nav-toggle:active {
  transform: translateY(-50%) scale(0.95);
}

.mobile-nav-menu {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 168px;
  background: #fff;
  z-index: 9998;
  box-shadow: -4px 0 20px rgba(0,0,0,.15);
  overflow-y: auto;
  overflow-x: hidden;
  transform: translateX(100%);
  transition: transform .3s ease;
}
.mobile-nav-menu.show {
  display: flex;
  flex-direction: column;
  transform: translateX(0);
}
.mobile-nav-menu::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.mobile-nav-header {
  background: #c98b30;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.mobile-nav-header .nav-icon {
  color: #fff;
  font-size: 1.8rem;
}
.mobile-nav-header .nav-title {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  flex: 1;
  text-align: center;
}
.mobile-nav-close {
  background: rgba(255,255,255,.2);
  border: none;
  color: #fff;
  font-size: 1.2rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}
.mobile-nav-close:hover {
  background: rgba(255,255,255,.3);
}

.mobile-nav-content {
  padding: 10px 0;
  flex: 1;
  overflow-y: auto;
}
.mobile-nav-content::-webkit-scrollbar {
  width: 4px;
}
.mobile-nav-content::-webkit-scrollbar-track {
  background: #f5f5f5;
}
.mobile-nav-content::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 2px;
}

.mobile-nav-content a {
  display: block;
  color: #333;
  text-decoration: none;
  font-size: .95rem;
  font-weight: 500;
  padding: 14px 20px;
  transition: all .2s;
  border-left: 4px solid transparent;
}
.mobile-nav-content a:hover {
  background: #f8f9fa;
  border-left-color: #c98b30;
}
.mobile-nav-content a.active {
  background: #fff8e1;
  border-left-color: #c98b30;
  color: #c98b30;
  font-weight: 600;
}

.mobile-nav-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,.4);
  z-index: 9997;
  opacity: 0;
  transition: opacity .3s ease;
}
.mobile-nav-overlay.show {
  display: block;
  opacity: 1;
}

/* ===== 移动端适配（屏幕宽度≤480px） ===== */
@media (max-width: 480px) {
  body { padding-top: 0; }
  .top-nav { display: none; }
  .mobile-nav-toggle { display: block; }
  header h1 { font-size: 1.1rem; }
  main { padding: 14px 12px 24px; }
  .card { padding: 14px; }
  .input-row { gap: 6px; }
  .custom-select-wrapper { flex: 0 0 31%; }
  .custom-select-trigger { font-size: .85rem; }
  .custom-select-options { width: 100%; }
  .custom-option { font-size: .85rem; padding: 8px 10px; }
  .input-row input { flex: 1; max-width: 172px; }
  .result-label { flex: 0 0 70px; font-size: .75rem; }
  .result-value { font-size: .85rem; }
  .copy-btn { padding: 4px 8px; font-size: .7rem; }
}