/* batch.css — 批量转换页专属样式（batch.html 单页）
   载入顺序：在 studio.css / navigation.css 之后。不改全局样式，不依赖 tokens.css。
   配色沿用 studio.css 既有色值（#405ddb / #d5ddeb / #273953 / #a32b25 / #8d9ff0）。

   §1  栅格：左窄右宽 5:7 + 响应式退化
   §2  卡片骨架与标题层级
   §3  按钮层级（primary / secondary / ghost / danger / danger-quiet / sm）
   §4  选中项汇总条
   §5  统计条与通知条
   §6  任务分组与任务卡
   §7  空状态
   §8  危险区
   §9  窄屏与按钮换行
   §10 动效降级（prefers-reduced-motion）

   ⚠ 索引：31 个受保护 id 均未改名/删除/移出 DOM；#task-list 仍在 .studio-card 内。
   ⚠ 按钮规则一律带 button.batch-btn（特异性 0,3,1+），确保压过 studio.css 的
     .studio-page button:not(:disabled):hover（0,3,1，同特异性靠源序在后胜出）。
*/

/* ══ §1 栅格 ══════════════════════════════════════════════════════ */

.studio-page .studio-grid {
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 24px;
  align-items: start;
}

/* ⚠ 必须自带 ≤900px 断点：studio.css 的 @media(max-width:900px){.studio-grid{…1fr}}
   特异性 (0,1,0) 低于上面的 (0,2,0)，若不重写，单栏规则会被压掉。 */
@media (max-width: 900px) {
  .studio-page .studio-grid { grid-template-columns: minmax(0, 1fr); }
}

/* 5:7 下左栏变窄的宽度补偿（不改 controls.js，只调容器） */
.studio-page #layout-controls .margins { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.studio-page #layout-controls .control-row { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.studio-page #layout-controls label,
.studio-page #layout-controls select,
.studio-page #layout-controls input,
.studio-page #layout-controls textarea { min-width: 0; }
.studio-page #urls { min-height: 132px; }

/* 模式三选：controls.js 用 flex 1 1 140px，在 5:7 的窄栏里会排成 2+1 且长文案折行凌乱。
   改为三列均分网格（不修改 controls.js，仅本页覆盖），折行也保持列对齐。 */
.studio-page #layout-controls .content-modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.studio-page #layout-controls .content-modes button {
  min-width: 0;
  padding: 6px;
  font-size: 12.5px;
  line-height: 1.3;
  text-align: center;
}
@media (max-width: 400px) {
  .studio-page #layout-controls .content-modes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .studio-page #layout-controls .content-modes button:last-child { grid-column: 1 / -1; }
}

/* ══ §2 卡片骨架与标题层级 ═══════════════════════════════════════ */

.studio-page .batch-tasks {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.studio-page .batch-tasks > h2,
.studio-page .studio-card > h2 { margin-bottom: 0; }

.studio-page .batch-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.studio-page .batch-card-head h2 { margin: 0; flex: 1 1 auto; min-width: 0; }

.studio-page .batch-settings-title { font-size: 18px; }

/* ══ §3 按钮层级 ══════════════════════════════════════════════════ */

/* 基座 */
.studio-page button.batch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  max-width: 100%;
  border: 1px solid #d5ddeb;
  border-radius: 9px;
  background: #fff;
  color: #273953;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease,
              color .15s ease, box-shadow .15s ease, transform .12s ease;
}
.studio-page button.batch-btn .batch-btn__icon { display: inline-flex; flex: none; }
.studio-page button.batch-btn .batch-btn__icon svg { width: 17px; height: 17px; display: block; }
.studio-page button.batch-btn .batch-btn__label { min-width: 0; }

/* 档 1 · primary —— 页面唯一主操作 */
.studio-page button.batch-btn--primary {
  background: #405ddb;
  border-color: #405ddb;
  color: #fff;
  box-shadow: 0 2px 8px rgba(64, 93, 219, .22);
}
.studio-page button.batch-btn--primary:hover:not(:disabled) {
  background: #344fc4;
  border-color: #344fc4;
  color: #fff;
}

/* 档 2 · secondary —— 选择作用域动作 */
.studio-page button.batch-btn--secondary {
  background: #fff;
  border-color: #c3cfe6;
  color: #2f4a86;
}
.studio-page button.batch-btn--secondary:hover:not(:disabled) {
  background: #f3f6fe;
  border-color: #405ddb;
  color: #2b3f77;
}

/* 档 3 · ghost —— 全局低频 / 可逆 */
.studio-page button.batch-btn--ghost {
  background: transparent;
  border-color: transparent;
  color: #5b6b88;
}
.studio-page button.batch-btn--ghost:hover:not(:disabled) {
  background: #eef2fa;
  border-color: #dbe2f2;
  color: #273953;
}

/* 档 4 · danger —— 破坏性 */
.studio-page button.batch-btn--danger {
  background: #fff;
  border-color: #e6b3ad;
  color: #a32b25;
}
.studio-page button.batch-btn--danger:hover:not(:disabled) {
  background: #fff0ef;
  border-color: #b03b33;
  color: #8e231d;
}

/* 危险弱化（任务项内 Remove） */
.studio-page button.batch-btn--danger-quiet {
  background: transparent;
  border-color: transparent;
  color: #b04a42;
}
.studio-page button.batch-btn--danger-quiet:hover:not(:disabled) {
  background: #fff0ef;
  color: #8e231d;
}

/* 尺寸变体：sm 仍 ≥40px，满足 action-layout.spec.js 的高度门槛 */
.studio-page button.batch-btn--sm {
  min-height: 40px;
  padding: 0 12px;
  font-size: 13px;
  gap: 6px;
  border-radius: 8px;
}
.studio-page button.batch-btn--sm .batch-btn__icon svg { width: 15px; height: 15px; }
.studio-page button.batch-btn--block { width: 100%; }

/* 交互态 */
.studio-page button.batch-btn:hover:not(:disabled) { box-shadow: 0 3px 12px rgba(30, 55, 120, .10); }
.studio-page button.batch-btn--ghost:hover:not(:disabled),
.studio-page button.batch-btn--danger-quiet:hover:not(:disabled) { box-shadow: none; }
.studio-page button.batch-btn:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
.studio-page button.batch-btn:focus-visible { outline: 3px solid #8d9ff0; outline-offset: 2px; }
.studio-page button.batch-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* 汇总条空态：容器 data-empty 时把选区动作压暗（不改变可聚焦性） */
.studio-page #batch-selection[data-empty="true"] .batch-selection__actions .batch-btn--secondary:not(:disabled) {
  border-color: #e3e8f2;
  color: #8a97b0;
  background: #fbfcfe;
}

/* ══ §4 选中项汇总条 ══════════════════════════════════════════════ */

.studio-page .batch-selection {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #dbe3f2;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8faff 0%, #f3f6fd 100%);
  transition: border-color .15s ease, background-color .15s ease;
}
.studio-page .batch-selection[data-empty="false"] {
  border-color: #b9cafa;
  background: linear-gradient(180deg, #eef3ff 0%, #e7eeff 100%);
}
.studio-page .batch-selection__count {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #40527c;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.studio-page .batch-selection[data-empty="false"] .batch-selection__count { color: #24356b; }
.studio-page .batch-selection__count::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b6c1d8;
  box-shadow: 0 0 0 3px rgba(182, 193, 216, .22);
}
.studio-page .batch-selection[data-empty="false"] .batch-selection__count::before {
  background: #405ddb;
  box-shadow: 0 0 0 3px rgba(64, 93, 219, .20);
}
.studio-page .batch-selection__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

/* ══ §5 统计条与通知条 ════════════════════════════════════════════ */

.studio-page .batch-status {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid #e3e8f3;
  border-radius: 10px;
  background: #f8fafd;
  color: #5b6b88;
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.studio-page .batch-status::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: #8ea2d8;
  transform: rotate(45deg);
}
.studio-page .batch-notice {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #eef3ff;
  border: 1px solid #c9d8f7;
  color: #2b3f77;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* ══ §6 任务分组与任务卡 ══════════════════════════════════════════ */

.studio-page .batch-tasks .task-list {
  padding: 0;
  margin: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.studio-page .task-group { border: 0; padding: 0; margin: 0; }
.studio-page .task-group__head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  position: sticky;
  top: 76px; /* 避开 sticky 导航栏（.gcd-nav-inner 高 76px） */
  z-index: 2;
  margin: 0 0 8px;
  padding: 8px 2px;
  background: linear-gradient(180deg, #fff 78%, rgba(255, 255, 255, 0));
}
.studio-page .task-group__title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .01em;
}
.studio-page .task-group[data-group="failed"] .task-group__title { color: #a32b25; }
.studio-page .task-group[data-group="active"] .task-group__title { color: #8a6a12; }
.studio-page .task-group[data-group="ready"] .task-group__title { color: #12694f; }
.studio-page .task-group[data-group="archived"] .task-group__title { color: #6b7a94; }
.studio-page .task-group__count {
  font-size: 11px;
  font-weight: 700;
  color: #6b7a94;
  background: #eef2f9;
  border-radius: 999px;
  padding: 2px 8px;
  flex: none;
}
.studio-page .task-group__head .batch-btn { margin-left: auto; }

.studio-page .task-group__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* 任务卡：替掉 studio.css 里 .task-list li 的 1px 分隔线 */
.studio-page .task-group__list > li {
  border: 1px solid #e4e9f3;
  border-left: 3px solid #cfd8ea;
  border-radius: 11px;
  padding: 11px 13px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow-wrap: anywhere;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.studio-page .task-group__list > li:hover {
  border-color: #c3cfe6;
  box-shadow: 0 2px 10px rgba(30, 55, 120, .07);
}
.studio-page .task-group__list > li[data-state="failed"] { border-left-color: #d1665c; background: #fffbfb; }
.studio-page .task-group__list > li[data-state="active"] { border-left-color: #d8a53c; }
.studio-page .task-group__list > li[data-state="ready"] { border-left-color: #39a37e; background: #fcfffe; }
.studio-page .task-group__list > li[data-state="archived"] { border-left-color: #c3cbd9; background: #fbfcfe; }

.studio-page .task-group__list > li > label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.4;
  margin-bottom: 0;
}
.studio-page .task-group__list > li > label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  flex: none;
  accent-color: #405ddb;
}
.studio-page .batch-row__url {
  margin: 0;
  font-size: 12px;
  color: #7c8aa3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: ltr;
}
.studio-page .batch-row__status {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: #5b6b88;
}
.studio-page .batch-row__status[data-state="failed"] { color: #a32b25; }
.studio-page .batch-row__status[data-state="ready"] { color: #12694f; }
.studio-page .batch-row__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.studio-page .task-project { align-self: flex-start; }

/* 本地任务列表（local 模式）同样卡片化 */
.studio-page #local-tasks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.studio-page #local-tasks > li {
  border: 1px solid #e4e9f3;
  border-left: 3px solid #cfd8ea;
  border-radius: 11px;
  padding: 11px 13px;
  background: #fff;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  overflow-wrap: anywhere;
}
.studio-page #local-tasks > li > strong { font-size: 14px; flex: 1 1 200px; min-width: 0; }
.studio-page #local-tasks > li > p { margin: 0; font-size: 12.5px; font-weight: 600; color: #5b6b88; }

/* ══ §7 空状态 ════════════════════════════════════════════════════ */

.studio-page .task-empty {
  margin: 0;
  padding: 28px 18px;
  text-align: center;
  border: 1px dashed #d5dded;
  border-radius: 12px;
  background: #fbfcfe;
  color: #697993;
  font-size: 13.5px;
  line-height: 1.6;
}

/* ══ §8 危险区 ════════════════════════════════════════════════════ */

.studio-page .batch-danger-zone {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding: 12px 14px;
  border: 1px solid #f2dedb;
  border-radius: 12px;
  background: #fffaf9;
}
.studio-page .batch-danger-zone #history-clear { margin-left: auto; }

/* ══ §9 窄屏与按钮换行 ════════════════════════════════════════════ */

@media (max-width: 900px) {
  /* 单栏时取消 sticky 组头，避免遮挡 */
  .studio-page .task-group__head { position: static; }
  .studio-page .task-group__head .batch-btn { margin-left: 0; }
}
@media (max-width: 480px) {
  /* 选区动作整行堆叠：4 个按钮两行会挤在一起 */
  .studio-page .batch-selection__actions > button.batch-btn { flex: 1 1 100%; }
  /* 任务项动作：Download / Remove 允许并排 */
  .studio-page .batch-row__actions > button.batch-btn { flex: 1 1 auto; min-width: 112px; }
  .studio-page .batch-danger-zone > button.batch-btn { flex: 1 1 100%; }
  .studio-page .batch-danger-zone #history-clear { margin-left: 0; }
  .studio-page .batch-selection { padding: 10px 11px; }
  .studio-page .batch-status { font-size: 12px; }
}
@media (max-width: 360px) {
  .studio-page .batch-row__actions > button.batch-btn { flex: 1 1 100%; }
}

/* ══ §10 动效降级 ═════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  .studio-page button.batch-btn,
  .studio-page .batch-selection,
  .studio-page .task-group__list > li,
  .studio-page #local-tasks > li {
    transition: none !important;
    animation: none !important;
  }
  .studio-page button.batch-btn:active:not(:disabled) { transform: none; }
}

.studio-page .batch-row__url{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px}
.studio-page .batch-row__url>a{min-width:0;overflow-wrap:anywhere;text-decoration:underline;text-underline-offset:3px}
.studio-page .batch-row__url>button{flex-shrink:0;min-height:36px}
.studio-page .batch-row__copy-status{flex-basis:100%;color:#34445f}
.studio-page .batch-row__copy-status:empty{display:none}

.studio-page .batch-row__url>.batch-copy-link{min-height:30px;padding:3px 9px;border:1px solid #c8d4ed;border-radius:7px;background:#fff;color:#2949ad;font-size:12px;font-weight:650;cursor:pointer}
.studio-page .batch-row__url>.batch-copy-link:hover{background:#edf2ff;border-color:#7590df}
.studio-page .batch-row__url>.batch-copy-link:focus-visible{outline:3px solid #8d9ff0;outline-offset:2px}
.batch-row__output-status{display:block;margin-top:8px;font-size:13px;color:#52617c}
.batch-row__output-status:empty{display:none}
.studio-page .batch-row__actions{gap:8px}
