/**
 * SIMRS Universal Image Loading Spinner & Progress Bar Styles
 * Standar Visual Modern Rumah Sakit
 */

/* Shimmer Skeleton pada Parent Container saat Gambar Sedang Dimuat */
.simrs-img-parent-loading {
    position: relative !important;
    background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%) !important;
    background-size: 200% 100% !important;
    animation: simrsSkeletonShimmer 1.8s ease-in-out infinite !important;
}

@keyframes simrsSkeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Sembunyikan visual broken / unfinished alt text saat gambar masih dalam proses loading */
img:not(.simrs-img-loaded) {
    color: transparent !important;
}

img.simrs-img-error {
    color: #94a3b8 !important;
}

/* Overlay Wadah Spinner & Progress Bar */
.simrs-img-loader-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, rgba(248, 250, 252, 0.96) 0%, rgba(241, 245, 249, 0.90) 100%);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 5;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.simrs-img-loader-overlay.simrs-loader-fadeout {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Spinner & Progress Bar Box */
.simrs-img-spinner-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 1.25rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

/* Dual Ring Emerald Spinner */
.simrs-img-spinner-ring {
    width: 38px;
    height: 38px;
    border: 3.5px solid rgba(16, 185, 129, 0.18);
    border-top-color: #059669;
    border-right-color: #10b981;
    border-bottom-color: #f59e0b;
    border-radius: 50%;
    animation: simrsSpinRotate 0.75s linear infinite;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.25);
}

@keyframes simrsSpinRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Progress Bar Track */
.simrs-img-progressbar-track {
    width: 86px;
    height: 5px;
    background: rgba(203, 213, 225, 0.75);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Animated Sliding Gradient Progress Bar */
.simrs-img-progressbar-fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 45%;
    background: linear-gradient(90deg, #059669 0%, #10b981 50%, #34d399 100%);
    border-radius: 9999px;
    animation: simrsProgressSlide 1.2s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

@keyframes simrsProgressSlide {
    0% {
        transform: translateX(-120%);
        width: 30%;
    }
    50% {
        transform: translateX(40%);
        width: 60%;
    }
    100% {
        transform: translateX(250%);
        width: 30%;
    }
}

/* Caption Label with Pulsing Dot */
.simrs-img-loader-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #065f46;
}

.simrs-pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    animation: simrsDotPulse 1s ease-in-out infinite;
}

@keyframes simrsDotPulse {
    0%, 100% { transform: scale(0.8); opacity: 0.6; }
    50% { transform: scale(1.3); opacity: 1; }
}

/* Image Transitions */
img.simrs-img-loading {
    opacity: 0.15 !important;
    filter: blur(8px);
    transition: opacity 0.45s ease-out, filter 0.45s ease-out;
}

img.simrs-img-loaded {
    opacity: 1 !important;
    filter: blur(0px) !important;
    transition: opacity 0.45s ease-out, filter 0.45s ease-out;
}
