/* ============================================================
   TEKA-TEKI C8 — shared stylesheet (semua halaman portal)
   Dipakai bersama Tailwind; berisi hal-hal yang tidak praktis
   ditulis sebagai utility: font lokal, loader, safe-area, dsb.
   ============================================================ */

/* --- Atribut `hidden` harus benar-benar menyembunyikan --------
   Utility display Tailwind (.flex, .grid, .block, …) punya
   spesifisitas sama dengan aturan preflight `[hidden]{display:none}`
   tetapi ditulis belakangan, sehingga menang. Akibatnya elemen
   seperti <button hidden class="flex …"> tetap tampak.
   Satu aturan ini menutup seluruh kelas bug tersebut di portal. */
[hidden] { display: none !important; }

/* --- Potong judul jadi 2 baris ------------------------------
   Kartu video di-render dari JavaScript (js/video-data.js), jadi
   kelasnya belum tentu terlihat oleh JIT Tailwind saat halaman
   pertama dipindai. Didefinisikan di sini supaya pasti berlaku. */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- Baris kategori video (video.html) ----------------------
   Kartu digeser mendatar. Padding + margin negatif yang saling
   meniadakan membuat kartu pertama sejajar teks halaman tetapi
   deretannya tetap bisa di-scroll sampai menyentuh tepi layar. */
.video-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  padding: 2px 20px 4px;
  margin: 0 -20px;
}
.video-row::-webkit-scrollbar { display: none; }
.video-tile { scroll-snap-align: start; }

/* --- Font lokal (offline / Capacitor-safe) ------------------ */
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/poppins-400.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../assets/fonts/poppins-600.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../assets/fonts/poppins-700.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../assets/fonts/poppins-800.woff2") format("woff2");
}

/* --- Base ---------------------------------------------------- */
html, body {
  height: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: "Poppins", ui-sans-serif, system-ui, -apple-system, "Nunito", sans-serif;
  color: #221b4e;
  /* Gradasi lavender→pink lembut seperti referensi desain */
  background:
    radial-gradient(120% 90% at 85% 0%, #fdeffa 0%, rgba(253, 239, 250, 0) 55%),
    radial-gradient(120% 90% at 0% 100%, #eef1fd 0%, rgba(238, 241, 253, 0) 55%),
    #f6f4fb;
  background-attachment: fixed;
}

/* Safe-area untuk notch (Capacitor iOS/Android) */
.safe-top    { padding-top: env(safe-area-inset-top, 0px); }
.safe-bottom { padding-bottom: env(safe-area-inset-bottom, 0px); }

/* Batasi lebar app di desktop supaya tetap terasa mobile-first */
.app-shell {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* --- Loader overlay (id: loader / loaderBar / loaderPct) ----- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background:
    radial-gradient(120% 90% at 85% 0%, #fdeffa 0%, rgba(253, 239, 250, 0) 55%),
    radial-gradient(120% 90% at 0% 100%, #eef1fd 0%, rgba(238, 241, 253, 0) 55%),
    #f6f4fb;
  transition: opacity .45s ease, visibility .45s ease;
}
.loader.hide { opacity: 0; visibility: hidden; pointer-events: none; }

.loader .logo-img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  animation: c8-bounce 1.6s ease-in-out infinite;
}
@keyframes c8-bounce {
  0%, 100% { transform: translateY(0) }
  50%      { transform: translateY(-8px) }
}

.loader-bar-track {
  width: min(240px, 60vw);
  height: 8px;
  border-radius: 999px;
  background: #e5e1f3;
  overflow: hidden;
}
.loader-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #8b5cf6, #34d399);
  transition: width .25s ease;
}
.loader-pct {
  font-size: 12px;
  font-weight: 700;
  color: #8b5cf6;
  letter-spacing: .08em;
}

/* --- Kartu game: efek tekan --------------------------------- */
.game-card { transition: transform .12s ease, box-shadow .12s ease; }
.game-card:active { transform: scale(.97); }

/* --- Modal sederhana ----------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(34, 27, 78, .45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}
.modal-backdrop.open { opacity: 1; visibility: visible; }
.modal-sheet {
  width: 100%;
  max-width: 430px;
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateY(24px);
  transition: transform .25s ease;
}
.modal-backdrop.open .modal-sheet { transform: translateY(0); }

/* --- Drawer menu utama (C8.initDrawer) -----------------------
   Panel di-inject ke <body> oleh core.js, tetapi tetap sejajar
   dengan .app-shell (maks 430px, terpusat) supaya di desktop
   drawer tidak melayang di tepi jendela yang jauh dari app. */
.drawer-root {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
}
.drawer-root .drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(246, 244, 251, .55);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .25s ease;
}
.drawer-root.open {
  pointer-events: auto;
}
.drawer-root.open .drawer-backdrop { opacity: 1; }

/* Kotak sejajar app-shell; overflow-hidden menahan panel di luar
   layar selama tertutup, jadi tidak ada scrollbar horizontal. */
.drawer-shell {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  overflow: hidden;
}
.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 78%;
  max-width: 330px;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: -18px 0 40px -20px rgba(34, 27, 78, .45);
  transform: translateX(102%);
  transition: transform .3s cubic-bezier(.22, 1, .36, 1);
}
.drawer-root.open .drawer-panel { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 16px 18px 18px;
  background: linear-gradient(100deg, #a78bfa 0%, #7dd3fc 55%, #6ee7b7 100%);
}
.drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 20px;
}
.drawer-foot {
  border-top: 1px solid #f1f0f7;
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px));
}

/* --- Halaman Info (info/faq/news/terms/privacy) ---------------
   Kelima halaman memakai satu bar judul lavender + tombol kembali
   yang sama, jadi bentuknya ditulis sekali di sini. */
.info-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 16px 14px;
  background: linear-gradient(100deg, #c2bcf6 0%, #cbc7f8 60%, #c7d3f9 100%);
}
.info-topbar h1 {
  font-size: 22px;
  font-weight: 800;
  color: #221b4e;
  line-height: 1.2;
  min-width: 0;
}
.info-back {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .5);
  color: #453d72;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .12s ease, background .12s ease;
}
.info-back:active { transform: scale(.94); background: rgba(255, 255, 255, .8); }

/* Label kecil di atas daftar ("PERTANYAAN POPULER", dst.) */
.info-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #9aa0b4;
}

/* --- Isi halaman yang ditulis admin di CMS ------------------
   Dipakai page.html, contact.html & about.html. Adminnya menulis
   HTML sederhana di panel "Konten App", jadi elemen dasarnya
   diberi gaya sekali di sini supaya rapi tanpa perlu menulis
   style manual di tiap halaman. */
.cms-body { font-size: 14px; line-height: 1.7; color: #475569; }
.cms-body h2 { font-weight: 800; color: #221b4e; font-size: 16px; margin: 18px 0 8px; }
.cms-body h2:first-child { margin-top: 0; }
.cms-body p { margin: 0 0 10px; }
.cms-body p:last-child { margin-bottom: 0; }
.cms-body ul, .cms-body ol { margin: 0 0 10px; padding-left: 20px; }
.cms-body a { color: #8b5cf6; text-decoration: underline; }
.cms-body b, .cms-body strong { color: #221b4e; }

/* Accordion FAQ: jawaban tersembunyi sampai kartunya dibuka. */
.faq-answer { display: none; }
.faq-item.open .faq-answer { display: block; }
.faq-chevron { transition: transform .2s ease; }
.faq-item.open .faq-chevron { transform: rotate(180deg); }

/* --- Halaman Redeem (redeem / konfirmasi / sukses / riwayat) ---
   Empat halaman penukaran poin memakai bentuk yang sama, jadi
   ditulis sekali di sini. */

/* Baris tab kategori: bisa digeser saat kategori lebih dari empat,
   tanpa scrollbar yang terlihat. */
.redeem-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 20px;
  margin: 0 -20px;
}
.redeem-tabs::-webkit-scrollbar { display: none; }

.redeem-tab {
  flex-shrink: 0;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: #6b7280;
  background: #fff;
  border: 1px solid #f1f0f7;
  box-shadow: 0 6px 18px -12px rgba(109, 40, 217, .25);
  transition: transform .12s ease, background .15s ease, color .15s ease;
}
.redeem-tab:active { transform: scale(.96); }
.redeem-tab[aria-selected="true"] {
  background: #a78bfa;
  border-color: #a78bfa;
  color: #fff;
}

/* Garis putus-putus pemisah subtotal → total pada rincian poin. */
.redeem-divider {
  border: 0;
  border-top: 1.5px dashed #e5e1f3;
  margin: 12px 0;
}

/* Tombol aksi utama menempel di bawah layar (konfirmasi & sukses):
   layar mockup punya ruang kosong lalu tombol di dasar viewport. */
.redeem-actions {
  margin-top: auto;
  padding-top: 28px;
}

/* Lingkaran centang halaman sukses, dengan cahaya lembut. */
.redeem-check {
  width: 76px;
  height: 76px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0f5132;
  background: linear-gradient(150deg, #6ee7b7 0%, #34d399 100%);
  box-shadow: 0 0 0 14px rgba(52, 211, 153, .16), 0 18px 32px -16px rgba(16, 185, 129, .7);
}

/* --- Toast (C8.Redeem.toast) ---------------------------------- */
.c8-toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 120;
  transform: translate(-50%, 16px);
  max-width: min(390px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
  color: #fff;
  background: #221b4e;
  box-shadow: 0 18px 40px -18px rgba(34, 27, 78, .8);
  opacity: 0;
  transition: opacity .25s ease, transform .25s ease;
}
.c8-toast.show { opacity: 1; transform: translate(-50%, 0); }
.c8-toast-error   { background: #be123c; }
.c8-toast-success { background: #047857; }

/* --- Scrollbar halus ------------------------------------------ */
::-webkit-scrollbar { width: 0; height: 0; }
