/* ===========================================================
   tool.css —— 两个在线工具页的样式（只被 工具\*.html 引用）
   全部使用 style.css 里的 CSS 变量，深浅色模式自动适配。
   =========================================================== */

.tool-page { max-width: 760px; margin: 0 auto; padding: 26px 0 10px; }
.tool-head { margin-bottom: 20px; }
.tool-head .page-title { margin-bottom: 6px; }

/* 面包屑（学科页也复用，样式写在 style.css；这里只补工具页间距） */
.tool-page .breadcrumb { margin-bottom: 16px; }

.tool-panel {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-s);
}

/* ---------------- 上传区 ---------------- */
.drop-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 38px 20px;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}
.drop-zone:hover,
.drop-zone:focus-visible {
  border-color: var(--brand);
  background: var(--brand-soft);
  outline: none;
}
.drop-zone.is-drag {
  border-color: var(--brand);
  background: var(--brand-soft);
  transform: scale(1.01);
}
.drop-zone.is-busy { cursor: not-allowed; opacity: 0.6; }
.drop-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 22px;
  font-weight: 700;
}
.drop-title { margin: 4px 0 0; font-weight: 600; font-size: 16.5px; color: var(--text); }
.drop-hint { margin: 0; font-size: 13px; color: var(--text-faint); line-height: 1.6; }

/* ---------------- 已选文件 ---------------- */
.file-chosen {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--bg);
}
.file-chosen-ico { flex: 0 0 auto; font-size: 20px; }
.file-chosen-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.file-chosen-name {
  font-size: 14.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-chosen-size { font-size: 12.5px; color: var(--text-faint); }
.file-chosen .btn-ghost { flex: 0 0 auto; }

/* ---------------- 任务下拉 ---------------- */
.tool-field { margin-top: 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.field-label { font-size: 14.5px; font-weight: 600; color: var(--text-soft); }
.task-select {
  flex: 1 1 240px;
  min-width: 0;
  font: inherit;
  font-size: 14.5px;
  padding: 9px 13px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--text);
}
.task-select:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }

.tool-actions { margin-top: 18px; display: flex; justify-content: flex-end; }
.tool-start { border: 0; cursor: pointer; font: inherit; }
.tool-start:disabled { opacity: 0.5; cursor: not-allowed; }
.tool-start:disabled:hover { background: var(--brand); }

/* ---------------- 进度 ---------------- */
.tool-status { margin-top: 20px; }
.progress {
  height: 10px;
  border-radius: 999px;
  background: var(--bg-mute);
  overflow: hidden;
  border: 1px solid var(--line);
}
.progress-bar {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), #8b5cf6);
  transition: width 0.35s ease;
}
.status-text { margin: 9px 0 0; font-size: 13.5px; color: var(--text-soft); }

/* ---------------- 结果 ---------------- */
.tool-result {
  margin-top: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--bg);
  text-align: center;
}
.result-title { margin: 0 0 12px; font-size: 16px; font-weight: 700; color: var(--text); }
.download-btn { padding: 11px 28px; font-size: 15.5px; }
.result-hint { margin: 10px 0 0; font-size: 12.5px; color: var(--text-faint); }

/* ---------------- 错误 ---------------- */
.tool-error {
  margin: 18px 0 0;
  padding: 11px 15px;
  border: 1px solid rgba(217, 58, 48, 0.35);
  border-radius: var(--radius-s);
  background: rgba(224, 78, 66, 0.09);
  color: #b3261e;
  font-size: 14px;
  line-height: 1.65;
}
html[data-theme='dark'] .tool-error {
  border-color: rgba(255, 122, 112, 0.4);
  background: rgba(255, 122, 112, 0.12);
  color: #ffb4ab;
}
@media (prefers-color-scheme: dark) {
  html[data-theme='auto'] .tool-error {
    border-color: rgba(255, 122, 112, 0.4);
    background: rgba(255, 122, 112, 0.12);
    color: #ffb4ab;
  }
}

.tool-disclaimer {
  margin: 22px 0 0;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-faint);
}

@media (max-width: 720px) {
  .tool-page { padding-top: 18px; }
  .tool-panel { padding: 18px 16px; }
  .drop-zone { padding: 30px 14px; }
  .file-chosen { flex-wrap: wrap; }
  .file-chosen .btn-ghost { width: 100%; }
  .tool-actions { justify-content: stretch; }
  .tool-start { width: 100%; }
}

/* ---- 任务类型按钮组（替代下拉框，2026-10-19）---- */
.tool-field-block { flex-direction: column; align-items: stretch; gap: 8px; }
.task-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.task-btn {
  flex: 1 1 220px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 16px;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-s);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.task-btn:hover:not(:disabled) { border-color: var(--brand); }
.task-btn:focus-visible { outline: 2px solid var(--brand-soft); outline-offset: 2px; }
.task-btn.is-active {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand);
}
.task-btn:disabled { opacity: .55; cursor: not-allowed; }
.task-btn-name { font-weight: 600; font-size: 15px; }
.task-btn-desc { font-size: 12.5px; color: var(--text-faint); }
.task-btn.is-active .task-btn-desc { color: var(--text-soft); }

@media (max-width: 560px) {
  .task-buttons { flex-direction: column; }
  .task-btn { flex-basis: auto; }
}

/* 修正：任务按钮不要被 flex 交叉轴拉伸成很高 */
.task-buttons { align-items: flex-start; }
.task-btn { flex: 0 1 auto; min-height: 0; }

/* 去掉副标题后：任务按钮单行居中、等宽等高 */
.task-buttons { align-items: stretch; }
.task-btn {
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 46px;
  padding: 12px 18px;
}
.task-btn-name { font-size: 15px; }
.task-btn-desc { display: none; }
@media (max-width: 560px) {
  .task-btn { flex-basis: auto; min-height: 44px; }
}

