/* ==========================================================================
 * tool-salary.css — 秒薪计算 (页面专属样式)
 * 位置: assets/css/tool-salary.css
 * 载入: pages/tool-salary.html (在 common.css / tool.css 之后, 可覆盖通用规则)
 *
 * 配色思路 (需求文档 特殊逻辑说明 ①):
 *   「钱」是主角 —— 秒薪 hero + 三张金额卡用品牌橙实心/描边, 数字最大最亮;
 *   「时长」是配角 —— 三张时长卡用浅橙底, 深色数字, 不跟金额抢视线。
 *   原型里 6 张卡全是实心橙, 全部都在喊 = 谁也听不见; 这里做了主次分层。
 *
 * 依赖的全站变量 (common.css :root):
 *   --brand #F97C12 / --brand-dark #E06B00 / --brand-2 #FB9D4F / --brand-soft #FFF3E9
 *   --surface --border --border-strong --text --text-sub --text-muted
 *   --red --red-soft --radius --radius-lg --radius-sm --shadow-card --shadow-pop
 * ========================================================================== */

/* ==========================================================================
   1. 主面板布局
   ========================================================================== */
.sal-wrap {
  padding: 18px;
}

/* ---- 顶栏: 提示 + 配置按钮 ---- */
.sal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.sal-hint {
  font-size: 13px;
  color: var(--text-muted);
}
.sal-hint b {
  color: var(--brand);
  font-weight: 600;
}

.sal-cfg-btn {
  flex: 0 0 auto;
  padding: 7px 18px;
  border: 1px solid var(--brand);
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.sal-cfg-btn:hover {
  background: var(--brand);
  color: #fff;
}

/* ==========================================================================
   2. 第三行: 秒薪 / 分薪 / 时薪 / 日薪
   ★ 本工具叫"秒薪计算", 秒薪是主角 -> 第一格更宽、字号更大, 其余三格陪衬。
   ========================================================================== */
.sal-rates {
  margin-top: 12px;
  padding: 13px 18px 15px;
  border: 1px solid #FFD9B3;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #FFF8F2 0%, #FFEAD5 100%);
}

.sal-rates-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}
.sal-rates-t {
  font-size: 12px;
  font-weight: 600;
  color: #A9713A;
}

/* 右上角「本月」标记: 这些数按【本月】的工作日数折算, 换个月就会不一样 */
.sal-this {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-dark);
}
.sal-this i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  animation: sal-pulse 1.8s ease-out infinite;
}
.sal-this em { font-style: normal; letter-spacing: .06em; }

/* 光有一个孤零零的呼吸点含义不明, 配个字才读得懂; 它同时是"数字还活着"的信号 */
@keyframes sal-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(249, 124, 18, .55); }
  70%  { box-shadow: 0 0 0 7px rgba(249, 124, 18, 0); }
  100% { box-shadow: 0 0 0 0 rgba(249, 124, 18, 0); }
}

.sal-rates-body {
  display: grid;
  /* 秒薪那格更宽, 其余三等分 */
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 10px;
}

.sal-rate {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.sal-rate-k {
  font-size: 11px;
  color: #A9713A;
  white-space: nowrap;
}
.sal-rate-v {
  font-size: 16px;
  font-weight: 700;
  color: var(--brand-dark);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 秒薪 = 主角 */
.sal-rate--main .sal-rate-k { font-size: 12px; font-weight: 600; }
.sal-rate--main .sal-rate-v {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -.5px;
  line-height: 1.15;
}

/* ==========================================================================
   3. 第一行(赚取) / 第二行(上班时间): 各 3 张卡
   ========================================================================== */
.sal-grid {
  display: grid;
  /* auto-fit: 宽栏自动 3 列, 窄屏自然降到 2 列 / 1 列, 不用写断点 */
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.sal-grid + .sal-grid { margin-top: 12px; }

.sal-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
}

.sal-card-k {
  font-size: 12px;
  line-height: 1.4;
}

.sal-card-v {
  font-size: 19px;
  line-height: 1.25;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---- 时长卡 (配角): 浅橙底 + 深色数字 ---- */
.sal-card--time {
  background: var(--brand-soft);
  border-color: #FFE3CC;
}
.sal-card--time .sal-card-k { color: #A9713A; }
.sal-card--time .sal-card-v { color: var(--text); }

/* ---- 金额卡 (主角): 品牌橙实心 + 白字 ---- */
.sal-card--money {
  background: linear-gradient(135deg, var(--brand-2) 0%, var(--brand) 100%);
  border-color: var(--brand);
  box-shadow: 0 6px 16px rgba(249, 124, 18, .18);
}
.sal-card--money .sal-card-k { color: rgba(255, 255, 255, .88); }
.sal-card--money .sal-card-v {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  transition: text-shadow .35s ease;
}

/* ==========================================================================
   3. 数字变化的动画 (需求文档 特殊逻辑说明 ②)
   JS 在「显示的字符串真的变了」时才加 .pop, 避免每秒空闪。
   ========================================================================== */
.sal-card-v.pop {
  animation: sal-pop .45s cubic-bezier(.2, .8, .3, 1);
}
/* 金额卡额外加一层白光, 让"+钱"这件事被看见 */
.sal-card--money .sal-card-v.pop {
  text-shadow: 0 0 14px rgba(255, 255, 255, .95);
}

@keyframes sal-pop {
  0%   { transform: none; }
  35%  { transform: translateY(-2px) scale(1.035); }
  100% { transform: none; }
}

/* ==========================================================================
   4. 未配置时的空态
   ========================================================================== */
.sal-empty {
  padding: 38px 20px;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: #FBFCFE;
}
.sal-empty-ico { font-size: 30px; line-height: 1; }
.sal-empty-t {
  margin: 12px 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.sal-empty-d {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ==========================================================================
   5. 配置弹窗
   ========================================================================== */
/* .modal 默认 400px; 这里要放「薪资 + 币种」「上班/下班」「午餐」「工作日」
   「节假日勾选」几行, 按需求整体加宽 1.3 倍: 500 -> 650 */
.sal-modal { width: 650px; }

.sal-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.sal-lb {
  flex: 0 0 84px;
  font-size: 13px;
  color: var(--text-sub);
}

.sal-ctrl {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* 金额输入在 flex 行里撑满剩余宽度 (覆盖 .modal input 的 width:100%) */
.sal-ctrl > #salAmount { flex: 1 1 auto; min-width: 0; }

/* ---- 分段控件 (薪资周期 / 工作日) ---- */
.sal-seg {
  display: inline-flex;
  border: 1px solid var(--brand);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.sal-seg button {
  padding: 8px 16px;
  border: 0;
  background: var(--surface);
  color: var(--brand);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.sal-seg button + button { border-left: 1px solid var(--brand); }
.sal-seg button:hover { background: var(--brand-soft); }
.sal-seg button.on {
  background: var(--brand);
  color: #fff;
  font-weight: 600;
}
.sal-seg button.on:hover { background: var(--brand-dark); }

/* ---- 时间输入 (HH : MM) ---- */
.sal-time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sal-time i {
  color: var(--text-muted);
  font-style: normal;
  font-size: 14px;
}
/* 覆盖 .modal input 的 width:100% (本文件在 common.css 之后载入, 同权重后者胜) */
.sal-time input {
  width: 48px;
  padding: 8px 0;
  text-align: center;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.sal-time-tilde {
  color: var(--text-muted);
  font-size: 14px;
}

/* ---- 币种 ---- */
.sal-cur {
  flex: 0 0 auto;
  padding: 9px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}
.sal-cur:focus { border-color: var(--brand); outline: none; }

/* ---- 法定节假日休息 (勾选项) ----
   放在"工作日"下面一行。左边的标签栏留空(.sal-lb 空着), 让勾选框与
   上方的工作日按钮左对齐, 视觉上归属同一组。 */
.sal-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
/* 方框本身(橙底白勾)统一在 tool.css 的「勾选框」段里定义, 这里只管排版。
   ★ 别往这里加 accent-color / width / height —— accent-color 画出来是黑勾,
     尺寸也归那条统一规则管, 两边都写会打架。 */
.sal-check input {
  margin: 0;
  cursor: pointer;
  flex: 0 0 auto;
}
/* 说明文字: 解释"勾上会怎样", 免得用户以为只是记一笔备忘 */
.sal-check-note {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---- 工作日 (一排 toggle) ---- */
.sal-days {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sal-day {
  min-width: 46px;
  padding: 8px 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-sub);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.sal-day:hover { border-color: var(--brand-2); color: var(--brand); }
.sal-day.on {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}

/* ---- 免责声明 ---- */
.sal-note {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #F7F9FC;
  font-size: 12px;
  line-height: 1.75;
  color: var(--text-muted);
}

/* ---- 底部按钮: 取消在左, 其余三个靠右 ---- */
.sal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}
.sal-actions .sal-gap { flex: 1 1 auto; }

.sal-btn-soft {
  border-color: #FFD2A8;
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.sal-btn-soft:hover { border-color: var(--brand); background: #FFE7D2; }

.sal-btn-danger {
  border-color: #F7C7C4;
  background: var(--red-soft);
  color: var(--red);
}
.sal-btn-danger:hover { border-color: var(--red); background: #FDDCDA; }

/* ---- 弹窗内的提示条 (保存结果 / 未登录) ---- */
.sal-toast {
  margin: 12px 0 0;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.6;
  background: var(--blue-soft);
  color: var(--blue);
}
.sal-toast.ok { background: var(--green-soft); color: var(--green); }
.sal-toast.warn { background: var(--amber-soft); color: var(--amber); }
.sal-toast.err { background: var(--red-soft); color: var(--red); }

/* ==========================================================================
   6. 窄屏
   ========================================================================== */
@media (max-width: 560px) {
  .sal-wrap { padding: 14px; }
  /* 折算率带: 4 列在窄屏挤不下 -> 降成 2 列, 秒薪不再额外加宽 */
  .sal-rates { padding: 12px 14px 14px; }
  .sal-rates-body { grid-template-columns: 1fr 1fr; }
  .sal-rate--main .sal-rate-v { font-size: 23px; }
  .sal-row { flex-wrap: wrap; gap: 8px; }
  .sal-lb { flex-basis: 100%; }
  .sal-modal { width: 92vw; }
  .sal-actions { flex-wrap: wrap; }
  .sal-actions .sal-gap { display: none; }
}

/* ==========================================================================
   7. 无障碍: 用户要求减少动效时, 全部关掉
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .sal-card-v.pop { animation: none; }
  .sal-this i { animation: none; }
  .sal-cfg-btn, .sal-seg button, .sal-day { transition: none; }
}
