/* ==========================================================================
   Vid18+ — gaya umum (index & detail)
   ========================================================================== */

:root {
  --bg: #0b0b10;
  --surface: #14141b;
  --surface-2: #1c1c26;
  --border: #272733;
  --text: #f3f3f7;
  --text-muted: #9b9bab;
  --accent: #ff3b4e;
  --accent-2: #ff6a3d;
  --radius: 14px;
  --gap: 12px;
  --max-width: 1200px;
}

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

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img { max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Header ---------- */
.main-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 11, 16, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.logo h1 span {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Pencarian ---------- */
.search-box {
  display: flex;
  width: min(280px, 55vw);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.search-box:focus-within { border-color: var(--accent); }

#search-input {
  flex: 1;
  min-width: 0;
  padding: 9px 14px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
}

#search-input::placeholder { color: var(--text-muted); }

#search-btn {
  border: 0;
  padding: 0 14px;
  cursor: pointer;
  background: transparent;
  font-size: 0.95rem;
}

/* ---------- Konten utama ---------- */
.main-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px;
}

/* ---------- Kategori (chip) ---------- */
.categories-container {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.categories-container::-webkit-scrollbar { display: none; }

.category-btn {
  flex: none;
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.category-btn:hover { color: var(--text); border-color: #3a3a4a; }

.category-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}

/* ---------- Tab urutan ---------- */
.tabs-section { margin: 14px 0 16px; }

.tabs-container {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.tab-btn {
  padding: 7px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active { background: var(--surface-2); color: var(--text); font-weight: 600; }

/* ---------- Grid film (masonry via JS) ---------- */
.movies-grid {
  display: flex;
  align-items: flex-start;
  gap: var(--gap);
}

.masonry-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.movie-card {
  display: block;
  animation: cardIn 0.35s ease-out both;
}

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

.movie-thumbnail-container {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.movie-thumbnail-container.aspect-16-9 { aspect-ratio: 16 / 9; }
.movie-thumbnail-container.aspect-9-16 { aspect-ratio: 9 / 16; }
.movie-thumbnail-container.aspect-3-4 { aspect-ratio: 3 / 4; }
.movie-thumbnail-container.aspect-4-3 { aspect-ratio: 4 / 3; }

.movie-thumbnail {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

@media (hover: hover) {
  .movie-card:hover .movie-thumbnail { transform: scale(1.05); }
  .movie-card:hover .movie-title { color: var(--accent); }
}

.movie-info { padding: 8px 2px 2px; }

.movie-title {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.2s;
}

.movie-meta {
  margin-top: 3px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ---------- Badge kategori ---------- */
.category-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(0, 0, 0, 0.75);
}

.category-colmek { background: rgba(239, 68, 68, 0.92); }
.category-berdua { background: rgba(16, 185, 129, 0.92); }
.category-bergilir { background: rgba(139, 92, 246, 0.92); }
.category-lainnya { background: rgba(97, 97, 97, 0.92); }

/* ---------- Skeleton loading ---------- */
.skeleton-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
}

@media (min-width: 769px) { .skeleton-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1025px) { .skeleton-grid { grid-template-columns: repeat(4, 1fr); } }

.skeleton-thumb,
.skeleton-line {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.skeleton-thumb { aspect-ratio: 16 / 9; border-radius: var(--radius); }
.skeleton-line { height: 12px; width: 70%; margin-top: 10px; border-radius: 6px; }

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

/* ---------- Pesan kosong / error ---------- */
.no-movies,
.loading-movies {
  flex: 1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

/* ---------- Tombol "Muat lebih banyak" ---------- */
.load-more-wrap { display: flex; justify-content: center; padding: 20px 0 8px; }
.load-more-wrap[hidden], .load-more-btn[hidden] { display: none; }

.load-more-btn {
  padding: 10px 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.load-more-btn:hover { background: var(--surface-2); border-color: #3a3a4a; }

/* ---------- Konfirmasi usia 18+ ---------- */
html.age-locked { overflow: hidden; }

.age-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 5, 8, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.age-gate-box {
  width: min(380px, 100%);
  padding: 28px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
}

.age-gate-badge {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 800;
  font-size: 1.2rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.age-gate-box h2 { font-size: 1.25rem; margin-bottom: 8px; }
.age-gate-box p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 20px; }

.age-gate-actions { display: flex; flex-direction: column; gap: 10px; }

.age-gate-yes {
  padding: 12px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.age-gate-no {
  padding: 10px;
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ---------- Responsif ---------- */
@media (max-width: 768px) {
  :root { --gap: 10px; --radius: 12px; }
  .main-content { padding: 12px 10px; }
  .header-container { padding: 10px; }
  .movie-title { font-size: 0.8rem; }
}

@media (max-width: 480px) {
  :root { --gap: 8px; --radius: 10px; }
  .category-badge { font-size: 0.55rem; padding: 2px 7px; }
}

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