/* SIMANIS · Lapisan UI bersama: transisi halaman, bilah progres, pop-up konfirmasi. */

/* ---------- Transisi antarhalaman (View Transitions lintas dokumen: Chrome/Edge 126+) ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: si-vt-out .26s cubic-bezier(.4, 0, 1, 1) both; }
::view-transition-new(root) { animation: si-vt-in .42s cubic-bezier(.16, 1, .3, 1) both; }
.sidebar { view-transition-name: si-sidebar; }
.topbar { view-transition-name: si-topbar; }
::view-transition-old(si-sidebar), ::view-transition-new(si-sidebar),
::view-transition-old(si-topbar), ::view-transition-new(si-topbar) { animation: none; mix-blend-mode: normal; }
::view-transition-group(si-sidebar), ::view-transition-group(si-topbar) { animation-duration: 0s; }
@keyframes si-vt-out { to { opacity: 0; transform: translateY(-10px) scale(.992); filter: blur(2px); } }
@keyframes si-vt-in { from { opacity: 0; transform: translateY(18px) scale(.996); } }

/* Peramban tanpa View Transitions: konten masuk & keluar dengan animasi CSS. */
html:not(.si-vt) .page-content,
html:not(.si-vt) .si-enter { animation: si-enter .5s cubic-bezier(.16, 1, .3, 1) backwards; }
html:not(.si-vt) body.si-leaving .page-content,
html:not(.si-vt) body.si-leaving .si-enter { animation: si-leave .2s cubic-bezier(.4, 0, 1, 1) forwards; }
@keyframes si-enter { from { opacity: 0; transform: translateY(16px); } }
@keyframes si-leave { to { opacity: 0; transform: translateY(-8px); } }

/* Elemen halaman muncul berurutan (kartu, panel). */
.page-content > * > .kr-card, .page-content > * > .kr-grid, .page-content > * > .ly-stats,
.page-content > * > .kr-tabs, .page-content .dash-layanan > a, .page-content .dash-grid > *,
.page-content .dash-columns > * { animation: si-rise .55s cubic-bezier(.16, 1, .3, 1) backwards; }
.page-content > * > :nth-child(2) { animation-delay: .04s; } .page-content > * > :nth-child(3) { animation-delay: .08s; }
.page-content > * > :nth-child(4) { animation-delay: .12s; } .page-content > * > :nth-child(5) { animation-delay: .16s; }
.page-content > * > :nth-child(n+6) { animation-delay: .2s; }
.page-content .dash-layanan > a:nth-child(2), .page-content .dash-grid > :nth-child(2) { animation-delay: .06s; }
.page-content .dash-layanan > a:nth-child(3), .page-content .dash-grid > :nth-child(3) { animation-delay: .12s; }
.page-content .dash-grid > :nth-child(4) { animation-delay: .18s; }
@keyframes si-rise { from { opacity: 0; transform: translateY(14px); } }

/* ---------- Bilah progres navigasi ---------- */
.si-progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 10000; pointer-events: none; opacity: 0; transition: opacity .2s; }
.si-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #d9b45f, #f3dc9b, #2f8a66); box-shadow: 0 0 12px rgba(217, 180, 95, .7); border-radius: 0 3px 3px 0; }
.si-progress.on { opacity: 1; }
.si-progress.on i { animation: si-progress 8s cubic-bezier(.08, .82, .17, 1) forwards; }
.si-progress.done i { width: 100% !important; transition: width .2s; animation: none; }
@keyframes si-progress { 0% { width: 0; } 10% { width: 35%; } 40% { width: 70%; } 100% { width: 94%; } }

/* ---------- Pop-up konfirmasi ---------- */
.si-modal { position: fixed; inset: 0; z-index: 10001; display: grid; place-items: center; padding: 18px; }
.si-modal[hidden] { display: none; }
.si-modal-backdrop { position: absolute; inset: 0; background: rgba(8, 30, 23, .5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: si-fade .22s ease both; }
.si-modal-card { position: relative; width: min(440px, 100%); background: #fff; border-radius: 22px; padding: 26px 26px 20px; box-shadow: 0 30px 80px rgba(8, 40, 30, .35), 0 0 0 1px rgba(255, 255, 255, .6) inset;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif; color: #1d2b26; text-align: center; animation: si-pop .38s cubic-bezier(.2, 1.3, .4, 1) both; overflow: hidden; }
.si-modal-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--si-tone, #1e6049); }
.si-modal-icon { width: 64px; height: 64px; margin: 4px auto 14px; border-radius: 50%; display: grid; place-items: center; background: var(--si-soft, #e6f1eb); color: var(--si-tone, #1e6049); position: relative; }
.si-modal-icon::after { content: ""; position: absolute; inset: -7px; border-radius: 50%; border: 2px solid var(--si-soft, #e6f1eb); animation: si-ring 1.8s ease-out infinite; }
.si-modal-icon svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.si-modal-title { font-size: 18px; font-weight: 800; margin: 0 0 6px; letter-spacing: -.2px; }
.si-modal-text { font-size: 13.5px; line-height: 1.6; color: #5e6c65; margin: 0 0 20px; white-space: pre-line; }
.si-modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.si-modal-actions button { font: 700 13.5px/1 "Plus Jakarta Sans", system-ui, sans-serif; min-height: 46px; border-radius: 13px; cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s; }
.si-modal-actions button:active { transform: scale(.97); }
.si-btn-cancel { background: #f2f5f3; color: #33443b; border: 1px solid #e1e8e3; }
.si-btn-cancel:hover { background: #e9eeeb; }
.si-btn-ok { background: var(--si-tone, #1e6049); color: #fff; border: 0; box-shadow: 0 8px 20px -6px var(--si-tone, #1e6049); }
.si-btn-ok:hover { filter: brightness(1.08); box-shadow: 0 10px 24px -6px var(--si-tone, #1e6049); }
.si-modal-actions button:focus-visible { outline: 3px solid #d9b45f; outline-offset: 2px; }
.si-modal.si-closing .si-modal-backdrop { animation: si-fade .18s ease reverse both; }
.si-modal.si-closing .si-modal-card { animation: si-pop-out .18s ease both; }
.si-tone-danger { --si-tone: #b3403a; --si-soft: #fcebea; }
.si-tone-warning { --si-tone: #b07a12; --si-soft: #fff4df; }
.si-tone-primary { --si-tone: #1e6049; --si-soft: #e6f1eb; }
.si-tone-info { --si-tone: #2b5d8a; --si-soft: #e3eefa; }
body.si-modal-open { overflow: hidden; }
@keyframes si-fade { from { opacity: 0; } }
@keyframes si-pop { from { opacity: 0; transform: translateY(18px) scale(.94); } }
@keyframes si-pop-out { to { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes si-ring { 0% { transform: scale(.85); opacity: 1; } 100% { transform: scale(1.25); opacity: 0; } }
@media (max-width: 480px) { .si-modal { align-items: end; padding: 0; } .si-modal-card { width: 100%; border-radius: 22px 22px 0 0; padding-bottom: calc(20px + env(safe-area-inset-bottom)); animation-name: si-sheet; } @keyframes si-sheet { from { transform: translateY(100%); } } }

/* Tombol sedang memproses setelah dikonfirmasi */
.si-busy { position: relative; pointer-events: none; opacity: .85; }
.si-busy::after { content: ""; display: inline-block; width: 13px; height: 13px; margin-left: 8px; vertical-align: -2px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: si-spin .7s linear infinite; }
@keyframes si-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media print { .si-progress, .si-modal { display: none !important; } }

/* Varian keluar (logout): foto pengguna + lencana */
.si-tone-logout{--si-tone:#1e6049;--si-soft:#e6f1eb}
.si-tone-logout::before{height:86px!important;background:linear-gradient(120deg,#123f33,#1e6049 60%,#b28a42)!important}
.si-tone-logout .si-modal-icon{margin-top:22px;background:#fff;box-shadow:0 10px 26px rgba(8,40,30,.25)}
.si-modal-icon.has-avatar{width:84px;height:84px;padding:4px}
.si-modal-icon.has-avatar::after{display:none}
.si-modal-icon img{width:100%;height:100%;border-radius:50%;object-fit:cover;display:block}
.si-modal-badge{position:absolute;right:-2px;bottom:-2px;width:30px;height:30px;border-radius:50%;display:grid;place-items:center;background:#c98f22;color:#fff;border:3px solid #fff}
.si-modal-badge svg{width:15px!important;height:15px!important}
.si-tone-logout .si-btn-ok{background:linear-gradient(135deg,#1e6049,#174d3b)}
html[data-theme=dark] .si-tone-logout .si-modal-icon,html[data-theme=dark] .si-modal-badge{border-color:#1c2722}
html[data-theme=dark] .si-tone-logout .si-modal-icon{background:#1c2722}
