/* ================================================
   TaiVideo.ChinhAnh.vn - Premium Dark Video Downloader
   ================================================ */

/* --- Design Tokens --- */
:root {
  --bg-body: #06060a;
  --bg-section: #0a0a12;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --bg-glass: rgba(255, 255, 255, 0.06);
  --bg-input: rgba(255, 255, 255, 0.05);

  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  --border-focus: rgba(99, 102, 241, 0.5);

  --text: #f0f0f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;

  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.25);

  --cyan: #06b6d4;
  --cyan-glow: rgba(6, 182, 212, 0.2);

  --green: #22c55e;
  --green-glow: rgba(34, 197, 94, 0.15);

  --pink: #ec4899;
  --red: #ef4444;

  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #06b6d4 50%, #22c55e 100%);
  --gradient-hero: radial-gradient(ellipse at 30% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
                    radial-gradient(ellipse at 70% 0%, rgba(6, 182, 212, 0.1) 0%, transparent 50%);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 30px var(--accent-glow);
}

/* --- Reset --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: var(--font); }
img { max-width: 100%; display: block; }
svg { display: inline-block; vertical-align: middle; flex-shrink: 0; max-width: 100%; }

/* --- Container --- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* --- Gradient Text --- */
.gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Section Titles --- */
.section-title {
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}
.section-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 560px;
  margin: 0 auto 48px;
}

/* ================================================
   HEADER
   ================================================ */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(6, 6, 10, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  font-size: 1.25rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -0.02em;
}
.logo-icon {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 1.4rem;
}
.logo-accent { color: var(--cyan); }

/* Nav */
.nav {
  display: flex;
  gap: 4px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  border: 1px solid transparent;
}
.nav-link:hover {
  color: var(--text);
  background: var(--bg-glass);
}
.nav-link.active {
  color: var(--text);
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}
.nav-icon {
  width: 16px;
  height: 16px;
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.menu-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: var(--transition);
}

/* ================================================
   HERO
   ================================================ */
.hero {
  position: relative;
  padding: 140px 0 80px;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background: var(--gradient-hero);
  pointer-events: none;
}
.hero-bg::before {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  animation: pulseGlow 6s ease-in-out infinite alternate;
}
@keyframes pulseGlow {
  from { opacity: 0.6; transform: translateX(-50%) scale(1); }
  to { opacity: 1; transform: translateX(-50%) scale(1.2); }
}

.hero-content {
  position: relative;
  text-align: center;
}
.hero-badge {
  display: inline-block;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 20px;
  font-size: 0.8rem;
  color: var(--cyan);
  font-weight: 500;
  margin-bottom: 28px;
  animation: fadeInDown 0.6s ease-out;
}
.hero-title {
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.035em;
  margin-bottom: 20px;
  animation: fadeInDown 0.7s ease-out 0.1s both;
}
.hero-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 640px;
  margin: 0 auto 40px;
  line-height: 1.7;
  animation: fadeInDown 0.7s ease-out 0.2s both;
}

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

/* --- Download Box --- */
.download-box {
  max-width: 680px;
  margin: 0 auto;
  animation: fadeInDown 0.7s ease-out 0.3s both;
}
.platform-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  justify-content: center;
}
.platform-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background var(--transition);
}
.platform-dot.detected { background: var(--green); box-shadow: 0 0 8px var(--green-glow); }

.download-form {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon {
  position: absolute;
  left: 16px;
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  pointer-events: none;
}
.url-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 48px 16px 46px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--font);
  outline: none;
  transition: all var(--transition);
}
.url-input::placeholder { color: var(--text-muted); }
.url-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px var(--accent-glow);
  background: rgba(255, 255, 255, 0.06);
}
.paste-btn {
  position: absolute;
  right: 10px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  transition: all var(--transition);
}
.paste-btn svg { width: 16px; height: 16px; }
.paste-btn:hover { color: var(--text); border-color: var(--border-hover); }

.btn-download {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 16px 28px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: all var(--transition);
}
.btn-download:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}
.btn-download:active { transform: translateY(0); }
.btn-dl-icon { width: 20px; height: 20px; }

/* --- Loading State --- */
.loading-state {
  text-align: center;
  padding: 40px 0;
  max-width: 680px;
  margin: 0 auto;
}
.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* --- Result Card --- */
.result-card {
  max-width: 680px;
  margin: 24px auto 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  animation: slideUp 0.4s ease-out;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.result-header {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}
.result-thumb {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.result-thumb svg { width: 28px; height: 28px; fill: #fff; }
.result-info { flex: 1; min-width: 0; }
.result-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.result-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.result-meta span {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 500;
}
.result-platform {
  background: var(--accent-glow);
  color: var(--accent-hover);
}
.result-quality {
  background: var(--green-glow);
  color: var(--green);
}
.result-size {
  background: var(--bg-glass);
  color: var(--text-secondary);
}
.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btn-action {
  flex: 1;
  min-width: 140px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition);
}
.btn-action svg { width: 18px; height: 18px; }
.btn-action:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.btn-video { border-color: rgba(34, 197, 94, 0.3); color: var(--green); }
.btn-video:hover { background: var(--green-glow); border-color: var(--green); }
.btn-audio { border-color: rgba(236, 72, 153, 0.3); color: var(--pink); }
.btn-audio:hover { background: rgba(236, 72, 153, 0.1); border-color: var(--pink); }

/* --- Error State --- */
.error-state {
  text-align: center;
  padding: 30px 0;
  max-width: 680px;
  margin: 0 auto;
}
.error-text {
  color: var(--red);
  font-size: 0.95rem;
  margin-bottom: 16px;
}
.btn-try-again {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-try-again:hover { background: var(--bg-card-hover); }

.hidden { display: none !important; }

/* ================================================
   FEATURES
   ================================================ */
.features {
  padding: 100px 0;
  background: var(--bg-section);
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  transition: all var(--transition);
}
.feature-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
}
.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
}
.feature-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}
.feature-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ================================================
   PLATFORMS
   ================================================ */
.platforms {
  padding: 100px 0;
}
.platforms-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.platform-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.platform-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.1), transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
}
.platform-card:hover::before { opacity: 1; }
.platform-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
}
.platform-card-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.platform-card-icon svg { width: 28px; height: 28px; color: var(--accent-hover); }
.platform-card-icon.facebook { background: rgba(59, 89, 152, 0.2); }
.platform-card-icon.facebook svg { color: #4285f4; }
.platform-card-icon.douyin { background: rgba(254, 44, 85, 0.15); }
.platform-card-icon.douyin svg { color: #fe2c55; }
.platform-card-icon.sora { background: rgba(34, 197, 94, 0.15); }
.platform-card-icon.sora svg { color: var(--green); }
.platform-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.platform-card p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
}
.platform-badge {
  font-size: 0.7rem;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
}

/* ================================================
   HOW TO (3 STEPS)
   ================================================ */
.howto {
  padding: 100px 0;
  background: var(--bg-section);
}
.steps-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.step-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  text-align: center;
  flex: 1;
  max-width: 280px;
  position: relative;
  transition: all var(--transition);
}
.step-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-4px);
}
.step-number {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px var(--accent-glow);
}
.step-icon {
  font-size: 2.5rem;
  margin-bottom: 14px;
}
.step-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 10px;
}
.step-card p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.step-connector {
  color: var(--text-muted);
  flex-shrink: 0;
}
.step-connector svg { width: 40px; height: 24px; }

/* ================================================
   STATS
   ================================================ */
.stats {
  padding: 80px 0;
  background: linear-gradient(180deg, var(--bg-section) 0%, var(--bg-body) 100%);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.stat-item {
  text-align: center;
  padding: 24px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.stat-number {
  font-size: 2rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: block;
  margin-bottom: 4px;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ================================================
   FAQ
   ================================================ */
.faq {
  padding: 100px 0;
}
.faq-list {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
}
.faq-item.open { border-color: var(--border-hover); }
.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  gap: 16px;
  transition: color var(--transition);
}
.faq-question:hover { color: var(--accent-hover); }
.faq-chevron {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform var(--transition);
}
.faq-item.open .faq-chevron { transform: rotate(180deg); color: var(--accent); }
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
}
.faq-item.open .faq-answer {
  max-height: 300px;
}
.faq-answer p {
  padding: 0 20px 18px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ================================================
   FOOTER
   ================================================ */
.footer {
  padding: 60px 0 30px;
  border-top: 1px solid var(--border);
  background: var(--bg-section);
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border);
}
.footer-desc {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 14px;
  line-height: 1.7;
}
.footer-links h4 {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text);
}
.footer-links a {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 5px 0;
  transition: color var(--transition);
}
.footer-links a:hover { color: var(--accent-hover); }
.footer-bottom {
  padding-top: 24px;
  text-align: center;
}
.footer-bottom p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ================================================
   SCROLL ANIMATIONS
   ================================================ */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 900px) {
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .platforms-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .hero-title { font-size: 2.4rem; }
}

@media (max-width: 768px) {
  .nav { display: none; }
  .nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(6, 6, 10, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
    gap: 4px;
  }
  .menu-toggle { display: flex; }
  .steps-grid { flex-direction: column; }
  .step-connector { transform: rotate(90deg); }
  .download-form { flex-direction: column; }
  .btn-download { justify-content: center; }
}

@media (max-width: 520px) {
  .hero { padding: 110px 0 60px; }
  .hero-title { font-size: 1.9rem; }
  .hero-subtitle { font-size: 0.95rem; }
  .section-title { font-size: 1.5rem; }
  .features-grid { grid-template-columns: 1fr; }
  .platforms-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .result-header { flex-direction: column; align-items: flex-start; }
  .result-actions { flex-direction: column; }
  .btn-action { min-width: 100%; }
}
