/* ============================================================
   home_html 子页面共享样式（tools/<code>/index.html 共用）
   从 home Vue 版以下来源提炼，纯 HTML 版保持同名类、同视觉：
   - src/web/home/src/style.css 的 .aitool 段（工具套件基样式）
   - src/web/home/src/components/aijob/*.vue 的 scoped 样式
   页面特有样式写在各自 index.html 的 <style> 内，不进本文件。
   ============================================================ */

/* ---------- 调色板 ---------- */
.aitool {
  --color-bg: #f5f7fa;
  --color-card: #ffffff;
  --color-border: #e5e7eb;
  --color-primary: #2563eb;
  --color-text: #1f2937;
  --color-muted: #6b7280;
  /* home 主页同款变量（env/worklog 等页沿用） */
  --mv-bg: #f6f7fb;
  --mv-card: #ffffff;
  --mv-text: #1f2937;
  --mv-text-secondary: #6b7280;
  --mv-primary: #4f7cff;
  --mv-primary-soft: #eef2ff;
  --mv-border: #e5e7eb;
  --mv-radius: 14px;
  --mv-dark: #182238;
}

/* ---------- 基础布局 ---------- */
.aitool .page {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.aitool .card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.aitool .row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.aitool .muted {
  color: var(--color-muted);
  font-size: 13px;
}

.aitool .err {
  color: #dc2626;
  font-size: 13px;
}

/* ---------- 表单元素 ---------- */
.aitool input,
.aitool textarea,
.aitool select {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  outline: none;
  background: #fff;
  font-family: inherit;
}

.aitool input:focus,
.aitool textarea:focus,
.aitool select:focus {
  border-color: var(--color-primary);
}

.aitool button {
  border: 1px solid var(--color-primary);
  background: var(--color-primary);
  color: #fff;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
}

.aitool button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.aitool button.ghost {
  background: #fff;
  color: var(--color-primary);
}

.aitool button.danger {
  background: #fff;
  color: #dc2626;
  border-color: #dc2626;
}

.aitool a.back-home {
  display: inline-block;
  border: 1px solid var(--color-primary);
  border-radius: 6px;
  padding: 8px 14px;
  background: #fff;
  color: var(--color-primary);
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}

.aitool a.back-home:hover {
  background: #eff6ff;
}

.aitool table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.aitool th,
.aitool td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--color-border);
}

/* ---------- 通用表单片段（各工具页共用类名） ---------- */
.aitool .field {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}

.aitool .field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.aitool .field-label .req {
  color: #dc2626;
  font-style: normal;
}

.aitool .field-hint {
  color: var(--color-muted);
  font-size: 12px;
}

.aitool .form-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.aitool .seg {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.aitool .seg-btn {
  background: #fff;
  color: var(--color-text);
  border-color: var(--color-border);
  font-weight: 500;
}

.aitool .seg-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.aitool .check {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
  font-size: 14px;
  cursor: pointer;
}

.aitool .check input,
.aitool .switch-row input {
  width: 16px;
  height: 16px;
  padding: 0;
  accent-color: var(--color-primary);
}

.aitool .switch-row {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.aitool .radios {
  display: flex;
  gap: 14px;
}

.aitool .radio {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

/* 胶囊单选（底色 / 模式选择等） */
.aitool .mode-options,
.aitool .bg-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.aitool .mode-option,
.aitool .bg-option {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
}

.aitool .mode-option.active,
.aitool .bg-option.active {
  border-color: var(--color-primary);
  background: #eff6ff;
  color: var(--color-primary);
  font-weight: 600;
}

.aitool .color-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.aitool .color-pick input[type='color'] {
  width: 36px;
  height: 28px;
  padding: 2px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.aitool .mono {
  font-family: Consolas, Menlo, monospace;
  color: var(--color-muted);
}

/* ---------- 演示提示条 ---------- */
.aitool .banner {
  border-color: #bfdbfe;
  background: #eff6ff;
  font-size: 14px;
}

.aitool .banner-info {
  border-color: #93c5fd;
  background: #eff6ff;
  font-size: 14px;
}

.aitool .tip {
  margin-top: 12px;
  background: #fffbeb;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: #92400e;
}

/* ---------- 状态徽标（进度 / 历史共用） ---------- */
.aitool .st,
.aitool .badge-st {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.aitool .st-queue { background: #f3f4f6; color: #6b7280; }
.aitool .st-run   { background: #dbeafe; color: #1d4ed8; }
.aitool .st-ok    { background: #dcfce7; color: #15803d; }
.aitool .st-fail  { background: #fee2e2; color: #b91c1c; }
.aitool .st-expired { background: #f3f4f6; color: #9ca3af; }

/* ---------- mg-uploader 上传组件 ---------- */
.aitool .up-label {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
}

.aitool .dropzone {
  border: 2px dashed var(--color-border);
  border-radius: 10px;
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.aitool .dropzone:hover,
.aitool .dropzone.dragging {
  border-color: var(--color-primary);
  background: #eff6ff;
}

.aitool .dz-main { font-size: 14px; }

.aitool .dz-hint {
  margin-top: 6px;
  color: var(--color-muted);
  font-size: 12px;
}

.aitool .file-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.aitool .file-list li {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 8px 10px;
}

.aitool .f-line {
  display: flex;
  gap: 8px;
  align-items: center;
}

.aitool .fname {
  font-size: 13px;
  font-weight: 600;
  max-width: 50%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aitool .f-err {
  color: #dc2626;
  font-size: 12px;
}

.aitool .remove {
  border: none;
  background: transparent;
  color: var(--color-muted);
  font-size: 14px;
  padding: 2px 6px;
  cursor: pointer;
}

.aitool .remove:hover:not(:disabled) { color: #dc2626; }

.aitool .remove:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.aitool .mini-bar {
  margin-top: 6px;
  height: 4px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}

.aitool .mini-bar-inner {
  height: 100%;
  background: var(--color-primary);
  transition: width 0.2s;
}

/* ---------- mg-job-progress 任务进度 ---------- */
.aitool .job-progress .bar {
  height: 8px;
  background: #eef2f7;
  border-radius: 999px;
  overflow: hidden;
}

.aitool .job-progress .bar-inner {
  height: 100%;
  background: var(--color-primary);
  border-radius: 999px;
  transition: width 0.4s;
}

.aitool .job-progress .bar-inner.st-ok { background: #16a34a; }
.aitool .job-progress .bar-inner.st-fail { background: #dc2626; }
.aitool .job-progress .bar-inner.st-expired { background: #9ca3af; }

/* ---------- mg-result-panel 结果面板 ---------- */
.aitool .result-panel .expired {
  background: #f3f4f6;
  border: 1px dashed var(--color-border);
  border-radius: 8px;
  padding: 12px;
  color: var(--color-muted);
  font-size: 13px;
}

.aitool .result-panel .output {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 10px 12px;
}

.aitool .result-panel .output + .output { margin-top: 10px; }

.aitool .result-panel .output-head { margin-bottom: 6px; }

.aitool .result-panel .badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.aitool .result-panel .badge.preview { background: #dcfce7; color: #15803d; }
.aitool .result-panel .badge.full { background: #fef3c7; color: #b45309; }

.aitool .result-panel .fname {
  font-size: 13px;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aitool .result-panel .media {
  margin: 6px 0;
  max-width: 100%;
}

.aitool .result-panel .thumb {
  display: block;
  max-width: 160px;
  max-height: 160px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  cursor: zoom-in;
}

.aitool .result-panel audio.media,
.aitool .result-panel video.media { width: 100%; }

.aitool .result-panel .output-ops { margin-top: 4px; }

.aitool .result-panel .output-ops a {
  color: var(--color-primary);
  font-size: 13px;
}

.aitool .result-panel .unlock {
  font-size: 13px;
  padding: 4px 10px;
}

/* ---------- mg-job-history 历史任务 ---------- */
.aitool .history .clickable { cursor: pointer; }
.aitool .history .clickable:hover td { background: #f8fafc; }
.aitool .history .clickable.active td { background: #eff6ff; }

/* ---------- 合规声明（静态 HTML，SEO 可读） ---------- */
.aitool .compliance .warn {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  margin-bottom: 8px;
}

.aitool .compliance .notice {
  margin: 0;
  color: var(--color-muted);
  font-size: 12px;
  line-height: 1.7;
}

/* ---------- mg-about 关于弹窗 ---------- */
.aitool .mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 16px;
}

.aitool .dialog {
  width: 100%;
  background: #fff;
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  max-height: 90vh;
  overflow: auto;
}

.aitool .about-dialog { width: 340px; max-width: calc(100vw - 32px); }

.aitool .about-head {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.aitool .about-logo { font-size: 26px; }
.aitool .about-title { font-size: 16px; font-weight: 700; }
.aitool .about-sub { font-size: 12px; }

.aitool .about-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.aitool .about-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.aitool .about-extra {
  font-size: 12px;
  line-height: 1.6;
  border-top: 1px dashed #e5e7eb;
  padding-top: 8px;
}

.aitool .about-foot {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #e5e7eb;
  font-size: 11px;
  color: #6b7280;
  text-align: center;
}

.aitool .dialog-ops {
  margin-top: 14px;
  text-align: right;
}

/* ---------- 子页面 toast（naive-ui message 的平替） ---------- */
.mg-toast-wrap {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.mg-toast {
  background: #fff;
  border: 1px solid var(--mv-border, #e5e7eb);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  color: #1f2937;
  animation: mg-toast-in 0.18s ease;
}

.mg-toast.success { border-color: #86efac; color: #15803d; }
.mg-toast.error { border-color: #fca5a5; color: #b91c1c; }
.mg-toast.warning { border-color: #fcd34d; color: #92400e; }

@keyframes mg-toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 无 JS 降级提示 ---------- */
.noscript-tip {
  max-width: 960px;
  margin: 16px auto 0;
  padding: 12px 16px;
  background: #fffbeb;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  font-size: 13px;
  color: #92400e;
}

[v-cloak] { display: none !important; }
