/* =====================================================================
   Player video LMS (dashboard member + halaman course publik)
   ---------------------------------------------------------------------
   Dimuat SESUDAH app.css / public.css agar aturan kontrol kustom menang
   atas gaya form global. Semua warna memakai token tema bila ada, dengan
   fallback netral supaya halaman publik tetap benar.
   ===================================================================== */

.video-wrap { position: relative; margin: 0 0 4px; }
.video-frame {
  position: relative;
  width: 100%;
  max-width: 760px;
  aspect-ratio: 16 / 9;
  margin: 0 auto;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.25);
}
.video-frame iframe,
.video-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.video-frame video { object-fit: contain; }
.video-embed { position: absolute; inset: 0; }
.video-embed[hidden] { display: none; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-frame:focus { outline: none; }
.video-frame:focus-visible { outline: 3px solid var(--ring, #22c55e); outline-offset: 2px; }

/* ---------- Watermark member: penanda rekaman, bukan penghalang ---------- */
.video-wm {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 4;
  max-width: 62%;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgb(0 0 0 / 0.3);
  color: #fff;
  opacity: 0.55;
  font: 500 11.5px/1.3 "Plus Jakarta Sans", system-ui, sans-serif;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 2px rgb(0 0 0 / 0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  user-select: none;
}

/* ---------- Gerbang klik-untuk-putar (YouTube) ---------- */
.video-gate {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 100%;
  border: 0;
  cursor: pointer;
  background: rgb(8 10 14 / 0.55);
  color: #fff;
  font: 600 14px "Plus Jakarta Sans", system-ui, sans-serif;
}
.video-gate[hidden] { display: none; }
.video-gate:hover { background: rgb(8 10 14 / 0.45); }
.video-gate:focus-visible { outline: 3px solid var(--ring, #22c55e); outline-offset: -3px; }
.video-gate-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 999px;
  background: var(--primary, #1e5b4f);
  color: var(--primary-foreground, #fff);
  font-size: 22px;
  padding-left: 4px;
}
.video-gate-text { opacity: 0.9; }

/* ---------- Tombol lanjutkan menonton ---------- */
.video-resume {
  position: absolute;
  left: 12px;
  bottom: 58px;
  z-index: 5;
  max-width: calc(100% - 24px);
  padding: 7px 13px;
  border: 1px solid rgb(255 255 255 / 0.28);
  border-radius: 999px;
  background: rgb(6 9 14 / 0.78);
  color: #fff;
  font: 600 12.5px/1.2 "Plus Jakarta Sans", system-ui, sans-serif;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.video-resume[hidden] { display: none; }
.video-resume:hover { background: rgb(6 9 14 / 0.92); }
.video-resume:focus-visible { outline: 2px solid var(--ring, #22c55e); outline-offset: 2px; }

/* ---------- Kontrol kustom video file ---------- */
.video-ui { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.video-ui[hidden] { display: none; }
.video-chrome { pointer-events: auto; }

.video-bigplay {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 0.26);
  border-radius: 999px;
  background: rgb(8 10 14 / 0.58);
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.14s ease, opacity 0.14s ease, background 0.14s ease;
}
.video-bigplay:hover { transform: scale(1.04); background: rgb(8 10 14 / 0.76); }
.video-bigplay:focus-visible { outline: 3px solid var(--ring, #22c55e); outline-offset: 3px; }
.video-bigplay svg { width: 28px; height: 28px; margin-left: 3px; }
.video-wrap[data-state="playing"] .video-bigplay { opacity: 0; pointer-events: none; }

.video-loading { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.video-loading[hidden] { display: none; }
.video-loading span {
  width: 34px;
  height: 34px;
  border: 3px solid rgb(255 255 255 / 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: video-spin 0.8s linear infinite;
}
@keyframes video-spin { to { transform: rotate(360deg); } }

.video-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px;
  background: rgb(0 0 0 / 0.84);
  color: #fff;
  text-align: center;
  pointer-events: auto;
}
.video-error[hidden] { display: none; }
.video-error p { margin: 0; font-weight: 600; }
.video-error a { color: #fff; text-decoration: underline; font-size: 13px; }

.video-chrome {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 30px 8px 6px;
  background: linear-gradient(to top, rgb(3 6 12 / 0.9), rgb(3 6 12 / 0.48) 55%, transparent);
  transition: opacity 0.16s ease;
}
.video-wrap.is-idle .video-chrome { opacity: 0; pointer-events: none; }
.video-wrap.is-idle { cursor: none; }

.video-track { position: relative; height: 18px; display: flex; align-items: center; cursor: pointer; }
.video-track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.26);
}
.video-track:hover::before { height: 5px; }
.video-buffer {
  position: absolute;
  left: 0;
  width: 0;
  height: 4px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.42);
}
.video-played {
  position: absolute;
  left: 0;
  width: 0;
  height: 4px;
  border-radius: 999px;
  background: var(--primary, #22c55e);
}
.video-thumb {
  position: absolute;
  right: -6px;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.5);
  transform: scale(0.8);
  transition: transform 0.12s ease;
}
.video-track:hover .video-thumb,
.video-track:focus-within .video-thumb { transform: scale(1); }
.video-track:focus-within { outline: 2px solid var(--ring, #22c55e); outline-offset: 3px; border-radius: 4px; }

/* Input range transparan di atas track agar bisa diseret + dijangkau keyboard. */
.video-wrap input.video-seek {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 18px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  opacity: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.video-row { display: flex; align-items: center; gap: 2px; margin-top: 2px; color: #fff; }
.video-btn {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.video-btn:hover { background: rgb(255 255 255 / 0.14); }
.video-btn:focus-visible { outline: 2px solid var(--ring, #22c55e); outline-offset: 1px; }
.video-btn svg { width: 18px; height: 18px; }
.video-ico { display: grid; place-items: center; }
.video-ico-pause,
.video-ico-muted { display: none; }
.video-wrap[data-state="playing"] .video-ico-play { display: none; }
.video-wrap[data-state="playing"] .video-ico-pause { display: grid; }
.video-wrap[data-muted="1"] .video-ico-vol { display: none; }
.video-wrap[data-muted="1"] .video-ico-muted { display: grid; }

.video-vol { display: flex; align-items: center; gap: 2px; }
.video-wrap input.video-volume {
  width: 66px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--primary, #22c55e);
  cursor: pointer;
}
.video-time {
  margin: 0 6px;
  color: #e8ebf0;
  font: 500 12px/1 "Plus Jakarta Sans", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.video-slash { margin: 0 3px; opacity: 0.6; }
.video-grow { flex: 1 1 auto; }

.video-rate { display: flex; align-items: center; margin: 0; }
.video-wrap select.video-speed {
  width: auto;
  margin: 0;
  padding: 3px 5px;
  border: 1px solid rgb(255 255 255 / 0.24);
  border-radius: 7px;
  background: rgb(255 255 255 / 0.1);
  color: #fff;
  font: 600 11.5px/1.2 "Plus Jakarta Sans", system-ui, sans-serif;
  cursor: pointer;
}
.video-wrap select.video-speed option { background: #161920; color: #fff; }
.video-wrap select.video-speed:focus-visible { outline: 2px solid var(--ring, #22c55e); outline-offset: 1px; }
.video-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Bilah meta di bawah player ---------- */
.video-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  max-width: 760px;
  margin: 10px auto 0;
  color: var(--muted-foreground, #6f675c);
  font-size: 12.5px;
}
.video-hint { line-height: 1.4; }
.video-tools { display: flex; align-items: center; gap: 8px; }
.video-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--border, #e3e7ec);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: 600 12px/1.2 "Plus Jakarta Sans", system-ui, sans-serif;
  cursor: pointer;
}
.video-pill svg { width: 14px; height: 14px; }
.video-pill:hover { background: color-mix(in srgb, currentColor 8%, transparent); }
.video-pill:focus-visible { outline: 2px solid var(--ring, #22c55e); outline-offset: 2px; }
.video-pill[aria-pressed="true"] { border-color: var(--primary, #22c55e); color: var(--primary-ink, #1e5b4f); }
.video-next {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  margin-left: auto;
  padding: 5px 11px;
  border: 1px solid var(--border, #e3e7ec);
  border-radius: 999px;
  color: var(--foreground, #2e2a24);
  text-decoration: none;
}
.video-next:hover { text-decoration: none; border-color: var(--primary, #22c55e); }
.video-next-label { color: var(--muted-foreground, #6f675c); font-size: 11.5px; }
.video-next strong {
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}
.video-next-arrow { opacity: 0.7; }
.video-next:focus-visible { outline: 2px solid var(--ring, #22c55e); outline-offset: 2px; }

/* ---------- Mode lebar (theater) ---------- */
.video-wrap.video-theater {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 16px;
  background: #05070a;
}
.video-wrap.video-theater .video-frame { width: 100%; max-width: 1240px; box-shadow: none; }
.video-wrap.video-theater .video-meta { width: 100%; max-width: 1240px; color: #c7ceda; }
.video-wrap.video-theater .video-hint { color: #c7ceda; }
.video-wrap.video-theater .video-next { color: #fff; border-color: rgb(255 255 255 / 0.28); }
.video-wrap.video-theater .video-next-label { color: #b9c2d0; }
.video-wrap.video-theater .video-pill { border-color: rgb(255 255 255 / 0.28); color: #fff; }
body.video-theater-open { overflow: hidden; }

/* ---------- Layar penuh: kontrol tetap menempel di bingkai ---------- */
.video-frame:fullscreen {
  width: 100%;
  height: 100%;
  max-width: none;
  aspect-ratio: auto;
  border-radius: 0;
  box-shadow: none;
}

@media (max-width: 640px) {
  .video-frame { border-radius: 10px; }
  .video-chrome { padding: 22px 4px 4px; }
  .video-row { gap: 0; }
  .video-vol,
  .video-pip,
  .video-theater-btn { display: none; }
  .video-btn { width: 32px; height: 32px; }
  .video-time { margin: 0 4px; font-size: 11px; }
  .video-resume { bottom: 52px; font-size: 12px; }
  .video-wm { top: 7px; right: 8px; max-width: 70%; font-size: 10.5px; }
  .video-meta { font-size: 12px; }
  .video-next { width: 100%; margin-left: 0; }
  .video-next strong { flex: 1; max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .video-chrome,
  .video-bigplay,
  .video-thumb { transition: none; }
  .video-loading span { animation-duration: 1.6s; }
}
