/* public/styles.css */

/* ---------- Tokens ---------- */
:root {
  --bg: #0a0a0c;
  --bg-soft: #0d0d10;
  --surface: #121216;
  --surface-2: #17171c;
  --border: #232329;
  --border-soft: #1b1b20;
  --text: #f4f4f6;
  --muted: #8b8b98;
  --accent: #3b82f6;
  --accent-hover: #2f72e6;
  --accent-soft: rgba(59, 130, 246, 0.12);
  --danger: #f05555;
  --ok: #34d399;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.28);
  --maxw: 1080px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

[data-theme='light'] {
  --bg: #ffffff;
  --bg-soft: #f7f7f9;
  --surface: #ffffff;
  --surface-2: #f4f4f6;
  --border: #e5e5ea;
  --border-soft: #eeeeF3;
  --text: #0d0d10;
  --muted: #6a6a76;
  --accent: #2563eb;
  --accent-hover: #1d4fd0;
  --accent-soft: rgba(37, 99, 235, 0.09);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 10px 30px rgba(16, 24, 40, 0.07);
}

/* ---------- Base ---------- */
*,
*::before,
*::after { 
  box-sizing: border-box; 
  /* TAMBAHAN: Menghilangkan kotak highlight bawaan browser di semua elemen */
  -webkit-tap-highlight-color: transparent; 
}

[hidden] { display: none !important; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
  overflow-x: hidden;
}

h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.028em; font-weight: 800; }
h1 { font-size: clamp(2.1rem, 6.2vw, 3.6rem); }
h2 { font-size: clamp(1.35rem, 3.2vw, 1.85rem); }
h3 { font-size: 1.02rem; font-weight: 700; letter-spacing: -0.015em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; outline: none; }
img { max-width: 100%; display: block; }
ul { margin: 0; padding: 0; list-style: none; }

/* TAMBAHAN: Menghilangkan border-radius kotak tajam saat fokus */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Memastikan semua elemen interaktif tidak menampilkan outline kotak tajam saat diklik */
a, button, .platforms li, .icon-btn, .btn, .icon-mini {
  outline: none;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

.muted { color: var(--muted); }
.sm { font-size: 0.84rem; }
.accent { color: var(--accent); }

/* ---------- Navbar ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border-soft);
}

.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: 1.06rem;
  outline: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  flex: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 12px;
}

.nav-links a {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  transition: color 0.18s var(--ease), background-color 0.18s var(--ease);
  outline: none;
}

.nav-links a:hover { color: var(--text); background: var(--surface-2); }

.nav-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease), transform 0.18s var(--ease);
  outline: none;
}

.icon-btn:hover { background: var(--surface-2); border-color: var(--border); }
.icon-btn:active { transform: scale(0.95); }

[data-theme='dark'] .icon-sun { display: none; }
[data-theme='light'] .icon-moon { display: none; }

.menu-btn { display: none; }

/* ---------- Hero ---------- */
.hero {
  padding: clamp(56px, 11vw, 104px) 0 clamp(40px, 6vw, 64px);
  text-align: center;
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  inset: -80px 0 auto 0;
  height: 380px;
  background: radial-gradient(60% 60% at 50% 0%, var(--accent-soft), transparent 72%);
  pointer-events: none;
}

.hero .container { position: relative; }

.pill {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin-bottom: 20px;
}

.hero h1 { margin-bottom: 14px; }

.lead {
  max-width: 540px;
  margin: 0 auto 32px;
  color: var(--muted);
  font-size: clamp(0.94rem, 2.2vw, 1.06rem);
  line-height: 1.65;
}

/* ---------- Input bar ---------- */
.inputbar {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.inputbar:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow);
}

.input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 0;
}

.input-icon {
  position: absolute;
  left: 12px;
  color: var(--muted);
  pointer-events: none;
}

#urlInput {
  width: 100%;
  height: 46px;
  padding: 0 40px 0 38px;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  border-radius: 10px;
  min-width: 0;
}

#urlInput::placeholder { color: var(--muted); opacity: 0.85; }
#urlInput:focus { outline: none; }

.clear-btn {
  position: absolute;
  right: 6px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  transition: color 0.18s var(--ease), background-color 0.18s var(--ease);
  outline: none;
}

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

.input-actions { display: flex; gap: 8px; flex: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 46px;
  padding: 0 18px;
  border-radius: 11px;
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease),
    color 0.18s var(--ease), transform 0.14s var(--ease), opacity 0.18s var(--ease);
  outline: none;
}

.btn:active:not(:disabled) { transform: scale(0.975); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); }

.btn.sm { height: 34px; padding: 0 12px; font-size: 0.82rem; border-radius: 9px; }

.btn.dl {
  height: 38px;
  padding: 0 14px;
  font-size: 0.84rem;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
}
.btn.dl:hover { background: var(--accent-hover); }

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.hint {
  min-height: 22px;
  margin-top: 12px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.2s var(--ease);
}

.hint.error { color: var(--danger); }
.hint.success { color: var(--ok); }

/* ---------- Platforms ---------- */
.platforms-wrap {
  max-width: 720px;
  margin: 40px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.platforms {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.platforms li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s var(--ease);
  outline: none;
}

.platforms li:hover { 
  color: var(--text); 
  border-color: var(--border); 
  background: var(--surface-2);
}

/* Gaya saat platform aktif terpilih */
.platforms li.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.platforms svg { width: 16px; height: 16px; flex: none; }
.platforms .more-btn { color: var(--muted); opacity: 0.9; font-weight: 500; }
.platforms .more-btn:hover { color: var(--accent); }

/* ---------- Sections ---------- */
.section { padding: clamp(48px, 8vw, 80px) 0; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.section-head h2 { margin-bottom: 4px; }

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.feature {
  padding: 22px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.feature:hover { border-color: var(--border); transform: translateY(-2px); }

.feature-num {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 12px;
}

.feature h3 { margin-bottom: 8px; }
.feature p { color: var(--muted); font-size: 0.88rem; }

.about-card {
  padding: clamp(24px, 4vw, 40px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: var(--surface);
  max-width: 720px;
}

.about-card h2 { margin-bottom: 14px; }
.about-card p { color: var(--muted); font-size: 0.92rem; margin-bottom: 12px; }
.about-card p:last-child { margin-bottom: 0; }

/* ---------- Result card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  max-width: 780px;
  margin: 0 auto;
  animation: rise 0.32s var(--ease);
}

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

.card-top {
  display: flex;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--border-soft);
}

.thumb {
  width: 128px;
  height: 92px;
  flex: none;
  border-radius: 11px;
  background: var(--surface-2) center/cover no-repeat;
  border: 1px solid var(--border-soft);
  overflow: hidden;
}

.thumb-fallback {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
}

.meta { min-width: 0; flex: 1; }

.platform-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-bottom: 8px;
}

.meta h3 {
  font-size: 1.02rem;
  font-weight: 700;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta .sub {
  color: var(--muted);
  font-size: 0.82rem;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.chip {
  padding: 3px 9px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
}

.media-list { padding: 8px; }

.media-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 11px;
  transition: background-color 0.16s var(--ease);
}

.media-row + .media-row { border-top: 1px solid var(--border-soft); }
.media-row:hover { background: var(--surface-2); }

.media-type {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
}

.media-type svg { width: 17px; height: 17px; }

.media-info { min-width: 0; flex: 1; }

.media-info strong {
  display: block;
  font-size: 0.87rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-info span { font-size: 0.75rem; color: var(--muted); }

.media-actions { display: flex; gap: 6px; flex: none; }

.icon-mini {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  transition: color 0.16s var(--ease), background-color 0.16s var(--ease);
  outline: none;
}

.icon-mini:hover { color: var(--text); background: var(--surface-2); }
.icon-mini svg { width: 16px; height: 16px; }

.notice {
  margin: 8px;
  padding: 14px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.alert {
  max-width: 780px;
  margin: 0 auto;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--border));
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
  color: var(--text);
  font-size: 0.88rem;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: rise 0.28s var(--ease);
}

.alert svg { width: 18px; height: 18px; flex: none; color: var(--danger); margin-top: 2px; }

/* Skeleton */
.skeleton {
  max-width: 780px;
  margin: 0 auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 18px;
  display: flex;
  gap: 16px;
}

.sk { background: var(--surface-2); border-radius: 10px; position: relative; overflow: hidden; }
.sk::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 6%, transparent), transparent);
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.sk-thumb { width: 128px; height: 92px; flex: none; }
.sk-lines { flex: 1; display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.sk-line { height: 12px; }
.sk-line.w60 { width: 60%; }
.sk-line.w40 { width: 40%; }

/* ---------- History ---------- */
.history { display: flex; flex-direction: column; gap: 8px; }

.history li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.18s var(--ease);
}

.history li:hover { border-color: var(--border); }

.h-thumb {
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 9px;
  background: var(--surface-2) center/cover no-repeat;
  border: 1px solid var(--border-soft);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
}

.h-info { min-width: 0; flex: 1; cursor: pointer; outline: none; }

.h-info strong {
  display: block;
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.h-info span { font-size: 0.74rem; color: var(--muted); }

.empty {
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  color: var(--muted);
  font-size: 0.86rem;
}

/* ---------- Footer ---------- */
.footer {
  margin-top: 40px;
  border-top: 1px solid var(--border-soft);
  padding: 40px 0 28px;
  background: var(--bg-soft);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
  padding-bottom: 28px;
}

.footer-brand { max-width: 320px; }
.footer-brand p { margin-top: 12px; color: var(--muted); font-size: 0.86rem; }

.footer-links { display: flex; flex-direction: column; gap: 10px; }

.footer-links a {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  width: fit-content;
  transition: color 0.18s var(--ease);
  outline: none;
}

.footer-links a:hover { color: var(--accent); }

.footer-bottom {
  padding-top: 22px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .menu-btn { display: grid; }

  .nav-links {
    position: absolute;
    top: 64px;
    left: 12px;
    right: 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px;
    margin: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  }

  .nav-links.open { opacity: 1; transform: none; pointer-events: auto; }
  .nav-links a { padding: 11px 12px; font-size: 0.92rem; }

  .inputbar { flex-direction: column; padding: 10px; }
  .input-actions { width: 100%; }
  .input-actions .btn { flex: 1; }

  .hero { padding-top: 44px; }
  .platforms { gap: 6px; margin-top: 30px; }
  .platforms li { padding: 7px 11px; font-size: 0.76rem; }

  .card-top { flex-direction: column; }
  .thumb { width: 100%; height: 168px; }

  .media-row { flex-wrap: wrap; }
  .media-actions { width: 100%; justify-content: flex-end; }

  .footer-inner { flex-direction: column; gap: 24px; }
  .footer-links { flex-direction: row; flex-wrap: wrap; gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}