/* ═══════════════════════════════════════════════════════════════════
   TikSnap UI — Stylesheet v2 (Optimized)
   Critical above-the-fold styles are inlined in index.html.
   This file contains the full stylesheet loaded non-blocking.
   ═══════════════════════════════════════════════════════════════════ */

/* ─── 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;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  color: #1a1a2e;
  background-color: #f8f9ff;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; font-family: inherit; }
ul { list-style: none; }

/* Accessibility */
.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;
}

/* Focus visible for keyboard navigation */
:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ─── Navbar ───────────────────────────────────────────────────── */
.navbar {
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 100;
  height: 60px;
}

.navbar .container {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 10px;
}

.navbar-brand {
  margin-right: auto;
}

.navbar-brand a {
  font-size: 1.5rem;
  font-weight: 800;
  color: #2563eb;
  letter-spacing: -0.5px;
}

.navbar-brand a span {
  color: #0f172a;
}

.navbar-end {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Language Switcher */
.lang-switcher {
  position: relative;
}

.lang-switcher-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  font-size: 0.875rem;
  font-weight: 500;
  color: #334155;
  transition: all 0.2s;
}

.lang-switcher-toggle:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.lang-switcher-toggle svg { transition: transform 0.2s; }
.lang-switcher.open .lang-switcher-toggle svg { transform: rotate(180deg); }

.lang-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  min-width: 320px;
  max-height: 420px;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 0.25rem;
}

.lang-switcher.open .lang-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-dropdown button[data-lang-switch] {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  color: #334155;
  transition: background 0.15s;
  border-radius: 6px;
  white-space: nowrap;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.lang-dropdown button[data-lang-switch]:hover { background: #f1f5f9; cursor: pointer; }
.lang-dropdown button[data-lang-switch].active { background: #eff6ff; color: #2563eb; font-weight: 600; }

/* Mobile Nav */
.navbar-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  gap: 5px;
  padding: 0;
}

.navbar-burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #334155;
  border-radius: 2px;
  transition: all 0.3s;
}

.navbar-burger.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.navbar-burger.is-active span:nth-child(2) { opacity: 0; }
.navbar-burger.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.navbar-menu {
  display: flex;
  align-items: center;
}

@media (max-width: 640px) {
  .navbar-burger { display: flex; }
  .navbar-menu {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    padding: 1rem;
    flex-direction: column;
    align-items: stretch;
  }
  .navbar-menu.is-active { display: flex; }
  .lang-dropdown { right: auto; left: 0; min-width: 100%; grid-template-columns: 1fr 1fr; max-height: 300px; }
}

/* ─── Hero Section ─────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 50%, #ede9fe 100%);
  padding: 3rem 0 3.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(99,102,241,0.08) 0%, transparent 70%);
  border-radius: 50%;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  color: #1e293b;
  line-height: 1.15;
  margin-bottom: 0.5rem;
  letter-spacing: -0.5px;
}

.hero-subtitle {
  font-size: 1.1rem;
  font-weight: 400;
  color: #475569;
  margin-bottom: 2rem;
}

/* ─── Download Form ────────────────────────────────────────────── */
.download-form {
  max-width: 680px;
  margin: 0 auto;
  position: relative;
}

.form-wrapper {
  background: #fff;
  border-radius: 16px;
  padding: 6px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.input-wrapper {
  flex: 1;
  position: relative;
}

.url-input {
  width: 100%;
  border: none;
  outline: none;
  padding: 14px 90px 14px 16px;
  font-size: 1rem;
  color: #1e293b;
  background: #f8fafc;
  border-radius: 12px;
  transition: background 0.2s;
}

.url-input:focus { background: #f1f5f9; }

.url-input::placeholder { color: #94a3b8; }

.paste-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: none;
  border-radius: 8px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s;
}

.paste-btn:hover { background: #dbeafe; }
.paste-btn.has-text { background: #fef2f2; color: #dc2626; }
.paste-btn.has-text:hover { background: #fee2e2; }

.submit-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  transition: all 0.3s;
  white-space: nowrap;
}

.submit-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(37,99,235,0.4); }
.submit-btn:active { transform: translateY(0); }
.submit-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }

.submit-btn svg { flex-shrink: 0; }

/* Error Box */
.error-box {
  margin-top: 0.75rem;
  padding: 0.65rem 1rem;
  background: #fef2f2;
  color: #b91c1c;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  display: none;
  text-align: left;
  border: 1px solid #fecaca;
}

.error-box.show { display: block; animation: slideDown 0.3s ease; }

/* Loader */
.loader {
  display: none;
  justify-content: center;
  margin-top: 1.5rem;
}

.loader.show { display: flex; }

.loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ─── Result Box ───────────────────────────────────────────────── */
.result-box {
  max-width: 680px;
  margin: 0 auto;
  display: none;
}

.result-box.show {
  display: block;
  animation: slideDown 0.4s ease;
}

.result-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  overflow: hidden;
  margin-top: 1.25rem;
}

.result-header {
  display: flex;
  gap: 1rem;
  padding: 1rem;
}

.result-cover {
  width: 100px;
  height: 130px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  background: #f1f5f9;
}

.result-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: #f1f5f9;
}

.result-info {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.result-author {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.result-author .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.author-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: #1e293b;
}

.result-desc {
  font-size: 0.8rem;
  color: #64748b;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.4;
}

.result-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: auto;
}

.stat {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0 1rem 1rem;
}

/* ─── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
}
.btn-primary:hover { box-shadow: 0 4px 16px rgba(37,99,235,0.3); transform: translateY(-1px); }

.btn-primary.btn-hd {
  background: linear-gradient(135deg, #059669, #10b981);
  position: relative;
}
.btn-primary.btn-hd::after {
  content: 'HD';
  font-size: 0.6rem;
  font-weight: 700;
  background: #fbbf24;
  color: #000;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
}
.btn-primary.btn-hd:hover { box-shadow: 0 4px 16px rgba(5,150,105,0.3); transform: translateY(-1px); }

.btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
}
.btn-secondary:hover { background: #e2e8f0; }

.btn-audio {
  background: #faf5ff;
  color: #7c3aed;
  border: 1px solid #e9d5ff;
}
.btn-audio:hover { background: #f3e8ff; }

/* ─── Image/Slideshow Gallery ──────────────────────────────────── */
.result-card-image .result-cover {
  border: 2px solid #e0e7ff;
}

.content-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.65rem;
  font-weight: 600;
  color: #7c3aed;
  background: #f3e8ff;
  padding: 2px 8px;
  border-radius: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.image-gallery-wrapper {
  padding: 0 1rem 0.5rem;
}

.image-gallery-header {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

.image-gallery-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #4f46e5;
}

.image-gallery-badge svg {
  color: #7c3aed;
}

.image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
  border-radius: 10px;
  background: #f8f9ff;
  border: 1px solid #e2e8f0;
}

.image-gallery-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 1;
  background: #e2e8f0;
}

.image-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s, opacity 0.2s;
}

.image-gallery-item:hover img {
  transform: scale(1.05);
  opacity: 0.85;
}

.btn-image-dl {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 6px;
  color: #2563eb;
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
  padding: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.image-gallery-item:hover .btn-image-dl {
  opacity: 1;
}

.btn-image-dl:hover {
  background: #2563eb;
  color: #fff;
}

.btn-download-all {
  width: 100%;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
}

.btn-download-all:hover {
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);
  transform: translateY(-1px);
}

.btn-download-all.downloading {
  opacity: 0.7;
  pointer-events: none;
}

/* Mobile: smaller gallery grid */
@media (max-width: 480px) {
  .image-gallery {
    grid-template-columns: repeat(3, 1fr);
    max-height: 260px;
  }
}

/* ─── Sections ─────────────────────────────────────────────────── */
.section {
  padding: 3rem 0;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 800;
  text-align: center;
  color: #1e293b;
  margin-bottom: 2rem;
  letter-spacing: -0.3px;
}

/* ─── How-To Steps ─────────────────────────────────────────────── */
.howto-section { background: #fff; }

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.step-card {
  text-align: center;
  padding: 1.5rem 1rem;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  transition: all 0.3s;
  position: relative;
}

.step-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.06); }

.step-card,
.feature-card,
.faq-item { contain: content; }

.step-icon { font-size: 2rem; margin-bottom: 0.5rem; }

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.step-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.4rem;
}

.step-desc {
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .steps-grid { grid-template-columns: 1fr; gap: 1rem; }
}

/* ─── Features ─────────────────────────────────────────────────── */
.features-section { background: #f8f9ff; }

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.feature-card {
  padding: 1.5rem;
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  transition: all 0.3s;
}

.feature-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.06); }

.feature-icon { font-size: 1.75rem; margin-bottom: 0.75rem; }

.feature-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.3rem;
}

.feature-desc {
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.5;
}

@media (max-width: 768px) {
  .features-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .features-grid { grid-template-columns: 1fr; }
}

/* ─── FAQ ──────────────────────────────────────────────────────── */
.faq-section { background: #fff; }

.faq-list {
  max-width: 720px;
  margin: 0 auto;
}

.faq-item {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 0.75rem;
  overflow: hidden;
  transition: all 0.2s;
}

.faq-item:hover { border-color: #cbd5e1; }
.faq-item.open { border-color: #93c5fd; box-shadow: 0 2px 8px rgba(37,99,235,0.08); }

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 1rem 1.25rem;
  border: none;
  background: none;
  text-align: left;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1e293b;
  gap: 1rem;
}

.faq-question:hover { color: #2563eb; }

.faq-arrow {
  flex-shrink: 0;
  transition: transform 0.3s;
  color: #94a3b8;
}

.faq-item.open .faq-arrow { transform: rotate(180deg); color: #2563eb; }

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.faq-item.open .faq-answer { max-height: 300px; }

.faq-answer p {
  padding: 0 1.25rem 1rem;
  font-size: 0.875rem;
  color: #64748b;
  line-height: 1.65;
}

/* ─── Footer ───────────────────────────────────────────────────── */
.footer {
  margin-top: auto;
  background: #0f172a;
  color: #94a3b8;
  padding: 2.5rem 0 1.5rem;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.footer-brand {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  margin-bottom: 0.5rem;
}

.footer-brand span { color: #60a5fa; }

.footer-desc {
  font-size: 0.85rem;
  max-width: 340px;
  line-height: 1.6;
}

.footer-links {
  display: flex;
  gap: 2rem;
}

.footer-links a {
  font-size: 0.85rem;
  color: #94a3b8;
  transition: color 0.2s;
}

.footer-links a:hover { color: #fff; }

.footer-bottom {
  border-top: 1px solid #1e293b;
  padding-top: 1rem;
  font-size: 0.8rem;
  text-align: center;
}

@media (max-width: 640px) {
  .footer-content { flex-direction: column; align-items: center; text-align: center; }
  .footer-desc { max-width: 100%; }
}

/* ─── Responsive Hero ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero { padding: 2rem 0 2.5rem; }
  .hero-title { font-size: 1.75rem; }
  .hero-subtitle { font-size: 0.95rem; }
  .form-wrapper { flex-direction: column; }
  .submit-btn { width: 100%; justify-content: center; }
  .section-title { font-size: 1.4rem; }
}

@media (max-width: 480px) {
  .hero-title { font-size: 1.5rem; }
  .url-input { padding: 12px 80px 12px 14px; font-size: 0.9rem; }
}

/* ─── Loading State on Form ────────────────────────────────────── */
.download-form.loading .form-wrapper { opacity: 0.6; pointer-events: none; }

/* ─── 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;
  }
}

/* ─── Print ────────────────────────────────────────────────────── */
@media print {
  .navbar, .download-form, .loader, .error-box, .lang-switcher { display: none !important; }
  .hero { background: none; padding: 1rem 0; }
  .footer { background: #fff; color: #000; }
}

/* ─── Nav Trending Button ──────────────────────────────────────── */
.nav-trending {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff !important;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 20px;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.nav-trending:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.nav-trending svg { flex-shrink: 0; }

@media (max-width: 640px) {
  .nav-trending { justify-content: center; }
}

/* ─── Trending Page ────────────────────────────────────────────── */

/* Hero */
.trending-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #0f0f1a 0%, #1a1025 40%, #2d1040 70%, #0f0f1a 100%);
  padding: 3.5rem 0 3rem;
  text-align: center;
  color: #fff;
}

.trending-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(239,68,68,.15) 0%, transparent 50%),
              radial-gradient(circle at 70% 30%, rgba(168,85,247,.12) 0%, transparent 50%),
              radial-gradient(circle at 50% 80%, rgba(59,130,246,.1) 0%, transparent 50%);
  animation: heroGlow 8s ease-in-out infinite alternate;
}

@keyframes heroGlow {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-2%, -1%) scale(1.05); }
}

.trending-hero .container {
  position: relative;
  z-index: 1;
}

.trending-hero-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 2.4rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.6rem;
  letter-spacing: -0.5px;
}

.trending-hero-title svg {
  color: #ef4444;
  filter: drop-shadow(0 0 8px rgba(239,68,68,.5));
  animation: heroFlash 2s ease-in-out infinite;
}

@keyframes heroFlash {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .7; transform: scale(1.1); }
}

.trending-hero-subtitle {
  font-size: 1.05rem;
  color: rgba(255,255,255,.6);
  margin-bottom: 1.25rem;
  font-weight: 400;
}

.trending-region {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: rgba(255,255,255,.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255,255,255,.85);
}

.trending-region-flag { font-size: 1.2rem; }

/* Tabs */
.trending-section {
  padding: 0 0 3rem;
  background: #f8f9ff;
}

.trending-tabs-wrap {
  position: sticky;
  top: 60px;
  z-index: 50;
  background: rgba(248,249,255,.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 1rem 0;
  border-bottom: 1px solid rgba(0,0,0,.04);
}

.trending-tabs {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.trending-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 24px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #64748b;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(.4,0,.2,1);
  position: relative;
  overflow: hidden;
}

.trending-tab::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  background: linear-gradient(135deg, #ef4444, #a855f7);
  transition: opacity 0.25s;
  z-index: -1;
}

.trending-tab:hover {
  color: #ef4444;
  border-color: #fca5a5;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239,68,68,.1);
}

.trending-tab.active {
  color: #fff;
  background: transparent;
  border-color: transparent;
  box-shadow: 0 4px 20px rgba(239,68,68,.3);
}

.trending-tab.active::after { opacity: 1; }
.trending-tab.active svg { stroke: #fff; }

.trending-tab .tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 700;
  background: #f1f5f9;
  color: #64748b;
}

.trending-tab.active .tab-count {
  background: rgba(255,255,255,.25);
  color: #fff;
}

/* Panels */
.trending-panels-area {
  padding-top: 1.5rem;
}

.trending-panel {
  display: none;
}

.trending-panel.active {
  display: block;
}

/* Grid */
.trending-grid {
  display: grid;
  gap: 16px;
}

.trending-users-grid {
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

.trending-hashtags-grid {
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

.trending-music-grid {
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

/* ── Card Base ── */
.trending-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: #fff;
  border: 1px solid #e8ecf2;
  border-radius: 16px;
  transition: all 0.3s cubic-bezier(.4,0,.2,1);
  text-decoration: none;
  color: inherit;
  position: relative;
  opacity: 0;
  transform: translateY(12px);
  animation: cardEntrance 0.4s cubic-bezier(.4,0,.2,1) forwards;
}

@keyframes cardEntrance {
  to { opacity: 1; transform: translateY(0); }
}

.trending-card:hover {
  border-color: transparent;
  box-shadow: 0 8px 30px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.04);
  transform: translateY(-3px);
}

/* ── Rank Badge ── */
.trending-rank {
  position: absolute;
  top: -6px;
  left: -6px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 800;
  color: #64748b;
  background: #f1f5f9;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
  z-index: 2;
}

.trending-card:nth-child(1) .trending-rank {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #fff;
  width: 34px; height: 34px;
  font-size: 0.8rem;
  box-shadow: 0 3px 10px rgba(251,191,36,.4);
}

.trending-card:nth-child(2) .trending-rank {
  background: linear-gradient(135deg, #cbd5e1, #94a3b8);
  color: #fff;
  box-shadow: 0 3px 10px rgba(148,163,184,.3);
}

.trending-card:nth-child(3) .trending-rank {
  background: linear-gradient(135deg, #f59e0b, #b45309);
  color: #fff;
  box-shadow: 0 3px 10px rgba(245,158,11,.3);
}

/* ── User Avatar ── */
.trending-user-avatar {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  border: 2.5px solid #fff;
  outline: 2px solid #e2e8f0;
  transition: all 0.3s;
}

.trending-card:hover .trending-user-avatar {
  outline-color: #ef4444;
  box-shadow: 0 4px 14px rgba(239,68,68,.15);
}

.trending-card:nth-child(1) .trending-user-avatar { outline-color: #fbbf24; }
.trending-card:nth-child(2) .trending-user-avatar { outline-color: #94a3b8; }
.trending-card:nth-child(3) .trending-user-avatar { outline-color: #f59e0b; }

/* ── Hashtag Icon ── */
.trending-hashtag-icon {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(135deg, #fef2f2, #fce7f3);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
  transition: all 0.3s;
}

.trending-card:hover .trending-hashtag-icon {
  transform: scale(1.05);
}

/* ── Music Cover ── */
.trending-music-cover {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  transition: all 0.3s;
}

.trending-music-card:hover .trending-music-cover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
}

/* ── Shared image rules ── */
.trending-user-avatar img,
.trending-hashtag-icon img,
.trending-music-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.trending-card:hover .trending-user-avatar img,
.trending-card:hover .trending-hashtag-icon img,
.trending-card:hover .trending-music-cover img {
  transform: scale(1.08);
}

.avatar-placeholder,
.hashtag-placeholder,
.music-placeholder {
  font-size: 1.6rem;
  color: #94a3b8;
}

.hashtag-placeholder {
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ef4444, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.music-placeholder {
  font-size: 1.4rem;
}

/* ── Card Info ── */
.trending-card-info {
  flex: 1;
  min-width: 0;
}

.trending-card-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
  line-height: 1.3;
}

.trending-card:hover .trending-card-title {
  color: #ef4444;
}

.verified-badge {
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(37,99,235,.2));
}

.trending-card-subtitle {
  font-size: 0.8rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.trending-card-bio {
  font-size: 0.75rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
  line-height: 1.3;
}

.trending-card-stats {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.trending-card-stats span {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 8px;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
}

/* ── Play Button ── */
.trending-play-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(.4,0,.2,1);
  z-index: 2;
  position: relative;
  box-shadow: 0 3px 10px rgba(239,68,68,.25);
}

.trending-play-btn:hover {
  transform: scale(1.15);
  box-shadow: 0 6px 20px rgba(239,68,68,.35);
}

.trending-play-btn.is-playing {
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  box-shadow: 0 3px 10px rgba(168,85,247,.3);
  animation: playPulse 1.5s ease-in-out infinite;
}

@keyframes playPulse {
  0%, 100% { box-shadow: 0 3px 10px rgba(168,85,247,.3); }
  50% { box-shadow: 0 3px 20px rgba(168,85,247,.5); }
}

/* ── Skeleton Loader ── */
.trending-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 3rem 0;
  color: #64748b;
  font-size: 0.9rem;
}

.trending-loader[hidden] { display: none; }

.trending-loader-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid #fecaca;
  border-top-color: #ef4444;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.trending-skeletons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  width: 100%;
}

.trending-skeleton {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: #fff;
  border: 1px solid #e8ecf2;
  border-radius: 16px;
}

.skel-avatar {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(90deg, #f1f5f9 25%, #e8ecf2 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skel-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skel-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #f1f5f9 25%, #e8ecf2 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skel-line:nth-child(1) { width: 60%; height: 14px; }
.skel-line:nth-child(2) { width: 40%; }
.skel-line:nth-child(3) { width: 80%; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Error ── */
.trending-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem 0;
  text-align: center;
  color: #64748b;
}

.trending-error[hidden] { display: none; }

.trending-retry-btn {
  padding: 12px 28px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  border: none;
  border-radius: 100px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 4px 14px rgba(239,68,68,.2);
}

.trending-retry-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239,68,68,.35);
}

/* ── Empty State ── */
.trending-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 0;
  color: #94a3b8;
  font-size: 0.9rem;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .trending-hero { padding: 2.5rem 0 2rem; }
  .trending-hero-title { font-size: 1.7rem; gap: 8px; }
  .trending-hero-title svg { width: 22px; height: 22px; }
  .trending-hero-subtitle { font-size: 0.95rem; }
  .trending-users-grid,
  .trending-hashtags-grid,
  .trending-music-grid { grid-template-columns: 1fr; }
  .trending-tab { padding: 8px 18px; font-size: 0.85rem; }
  .trending-skeletons { grid-template-columns: 1fr; }
  .trending-user-avatar { width: 48px; height: 48px; }
  .trending-hashtag-icon { width: 52px; height: 52px; }
  .trending-music-cover { width: 48px; height: 48px; }
}

@media (max-width: 480px) {
  .trending-hero-title { font-size: 1.4rem; }
  .trending-card { padding: 12px; gap: 10px; }
  .trending-card-stats { gap: 4px; }
  .trending-card-stats span { padding: 1px 6px; font-size: 0.65rem; }
}

/* ─── RTL Support (Arabic) ─────────────────────────────────────── */
html[dir="rtl"] {
  direction: rtl;
}
html[dir="rtl"] .navbar .container,
html[dir="rtl"] .footer-content {
  flex-direction: row-reverse;
}
html[dir="rtl"] .form-wrapper {
  flex-direction: row-reverse;
}
html[dir="rtl"] .url-input {
  text-align: right;
  padding: 14px 16px 14px 90px;
}
html[dir="rtl"] .paste-btn {
  right: auto;
  left: 6px;
}
html[dir="rtl"] .result-header {
  flex-direction: row-reverse;
}
html[dir="rtl"] .result-author {
  flex-direction: row-reverse;
}
html[dir="rtl"] .result-desc,
html[dir="rtl"] .step-desc,
html[dir="rtl"] .feature-desc,
html[dir="rtl"] .faq-answer p {
  text-align: right;
}
html[dir="rtl"] .step-card,
html[dir="rtl"] .feature-card {
  text-align: right;
}
html[dir="rtl"] .faq-question {
  flex-direction: row-reverse;
}
html[dir="rtl"] .footer-links {
  flex-direction: row-reverse;
}
@media (max-width: 768px) {
  html[dir="rtl"] .form-wrapper {
    flex-direction: column-reverse;
  }
}
