﻿/* ═══════════════════════════════════════════════════════════
   style.css — 仅保留 JS 动态组件所需样式
   视觉布局全部通过 Tailwind 内联类处理
   ═══════════════════════════════════════════════════════════ */

/* ───── Inter Font (local) ───── */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("./vendor/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("./vendor/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ───── CSS Variables ───── */
:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-soft-hover: #eef2ff;
  --text: #0f172a;
  --muted: #475569;
  --border: #e5e7eb;
  --primary: #0ea5e9;
  --primary-hover: #0284c7;
  --secondary: #10b981;
  --secondary-hover: #059669;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --warn: #d97706;
  --success: #16a34a;
  --info: #64748b;
  --log-bg: #0b1220;
  --log-border: #1f2937;
}
html.dark {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-soft: #0f1726;
  --surface-soft-hover: #162136;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: #374151;
  --primary: #38bdf8;
  --primary-hover: #0ea5e9;
  --secondary: #10b981;
  --secondary-hover: #059669;
  --danger: #f87171;
  --danger-hover: #ef4444;
  --warn: #f59e0b;
  --success: #4ade80;
  --info: #94a3b8;
  --log-bg: #020817;
  --log-border: #334155;
}

/* ───── Reset (minimal) ───── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { overflow-x: hidden; }

/* ───── Theme Transition ───── */
:root.theme-transitioning,
:root.theme-transitioning body,
:root.theme-transitioning header,
:root.theme-transitioning main,
:root.theme-transitioning section,
:root.theme-transitioning div,
:root.theme-transitioning footer,
:root.theme-transitioning details,
:root.theme-transitioning summary,
:root.theme-transitioning p,
:root.theme-transitioning span,
:root.theme-transitioning h1,
:root.theme-transitioning h2,
:root.theme-transitioning h3 {
  transition: background-color 0.22s ease, color 0.22s ease, border-color 0.22s ease !important;
}

/* ───── Utility ───── */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary);
  color: #fff;
  padding: 8px 16px;
  z-index: 999;
  border-radius: 0 0 8px 0;
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus { top: 0; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.hidden-input { display: none; }

.glass-panel {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body.is-busy { cursor: wait; }
body.is-busy button,
body.is-busy input,
body.is-busy select,
body.is-busy a { cursor: wait !important; }
body.dragging-files,
body.dragging-files * { cursor: copy !important; }

/* ───── Focus Ring ───── */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ───── Convert Button (matches TEST.html green gradient) ───── */
.btn-convert {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 10px 32px;
  border-radius: 0.5rem;
  background: linear-gradient(to right, #10b981, #22c55e);
  color: #fff;
  font-weight: 700;
  font-size: 0.875rem;
  line-height: 1.2;
  border: none;
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.3);
  transition: all 0.2s ease;
  cursor: pointer;
}
.btn-convert:hover:not(:disabled) {
  background: linear-gradient(to right, #22c55e, #10b981);
  transform: scale(1.05);
}
.btn-convert:active:not(:disabled) { transform: scale(0.95); }
.btn-convert:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* ───── Button Classes (used in JS-generated HTML) ───── */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.btn-secondary:hover { background: var(--surface-soft-hover); }
.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-remove {
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: transparent;
  color: var(--danger);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.btn-remove:hover { background: rgba(220, 38, 38, 0.08); }

/* ───── Button Content (setButtonContent) ───── */
.btn-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}
.btn-text { display: inline-block; }

/* ───── Icons ───── */
.ui-icon { width: 18px; height: 18px; flex: 0 0 auto; }
.ext-icon { width: 12px; height: 12px; }
.spin { animation: icon-spin 0.8s linear infinite; }
@keyframes icon-spin { to { transform: rotate(360deg); } }

/* ───── Hint / Status Text ───── */
.hint {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.4;
}
.hint.status-success { color: var(--success); font-weight: 500; }
.hint.status-warn    { color: var(--warn);    font-weight: 500; }
.hint.status-error   { color: var(--danger);  font-weight: 500; }

/* ───── Alert ───── */
.alert {
  padding: 12px 16px;
  border-radius: 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid transparent;
  line-height: 1.4;
}
.alert.alert-error {
  background: rgba(220, 38, 38, 0.08);
  border-color: var(--danger);
  color: var(--danger);
}
.alert.alert-success {
  background: rgba(22, 163, 74, 0.08);
  border-color: var(--success);
  color: var(--success);
}
.alert.alert-warn {
  background: rgba(217, 119, 6, 0.08);
  border-color: var(--warn);
  color: var(--warn);
}

/* ───── Update Banner ───── */
.update-banner-host { display: block; }
.update-banner {
  border: 1px solid var(--primary);
  background: rgba(14, 165, 233, 0.06);
  border-radius: 0.75rem;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.5;
}
.update-banner-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
.update-banner-title {
  font-weight: 700;
  font-size: 0.85rem;
}
.update-banner-summary {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}
.update-action-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  background: var(--primary);
  color: #fff;
  transition: background-color 0.15s ease;
}
.update-action-link:hover { background: var(--primary-hover); }
.update-action-link.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.update-action-link.secondary:hover { background: var(--surface-soft-hover); }
.update-action-btn {
  padding: 4px 10px;
  border-radius: 0.5rem;
  font-size: 0.72rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
}
.update-action-btn:hover { background: var(--surface-soft-hover); }
.update-action-close {
  padding: 4px;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  font-size: 1.1rem;
}
.update-action-close:hover { color: var(--text); }

/* ───── Version Badge ───── */
.version-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-weight: 600;
  border-radius: 6px;
  background: rgba(14, 165, 233, 0.1);
  color: var(--primary);
  letter-spacing: 0.02em;
  line-height: 1.6;
}
.version-badge.preview {
  background: rgba(217, 119, 6, 0.12);
  color: var(--warn);
}

/* ───── File Preview List (uploader.js) ───── */
.file-preview-list {
  max-height: 200px;
  overflow-y: auto;
  position: relative;
}
.file-preview-list.virtual-list { overflow-y: auto; }
.file-preview-spacer { flex-shrink: 0; pointer-events: none; }
.file-preview-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text);
  transition: background-color 0.15s ease;
}
.file-preview-item:hover { background: var(--surface-soft); }
.file-preview-item:last-child { border-bottom: none; }
#dropZone.drop-zone-mini {
  height: 88px;
}
#dropZone.drop-zone-mini .w-16,
#dropZone.drop-zone-mini .flex.gap-2.justify-center.text-\[10px\] {
  display: none;
}
#dropZone.drop-zone-mini .z-10 {
  display: flex;
  width: 100%;
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
  text-align: left;
}
#dropZone.drop-zone-mini h3 {
  font-size: 0.92rem;
  margin: 0;
}
#dropZone.drop-zone-mini p {
  font-size: 0.75rem;
  margin-top: 2px;
}
#dropZone.drop-zone-mini #pickFilesBtn {
  padding: 6px 12px;
  font-size: 0.75rem;
  white-space: nowrap;
}
.file-preview-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.file-preview-size {
  color: var(--muted);
  font-size: 0.72rem;
  flex-shrink: 0;
}

/* ───── File Extension Badge ───── */
.file-ext-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.ext-kgg  { background: #fef3c7; color: #92400e; }
.ext-kgm  { background: #e0e7ff; color: #3730a3; }
.ext-kgma { background: #fce7f3; color: #9d174d; }
.ext-vpr  { background: #d1fae5; color: #065f46; }
.ext-ncm  { background: #f3e8ff; color: #6b21a8; }
.ext-mp3  { background: #dbeafe; color: #1e40af; }
.ext-flac { background: #dcfce7; color: #166534; }
.ext-wav  { background: #fef9c3; color: #854d0e; }

html.dark .ext-kgg  { background: #78350f44; color: #fbbf24; }
html.dark .ext-kgm  { background: #3730a344; color: #a5b4fc; }
html.dark .ext-kgma { background: #9d174d44; color: #f9a8d4; }
html.dark .ext-vpr  { background: #065f4644; color: #6ee7b7; }
html.dark .ext-ncm  { background: #6b21a844; color: #d8b4fe; }
html.dark .ext-mp3  { background: #1e40af44; color: #93c5fd; }
html.dark .ext-flac { background: #16653444; color: #86efac; }
html.dark .ext-wav  { background: #854d0e44; color: #fde047; }

/* ───── Progress ───── */
.progress-bar-container {
  width: 100%;
  height: 10px;
  background: var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 10px;
  transition: width 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}
.progress-bar.warning { background: linear-gradient(90deg, var(--warn), #f59e0b); }
.progress-bar.error   { background: linear-gradient(90deg, var(--danger), #f87171); }
.progress-text {
  padding-right: 6px;
  font-size: 0.6rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}
.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
}

/* ───── File List (progress items) ───── */
.file-list {
  max-height: 240px;
  overflow-y: auto;
  margin-top: 12px;
}
.file-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text);
}
.file-list-item:last-child { border-bottom: none; }
.file-list-item.pending { color: var(--muted); }
.file-list-item.success { color: var(--success); }
.file-list-item.error   { color: var(--danger); }
.file-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-icon { flex: 0 0 auto; width: 16px; height: 16px; }
.status-icon.success { color: var(--success); }
.status-icon.error { color: var(--danger); }
.status-icon.pending { color: var(--muted); }

/* ───── Dashboard / Stats ───── */
.dashboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.stat-card {
  text-align: center;
  padding: 16px;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}
.stat-number {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.2;
}
.stat-label {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
}
.stat-success .stat-number { color: var(--success); }
.stat-failed .stat-number  { color: var(--danger); }
.stat-duration .stat-number { color: var(--primary); }

/* ───── Success / Failed ───── */
.success-list, .failed-list {
  max-height: 200px;
  overflow-y: auto;
  margin-top: 8px;
}
.success-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.success-item:hover { background: var(--surface-soft); }
.success-item:last-child { border-bottom: none; }
.success-item.playing,
.success-item.active-preview { background: rgba(14, 165, 233, 0.06); }

.failed-list {
  padding: 4px;
}
.failed-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: var(--surface-soft);
}
.failed-item:last-child {
  margin-bottom: 0;
}
.failed-main {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
}
.failed-meta,
.failed-path {
  font-size: 0.74rem;
  line-height: 1.45;
  color: var(--muted);
  word-break: break-all;
}
.failed-item .retry-single-btn {
  justify-self: flex-start;
  margin-top: 2px;
}

.preview-audio {
  width: 100%;
  margin-top: 8px;
  border-radius: 8px;
}

/* ───── Log Box ───── */
.log-box {
  background: var(--log-bg);
  border: 1px solid var(--log-border);
  border-radius: 0.5rem;
  padding: 10px 14px;
  max-height: 240px;
  overflow-y: auto;
  font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
  font-size: 0.72rem;
  line-height: 1.7;
  color: #94a3b8;
}
.log-box:empty::before {
  content: "暂无日志";
  color: #475569;
  font-style: italic;
}
.log-line {
  white-space: pre-wrap;
  word-break: break-all;
}
.log-error   { color: #f87171; }
.log-success { color: #4ade80; }
.log-warn    { color: #fbbf24; }
.log-info    { color: #60a5fa; }

/* ───── History Panel ───── */
.history-panel {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
}
.history-panel:empty::before {
  content: "暂无转换历史";
  display: block;
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-size: 0.8rem;
  font-style: italic;
}
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text);
  transition: background-color 0.15s ease;
}
.history-item:hover { background: var(--surface-soft); }
.history-item:last-child { border-bottom: none; }
.history-toggle-row {
  display: flex;
  justify-content: center;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
}
.history-toggle-btn { font-size: 0.72rem; }

/* ───── Toast ───── */
.toast-host {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 12px 18px;
  border-radius: 0.75rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateX(100%);
  max-width: 360px;
}
.toast.toast-success { background: #16a34a; }
.toast.toast-error   { background: #dc2626; }
.toast.toast-info    { background: #475569; }
.toast.toast-enter { animation: toast-in 0.3s ease forwards; }
.toast.toast-exit  { animation: toast-out 0.25s ease forwards; }
.toast.show { opacity: 1; transform: translateX(0); }

@keyframes toast-in {
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(100%); }
}

/* ───── Scanner ───── */
.scan-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 600;
}
.scan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.file-name-list {
  max-height: 280px;
  overflow-y: auto;
}
.file-name-item {
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.file-name-item:last-child { border-bottom: none; }
.folder-header {
  padding: 6px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.folder-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
}
.folder-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 9999px;
  font-size: 0.72rem;
  color: var(--text);
}
.tag-remove {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-size: 0.8rem;
}
.tag-remove:hover { color: var(--danger); }

/* ───── Drag-over state ───── */
.drag-over {
  border-color: var(--primary) !important;
  background: rgba(14, 165, 233, 0.04) !important;
}

/* ───── Skeleton ───── */
.skeleton-screen {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.skeleton-card {
  padding: 24px;
  border-radius: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--border) 25%, var(--surface-soft) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
}
.skeleton-line.w-35 { width: 35%; }
.skeleton-line.w-45 { width: 45%; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-80 { width: 80%; }
.skeleton-line.w-90 { width: 90%; }
.skeleton-line.w-100 { width: 100%; }

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* app-loading state: hide real content, show skeleton */
body.app-loading .card,
body.app-loading .footer,
body.app-loading #updateBannerHost,
body.app-loading #globalAlert,
body.app-loading .toast-host,
body.app-loading #bottomActionBar {
  display: none !important;
}
body:not(.app-loading) .skeleton-screen {
  display: none !important;
}

/* ───── Scrollbar ───── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ───── Responsive ───── */
@media (max-width: 640px) {
  .dashboard { grid-template-columns: 1fr; }
  .btn-convert { padding: 10px 20px; font-size: 0.8rem; }
}

/* ───── Reduced Motion ───── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
