/* ============================================
   视频无水印下载 - 现代化界面样式
   ============================================ */

/* --- CSS Variables --- */
:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #e0e7ff;
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

  --bg-primary: #f8fafc;
  --bg-card: #ffffff;
  --bg-input: #f1f5f9;

  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  --border: #e2e8f0;
  --border-focus: #6366f1;

  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 32px 80px rgba(0, 0, 0, 0.16);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

/* --- Hero Section --- */
.hero {
  text-align: center;
  padding: 48px 16px 32px;
}

.hero-icon {
  font-size: 56px;
  margin-bottom: 8px;
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.hero h1 {
  font-size: 2.2rem;
  font-weight: 800;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.hero-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  font-weight: 400;
}

/* --- Input Section --- */
.input-section {
  margin-bottom: 20px;
}

.input-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 6px;
  transition: box-shadow 0.3s ease;
}

.input-card:focus-within {
  box-shadow: var(--shadow-lg), 0 0 0 3px var(--primary-light);
}

.input-wrapper {
  position: relative;
}

.url-input {
  width: 100%;
  padding: 16px 52px 16px 20px;
  font-size: 0.95rem;
  font-family: var(--font-sans);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
  resize: vertical;
  min-height: 56px;
  max-height: 160px;
  transition: all 0.2s ease;
  outline: none;
}

.url-input:focus {
  border-color: var(--border-focus);
  background: white;
}

.url-input::placeholder {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.btn-clear {
  position: absolute;
  top: 22px;
  right: 16px;
  background: var(--border);
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  opacity: 0;
  pointer-events: none;
}

.btn-clear.visible {
  opacity: 1;
  pointer-events: auto;
}

.btn-clear:hover {
  background: var(--text-secondary);
  color: white;
}

.input-actions {
  display: flex;
  gap: 10px;
  padding: 0 8px 12px;
}

.btn-paste, .btn-parse {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.btn-paste {
  flex: 0 0 auto;
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}

.btn-paste:hover {
  background: var(--border);
  color: var(--text-primary);
}

.btn-parse {
  flex: 1;
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-parse:hover {
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
  transform: translateY(-1px);
}

.btn-parse:active {
  transform: translateY(0);
}

.btn-parse:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-icon {
  font-size: 1rem;
}

/* --- Platform Badges --- */
.platform-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  padding: 0 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: default;
  transition: all 0.2s;
}

.badge:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.badge::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-left: 2px;
}

.badge-douyin::after  { background: #010101; }
.badge-kuaishou::after { background: #FF4906; }
.badge-bilibili::after { background: #FB7299; }
.badge-xiaohongshu::after { background: #FF2442; }
.badge-weibo::after { background: #E6162D; }
.badge-xigua::after { background: #F04135; }
.badge-youtube::after { background: #FF0000; }

/* --- Loading Section --- */
.loading-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  gap: 20px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#loading-text {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* --- Error Section --- */
.error-section {
  padding: 20px 0;
}

.error-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  box-shadow: var(--shadow-md);
  border: 1px solid #fecaca;
}

.error-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.error-card h3 {
  color: var(--error);
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.error-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 20px;
}

.btn-retry {
  padding: 10px 28px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-sans);
}

.btn-retry:hover {
  background: var(--bg-input);
  border-color: var(--text-muted);
}

/* --- Result Section --- */
.result-section {
  padding: 20px 0;
}

.result-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.btn-result-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  background: rgba(0,0,0,0.4);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-result-close:hover {
  background: rgba(0,0,0,0.7);
  transform: scale(1.1);
}

/* Thumbnail */
.video-thumbnail-wrapper {
  position: relative;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  max-height: 400px;
  overflow: hidden;
}

.video-thumbnail {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  display: block;
}

.duration-badge {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0,0,0,0.75);
  color: white;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 500;
}

.platform-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(99, 102, 241, 0.9);
  color: white;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* Video Info */
.video-info {
  padding: 20px 24px;
}

.video-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.author-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.author-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-input);
}

.author-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.author-uid {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.video-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.meta-item {
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding: 4px 10px;
  background: var(--bg-input);
  border-radius: 16px;
  white-space: nowrap;
}

/* Download Button */
.btn-download {
  width: 100%;
  padding: 14px 24px;
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font-sans);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
  transition: all 0.3s ease;
}

.btn-download:hover {
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.5);
  transform: translateY(-2px);
}

.btn-download:active {
  transform: translateY(0);
}

.btn-download:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Download Progress */
.download-progress {
  margin-top: 16px;
  padding: 12px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
}

.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* Stats Row */
.stats-row {
  display: flex;
  gap: 16px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.stat-item {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* Music Info (Douyin) */
.music-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
}

.music-icon {
  font-size: 1.1rem;
}

.music-title {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-download-audio {
  padding: 5px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font-sans);
  transition: all 0.2s;
}

.btn-download-audio:hover {
  background: var(--border);
}

/* --- Features Section --- */
.features-section {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 40px 0;
}

.feature-item {
  text-align: center;
  padding: 20px 12px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s;
}

.feature-item:hover {
  transform: translateY(-2px);
}

.feature-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.feature-item h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.feature-item p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* --- Footer --- */
.footer {
  margin-top: 40px;
  text-align: center;
  padding: 0 16px;
}

.footer-disclaimer {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 600px;
  margin: 0 auto 12px;
}

.footer-credit {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* --- Utility --- */
.hidden {
  display: none !important;
}

/* --- Animations --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-section,
.error-section {
  animation: fadeInUp 0.4s ease;
}

.input-card {
  animation: slideDown 0.4s ease;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .hero {
    padding: 32px 8px 24px;
  }

  .hero-icon {
    font-size: 44px;
  }

  .hero h1 {
    font-size: 1.7rem;
  }

  .hero-subtitle {
    font-size: 0.95rem;
  }

  .features-section {
    grid-template-columns: repeat(2, 1fr);
  }

  .video-info {
    padding: 16px;
  }

  .btn-download {
    padding: 12px 20px;
    font-size: 0.95rem;
  }

  .platform-badges {
    gap: 6px;
  }

  .badge {
    font-size: 0.75rem;
    padding: 4px 10px;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.5rem;
  }

  .features-section {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .feature-item {
    padding: 14px 8px;
  }

  .input-actions {
    padding: 0 4px 8px;
  }

  .btn-paste, .btn-parse {
    padding: 8px 14px;
    font-size: 0.82rem;
  }
}
