/*
 * Every popup on the console and the classic partner panel (the owner,
 * 15 Nov 2026): the page behind dims a little and stays readable, barely
 * blurred, and the window rises in on a soft spring instead of snapping
 * open, then leaves quicker than it came. The same feel as the portal's and
 * the store's dialogs (dlg-* in their globals.css).
 *
 * Plain CSS loaded after Filament's, which sits in a layer, so these win.
 * Filament v4 moves the window with the `translate` and `scale` properties,
 * not `transform`, so these do too.
 */
.fi-modal > .fi-modal-close-overlay {
    background-color: rgb(15 23 42 / .3);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.dark .fi-modal > .fi-modal-close-overlay {
    background-color: rgb(2 6 23 / .6);
}

.fi-modal:not(.fi-modal-slide-over) > .fi-modal-window-ctn > .fi-modal-window.fi-transition-enter {
    transition-property: opacity, translate, scale;
    transition-duration: .55s;
    /* Overshoots a few pixels and settles. */
    transition-timing-function: cubic-bezier(.2, 1.18, .4, 1);
}

.fi-modal:not(.fi-modal-slide-over) > .fi-modal-window-ctn > .fi-modal-window.fi-transition-enter-start {
    opacity: 0;
    translate: 0 26px;
    scale: .94;
}

.fi-modal:not(.fi-modal-slide-over) > .fi-modal-window-ctn > .fi-modal-window.fi-transition-enter-end,
.fi-modal:not(.fi-modal-slide-over) > .fi-modal-window-ctn > .fi-modal-window.fi-transition-leave-start {
    opacity: 1;
    translate: 0 0;
    scale: 1;
}

.fi-modal:not(.fi-modal-slide-over) > .fi-modal-window-ctn > .fi-modal-window.fi-transition-leave {
    transition-property: opacity, translate, scale;
    transition-duration: .18s;
    transition-timing-function: cubic-bezier(.4, 0, 1, 1);
}

.fi-modal:not(.fi-modal-slide-over) > .fi-modal-window-ctn > .fi-modal-window.fi-transition-leave-end {
    opacity: 0;
    translate: 0 10px;
    scale: .97;
}

/* Slide-overs keep sliding, on the same easing. */
.fi-modal.fi-modal-slide-over > .fi-modal-window-ctn > .fi-modal-window.fi-transition-enter {
    transition-duration: .45s;
    transition-timing-function: cubic-bezier(.22, 1, .36, 1);
}

/* The heading's icon pops in just after the window. */
.fi-modal.fi-modal-open .fi-modal-icon-ctn {
    animation: fi-popup-icon .5s cubic-bezier(.34, 1.56, .64, 1) .2s both;
}

@keyframes fi-popup-icon {
    from { opacity: 0; scale: .4; rotate: -14deg; }
    to { opacity: 1; scale: 1; rotate: 0deg; }
}

/*
 * The panels' own popups, drawn outside Filament's modal: fare rules, fare
 * change and the leaving box on the classic flight search, the reissue
 * search's fare rules, and the console's credit, ledger and analytics sheets.
 * The same light backdrop and the same rise. `body` outranks the pages' own
 * <style> blocks, which come later.
 */
body :is(.fs-backdrop, .fs-leaving, .ri-modal-bg, .ag-sheet, .al-sheet, .va-sheet) {
    background: rgb(15 23 42 / .3);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: fi-popup-fade .3s ease-out both;
}

.dark :is(.fs-backdrop, .fs-leaving, .ri-modal-bg, .ag-sheet, .al-sheet, .va-sheet) {
    background: rgb(2 6 23 / .6);
}

body :is(.fs-backdrop > .fs-modal, .ri-modal-bg > .ri-modal, .ag-sheet > .ag-sheet-box, .al-sheet > .al-sheet-box, .va-sheet > .va-sheet-box) {
    animation: fi-popup-in .55s cubic-bezier(.22, 1, .36, 1) .04s both;
    transform-origin: 50% 60%;
}

@keyframes fi-popup-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fi-popup-in {
    0% { opacity: 0; transform: translateY(26px) scale(.94); }
    55% { opacity: 1; transform: translateY(-3px) scale(1.006); }
    100% { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    body :is(.fs-backdrop, .fs-leaving, .ri-modal-bg, .ag-sheet, .al-sheet, .va-sheet),
    body :is(.fs-backdrop > .fs-modal, .ri-modal-bg > .ri-modal, .ag-sheet > .ag-sheet-box, .al-sheet > .al-sheet-box, .va-sheet > .va-sheet-box) {
        animation: none;
    }

    .fi-modal > .fi-modal-window-ctn > .fi-modal-window.fi-transition-enter,
    .fi-modal > .fi-modal-window-ctn > .fi-modal-window.fi-transition-leave {
        transition-duration: 0s;
    }

    .fi-modal.fi-modal-open .fi-modal-icon-ctn {
        animation: none;
    }
}
