/* ==========================================================
   assets/animasi.css — Animasi & transisi global PustakaSALSA
   Di-include lewat navbar_publik.php & includes/sidebar.php
   supaya otomatis aktif di hampir semua halaman.
   ========================================================== */

/* Transisi halaman: fade-in saat load, fade-out singkat saat pindah halaman */
html.animasi-siap body { animation: psFadeInBody .35s ease both; }
@keyframes psFadeInBody { from { opacity: 0; } to { opacity: 1; } }
body.ps-navigating { opacity: 0 !important; transition: opacity .15s ease; }

/* Scroll reveal: elemen dengan class reveal-on-scroll muncul halus saat kelihatan */
.reveal-on-scroll { opacity: 0; transform: translateY(18px); transition: opacity .55s cubic-bezier(.16,1,.3,1), transform .55s cubic-bezier(.16,1,.3,1); }
.reveal-on-scroll.revealed { opacity: 1; transform: translateY(0); }

/* Kartu interaktif: naik halus + shadow membesar saat hover */
.card-hover { transition: transform .25s cubic-bezier(.16,1,.3,1), box-shadow .25s ease; }
.card-hover:hover { transform: translateY(-4px); box-shadow: 0 12px 28px -8px rgba(0,0,0,.18); }

/* Tombol dengan micro-interaction pop */
.btn-pop { transition: transform .15s ease, box-shadow .15s ease, background-color .2s ease; }
.btn-pop:hover { transform: translateY(-1px) scale(1.02); }
.btn-pop:active { transform: scale(.95); }

/* Gambar zoom halus saat hover di dalam kartu */
.img-zoom-wrap { overflow: hidden; }
.img-zoom-wrap img { transition: transform .4s cubic-bezier(.16,1,.3,1); }
.img-zoom-wrap:hover img { transform: scale(1.08); }

/* Skeleton loading shimmer (dipakai saat konten masih dimuat via AJAX) */
.skeleton { background: linear-gradient(90deg, #eee 25%, #f5f5f5 37%, #eee 63%); background-size: 400% 100%; animation: psShimmer 1.4s ease infinite; }
@keyframes psShimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* Badge/notification pulse halus */
.badge-pulse { animation: psBadgePulse 1.8s ease-in-out infinite; }
@keyframes psBadgePulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }

/* Fade-slide untuk item list (komentar, notifikasi, dsb) */
.list-in { animation: psListIn .35s cubic-bezier(.16,1,.3,1) both; }
@keyframes psListIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Underline animasi untuk link navigasi */
.nav-underline { position: relative; }
.nav-underline::after { content: ''; position: absolute; left: 0; bottom: -3px; width: 0; height: 2px; background: currentColor; transition: width .25s ease; }
.nav-underline:hover::after { width: 100%; }

/* Spinner halus untuk loading state tombol */
.ps-spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: psSpin .6s linear infinite; }
@keyframes psSpin { to { transform: rotate(360deg); } }

/* ==========================================================
   Bottom Navigation (mobile web-app feel)
   ========================================================== */
.ps-bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    display: flex; align-items: stretch; justify-content: space-around;
    background: #fff; border-top: 1px solid #e5e7eb;
    box-shadow: 0 -4px 16px rgba(0,0,0,.06);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.ps-bn-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; padding: 8px 2px 6px; color: #6b7280; font-size: 10px; font-weight: 600;
    background: none; border: none; cursor: pointer; transition: color .15s ease, transform .15s ease;
}
.ps-bn-item i { font-size: 18px; margin-bottom: 1px; transition: transform .15s ease; }
.ps-bn-item:hover, .ps-bn-item:active { color: #2563eb; }
.ps-bn-item:active i { transform: scale(1.15); }
.ps-bn-relative { position: relative; }
.ps-bn-badge {
    position: absolute; top: 2px; right: 22%; background: #ef4444; color: #fff;
    font-size: 9px; font-weight: 700; min-width: 15px; height: 15px; border-radius: 999px;
    display: flex; align-items: center; justify-content: center; padding: 0 3px;
}
.ps-bn-fab-wrap { color: #2563eb; }
.ps-bn-fab {
    width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg,#2563eb,#4f46e5); color: #fff; font-size: 15px; margin-bottom: 2px;
    box-shadow: 0 4px 10px rgba(37,99,235,.35);
}

/* Bottom sheet "Lainnya" */
.ps-bn-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 49; }
.ps-bn-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: #fff; border-radius: 20px 20px 0 0; padding: 10px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    transform: translateY(100%); transition: transform .3s cubic-bezier(.16,1,.3,1);
    max-height: 75vh; overflow-y: auto;
}
.ps-bn-sheet-open { transform: translateY(0); }
.ps-bn-sheet-handle { width: 40px; height: 4px; border-radius: 999px; background: #e5e7eb; margin: 4px auto 14px; }
.ps-bn-sheet-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.ps-bn-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: #374151; position: relative; }
.ps-bn-tile-icon { width: 48px; height: 48px; border-radius: 16px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 19px; box-shadow: 0 4px 10px rgba(0,0,0,.12); transition: transform .15s ease; }
.ps-bn-tile:active .ps-bn-tile-icon { transform: scale(.92); }
.ps-bn-sheet-close { width: 100%; text-align: center; font-size: 12px; font-weight: 700; color: #6b7280; padding: 14px 0 4px; background: none; border: none; }

/* Kasih ruang di bawah supaya konten tidak ketutup bottom nav */
body.ps-has-bottom-nav { padding-bottom: 68px; }
@media (min-width: 768px) { body.ps-has-bottom-nav { padding-bottom: 0; } }
/* Untuk layout admin (h-screen + main yang scroll sendiri), body tidak ikut discroll,
   jadi padding ekstra perlu ditaruh di elemen <main> yang sebenarnya scroll */
@media (max-width: 767px) {
    body.ps-has-bottom-nav main { padding-bottom: 76px; }
}
