/* 组件库：按钮、表单、标签、进度、面板、提示、对话框。页面不得自造同类组件。 */

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: var(--h-ctl); padding: 0 var(--s-4);
  border: var(--bw-strong) solid transparent; border-radius: var(--r-m);
  background: transparent; color: var(--ink);
  font-size: var(--fs-base); font-weight: var(--fw-bold); line-height: 1;
  white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background-color var(--t-fast), border-color var(--t-fast), transform 60ms;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--tape); border-color: var(--on-tape); color: var(--on-tape); }
.btn-primary:hover:not([disabled]) { background: var(--tape-hover); }
.btn-primary:active:not([disabled]) { background: var(--tape-press); }

.btn-secondary { background: var(--surface); border-color: var(--line-strong); }
.btn-secondary:hover:not([disabled]) { border-color: var(--ink); }

.btn-ghost { color: var(--ink-2); font-weight: var(--fw-medium); }
.btn-ghost:hover:not([disabled]) { background: var(--surface-2); color: var(--ink); }

.btn-danger { border-color: var(--err); color: var(--err); }
.btn-danger:hover:not([disabled]) { background: var(--err-soft); }

.btn-sm { height: var(--h-sm); padding: 0 var(--s-3); font-size: var(--fs-sm); }
.btn-hero { height: 100%; border-radius: 0; }
.btn-icon { width: var(--h-ctl); padding: 0; }
.btn-icon.btn-sm { width: var(--h-sm); }

/* ---------- 表单 ---------- */
.field { display: grid; gap: var(--s-1); }
.label { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--ink-2); }
.hint { font-size: var(--fs-sm); color: var(--ink-3); }
.field-error { font-size: var(--fs-sm); color: var(--err); font-weight: var(--fw-medium); }

.input, .select {
  width: 100%; height: var(--h-ctl); padding: 0 var(--s-3);
  background: var(--surface); color: var(--ink);
  border: var(--bw) solid var(--line-strong); border-radius: var(--r-m);
  transition: border-color var(--t-fast);
}
.input::placeholder { color: var(--ink-3); }
.input:hover, .select:hover { border-color: var(--ink-3); }
.input:focus, .select:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 2px var(--focus); }
.input.is-invalid { border-color: var(--err); }
.select { appearance: none; padding-right: var(--s-6); cursor: pointer; }
.select-wrap { position: relative; }
.select-wrap::after {
  content: ""; position: absolute; right: var(--s-3); top: 50%; width: 7px; height: 7px;
  border: solid var(--ink-2); border-width: 0 2px 2px 0; transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

/* 分段选择：用于互斥的少量选项（保存为 视频/音频/封面） */
.seg { display: inline-flex; border: var(--bw) solid var(--line-strong); border-radius: var(--r-m);
       background: var(--surface); overflow: hidden; }
.seg label { position: relative; }
.seg span { display: inline-flex; align-items: center; gap: var(--s-2); height: calc(var(--h-ctl) - 2 * var(--bw));
            padding: 0 var(--s-4); cursor: pointer; font-weight: var(--fw-medium); color: var(--ink-2);
            transition: background-color var(--t-fast); }
.seg label + label span { border-left: var(--bw) solid var(--line); }
.seg span:hover { background: var(--surface-2); }
.seg input:checked + span { background: var(--tape); color: var(--on-tape); font-weight: var(--fw-bold); }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -4px; }

/* 复选框 */
.check { display: inline-flex; align-items: center; gap: var(--s-2); cursor: pointer; }
.check input {
  appearance: none; width: 20px; height: 20px; margin: 0; flex: none;
  background: var(--surface) center / 14px no-repeat; border: var(--bw) solid var(--line-strong);
  border-radius: var(--r-s); cursor: pointer; transition: background-color var(--t-fast);
}
.check input:hover { border-color: var(--ink); }
.check input:checked {
  background-color: var(--ink); border-color: var(--ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffd23f' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  .check input:checked {
    background-color: var(--tape); border-color: var(--tape);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231c2740' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E");
  }
}

/* ---------- 状态标签（文字必须在，不能只靠颜色） ---------- */
.chip { display: inline-flex; align-items: center; gap: var(--s-1); height: 24px; padding: 0 var(--s-2);
        border-radius: var(--r-s); font-size: var(--fs-xs); font-weight: var(--fw-bold); white-space: nowrap; }
.chip .ic { width: 14px; height: 14px; }
.chip-run  { background: var(--run-soft);  color: var(--run); }
.chip-ok   { background: var(--ok-soft);   color: var(--ok); }
.chip-err  { background: var(--err-soft);  color: var(--err); }
.chip-wait { background: var(--wait-soft); color: var(--wait); }

/* ---------- 进度 ---------- */
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--run); border-radius: 3px;
                transition: width 300ms linear; }
.progress.is-ok > i { background: var(--ok); }
.progress.is-err > i { background: var(--err); }

/* ---------- 缩略图占位 ---------- */
.thumb { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--r-s);
         background: var(--surface-2); border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-badge { position: absolute; right: var(--s-1); bottom: var(--s-1); padding: 0 6px; border-radius: var(--r-s);
               background: var(--ink); color: var(--paper); font-size: var(--fs-xs); font-weight: var(--fw-bold); line-height: 18px; }

/* ---------- 面板与列表 ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
              padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--line); }
.panel-body { padding: var(--s-5); }
.panel-foot { display: flex; justify-content: flex-end; gap: var(--s-3); padding: var(--s-4) var(--s-5);
              border-top: 1px solid var(--line); }
.rows > * + * { border-top: 1px solid var(--line); }

/* ---------- 行内提示 ---------- */
.notice { display: flex; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--r-m);
          border-left: 4px solid var(--run); background: var(--run-soft); font-size: var(--fs-sm); }
.notice .ic { margin-top: 2px; }
.notice-err { border-left-color: var(--err); background: var(--err-soft); }
.notice-ok  { border-left-color: var(--ok);  background: var(--ok-soft); }

/* ---------- 空状态 ---------- */
.empty { display: grid; justify-items: center; gap: var(--s-3); padding: var(--s-8) var(--s-5); text-align: center; }
.empty .ic { width: 40px; height: 40px; color: var(--ink-3); stroke-width: 1.5; }
.empty p { max-width: 36ch; color: var(--ink-2); }

/* ---------- 提示条 ---------- */
.toasts { position: fixed; left: 50%; bottom: var(--s-5); transform: translateX(-50%); z-index: 50;
          display: grid; gap: var(--s-2); width: min(92vw, 420px); }
.toast { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4);
         background: var(--ink); color: var(--paper); border-radius: var(--r-m); box-shadow: var(--shadow-pop);
         animation: toast-in 160ms ease-out; }
.toast span { flex: 1; }
.toast button { background: none; border: 0; color: var(--tape); font-weight: var(--fw-bold); cursor: pointer; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- 对话框 ---------- */
dialog.dlg { width: min(92vw, 440px); padding: var(--s-5); border: 0; border-radius: var(--r-xl);
             background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); }
dialog.dlg::backdrop { background: var(--overlay); }
.dlg h3 { margin-bottom: var(--s-2); }
.dlg-actions { display: flex; justify-content: flex-end; gap: var(--s-3); margin-top: var(--s-5); }

/* 缩略图占位（没有真实封面时） */
.thumb-ph { display: grid; place-items: center; color: var(--ink-3); }
.thumb-ph .ic { width: 24px; height: 24px; stroke-width: 1.5; }

.thumb-ph:has(.thumb-badge) .ic { margin-top: -10px; }
