/* Destination search filter — homepage hero */

.csf {
    position: relative;
    /* Starts at 460px, grows with content up to 700px (never past the parent),
       then tags/input wrap to a second line inside .csf__field. */
    width: -moz-fit-content;
    width: fit-content;
    min-width: min(460px, 100%);
    max-width: min(700px, 100%);
    margin: 0 auto;
    text-align: left;
}

.csf__box {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
    min-height: 54px;
    padding: 6px 8px 6px 16px;
    border-radius: 30px;
    border: 2px solid #0083f2;
    background: rgba(10, 20, 40, 0.35);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

/* Tags + input wrap onto new lines here; the search button stays a
   non-wrapping sibling, pinned to the right and vertically centred. */
.csf__field {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

/* Terminal-style caret: the input auto-sizes to its content (JS), the underscore
   sits right after the text, and it never falls back to the native I-beam. */
.csf__entry {
    display: inline-flex;
    align-items: flex-end;
    max-width: 100%;
    cursor: text;
}

.csf__input {
    caret-color: transparent;
}

.csf__caret {
    display: none;
    width: 12px;
    height: 2px;
    margin: 0 1px 9px;
    border-radius: 1px;
    background: #eaf2ff;
    flex-shrink: 0;
}

/* Caret only on real focus (not hover) so it never looks active before a click */
.csf__box.is-focused .csf__caret {
    display: block;
    animation: csf-blink 1.1s step-start infinite;
}

.csf__placeholder {
    align-self: center;
    margin-left: 4px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 15px;
    white-space: nowrap;
    pointer-events: none;
}

.csf__field:not(.is-empty) .csf__placeholder,
.csf__box.has-tags .csf__placeholder {
    display: none;
}

@keyframes csf-blink {
    50% {
        opacity: 0;
    }
}

.csf__box.is-focused {
    border-color: #4fa8ff;
    background: rgba(10, 20, 40, 0.5);
}

.csf__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.csf__tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px 5px 10px;
    background: #0083f2;
    color: #fff;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    animation: csf-tag-in 0.18s ease-out;
}

.csf__tag .fp {
    width: 16px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

.csf__tag-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
    line-height: 1;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
}

.csf__tag-remove:hover {
    background: rgba(255, 255, 255, 0.5);
}

.csf__input {
    flex: 0 0 auto;
    width: 2px;
    min-width: 2px;
    border: none;
    outline: none;
    background: transparent;
    color: #fff;
    font-size: 15px;
    padding: 8px 0;
}

.csf__input::placeholder {
    color: rgba(255, 255, 255, 0.75);
}

.csf__search-btn {
    flex-shrink: 0;
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #0083f2;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.csf__search-btn:hover {
    background: #2c71ff;
    transform: scale(1.05);
}

.csf__box.has-tags .csf__search-btn {
    display: flex;
}

.csf__suggestions {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    max-height: 260px;
    overflow-y: auto;
    padding: 6px;
    background: rgba(10, 20, 40, 0.85);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(79, 168, 255, 0.45);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 10, 30, 0.45);
    z-index: 30;
}

.csf__suggestions.is-open {
    display: block;
}

.csf__suggestion-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    color: #eaf2ff;
    font-size: 14px;
    transition: background-color 0.15s ease;
}

.csf__suggestion-item:hover,
.csf__suggestion-item.is-active {
    background: rgba(0, 131, 242, 0.28);
}

.csf__suggestion-item .fp {
    width: 20px;
    height: 15px;
    border-radius: 2px;
    flex-shrink: 0;
}

.csf__suggestion-empty {
    padding: 12px;
    color: rgba(234, 242, 255, 0.6);
    font-size: 13px;
}

@keyframes csf-tag-in {
    from {
        opacity: 0;
        transform: scale(0.85);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@media (max-width: 600px) {
    .csf {
        max-width: 100%;
    }

    .csf__box {
        padding: 6px 6px 6px 12px;
    }
}

/* ---------------------------------------------------------------------- */
/* Results popup                                                          */
/* ---------------------------------------------------------------------- */

.csf-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    align-items: flex-start;
    justify-content: center;
    padding: 4vh 16px;
    background: rgba(6, 12, 26, 0.6);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    overflow-y: auto;
}

.csf-overlay.is-open {
    display: flex;
}

/* Dimensions follow billionconnect's results dialog (710px card, 144px rows,
   161x144 media); the skin is ours — the same dark glass as the search box and
   its suggestions dropdown, with a #0083f2 accent. */
.csf-popup {
    position: relative;
    width: 710px;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: rgba(10, 20, 40, 0.9);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(79, 168, 255, 0.4);
    border-radius: 20px;
    padding: 40px 50px 48px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    animation: csf-popup-in 0.22s ease-out;
    scrollbar-width: none;
}

@keyframes csf-popup-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.csf-popup__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: none;
    color: #eaf2ff;
    font-size: 30px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease;
    z-index: 1;
}

.csf-popup__close:hover {
    background: rgba(255, 255, 255, 0.12);
}

.csf-popup__header {
    flex-shrink: 0;
    padding: 0 24px 24px;
    text-align: center;
}

.csf-popup__tags {
    font-size: 24px;
    font-weight: 800;
    color: #eaf2ff;
    line-height: 1.25;
}

.csf-popup__body {
    overflow-y: auto;
    scrollbar-width: none;
    /* Breathing room so a hovered card's lift + shadow isn't clipped by the
       scroll container; negative margin keeps the cards' size/position. */
    padding: 8px 8px 4px;
    margin: 0 -8px;
}

.csf-popup__body::-webkit-scrollbar,
.csf-popup::-webkit-scrollbar {
    display: none;
}

.csf-popup__loader {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
}

.csf-popup__loader.is-visible {
    display: flex;
}

.csf-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid rgba(255, 255, 255, 0.18);
    border-top-color: #4fa8ff;
    border-radius: 50%;
    animation: csf-spin 0.7s linear infinite;
}

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

.csf-popup__empty {
    display: none;
    text-align: center;
    padding: 50px 24px;
    color: rgba(234, 242, 255, 0.8);
    font-size: 18px;
    line-height: 1.5;
}

.csf-popup__empty.is-visible {
    display: block;
}

.csf-row-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.csf-item {
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.csf-item:hover {
    background: rgba(0, 131, 242, 0.14);
    border-color: rgba(79, 168, 255, 0.4);
}

.csf-item.is-open {
    background: rgba(0, 131, 242, 0.16);
    border-color: rgba(79, 168, 255, 0.5);
}

.csf-row {
    display: flex;
    align-items: center;
    gap: 14px;
    height: 144px;
    padding-right: 20px;
    cursor: pointer;
    user-select: none;
}

/* Chevron shown only while the item is open (points up = click to collapse) */
.csf-row__toggle {
    display: none;
    flex-shrink: 0;
    margin-left: auto;
    color: rgba(234, 242, 255, 0.7);
    font-size: 20px;
}

.csf-item.is-open .csf-row__toggle {
    display: block;
}

.csf-row__media {
    flex-shrink: 0;
    width: 161px;
    height: 144px;
    border-radius: 16px !important;
    background-size: cover !important;
    background-position: center !important;
}

/* Flag: a rounded 4:3 chip (matches the flag's own ratio, so no stretch/crop),
   centred in the media slot so the text still lines up with photo cards. */
.csf-row__media--flag {
    width: 120px !important;
    height: 90px !important;
    margin: 0 20px;
    border-radius: 10px !important;
    background-color: transparent;
    background-size: cover !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Region / global: placeholder image as a chip, same size as the flag chip */
.csf-row__media--placeholder {
    width: 120px !important;
    height: 90px !important;
    margin: 0 20px;
    border-radius: 10px !important;
    background-image: url('/assets/images/regional-flag-placeholder.jpeg');
    background-size: cover !important;
    background-position: center !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.csf-row__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: center;
    gap: 9px;
    min-width: 0;
}

.csf-row__title {
    font-size: 16px;
    font-weight: 700;
    color: #eaf2ff;
    line-height: 19px;
}

.csf-row__subtitle {
    font-size: 14px;
    color: rgba(234, 242, 255, 0.7);
    line-height: 18px;
}

.csf-row__subtitle strong {
    color: #4fa8ff;
    font-weight: 700;
}

/* Collapse — the bundle's packages, rendered 1:1 with the "choose a country"
   markup on a white panel (that markup is dark-text on white). */
.csf-collapse {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.csf-item.is-open .csf-collapse {
    max-height: 3000px;
    padding: 0 0.5px;
}

.csf-collapse__inner {
    background: #fff;
    padding: 5px 0;
}

.csf-collapse__loader {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
    color: #7a8699;
    font-size: 14px;
}

.csf-collapse__loader .csf-spinner {
    border: 3px solid #e3e8f0;
    border-top-color: #0083f2;
}

@media (max-width: 600px) {
    .csf-popup {
        width: 100%;
        padding: 32px 16px 24px;
        border-radius: 18px;
    }

    .csf-popup__header {
        padding: 0 24px 18px;
    }

    .csf-popup__tags {
        font-size: 20px;
    }

    .csf-row {
        height: 104px;
        gap: 12px;
        padding-right: 14px;
    }

    .csf-row__media--flag,
    .csf-row__media--placeholder {
        width: 92px !important;
        height: 69px !important;
        margin: 0 12px;
    }
}
