/* ========== 全局变量 ========== */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f9fa;
  --border: #e9ecef;
  --border-focus: #6366f1;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.15);
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --text-muted: #adb5bd;
  --success: #28a745;
  --error: #dc3545;
  --warning: #ffc107;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.2s ease;
  --navbar-height: 60px;
}

/* ========== 暗色主题 ========== */
[data-theme="dark"] {
  --bg-primary: #1a1b1e;
  --bg-secondary: #141517;
  --bg-card: #212225;
  --bg-card-hover: #2a2b30;
  --border: #333538;
  --border-focus: #818cf8;
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-glow: rgba(129, 140, 248, 0.2);
  --text-primary: #e4e6eb;
  --text-secondary: #a8aab3;
  --text-muted: #6b6e78;
  --success: #3fb950;
  --error: #f85149;
  --warning: #f0b429;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* ========== Reset ========== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  padding-top: var(--navbar-height);
}

/* ========== 导航栏 ========== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-height);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 1000;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  justify-content: space-between;
  height: 100%;
}

.nav-brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.nav-home,
.nav-download {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
  padding: 6px 12px;
  border-radius: 6px;
}

.nav-home:hover,
.nav-download:hover {
  color: var(--accent);
  background: var(--accent-glow);
}

.nav-download {
  background: var(--accent);
  color: white;
  font-weight: 600;
}

.nav-download:hover {
  background: var(--accent-hover);
  color: white;
}

.nav-download.disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

/* ========== 主题切换按钮 ========== */
.theme-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px;
  margin-left: 16px;
}

.theme-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  padding: 6px 8px;
  border-radius: 16px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.theme-btn:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.theme-btn.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* 导航栏右侧容器 */
.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ========== 布局 ========== */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ========== 头部 ========== */
.header {
  text-align: center;
  padding: 60px 0 24px;
}

.header .logo {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.header .logo-icon {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
}

.header .subtitle {
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 400;
}

/* ========== 标语 ========== */
.tagline {
  text-align: center;
  padding: 24px 0 32px;
}

.tagline h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.tagline p {
  color: var(--text-secondary);
  font-size: 15px;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.8;
}

/* ========== 上传和操作区域行 ========== */
.upload-action-row {
  display: flex;
  gap: 5%;
  margin-bottom: 28px;
  align-items: stretch;
}

/* ========== 拖拽区域 ========== */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-card);
  position: relative;
  box-shadow: var(--shadow);
  flex: 0 0 80%;
}

.drop-zone:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
}

.drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
  transform: scale(1.01);
}

.drop-zone .drop-icon {
  font-size: 40px;
  margin-bottom: 12px;
  display: block;
  opacity: 0.9;
}

.drop-zone h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.drop-zone p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 12px;
}

.drop-zone .drop-hint {
  font-size: 13px;
  color: var(--text-muted);
}

.drop-zone input[type="file"] {
  display: none;
}

/* ========== 操作栏 ========== */
.action-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 0 0 15%;
  justify-content: center;
}

.download-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.download-buttons .btn {
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 12px var(--accent-glow);
  flex: 1;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--accent-glow);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary.btn-stop {
  background: var(--error);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-hover);
}

.hidden {
  display: none !important;
}

/* ========== 进度条 ========== */
.progress-area {
  margin-bottom: 28px;
}

.progress-bar-bg {
  height: 8px;
  background: var(--bg-card);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: 4px;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
}

/* ========== 文件列表 ========== */
.file-list-section {
  margin-bottom: 40px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.file-count {
  background: var(--accent);
  color: white;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 12px;
  min-width: 28px;
  text-align: center;
}

.file-list {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
  white-space: nowrap;
}

.file-item:last-child {
  border-bottom: none;
}

.file-item-header {
  background: var(--bg-secondary);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  white-space: nowrap;
}

.file-item:not(.file-item-header):hover {
  background: var(--bg-card-hover);
}

.file-name {
  font-size: 15px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.file-size {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: right;
  flex-shrink: 0;
  width: 80px;
}

.file-status {
  font-size: 18px;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.status-done { color: var(--success); }
.status-error { color: var(--error); }
.status-converting { color: var(--warning); }

.file-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  width: 70px;
  justify-content: center;
}

.file-item-header .file-actions {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: var(--transition);
  line-height: 1;
  flex-shrink: 0;
}

.btn-icon:hover {
  color: var(--error);
  background: rgba(220, 53, 69, 0.1);
}

.btn-download {
  font-size: 16px;
  color: var(--accent);
}

.btn-download:hover {
  color: #198ae2;
  background: rgba(30, 150, 252, 0.1);
}

.btn-download:disabled {
  color: var(--text-muted);
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-download:disabled:hover {
  background: none;
}

/* ========== 空状态 ========== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
  opacity: 0.6;
}

.empty-state p {
  font-size: 15px;
}

/* ========== 页脚 ========== */
.footer {
  text-align: center;
  padding: 32px 0 40px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.footer p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.footer-links {
  margin-top: 12px;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.footer a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  top: 28px;
  right: 28px;
  background: var(--bg-card);
  border: 1px solid var(--error);
  border-radius: var(--radius-sm);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 1000;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  transform: translateX(120%);
  transition: transform 0.3s ease;
}

.toast.show {
  transform: translateX(0);
}

.toast .toast-icon {
  font-size: 22px;
  color: var(--error);
}

.toast .toast-content {
  font-size: 15px;
  color: var(--text-primary);
}

.toast .toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  margin-left: 12px;
  border-radius: 4px;
  transition: var(--transition);
}

.toast .toast-close:hover {
  background: var(--bg-secondary);
}

/* ========== Spinner ========== */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========== 响应式 ========== */
@media (max-width: 640px) {
  .app {
    padding: 0 16px;
  }

  .navbar {
    height: 50px;
  }

  body {
    padding-top: 50px;
  }

  .nav-container {
    padding: 0 16px;
  }

  .nav-brand {
    font-size: 16px;
    font-weight: 700;
  }

  .nav-home {
    font-size: 13px;
  }

  .header {
    padding: 32px 0 12px;
  }

  .header .logo {
    font-size: 26px;
  }

  .tagline h2 {
    font-size: 20px;
  }

  .action-bar {
    flex-direction: column;
  }

  .drop-zone {
    padding: 24px 16px;
  }

  .file-item {
    gap: 8px;
    padding: 12px;
  }

  .file-size {
    display: none;
  }

  .footer {
    padding: 24px 0 32px;
  }
}

/* ========== 打赏按钮 ========== */
.donate-section {
  text-align: center;
  margin: 20px 0 40px;
}

.btn-donate {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
  color: white;
  border: none;
  padding: 12px 32px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(238, 90, 36, 0.3);
}

.btn-donate:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(238, 90, 36, 0.4);
}

.btn-donate:active {
  transform: translateY(0);
}

/* ========== 打赏模态框 ========== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
 background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 40px 30px 30px;
 max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.modal-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.donate-qr {
  margin: 20px 0;
}

.donate-qr img {
  width: 200px;
  height: 200px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  object-fit: cover;
}

.donate-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-top: 20px;
  padding: 0 10px;
}
