/* Summarecon Learning PWA — local_slpwa 1.1 */
:root{
  --slpwa-orange:#F47A20; --slpwa-amber:#FAA51A; --slpwa-yellow:#FECD07; --slpwa-green:#006526;
  --slpwa-ink:#1d1d1f; --slpwa-muted:#8a8a8e; --slpwa-line:rgba(0,0,0,.08);
  --slpwa-bg:rgba(255,255,255,.92);
  --slpwa-nav-h:62px;
  --slpwa-safe-b:env(safe-area-inset-bottom,0px);
}
html.dark-mode{ --slpwa-ink:#f5f5f7; --slpwa-muted:#9a9aa0; --slpwa-line:rgba(255,255,255,.1); --slpwa-bg:rgba(24,24,27,.92); }

/* ---------- App feel (hanya saat dibuka sebagai app) ---------- */
html.slpwa-standalone body{ -webkit-tap-highlight-color:transparent; }
html.slpwa-standalone a, html.slpwa-standalone button{ touch-action:manipulation; }

/* ---------- Bottom navigation ---------- */
.slpwa-nav{
  position:fixed; left:0; right:0; bottom:0; z-index:1035;
  display:flex; justify-content:space-around; align-items:stretch;
  height:calc(var(--slpwa-nav-h) + var(--slpwa-safe-b));
  padding:0 max(8px, env(safe-area-inset-left)) var(--slpwa-safe-b) max(8px, env(safe-area-inset-right));
  background:var(--slpwa-bg);
  -webkit-backdrop-filter:saturate(180%) blur(18px); backdrop-filter:saturate(180%) blur(18px);
  border-top:1px solid var(--slpwa-line);
  box-shadow:0 -6px 24px rgba(0,0,0,.04);
  transition:transform .28s cubic-bezier(.2,.8,.2,1);
  -webkit-user-select:none; user-select:none; -webkit-touch-callout:none;
}
.slpwa-nav.is-hidden{ transform:translateY(110%); }
.slpwa-nav__item{
  flex:1 1 0; min-width:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px;
  color:var(--slpwa-muted) !important; text-decoration:none !important; font-size:11px; font-weight:500; line-height:1;
  letter-spacing:.01em; transition:color .2s;
}
.slpwa-nav__icon{
  position:relative; display:flex; align-items:center; justify-content:center;
  width:56px; height:30px; border-radius:999px; transition:background-color .25s, transform .15s;
}
.slpwa-nav__icon svg{ width:23px; height:23px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.slpwa-nav__icon img{ width:25px; height:25px; border-radius:50%; object-fit:cover; box-shadow:0 0 0 1.5px var(--slpwa-line); }
.slpwa-nav__item:active .slpwa-nav__icon{ transform:scale(.9); }
.slpwa-nav__item.is-active{ color:var(--slpwa-orange) !important; font-weight:600; }
.slpwa-nav__item.is-active .slpwa-nav__icon{ background:rgba(244,122,32,.12); }
.slpwa-nav__item.is-active .slpwa-nav__icon svg{ stroke-width:2.1; }
.slpwa-nav__item.is-active .slpwa-nav__icon img{ box-shadow:0 0 0 2px var(--slpwa-orange); }
.slpwa-nav__label{ max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ruang supaya konten tidak ketutup nav */
html.slpwa-has-nav body,
html.slpwa-has-nav #page.drawers{ padding-bottom:calc(var(--slpwa-nav-h) + var(--slpwa-safe-b)) !important; }
html.slpwa-has-nav .btn-footer-popover,
html.slpwa-has-nav #goto-top-link,
html.slpwa-has-nav .stickyfooter,
html.slpwa-has-nav #sticky-footer{ bottom:calc(var(--slpwa-nav-h) + var(--slpwa-safe-b) + 8px) !important; }
/* sembunyikan nav saat drawer / modal terbuka */
html.slpwa-has-nav body.modal-open .slpwa-nav,
html.slpwa-has-nav body:has(.drawer.show) .slpwa-nav{ transform:translateY(110%); }

/* ---------- Install banner ---------- */
.slpwa-install{
  position:fixed; left:12px; right:12px; z-index:1060;
  bottom:calc(12px + var(--slpwa-safe-b));
  max-width:480px; margin:0 auto;
  display:flex; align-items:center; gap:12px; padding:12px 12px 12px 12px;
  background:#fff; color:#1d1d1f; border-radius:18px;
  box-shadow:0 12px 40px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.04);
  transform:translateY(140%); transition:transform .4s cubic-bezier(.2,.9,.2,1);
  font-family:inherit;
}
.slpwa-install.is-in{ transform:none; }
.slpwa-install__icon{ width:46px; height:46px; border-radius:11px; flex:none; box-shadow:0 0 0 1px rgba(0,0,0,.06); }
.slpwa-install__txt{ flex:1; min-width:0; }
.slpwa-install__txt b{ display:block; font-size:14.5px; line-height:1.25; }
.slpwa-install__txt span{ display:block; font-size:12.5px; color:#6e6e73; margin-top:2px; line-height:1.3; }
.slpwa-btn{
  appearance:none; border:0; border-radius:999px; padding:9px 15px; min-height:36px;
  font:600 13.5px/1 inherit; cursor:pointer; white-space:nowrap;
}
.slpwa-btn--primary{ background:var(--slpwa-orange); color:#fff; }
.slpwa-btn--ghost{ background:transparent; color:#6e6e73; padding:9px 8px; }

/* iOS guide sheet */
.slpwa-sheet-backdrop{
  position:fixed; inset:0; z-index:1070; background:rgba(0,0,0,.35); opacity:0; transition:opacity .25s;
}
.slpwa-sheet-backdrop.is-in{ opacity:1; }
.slpwa-sheet{
  position:fixed; left:0; right:0; bottom:0; z-index:1071; max-width:520px; margin:0 auto;
  background:#fff; color:#1d1d1f; border-radius:22px 22px 0 0;
  padding:10px 22px calc(22px + var(--slpwa-safe-b));
  transform:translateY(100%); transition:transform .35s cubic-bezier(.2,.9,.2,1);
}
.slpwa-sheet.is-in{ transform:none; }
.slpwa-sheet__grab{ width:38px; height:5px; border-radius:3px; background:#d1d1d6; margin:0 auto 16px; }
.slpwa-sheet h3{ font-size:19px; margin:0 0 4px; font-weight:700; }
.slpwa-sheet p{ margin:0 0 16px; color:#6e6e73; font-size:14px; }
.slpwa-steps{ list-style:none; margin:0 0 20px; padding:0; }
.slpwa-steps li{ display:flex; align-items:center; gap:12px; padding:11px 0; border-top:1px solid #f0f0f2; font-size:14.5px; }
.slpwa-steps li:first-child{ border-top:0; }
.slpwa-steps .n{ flex:none; width:26px; height:26px; border-radius:50%; background:rgba(244,122,32,.12); color:var(--slpwa-orange); font-weight:700; font-size:13px; display:flex; align-items:center; justify-content:center; }
.slpwa-steps svg{ width:20px; height:20px; vertical-align:-4px; stroke:#0a84ff; fill:none; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.slpwa-sheet .slpwa-btn{ width:100%; padding:14px; font-size:15px; }

/* ---------- Splash / loading screen berlogo (hanya mode app) ---------- */
html.slpwa-standalone::before,
html.slpwa-standalone::after{
  content:''; position:fixed; z-index:2147483500; pointer-events:none;
  opacity:0; visibility:hidden;
  transition:opacity .28s ease, visibility 0s linear .28s;
}
html.slpwa-standalone::before{ inset:0; background:#fff; }
html.dark-mode.slpwa-standalone::before{ background:#101113; }
html.slpwa-standalone::after{
  left:50%; top:50%; width:150px; height:112px; margin:-56px 0 0 -75px;
  background:url('../icons/logo.svg') center/contain no-repeat;
}
html.slpwa-booting::before, html.slpwa-booting::after,
html.slpwa-loading::before, html.slpwa-loading::after{
  opacity:1; visibility:visible; pointer-events:auto;
  transition:opacity .16s ease, visibility 0s;
}
html.slpwa-booting::before, html.slpwa-booting::after{ transition:none; }
html.slpwa-booting::before{ animation:slpwa-failsafe .2s ease 9s forwards; }
html.slpwa-booting::after{ animation:slpwa-pulse 1.3s ease-in-out infinite, slpwa-failsafe .2s ease 9s forwards; }
html.slpwa-loading::after{ animation:slpwa-pulse 1.3s ease-in-out infinite; }
@keyframes slpwa-pulse{ 0%,100%{ transform:scale(.92); } 50%{ transform:scale(1.05); } }
@keyframes slpwa-failsafe{ to{ opacity:0; visibility:hidden; pointer-events:none; } }
@media (prefers-reduced-motion:reduce){
  html.slpwa-booting::after, html.slpwa-loading::after{ animation:none; }
}

/* ---------- Tombol fixed bawaan Moodle/Space yang bentrok dengan bottom nav ---------- */
/* Switch "Edit mode" (admin/guru): pindah ke kiri-bawah, di atas nav, supaya tidak menutupi tab Profile / tombol kanan lain */
html.slpwa-has-nav .editmode-switch-form{
  left:16px !important; right:auto !important;
  bottom:calc(var(--slpwa-nav-h) + var(--slpwa-safe-b) + 14px) !important;
}

/* ---------- Thumbnail card tidak kepotong ---------- */
img.slpwa-nocrop{ object-fit:contain !important; object-position:center !important; }
.slpwa-nocrop-bg{ background-size:contain !important; background-repeat:no-repeat !important; background-position:center !important; }

/* ---------- Video fullscreen ---------- */
.slpwa-fsbtn{
  display:inline-flex; align-items:center; gap:6px; margin:8px 0 4px;
  appearance:none; border:1px solid var(--slpwa-line); background:transparent; color:inherit;
  border-radius:999px; padding:7px 13px; font:600 12.5px/1 inherit; cursor:pointer;
}
.slpwa-fsbtn svg{ width:15px; height:15px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.slpwa-fsbtn:active{ transform:scale(.96); }

html.slpwa-fs-on, html.slpwa-fs-on body, html.slpwa-fs-on #page{ overflow:hidden !important; }
html.slpwa-fs-on .slpwa-nav, html.slpwa-fs-on .slpwa-install{ display:none !important; }
html.slpwa-fs-on #topBar, html.slpwa-fs-on .navbar.fixed-top, html.slpwa-fs-on .drawer, html.slpwa-fs-on .drawer-toggles,
html.slpwa-fs-on #page-footer, html.slpwa-fs-on .btn-footer-popover, html.slpwa-fs-on #goto-top-link,
html.slpwa-fs-on .editmode-switch-form{ visibility:hidden !important; }

/* Selector digandakan (.x.x) supaya menang atas aturan tema seperti ".h5p-iframe-wrapper iframe{height:100%!important}" */
html .slpwa-pseudofs.slpwa-pseudofs{
  position:fixed !important; inset:0 !important; top:0 !important; left:0 !important; right:0 !important; bottom:0 !important;
  width:100vw !important; height:100vh !important; height:100dvh !important;
  max-width:none !important; max-height:none !important; min-width:0 !important; min-height:0 !important;
  margin:0 !important; padding:0 !important; border:0 !important; border-radius:0 !important;
  transform:none !important; translate:none !important; box-sizing:border-box !important;
  background:#000 !important; overflow:hidden !important; display:block !important;
  z-index:2147483000 !important; touch-action:none;
}
/* iframe / video: sisakan area aman (notch & home indicator) */
html iframe.slpwa-pseudofs.slpwa-pseudofs, html video.slpwa-pseudofs.slpwa-pseudofs{
  top:env(safe-area-inset-top,0px) !important; left:env(safe-area-inset-left,0px) !important;
  right:auto !important; bottom:auto !important;
  width:calc(100vw - env(safe-area-inset-left,0px) - env(safe-area-inset-right,0px)) !important;
  height:calc(100vh - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)) !important;
  height:calc(100dvh - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)) !important;
}
/* wrapper (video.js, .ratio): isinya yang dipenuhkan */
html .slpwa-pseudofs.slpwa-pseudofs:not(iframe):not(video){
  padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px) !important;
}
.slpwa-pseudofs > iframe, .slpwa-pseudofs > video, .slpwa-pseudofs video.vjs-tech, .slpwa-pseudofs iframe.vjs-tech{
  position:absolute !important; top:env(safe-area-inset-top,0px) !important; left:env(safe-area-inset-left,0px) !important;
  width:calc(100% - env(safe-area-inset-left,0px) - env(safe-area-inset-right,0px)) !important;
  height:calc(100% - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)) !important;
  object-fit:contain;
}

/* Tombol Tutup & toast: dilempar ke top layer (popover) agar tetap di atas video → timpa gaya bawaan [popover] */
.slpwa-fsclose, .slpwa-toast{ margin:0; border:0; overflow:visible; width:auto; height:auto; }
.slpwa-fsclose{
  position:fixed; z-index:2147483001;
  top:calc(10px + env(safe-area-inset-top,0px)); right:calc(10px + env(safe-area-inset-right,0px)); left:auto; bottom:auto;
  display:flex; align-items:center; gap:6px; appearance:none; cursor:pointer;
  padding:9px 14px; border-radius:999px; background:rgba(30,30,30,.72); color:#fff;
  -webkit-backdrop-filter:blur(12px); backdrop-filter:blur(12px);
  font:600 13px/1 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
}
.slpwa-fsclose svg{ width:14px; height:14px; stroke:#fff; stroke-width:2.4; fill:none; stroke-linecap:round; }
.slpwa-toast{
  position:fixed; z-index:2147483002; left:50%; top:auto; right:auto; bottom:calc(28px + var(--slpwa-safe-b));
  transform:translateX(-50%) translateY(20px); opacity:0; transition:all .3s;
  background:rgba(30,30,30,.85); color:#fff; padding:10px 16px; border-radius:999px;
  font:500 13px/1.3 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
  max-width:calc(100vw - 40px); width:max-content; text-align:center; pointer-events:none;
}
.slpwa-toast.is-in{ opacity:1; transform:translateX(-50%) translateY(0); }
