:root {
  --bg:      #080810;
  --bg2:     #0f0f1a;
  --bg3:     #17172a;
  --card:    #111120;
  --border:  #252538;
  --text:    #eeeef8;
  --muted:   #6b6b90;
  --accent:  #7c5cfc;
  --accent2: #d946ef;
  --accent3: #00e5bd;
  --red:     #f43f5e;
  --yellow:  #fbbf24;
  --shadow:  0 12px 40px rgba(0,0,0,0.6);
  --glow:    0 0 60px rgba(124,92,252,0.12);
  --radius:  18px;
  --radius-sm: 11px;
}

[data-theme="light"] {
  --bg:     #f0f0fa;
  --bg2:    #e4e4f5;
  --bg3:    #d8d8ee;
  --card:   #ffffff;
  --border: #cacae0;
  --text:   #0e0e22;
  --muted:  #6060a0;
  --shadow: 0 12px 40px rgba(0,0,0,0.08);
  --glow:   0 0 60px rgba(124,92,252,0.07);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background .25s, color .25s;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 45% at 15% 0%, rgba(124,92,252,0.10) 0%, transparent 55%),
    radial-gradient(ellipse 55% 40% at 85% 90%, rgba(217,70,239,0.07) 0%, transparent 55%);
  pointer-events: none;
  z-index: 0;
}

/* ── NAV ── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 58px;
  background: rgba(8,8,16,0.82);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

[data-theme="light"] nav {
  background: rgba(240,240,250,0.82);
}

.nav-logo {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-logo span {
  -webkit-text-fill-color: var(--accent3);
  color: var(--accent3);
}

.theme-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 50px;
  padding: 6px 14px;
  font-size: .82rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}

.theme-btn svg { flex-shrink: 0; }
.theme-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.theme-btn:hover svg { stroke: #fff; }

/* ── HERO ── */
.hero {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 52px 20px 44px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(124,92,252,0.1);
  border: 1px solid rgba(124,92,252,0.28);
  color: var(--accent);
  border-radius: 50px;
  padding: 5px 14px;
  font-size: .75rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  margin-bottom: 22px;
  letter-spacing: .4px;
}

.hero-badge svg { fill: currentColor; }

.hero h1 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: clamp(1.9rem, 6vw, 3.4rem);
  line-height: 1.1;
  letter-spacing: -1.5px;
  margin-bottom: 14px;
}

.hero h1 .grad {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 50%, var(--accent3) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--muted);
  font-size: .95rem;
  font-weight: 500;
  max-width: 400px;
  margin: 0 auto 30px;
  line-height: 1.65;
}

/* ── PLATFORM PILLS ── */
.platforms {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 44px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: .78rem;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--card);
  transition: all .2s;
  user-select: none;
  letter-spacing: .2px;
}

.pill svg { width: 14px; height: 14px; }

.pill-yt { color: #ff4040; }
.pill-ig { color: #d946ef; }
.pill-tt { color: #00e5bd; }
.pill-fb { color: #4a90e2; }
.pill-cc { color: var(--yellow); }

/* ── MAIN ── */
.main {
  position: relative;
  z-index: 1;
  max-width: 660px;
  margin: 0 auto;
  padding: 0 14px 80px;
}

.input-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow), var(--glow);
  margin-bottom: 18px;
}

/* ── TYPE SELECTOR ── */
.type-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.type-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  color: var(--muted);
  font-size: .82rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.type-btn svg { width: 20px; height: 20px; transition: all .2s; }

.type-btn.active {
  background: rgba(124,92,252,0.14);
  border-color: var(--accent);
  color: var(--text);
}

.type-btn:not(.active):hover {
  border-color: var(--muted);
  color: var(--text);
}

/* ── YT MODE ── */
.yt-mode {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.yt-mode.show { display: grid; }

.yt-mode-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  font-family: 'Plus Jakarta Sans', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.yt-mode-btn svg { width: 16px; height: 16px; }

.yt-mode-btn.active {
  background: rgba(0,229,189,0.1);
  border-color: var(--accent3);
  color: var(--accent3);
}

/* ── INPUT GROUP ── */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--muted);
  pointer-events: none;
  flex-shrink: 0;
}

.input-icon svg { width: 18px; height: 18px; }

.url-input {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 44px 13px 40px;
  color: var(--text);
  font-size: .92rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 500;
  outline: none;
  transition: border .2s;
}

.url-input:focus { border-color: var(--accent); }
.url-input::placeholder { color: var(--muted); font-weight: 400; }

.clear-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  display: none;
  transition: color .2s;
  border-radius: 6px;
}

.clear-btn svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; }
.clear-btn:hover { color: var(--red); }

.dl-btn {
  width: 100%;
  margin-top: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px;
  color: #fff;
  font-size: .9rem;
  font-weight: 700;
  font-family: 'Plus Jakarta Sans', sans-serif;
  cursor: pointer;
  letter-spacing: .3px;
  transition: opacity .2s, transform .1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.dl-btn svg { width: 18px; height: 18px; stroke: #fff; stroke-width: 2; }
.dl-btn:hover { opacity: .87; }
.dl-btn:active { transform: scale(.98); }
.dl-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── ERROR ── */
.error-box {
  background: rgba(244,63,94,0.08);
  border: 1px solid rgba(244,63,94,0.28);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--red);
  font-size: .83rem;
  font-weight: 500;
  margin-top: 11px;
  display: none;
  align-items: center;
  gap: 8px;
}

.error-box svq { width: 18px; height: 18px; flex-shrink: 0; }
.error-box.show { display: flex; }

/* ── LOADING ── */
.loading-wrap {
  text-align: center;
  padding: 44px 20px;
  display: none;
}

.loading-wrap.show { display: block; }

.spinner {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  animation: spin .75s linear infinite;
  margin: 0 auto 14px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  color: var(--muted);
  font-size: .82rem;
  font-family: 'JetBrains Mono', monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.loading-text svg { width: 18px; height: 18px; animation: spin 1s linear infinite; }

/* ── RESULT CARD ── */
.result-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: none;
  animation: slideUp .28s ease;
}

.result-card.show { display: block; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── RESULT HEADER ── */
.result-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.result-header-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.result-header-icon svg { width: 20px; height: 20px; }

.result-header-title {
  font-size: .88rem;
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.result-platform-tag {
  font-size: .68rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 50px;
  letter-spacing: .4px;
  flex-shrink: 0;
}

/* ── THUMBNAIL ── */
.thumb-wrap {
  position: relative;
  overflow: hidden;
  max-height: 270px;
}

.thumb-wrap img {
  width: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s;
}

.meta-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.82));
  padding: 36px 16px 14px;
}

.meta-title {
  font-weight: 700;
  font-size: .88rem;
  line-height: 1.4;
  color: #fff;
}

.meta-sub {
  font-size: .72rem;
  color: rgba(255,255,255,.65);
  margin-top: 4px;
  font-family: 'JetBrains Mono', monospace;
}

/* ── RESULT BODY ── */
.result-body { padding: 14px 18px; }
.result-grid { display: grid; gap: 8px; }

/* ── DL ITEM ── */
.dl-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  display: flex;
  align-items: center;
  gap: 11px;
  transition: border-color .2s;
}

.dl-item:hover { border-color: rgba(124,92,252,0.5); }

.dl-item-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dl-item-icon svg { width: 18px; height: 18px; }

.dl-item-info { flex: 1; min-width: 0; }

.dl-item-title {
  font-size: .83rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dl-item-sub {
  font-size: .7rem;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
}

.dl-item-actions { display: flex; gap: 6px; flex-shrink: 0; }

.action-btn {
  padding: 7px 11px;
  border-radius: 8px;
  font-size: .76rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: all .18s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  letter-spacing: .2px;
}

.action-btn svg { width: 14px; height: 14px; }

.btn-dl {
  background: var(--accent);
  color: #fff;
}

.btn-dl:hover { background: var(--accent2); }

.btn-play {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-play:hover {
  background: var(--accent3);
  color: #000;
  border-color: var(--accent3);
}

.btn-open {
  background: var(--bg3);
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-open:hover { color: var(--text); border-color: var(--muted); }

/* ── MEDIA PLAYER ── */
.media-player {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 14px 18px;
  display: none;
}

.media-player.show { display: block; }

.media-player audio,
.media-player video {
  width: 100%;
  border-radius: var(--radius-sm);
  outline: none;
}

.media-player video {
  max-height: 310px;
  background: #000;
}

.player-note {
  font-size: .72rem;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 8px;
  text-align: center;
}

/* ── SLIDE GALLERY ── */
.slide-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}

.slide-item {
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  padding-bottom: 100%;
  background: var(--bg3);
}

.slide-item img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slide-item a {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.55);
  opacity: 0;
  transition: opacity .2s;
  color: #fff;
  text-decoration: none;
}

.slide-item a svg { width: 28px; height: 28px; stroke: #fff; stroke-width: 1.5; }
.slide-item:hover a { opacity: 1; }

/* ── STATS BAR ── */
.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 18px;
  border-top: 1px solid var(--border);
}

.stat {
  font-size: .7rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--muted);
  background: var(--bg3);
  padding: 3px 9px;
  border-radius: 50px;
  border: 1px solid var(--border);
}

/* ── FOOTER ── */
footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 22px;
  color: var(--muted);
  font-size: .75rem;
  font-family: 'JetBrains Mono', monospace;
  border-top: 1px solid var(--border);
}

footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ── MOBILE ── */
@media (max-width: 480px) {
  .hero { padding: 36px 14px 30px; }
  .type-selector { grid-template-columns: 1fr 1fr; }
  .dl-item { flex-wrap: wrap; }
  .dl-item-actions { width: 100%; }
  .action-btn { flex: 1; justify-content: center; }
  .meta-title { font-size: .8rem; }
  .platforms { gap: 6px; }
  .pill { font-size: .72rem; padding: 5px 11px; }
}

/* ========== TAMBAHAN UNTUK FIX TAMPILAN RESULT ========== */

/* Fix thumbnail overlay biar rapi */
.thumb-wrap {
  position: relative;
  overflow: hidden;
  max-height: 220px;
  background: var(--bg2);
}

.thumb-wrap img {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
}

.meta-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
  padding: 40px 16px 12px;
}

.meta-title {
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1.4;
  color: white;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
}

.meta-sub {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Fix result body */
.result-body {
  padding: 16px;
}

.result-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Fix DL item (card download) */
.dl-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s;
}

.dl-item:hover {
  border-color: var(--accent);
}

.dl-item-icon {
  width: 40px;
  height: 40px;
  background: var(--bg3);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dl-item-icon svg {
  width: 20px;
  height: 20px;
}

.dl-item-info {
  flex: 1;
  min-width: 0;
}

.dl-item-title {
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dl-item-sub {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 2px;
  font-family: 'JetBrains Mono', monospace;
}

.dl-item-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.action-btn {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  text-decoration: none;
  border: none;
}

.btn-play {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-play:hover {
  background: var(--accent3);
  color: #000;
  border-color: var(--accent3);
}

.btn-dl {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
}

.btn-dl:hover {
  opacity: 0.85;
  transform: scale(0.98);
}

/* Fix stats bar */
.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
}

.stat {
  font-size: 0.7rem;
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg3);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--muted);
}

/* Fix media player */
.media-player {
  padding: 16px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
}

.media-player audio,
.media-player video {
  width: 100%;
  border-radius: 10px;
}

.player-note {
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
  margin-top: 10px;
  font-family: 'JetBrains Mono', monospace;
}

/* ========== TOAST NOTIFICATION STYLES ========== */
.download-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
  white-space: nowrap;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  animation: toastSlideUp 0.3s ease;
  pointer-events: none;
}

.download-toast .toast-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast-info {
  background: rgba(59, 130, 246, 0.95);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.toast-success {
  background: rgba(34, 197, 94, 0.95);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.toast-error {
  background: rgba(239, 68, 68, 0.95);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.toast-hide {
  animation: toastSlideDown 0.3s ease forwards;
}

@keyframes toastSlideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes toastSlideDown {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
}

/* Fix responsive mobile */
@media (max-width: 500px) {
  .dl-item {
    flex-wrap: wrap;
  }
  
  .dl-item-actions {
    width: 100%;
    justify-content: flex-end;
  }
  
  .action-btn {
    flex: 1;
    justify-content: center;
  }
  
  .meta-title {
    font-size: 0.75rem;
  }
}
