/* ========================================
   PAGE TRANSITIONS - SMOOTH NAVIGATION
   ======================================== */

/* Page transition overlay */
.page-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Active state - fading in */
.page-transition-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* Page fade-in animation on load - from TOP */
.page-fade-in {
    animation: pageFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
        /* Slide from TOP */
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Content wrapper for transitions */
.content-wrapper {
    opacity: 1;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Content fading out */
.content-wrapper.fading-out {
    opacity: 0;
}

/* Exception: Don't hide modals and map controls */
.header-area,
.main-nav,
.info,
.modal,
#ModalPage1,
.modal-dialog,
.modal-content,
.bootstrap-modal,
[role="dialog"],
.modal-backdrop,
.close-modal-btn {
    visibility: visible !important;
    opacity: 1 !important;
}

/* .cari modal - ONLY visible when .show class present */
.cari.show {
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 99999 !important;
    position: fixed !important;
}

/* Force modal above everything */
.cari.show {
    z-index: 99999 !important;
    /* Above page overlay (9999) */
    position: fixed !important;
}

/* Ensure close button is clickable */
.close-modal-btn,
button.close-modal-btn,
.cari .close-modal-btn {
    pointer-events: auto !important;
    z-index: 100000 !important;
    /* Above modal */
    cursor: pointer !important;
    position: absolute !important;
    display: block !important;
}

/* Mobile specific fix */
@media (max-width: 768px) {
    .cari {
        z-index: 99999 !important;
    }

    .close-modal-btn {
        display: block !important;
        pointer-events: auto !important;
        touch-action: auto !important;
        z-index: 100000 !important;
    }
}


/* Prevent scrolling during transition */
body.transitioning {
    overflow: hidden;
}

/* Loading indicator during transition */
.transition-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.transition-loading.active {
    opacity: 1;
}

.transition-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f2f5;
    border-top: 3px solid #22b3c1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Smooth link transitions */
a:not(.no-transition) {
    position: relative;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .page-transition-overlay {
        transition-duration: 0.3s;
    }

    .page-fade-in {
        animation-duration: 0.4s;
    }
}

/* Accessibility: Reduced motion */
@media (prefers-reduced-motion: reduce) {

    .page-transition-overlay,
    .content-wrapper,
    .page-fade-in {
        animation: none !important;
        transition: none !important;
    }
}