

/**
 * SiPena Universal Page Loader & App Splash Engine
 * 1. App Launch Splash Screen (Halaman Awal Pertama Kali Dibuka) - Animated Transparent Brand Logo
 * 2. Navigation Page Spinner (Penanda Navigasi / Klik Halaman) - Clean Simple Spinner Pill
 */

/* ========================================================================= */
/* 1. INITIAL APP LAUNCH SPLASH SCREEN (Halaman Awal Pertama Kali Dibuka)   */
/* ========================================================================= */
/* Sembunyikan secara default (0ms) untuk mencegah FOUC / kedipan hitam saat navigasi antar menu */
#sipenaAppSplash,
.sipena-app-splash {
    display: none !important;
}

/* Hanya tampil jika aplikasi baru pertama kali dibuka dalam sesi aktif */
html.sipena-first-launch:not(.sipena-splash-skipped) #sipenaAppSplash,
html.sipena-first-launch:not(.sipena-splash-skipped) .sipena-app-splash {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, #111d2e 0%, #0b131e 100%);
    z-index: 100000000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    user-select: none;
    -webkit-user-select: none;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s ease;
}

.sipena-app-splash.fade-out {
    opacity: 0 !important;
    visibility: hidden !important;
    transform: scale(1.04);
    pointer-events: none;
}

.sipena-splash-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Lingkaran Orbit Neon Mengelilingi Logo Transparan (Tanpa Kartu Kotak) */
.sipena-splash-icon-wrapper {
    position: relative;
    width: 86px;
    height: 86px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    background: transparent !important;
}

.sipena-splash-orbit {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(0, 210, 255, 0.15);
    border-top: 2.5px solid #00d2ff;
    border-right: 2.5px solid rgba(59, 130, 246, 0.8);
    box-shadow: 0 0 16px rgba(0, 210, 255, 0.35);
    animation: sipena-spin 0.85s linear infinite;
    pointer-events: none;
}

/* Logo SiPena Transparan Asli (Proporsional, Bukan Kartu Kotak) */
.sipena-splash-logo {
    width: 58px;
    height: 58px;
    object-fit: contain;
    background: transparent !important;
    filter: drop-shadow(0 4px 16px rgba(0, 210, 255, 0.5));
    animation: sipena-splash-breathe 2s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes sipena-splash-breathe {
    0% {
        transform: scale(0.96);
        filter: drop-shadow(0 2px 10px rgba(0, 210, 255, 0.35));
    }
    100% {
        transform: scale(1.04);
        filter: drop-shadow(0 6px 22px rgba(0, 210, 255, 0.75));
    }
}

.sipena-splash-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.sipena-splash-title {
    font-size: 1.45rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.08em;
    margin-bottom: 12px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}

.sipena-splash-loading-bar {
    width: 110px;
    height: 3px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}

.sipena-splash-loading-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 45%;
    background: linear-gradient(90deg, #00d2ff, #3b82f6);
    border-radius: 9999px;
    box-shadow: 0 0 8px #00d2ff;
    animation: sipena-splash-slide 1.2s infinite ease-in-out;
}

@keyframes sipena-splash-slide {
    0% { left: -50%; width: 30%; }
    50% { width: 60%; }
    100% { left: 100%; width: 30%; }
}


/* ========================================================================= */
/* 2. NAVIGATION PAGE INDICATOR (Penanda Halaman Dimuat saat Klik / Pindah)  */
/* ========================================================================= */

/* Top Neon Progress Bar (Chrome / YouTube / PWA Style) */
.sipena-page-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3.5px;
    width: 0%;
    background: linear-gradient(90deg, #00d2ff 0%, #3b82f6 50%, #00d2ff 100%);
    background-size: 200% 100%;
    box-shadow: 0 0 12px rgba(0, 210, 255, 0.85), 0 0 4px rgba(59, 130, 246, 0.6);
    z-index: 10000001;
    pointer-events: none;
    opacity: 0;
    transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

.sipena-page-progress.active {
    opacity: 1;
    animation: sipena-progress-shimmer 1.5s infinite linear;
}

@keyframes sipena-progress-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Dimmed Overlay to absorb multi-clicks during transit */
.sipena-page-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.35);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    z-index: 9999999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.sipena-page-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: none; /* [NON-BLOCKING] Jangan pernah memblokir klik navigasi (Dashboard / Kembali) pengguna */
}

/* Floating Frosted Glass Spinner Pill (Clean & Minimalist, Zero Logo) */
.sipena-page-spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    z-index: 10000000;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s ease;
}

.sipena-page-spinner.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.sipena-spinner-glass {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: rgba(15, 23, 42, 0.90);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1.5px solid rgba(0, 210, 255, 0.4);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 20px rgba(0, 210, 255, 0.3);
    padding: 12px 22px;
    border-radius: 9999px;
    color: #ffffff;
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.015em;
    user-select: none;
    -webkit-user-select: none;
}

.sipena-spinner-ring {
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, 0.2);
    border-top-color: #00d2ff;
    border-right-color: #00d2ff;
    border-radius: 50%;
    animation: sipena-spin 0.65s linear infinite;
    flex-shrink: 0;
}

@keyframes sipena-spin {
    to { transform: rotate(360deg); }
}

.sipena-spinner-text {
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
