/* ================================================================
   TikTok Downloader — design system
   ================================================================ */

:root {
  --bg: #0b0b12;
  --bg-soft: #12121c;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-strong: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.1);
  --text: #f2f3f8;
  --text-dim: #9a9db1;
  --cyan: #25f4ee;
  --magenta: #fe2c55;
  --violet: #7b5cff;
  --gradient: linear-gradient(120deg, var(--cyan), var(--magenta));
  --radius: 18px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  color-scheme: dark;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- ambient background ---------- */

.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(130px);
  opacity: 0.28;
  pointer-events: none;
  z-index: 0;
}

.bg-glow--cyan {
  width: 520px;
  height: 520px;
  top: -180px;
  left: -140px;
  background: radial-gradient(circle, var(--cyan), transparent 65%);
  animation: drift 16s ease-in-out infinite alternate;
}

.bg-glow--magenta {
  width: 560px;
  height: 560px;
  bottom: -220px;
  right: -160px;
  background: radial-gradient(circle, var(--magenta), transparent 65%);
  animation: drift 20s ease-in-out infinite alternate-reverse;
}

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(60px, 40px) scale(1.15); }
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black, transparent 75%);
  pointer-events: none;
  z-index: 0;
}

/* ---------- layout ---------- */

.shell {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 72px 20px 48px;
}

.hero {
  text-align: center;
  margin-bottom: 40px;
  animation: rise 0.7s ease both;
}

.logo-badge {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  font-weight: 800;
  font-size: 24px;
  letter-spacing: 1px;
  color: #0b0b12;
  background: var(--gradient);
  box-shadow: 0 12px 32px rgba(254, 44, 85, 0.35);
  animation: pulse 3.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 12px 32px rgba(254, 44, 85, 0.35); }
  50%      { transform: scale(1.06); box-shadow: 0 16px 44px rgba(37, 244, 238, 0.35); }
}

.hero-title {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-subtitle {
  margin-top: 12px;
  color: var(--text-dim);
  font-size: 1.05rem;
}

/* ---------- badges ---------- */

.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: rise 0.6s ease both;
}

.badge:nth-child(1) { animation-delay: 0.15s; }
.badge:nth-child(2) { animation-delay: 0.25s; }
.badge:nth-child(3) { animation-delay: 0.35s; }

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: blink 1.6s ease-in-out infinite;
}

.badge--free .badge-dot {
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}

.badge--unlimited .badge-dot {
  background: var(--magenta);
  box-shadow: 0 0 10px var(--magenta);
}

.badge--hd .badge-dot {
  background: var(--violet);
  box-shadow: 0 0 10px var(--violet);
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

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

/* ---------- card / glass ---------- */

.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.card {
  padding: 28px;
  animation: rise 0.7s 0.12s ease both;
}

/* ---------- form ---------- */

.form {
  display: flex;
  gap: 12px;
}

.url-input {
  flex: 1;
  min-width: 0;
  padding: 15px 18px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.url-input::placeholder {
  color: #6b6e82;
}

.url-input:focus {
  border-color: rgba(37, 244, 238, 0.6);
  box-shadow: 0 0 0 4px rgba(37, 244, 238, 0.12);
  background: rgba(255, 255, 255, 0.07);
}

.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px 26px;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  color: #0b0b12;
  background: var(--gradient);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow: 0 12px 28px rgba(254, 44, 85, 0.35);
}

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

.btn-primary:disabled {
  opacity: 0.75;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  padding: 13px 22px;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn-ghost:hover {
  background: var(--surface-strong);
  border-color: rgba(255, 255, 255, 0.22);
}

/* spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(11, 11, 18, 0.35);
  border-top-color: #0b0b12;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ---------- status ---------- */

.status-msg {
  margin-top: 14px;
  min-height: 1.4em;
  font-size: 0.9rem;
  color: var(--text-dim);
  text-align: center;
}

.status-msg.error {
  color: #ff7a90;
}

/* ---------- progress bar ---------- */

.progress {
  margin-top: 18px;
}

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--gradient);
  background-size: 200% 100%;
  animation: gradient-shift 1.6s linear infinite;
  transition: width 0.5s ease;
}

@keyframes gradient-shift {
  from { background-position: 0% 0; }
  to   { background-position: 200% 0; }
}

/* ---------- result ---------- */

.result {
  margin-top: 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  animation: rise 0.45s ease both;
}

[hidden] {
  display: none !important;
}

/* ---------- placeholder (default, sebelum pengecekan) ---------- */

.result-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 34px 20px;
  text-align: center;
}

.ph-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(37, 244, 238, 0.08);
  border: 1px dashed rgba(37, 244, 238, 0.35);
  animation: ph-bob 2.6s ease-in-out infinite;
}

.ph-svg {
  width: 30px;
  height: 30px;
  color: var(--cyan);
  animation: ph-pulse 2.6s ease-in-out infinite;
}

@keyframes ph-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}

@keyframes ph-pulse {
  0%, 100% { opacity: 0.55; transform: scale(0.94); }
  50%      { opacity: 1;    transform: scale(1.06); }
}

.ph-text {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin: 0;
}

.ph-text strong {
  color: var(--text);
}

.ph-steps {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.ph-step {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.ph-step b {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  font-size: 0.65rem;
  color: #0b0b12;
  background: var(--gradient);
}

/* ---------- konten hasil (setelah pengecekan) ---------- */

.result-content {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 20px;
  align-items: center;
  padding: 18px;
}

.result-media {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  aspect-ratio: 9 / 16;
  background: var(--surface-strong);
}

.result-cover {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.result-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

/* muncul dengan fade-in setelah video terdeteksi */
.result-content .result-cover,
.result-content .result-title,
.result-content .result-author,
.result-content .result-actions {
  animation: rise 0.5s ease both;
}

.result-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-author {
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 0.88rem;
}

.result-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn-download {
  text-decoration: none;
}

.icon-down {
  width: 14px;
  height: 14px;
  border-left: 2.5px solid #0b0b12;
  border-bottom: 2.5px solid #0b0b12;
  transform: rotate(-45deg) translateY(-2px);
}

/* ---------- howto ---------- */

.howto {
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.howto-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.howto-list {
  padding-left: 20px;
  display: grid;
  gap: 8px;
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.6;
}

.howto-list strong,
.howto-list em {
  color: var(--text);
  font-style: normal;
}

/* ---------- footer ---------- */

.footer {
  margin-top: 40px;
  text-align: center;
  color: #5c5f73;
  font-size: 0.8rem;
}

/* ---------- stats ---------- */

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  max-width: 680px;
  margin: 0 auto 28px;
  padding: 18px 22px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.stats-item--countries {
  text-align: left;
}

.stats-list {
  list-style: none;
  display: grid;
  gap: 4px;
  padding: 0;
  margin: 0;
  max-height: 110px;
  overflow-y: auto;
}

.stats-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.76rem;
  color: var(--text-dim);
}

.stats-list .count {
  font-weight: 700;
  color: var(--text);
}

.stats-empty {
  font-size: 0.75rem;
  color: #5c5f73;
  font-style: italic;
}

/* ---------- modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(11, 11, 18, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fadeIn 0.25s ease;
}

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

.modal-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 28px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--text);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 6px;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.modal-sub {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.modal-social-list {
  display: grid;
  gap: 12px;
}

.modal-social-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-radius: 14px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  transition: transform 0.18s, border-color 0.2s, background 0.2s;
}

.modal-social-item:hover {
  transform: translateY(-2px);
  border-color: rgba(37, 244, 238, 0.5);
  background: rgba(255, 255, 255, 0.08);
}

.modal-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.modal-ig { color: var(--magenta); }
.modal-fb { color: var(--cyan); }
.modal-lt { color: var(--violet); }

.stats-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6b6e82;
  margin-bottom: 6px;
}

.stats-value {
  font-size: 1.9rem;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
}

/* ---------- socials ---------- */

.socials {
  margin-bottom: 24px;
}

.socials-title {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6b6e82;
  margin-bottom: 14px;
}

.socials-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.18s, border-color 0.2s, box-shadow 0.2s;
}

.social-link:hover {
  transform: translateY(-2px);
  border-color: rgba(37, 244, 238, 0.5);
  box-shadow: 0 8px 22px rgba(37, 244, 238, 0.18);
}

.social-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.footer-note {
  margin-top: 8px;
}

/* ---------- responsive ---------- */

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

  .result-content {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .result-media {
    width: 130px;
  }
}



.footer-link {
  color: var(--text-dim);
  font-weight: 600;
  text-decoration: none;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transition: filter 0.2s;
}

.footer-link:hover {
  filter: brightness(1.3);
}

.footer-heart {
  color: var(--magenta);
  animation: heartbeat 1.4s ease-in-out infinite;
  display: inline-block;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.25); }
  45% { transform: scale(1); }
}

.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;
}

/* ---------- responsive ---------- */

@media (max-width: 560px) {
  .shell { padding-top: 44px; }
  .card { padding: 20px; }
  .form { flex-direction: column; }
  .btn-primary { width: 100%; }
  .result { grid-template-columns: 1fr; }
  .result-media { max-width: 150px; }
}
