/* ============================================================
   storefront.css — shared visual system buat semua halaman
   storefront (homepage, folder, video detail). --accent di-set
   inline per-halaman (dari branding warna aksen tiap user).
============================================================ */

:root {
  --accent: #388bfd;
  --bg: #0a0f1a;
  --bg-elevated: #10182b;
  --surface: #111a2e;
  --surface-2: #16203a;
  --border: rgba(255, 255, 255, 0.08);
  --border-2: rgba(255, 255, 255, 0.14);
  --text: #eef2f8;
  --text-2: #9fb0c9;
  --text-3: #6b7c96;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(1200px 500px at 15% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent),
    radial-gradient(900px 400px at 100% 0%, color-mix(in srgb, var(--accent) 8%, transparent), transparent);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ============================================================
   HEADER
============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(10, 15, 26, 0.78);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}

.site-header-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand img {
  height: 36px;
  width: 36px;
  border-radius: 9px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-2);
}

.brand-fallback {
  height: 36px;
  width: 36px;
  border-radius: 9px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #7c3aed));
}

.brand-text {
  min-width: 0;
}

.brand-text h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-text .tagline {
  margin: 1px 0 0;
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40vw;
}

/* ============================================================
   NAV — link teks polos (bukan pill), Home dulu baru kategori
   pilihan user (urutan dari menu_order, lihat getMenuFolders()).
   Desktop: horizontal di sebelah logo. Mobile: disembunyiin di
   belakang tombol hamburger, dibuka jadi dropdown lewat JS
   (storefront.js, toggle class "open").
============================================================ */
.sitenav {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-left: auto;
  flex-wrap: wrap;
}

.navlink {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: 0.15s;
  white-space: nowrap;
}
.navlink:hover { color: var(--text); }
.navlink.active { color: var(--accent); border-bottom-color: var(--accent); }

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 34px;
  height: 34px;
  padding: 0;
  margin-left: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
}
.hamburger span {
  display: block;
  height: 2px;
  width: 16px;
  margin: 0 auto;
  background: var(--text-2);
  border-radius: 2px;
  transition: 0.2s;
}
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ============================================================
   SEARCH BAR
============================================================ */
.search-form {
  display: flex;
  gap: 8px;
  padding: 0 0 14px;
  max-width: 480px;
  margin: 0 auto 0 0;
}
.search-input {
  flex: 1;
  min-width: 0;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-family: var(--font);
}
.search-input:focus { outline: none; border-color: var(--accent); }
.search-input::placeholder { color: var(--text-3); }
.search-btn {
  flex-shrink: 0;
  padding: 10px 20px;
  border-radius: 999px;
  border: none;
  background: var(--text);
  color: var(--bg);
  font-size: 13.5px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: 0.15s;
}
.search-btn:hover { background: var(--accent); color: #fff; }

/* ============================================================
   AD SLOT — placeholder kosong, cuma kekutup kalau nanti diisi
   (belum ada sistem iklan) - collapse total kalau kosong biar
   nggak nyisain kotak kosong di layout.
============================================================ */
.ad-slot { margin-bottom: 14px; }
.ad-slot:empty { display: none; margin: 0; }

/* ============================================================
   PAGE HERO — H1 + subtitle di atas grid video (homepage,
   kategori, hasil search).
============================================================ */
.page-hero { padding: 4px 0 18px; }
.page-heading {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
}
.page-subtitle {
  margin: 6px 0 0;
  font-size: 13.5px;
  color: var(--text-2);
}

/* ============================================================
   BREADCRUMB
============================================================ */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-3);
  padding: 16px 0 0;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-2); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { opacity: 0.5; }
.breadcrumb .current { color: var(--text); font-weight: 600; }

/* ============================================================
   MAIN / SECTION HEADINGS
============================================================ */
main { padding: 22px 0 60px; }

.section-title {
  font-size: 15px;
  font-weight: 800;
  margin: 0 0 14px;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.section-title .sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
}

/* ============================================================
   VIDEO GRID / CARD
============================================================ */
.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}

.card {
  display: block;
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: transform 0.18s ease;
}
.card:hover { transform: translateY(-3px); }

.thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--surface);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.card:hover .thumb { border-color: var(--border-2); box-shadow: var(--shadow); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.35s ease; }
.card:hover .thumb img { transform: scale(1.04); }

.thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
}

.duration {
  position: absolute;
  bottom: 7px;
  right: 7px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 5px;
  letter-spacing: 0.02em;
}

.like-btn {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.62);
  color: #d7deea;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  transition: 0.15s;
}
.like-btn:hover { background: rgba(0, 0, 0, 0.82); }
.like-btn.liked { color: #fff; background: var(--accent); }

.card-body { padding: 10px 2px 0; }
.title {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card:hover .title { color: var(--accent); }
.meta { font-size: 12px; color: var(--text-3); margin-top: 4px; }

.empty {
  color: var(--text-2);
  padding: 60px 20px;
  text-align: center;
  border: 1px dashed var(--border-2);
  border-radius: var(--radius);
  font-size: 14px;
}

/* ============================================================
   PAGINATION — bernomor + ellipsis ("1 2 3 ... 404 405 Next >"),
   lihat renderPagination() di public/inc/functions.php.
============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 30px;
}
.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
}
.page-link:hover { color: var(--text); border-color: var(--border-2); }
.page-link.active {
  color: #fff;
  background: var(--accent);
  border-color: transparent;
}
.page-link.prev, .page-link.next { padding: 0 14px; }
.page-link.disabled { opacity: 0.35; pointer-events: none; }
.page-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  color: var(--text-3);
  font-size: 13px;
}

/* ============================================================
   VIDEO DETAIL PAGE
============================================================ */
.player-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.player-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-head {
  margin-top: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.video-head h1 {
  font-size: 21px;
  font-weight: 800;
  margin: 0;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.video-stats {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-2);
}

.like-cta {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--border-2);
  color: var(--text);
  cursor: pointer;
  transition: 0.15s;
}
.like-cta:hover { border-color: var(--accent); }
.like-cta.liked { background: var(--accent); border-color: transparent; color: #fff; }

/* Wrapper - video bisa punya >1 category sekarang (lihat
   migration-5-video-categories.sql), jadi tag-nya dirender bareng
   dalam 1 baris yang bisa wrap. */
.video-category-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.video-folder-tag {
  display: inline-flex;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
}
.video-folder-tag:hover { color: var(--accent); border-color: var(--accent); }

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

/* ============================================================
   FOOTER — deskripsi situs + daftar link kategori + copyright,
   pola dari desain referensi (footer 2-kolom + garis bawah).
============================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 34px 0 30px;
  margin-top: 30px;
}
.footer-about { max-width: 640px; }
.footer-brand { font-size: 16px; font-weight: 800; color: var(--text); }
.footer-desc {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-2);
}

.footer-categories { margin-top: 26px; }
.footer-heading {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  margin-bottom: 10px;
}
.footer-catlist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}
.footer-catlist li { font-size: 13px; }
.footer-catlist a { color: var(--text-2); }
.footer-catlist a:hover { color: var(--accent); }

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-3);
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.footer-powered a { color: var(--text-2); font-weight: 600; }
.footer-powered a:hover { color: var(--accent); }

/* ============================================================
   TOAST
============================================================ */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  left: auto;
  z-index: 999;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  box-shadow: var(--shadow);
  animation: toastUp 0.25s ease;
  max-width: min(320px, calc(100vw - 40px));
}
@keyframes toastUp {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ============================================================
   RESPONSIVE
============================================================ */

/* Desktop default: grid 4 kolom (bukan auto-fill bebas), biar
   konsisten sama referensi desktop (4 video per baris). */
@media (min-width: 641px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .brand img, .brand-fallback { height: 32px; width: 32px; }
  .brand-text h1 { font-size: 15px; }
  .video-head h1 { font-size: 18px; }
  .like-cta { padding: 8px 14px; font-size: 13px; }

  /* Nav disembunyiin di belakang hamburger - dibuka jadi dropdown
     full-width di bawah top bar pas class "open" ke-toggle JS. */
  .site-header-top { flex-wrap: wrap; }
  .hamburger { display: flex; }
  .sitenav {
    display: none;
    width: 100%;
    order: 3;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    margin: 10px 0 4px;
    padding: 10px 0 0;
    border-top: 1px solid var(--border);
  }
  .sitenav.open { display: flex; }
  .navlink { width: 100%; padding: 9px 2px; border-bottom: 1px solid var(--border); }
  .navlink.active { border-bottom: 1px solid var(--border); }
  .navlink:last-child { border-bottom: none; }

  .search-form { max-width: none; }
  .page-heading { font-size: 19px; }
}
