/**
 * flight-search-loader.css - Flight search loading modal
 * Location: /kiyans-travel/public_site/assets/css/flight-search-loader.css
 *
 * Shared by public_site/index.php and public_site/flights.php. The markup is
 * built on demand by assets/js/flight-search-loader.js, so pages that carry no
 * flight-search form pay nothing but this stylesheet.
 *
 * Colours come from the design tokens in style.css, with literal fallbacks.
 * Everything is CSS/SVG - no animation library, no external assets.
 */

.fsl-overlay {
    position: fixed;
    inset: 0;
    z-index: 11000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 31, 68, 0.42);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s ease;
}

.fsl-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.fsl-overlay[hidden] {
    display: none;
}

.fsl-dialog {
    width: min(520px, 100%);
    max-height: calc(100vh - 48px);
    overflow: hidden auto;
    text-align: center;
    color: #fff;
    background: linear-gradient(160deg, #2C56B0 0%, #23408E 55%, #1A3270 100%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 24px;
    box-shadow: 0 30px 80px rgba(10, 31, 75, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    transform: translateY(14px) scale(0.985);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.fsl-overlay.is-visible .fsl-dialog {
    transform: none;
}

/* ── Sky scene ───────────────────────────────────────────── */
.fsl-scene {
    position: relative;
    height: 168px;
    overflow: hidden;
    background:
        radial-gradient(120% 90% at 50% 105%, rgba(255, 255, 255, 0.16), transparent 60%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0));
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.fsl-scene svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Soft drifting clouds. */
.fsl-cloud {
    opacity: 0.22;
    animation: fslDrift 26s linear infinite;
}

.fsl-cloud-2 {
    opacity: 0.15;
    animation-duration: 34s;
    animation-delay: -12s;
}

.fsl-cloud-3 {
    opacity: 0.12;
    animation-duration: 42s;
    animation-delay: -25s;
}

@keyframes fslDrift {
    from { transform: translateX(-130px); }
    to   { transform: translateX(400px); }
}

/* The route draws itself, suggesting routes being discovered. */
.fsl-route {
    stroke-dasharray: 4 6;
    animation: fslRoute 2.6s linear infinite;
}

@keyframes fslRoute {
    to { stroke-dashoffset: -100; }
}

.fsl-endpoint {
    animation: fslPulse 2.4s ease-in-out infinite;
    transform-origin: center;
}

.fsl-endpoint-2 { animation-delay: 1.2s; }

@keyframes fslPulse {
    0%, 100% { opacity: 0.55; r: 4; }
    50%      { opacity: 1;    r: 5.5; }
}

/* The plane follows the same arc as the drawn route. */
.fsl-plane {
    offset-path: path('M 26 118 C 92 34, 208 34, 274 96');
    offset-rotate: auto;
    animation: fslFly 4.2s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

@keyframes fslFly {
    0%        { offset-distance: 0%;   opacity: 0; }
    8%        { opacity: 1; }
    88%       { opacity: 1; }
    100%      { offset-distance: 100%; opacity: 0; }
}

/* Browsers without offset-path still get motion rather than a frozen plane. */
@supports not (offset-path: path('M 0 0 L 1 1')) {
    .fsl-plane {
        animation: fslFlyFallback 4.2s ease-in-out infinite;
    }

    @keyframes fslFlyFallback {
        0%   { transform: translate(26px, 104px) rotate(-26deg); opacity: 0; }
        8%   { opacity: 1; }
        50%  { transform: translate(150px, 44px) rotate(0deg); }
        88%  { opacity: 1; }
        100% { transform: translate(274px, 88px) rotate(26deg); opacity: 0; }
    }
}

/* ── Copy ────────────────────────────────────────────────── */
.fsl-body {
    padding: 26px 34px 30px;
}

.fsl-title {
    margin: 0 0 10px;
    font-size: clamp(1.25rem, 2.6vw, 1.5rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #fff;
}

/* Fixed height so rotating messages never shift the layout. */
.fsl-status {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 3em;
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
    transition: opacity 0.24s ease, transform 0.24s ease;
}

.fsl-status.is-changing {
    opacity: 0;
    transform: translateY(6px);
}

/* Indeterminate: activity, not fake precision. */
.fsl-progress {
    position: relative;
    height: 4px;
    margin: 18px auto 0;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
}

.fsl-progress::after {
    position: absolute;
    top: 0;
    left: 0;
    width: 38%;
    height: 100%;
    content: '';
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.25), #fff 50%, rgba(255, 255, 255, 0.25));
    border-radius: inherit;
    animation: fslProgress 1.5s ease-in-out infinite;
}

@keyframes fslProgress {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(300%); }
}

.fsl-note {
    display: block;
    margin-top: 16px;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.66);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 575px) {
    .fsl-overlay { padding: 16px; }
    .fsl-dialog { border-radius: 20px; }
    .fsl-scene { height: 138px; }
    .fsl-body { padding: 22px 20px 26px; }
    .fsl-status { min-height: 3.2em; font-size: 0.92rem; }
}

/* Short viewports (landscape phones, keyboard open). */
@media (max-height: 480px) {
    .fsl-scene { height: 96px; }
    .fsl-body { padding: 16px 20px 20px; }
    .fsl-note { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .fsl-overlay,
    .fsl-dialog,
    .fsl-status { transition: none; }

    .fsl-cloud,
    .fsl-route,
    .fsl-endpoint,
    .fsl-plane,
    .fsl-progress::after { animation: none; }

    /* Without motion the plane still needs a sensible resting position. */
    .fsl-plane { offset-distance: 62%; }

    .fsl-progress::after { width: 100%; transform: none; opacity: 0.55; }
}
