/* ============================================================
 * 视频下载页面样式（移植「珠姐专用视频下载器」，融入平台浅色主题）
 * 所有颜色/圆角/阴影统一使用 style.css :root 中的变量
 * ============================================================ */

/* ---------- 解析区 ---------- */
#page-downloader .dl-parse-card { margin-bottom: 18px; }

.dl-input-row { display: flex; align-items: center; gap: 10px; }

.dl-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 12px;
  background: var(--bg-t);
  border: 1px solid var(--bd);
  border-radius: var(--r-md);
  transition: border-color var(--t-f), box-shadow var(--t-f);
  min-width: 0;
}
.dl-input-wrap:focus-within { border-color: var(--ac-p); box-shadow: 0 0 0 3px var(--ag); }
.dl-input-wrap.dl-focus-douyin { border-color: #0ea5a5; box-shadow: 0 0 0 3px rgba(0, 178, 178, .15); }
.dl-input-wrap.dl-focus-xhs { border-color: #ff2442; box-shadow: 0 0 0 3px rgba(255, 36, 66, .14); }
.dl-input-wrap.dl-focus-none { border-color: var(--dg); box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }

.dl-url-input {
  flex: 1;
  width: 100%;
  min-width: 0;
  padding: 10px 0;
  background: transparent;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--tx-p);
}
.dl-url-input::placeholder { color: var(--tx-m); }

.dl-platform-badge {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-h);
  color: var(--tx-s);
  white-space: nowrap;
}
.dl-platform-badge.dl-badge-douyin { color: #0b8a8a; background: rgba(0, 178, 178, .14); }
.dl-platform-badge.dl-badge-xhs { color: #e11d48; background: rgba(255, 36, 66, .12); }
.dl-platform-badge.dl-badge-none { color: var(--dg); background: rgba(220, 38, 38, .1); }

.dl-tips { margin-top: 10px; font-size: 12px; color: var(--tx-m); }

.dl-local-upload { margin-top: 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dl-local-upload-hint { font-size: 12px; color: var(--tx-m); }

/* ---------- 解析结果卡片 ---------- */
.dl-result-card { margin-bottom: 20px; }
.dl-result-head { display: flex; align-items: center; gap: 10px; }
.dl-result-badge {
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--ac-g); color: #fff;
}
.dl-result-body { display: grid; grid-template-columns: 320px 1fr; gap: 20px; }
.dl-result-media { min-width: 0; }

.dl-preview-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 420px;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-t);
  cursor: pointer;
}
.dl-preview-wrap img { width: 100%; height: 100%; object-fit: cover; }
.dl-preview-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .28); opacity: 0; transition: opacity var(--t-f);
}
.dl-preview-wrap:hover .dl-preview-overlay { opacity: 1; }
.dl-play-icon {
  width: 56px; height: 56px; border-radius: 50%; background: rgba(255, 255, 255, .95);
  color: #1c1917; display: flex; align-items: center; justify-content: center;
}
.dl-play-icon svg { width: 24px; height: 24px; margin-left: 3px; }
.dl-duration {
  position: absolute; right: 10px; bottom: 10px; padding: 3px 9px; border-radius: 6px;
  background: rgba(0, 0, 0, .72); color: #fff; font-size: 12px; font-weight: 500;
}
.dl-image-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  max-height: 420px; overflow-y: auto;
}
.dl-image-grid img {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--r-sm);
  cursor: pointer; transition: transform var(--t-f);
}
.dl-image-grid img:hover { transform: scale(1.04); }

.dl-result-info { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.dl-result-title { font-size: 18px; font-weight: 700; color: var(--tx-p); line-height: 1.4; }
.dl-result-desc {
  font-size: 13px; color: var(--tx-s); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

.dl-author { display: flex; align-items: center; gap: 10px; }
.dl-author-avatar {
  width: 42px; height: 42px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  background: var(--ac-g); color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 16px;
}
.dl-author-avatar img { width: 100%; height: 100%; object-fit: cover; }
.dl-author-name { font-size: 14px; font-weight: 600; color: var(--tx-p); }

.dl-stats { display: flex; gap: 20px; flex-wrap: wrap; padding: 12px 14px; background: var(--bg-t); border-radius: var(--r-md); }
.dl-stat { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--tx-s); }
.dl-stat svg { width: 16px; height: 16px; }

.dl-result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.dl-result-actions .btn { font-size: 12.5px; }
.dl-points-hint { font-size: 12px; color: var(--tx-m); align-self: center; }

/* ---------- 作品库工具栏 ---------- */
#page-downloader .dl-library-title {
  display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; color: var(--tx-p);
}

.dl-batch-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 14px;
  background: var(--bg-t); border: 1px solid var(--bd); border-radius: var(--r-md);
}
.dl-sel-count { font-size: 13px; color: var(--tx-s); min-width: 72px; }
.dl-batch-bar button {
  padding: 6px 12px; border-radius: var(--r-sm); font-size: 12.5px;
  border: 1px solid var(--bd); background: var(--bg-s); color: var(--tx-s);
  display: inline-flex; align-items: center; gap: 5px; transition: all var(--t-f);
}
.dl-batch-bar button:hover:not(:disabled) { border-color: var(--ac-p); color: var(--ac-p); }
.dl-batch-bar button:disabled { opacity: .45; cursor: not-allowed; }
.dl-batch-bar button.dl-btn-danger { color: var(--dg); border-color: rgba(220, 38, 38, .35); }
.dl-batch-bar button.dl-btn-danger:hover:not(:disabled) { background: rgba(220, 38, 38, .1); color: var(--dg); border-color: var(--dg); }

.dl-check-all { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--tx-s); cursor: pointer; }

/* ---------- 作品库网格 ---------- */
.dl-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

.dl-card {
  position: relative;
  background: var(--bg-s);
  border: 1px solid var(--bd);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color var(--t-f), box-shadow var(--t-f), transform var(--t-f);
}
.dl-card:hover { border-color: var(--ac-p); box-shadow: var(--s-md); transform: translateY(-2px); }
.dl-card.dl-selected { border-color: var(--ac-p); box-shadow: 0 0 0 2px var(--ag); }

.dl-card-check {
  position: absolute; top: 8px; left: 8px; z-index: 3;
  width: 22px; height: 22px; cursor: pointer; accent-color: var(--ac-p);
}

.dl-thumb {
  position: relative; width: 100%; aspect-ratio: 16 / 9; background: var(--bg-t); overflow: hidden;
}
.dl-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dl-thumb-ph {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--bd-l);
}
.dl-thumb-ph svg { width: 40px; height: 40px; }
.dl-thumb-dur {
  position: absolute; right: 6px; bottom: 6px; z-index: 2;
  padding: 1px 7px; border-radius: 4px; background: rgba(0, 0, 0, .72); color: #fff; font-size: 11px;
}
.dl-thumb-play {
  position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center;
  color: #fff; opacity: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 45%, rgba(0,0,0,.45) 100%);
  transition: opacity var(--t-f); pointer-events: none;
}
.dl-thumb-play svg { width: 38px; height: 38px; filter: drop-shadow(0 2px 8px rgba(0,0,0,.6)); }
.dl-card:hover .dl-thumb-play { opacity: 1; }

.dl-card-info { padding: 10px 12px 4px; }
.dl-card-name {
  font-size: 13px; color: var(--tx-p); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dl-card-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 11px; color: var(--tx-m); flex-wrap: wrap; }

.dl-tag { padding: 1px 8px; border-radius: 999px; font-size: 11px; line-height: 1.7; background: var(--bg-t); color: var(--tx-s); }
.dl-tag.dl-tag-douyin { color: #0b8a8a; background: rgba(0, 178, 178, .14); }
.dl-tag.dl-tag-xhs { color: #e11d48; background: rgba(255, 36, 66, .12); }
.dl-tag.dl-tag-local { color: var(--sc); background: rgba(21, 128, 61, .12); }

.dl-card-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 12px; }
.dl-card-actions button {
  flex: 1 1 auto; min-width: 54px; padding: 6px 4px;
  border: 1px solid var(--bd); border-radius: var(--r-sm);
  background: var(--bg-t); color: var(--tx-s); font-size: 11.5px;
  display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  transition: all var(--t-f);
}
.dl-card-actions button:hover { border-color: var(--ac-p); color: var(--ac-p); }
.dl-card-actions button.dl-act-del:hover { border-color: var(--dg); color: var(--dg); background: rgba(220, 38, 38, .08); }
.dl-card-actions svg { width: 13px; height: 13px; }

.dl-empty {
  grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; color: var(--tx-m); gap: 8px;
}
.dl-empty p { font-size: 14px; color: var(--tx-s); margin: 0; }
.dl-empty span { font-size: 12px; }

/* ---------- 批量结果弹窗 ---------- */
.dl-batch-status { font-size: 13px; color: var(--tx-s); margin-bottom: 10px; }
.dl-batch-result { margin-top: 14px; max-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.dl-batch-line { font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.dl-batch-line.dl-ok { color: var(--sc); }
.dl-batch-line.dl-fail { color: var(--dg); }
.dl-batch-line code { font-size: 11.5px; color: var(--tx-m); word-break: break-all; }

/* ---------- 弹窗通用 ---------- */
.dl-modal { width: 620px; max-width: 92vw; }
.dl-modal-narrow { width: 440px; }
.dl-file-name { font-size: 12px; color: var(--tx-m); margin-bottom: 12px; word-break: break-all; }

.dl-video { width: 100%; max-height: 320px; background: #000; border-radius: var(--r-md); display: block; }
.dl-status { margin-top: 12px; font-size: 13px; color: var(--tx-s); min-height: 18px; text-align: center; }
.dl-status.success { color: var(--sc); }
.dl-status.error { color: var(--dg); }
.dl-modal-actions { display: flex; gap: 10px; }

/* ---------- 剪辑片段 ---------- */
.dl-times { display: flex; gap: 10px; margin: 14px 0; }
.dl-time-box {
  flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 10px 12px;
  background: var(--bg-t); border: 1px solid var(--bd); border-radius: var(--r-md); text-align: center;
}
.dl-time-box.dl-highlight { border-color: var(--ac-p); background: rgba(194, 65, 12, .08); }
.dl-time-label { font-size: 12px; color: var(--tx-m); }
.dl-time-value { font-size: 16px; font-weight: 700; color: var(--tx-p); font-variant-numeric: tabular-nums; }
.dl-slider-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.dl-slider-tag { width: 36px; font-size: 13px; color: var(--tx-s); flex-shrink: 0; }
.dl-hint { font-size: 12px; color: var(--tx-m); margin: 10px 0 16px; line-height: 1.6; }

.dl-range {
  flex: 1; -webkit-appearance: none; appearance: none; height: 6px; border-radius: 100px;
  background: var(--bg-t); outline: none; cursor: pointer;
}
.dl-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--ac-g); border: 2px solid #fff; box-shadow: var(--s-sm); cursor: pointer;
}
.dl-range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--ac-p); border: 2px solid #fff; cursor: pointer; }

/* ---------- 提取音频 ---------- */
.dl-audio-formats { display: flex; flex-direction: column; gap: 10px; }
.dl-audio-format {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 12px 16px; background: var(--bg-t); border: 1px solid var(--bd);
  border-radius: var(--r-md); text-align: left; transition: all var(--t-f);
}
.dl-audio-format:hover { border-color: var(--ac-p); background: rgba(194, 65, 12, .06); }
.dl-audio-format.active { border-color: var(--ac-p); background: rgba(194, 65, 12, .1); }
.dl-audio-format:disabled { opacity: .55; cursor: not-allowed; }
.dl-af-name { font-size: 15px; font-weight: 700; color: var(--tx-p); }
.dl-af-desc { font-size: 12px; color: var(--tx-m); }

/* ---------- 去水印弹窗 ---------- */
.dl-wm-modes { display: flex; gap: 10px; margin-bottom: 16px; }
.dl-wm-mode {
  flex: 1; display: flex; flex-direction: column; gap: 3px; padding: 12px 14px;
  border-radius: var(--r-md); border: 1px solid var(--bd); background: var(--bg-t);
  text-align: left; transition: all var(--t-f);
}
.dl-wm-mode:hover { border-color: var(--bd-l); }
.dl-wm-mode.active { border-color: var(--ac-p); background: rgba(194, 65, 12, .1); box-shadow: 0 0 0 1px var(--ac-p) inset; }
.dl-wm-mode-title { font-size: 14px; font-weight: 700; color: var(--tx-p); }
.dl-wm-mode-desc { font-size: 11.5px; color: var(--tx-m); line-height: 1.4; }

.dl-wm-stage {
  position: relative; width: 100%; background: #000; border-radius: var(--r-md); overflow: hidden;
  touch-action: none; user-select: none; cursor: crosshair; line-height: 0;
}
.dl-wm-video { width: 100%; max-height: 340px; display: block; background: #000; pointer-events: none; }
.dl-wm-select {
  position: absolute; border: 2px solid var(--ac-p); background: rgba(194, 65, 12, .25);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .45); border-radius: 4px; pointer-events: none;
}
.dl-wm-toolbar { display: flex; align-items: center; gap: 12px; margin: 14px 0 10px; }
.dl-wm-play {
  display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--r-sm);
  background: var(--bg-t); border: 1px solid var(--bd); color: var(--tx-p); font-size: 13px; flex-shrink: 0;
}
.dl-wm-play:hover { background: var(--ac-p); border-color: var(--ac-p); color: #fff; }
.dl-wm-play svg { width: 14px; height: 14px; }
.dl-wm-time { font-size: 12px; color: var(--tx-s); font-variant-numeric: tabular-nums; flex-shrink: 0; min-width: 84px; text-align: right; }
.dl-wm-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.dl-wm-presets button {
  padding: 6px 12px; border-radius: 999px; background: var(--bg-t); border: 1px solid var(--bd);
  color: var(--tx-s); font-size: 12px; transition: all var(--t-f);
}
.dl-wm-presets button:hover { background: rgba(194, 65, 12, .12); border-color: var(--ac-p); color: var(--tx-p); }
.dl-wm-coords {
  font-size: 13px; color: var(--tx-s); padding: 10px 12px; background: var(--bg-t);
  border: 1px solid var(--bd); border-radius: var(--r-md); margin-bottom: 14px; font-variant-numeric: tabular-nums;
}
.dl-wm-note {
  font-size: 12.5px; line-height: 1.7; color: var(--tx-s);
  background: rgba(249, 115, 22, .07); border: 1px solid rgba(249, 115, 22, .28);
  border-radius: var(--r-md); padding: 12px 14px;
}
.dl-wm-note b { color: var(--ac-p); }
.dl-wm-progress { margin-top: 12px; }

/* ---------- 视频预览弹窗 ---------- */
.dl-preview-modal { width: 900px; max-width: 94vw; }
.dl-preview-video { width: 100%; max-height: 70vh; background: #000; border-radius: var(--r-md); }
.dl-preview-tip { margin-top: 12px; font-size: 13px; color: var(--tx-m); text-align: center; }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .dl-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .dl-result-body { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .dl-input-row { flex-wrap: wrap; }
  .dl-input-wrap { flex-basis: 100%; }
  .dl-grid { grid-template-columns: repeat(2, 1fr); }
  .dl-result-body { grid-template-columns: 1fr; }
}
