/**
 * autocomplete.css - Airport / City autocomplete component
 * Location: /kiyans-travel/public_site/assets/css/autocomplete.css
 *
 * Kept separate from style.css because assets/js/search.js is shared by the
 * public site and the admin booking search, which load different stylesheets.
 * A dedicated file lets both pages style the component without the admin
 * layout inheriting the whole public stylesheet.
 *
 * Colours, radii and shadows come from the design tokens defined in style.css;
 * the literal fallbacks keep the component presentable where those tokens are
 * not in scope.
 */

.ac-wrapper {
    position: relative;
}

.ac-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 1200;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: var(--surface, #FFFFFF);
    border: 1px solid var(--border, #E5E7EB);
    border-radius: var(--radius-sm, 8px);
    box-shadow: var(--shadow-lg, 0 8px 30px rgba(0, 0, 0, 0.12));
}

/* Flipped above the field when there is not enough room below it. */
.ac-panel-above {
    top: auto;
    bottom: calc(100% + 6px);
}

.ac-panel[hidden] {
    display: none;
}

.ac-list {
    margin: 0;
    padding: 4px;
    list-style: none;
}

.ac-option {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 8px 10px;
    border-radius: var(--radius-sm, 8px);
    cursor: pointer;
}

.ac-option:hover,
.ac-option.is-active {
    background: rgba(35, 64, 142, 0.08);
}

.ac-option.is-active {
    box-shadow: inset 0 0 0 2px var(--primary, #23408E);
}

/* Fixed box so a flag and the neutral fallback occupy identical space -
   neither variant shifts the layout. */
.ac-flag {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 20px;
    line-height: 1;
}

/* Local 4x3 SVG flag. cover trims the 1.333 asset to the 1.4 box without
   distorting it; the hairline keeps pale flags legible on white. */
.ac-flag-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.ac-flag-empty {
    background: var(--border, #E5E7EB);
    border-radius: 3px;
    opacity: 0.5;
}

.ac-text {
    flex: 1 1 auto;
    min-width: 0;
}

.ac-name,
.ac-meta {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ac-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #1F2937);
}

.ac-meta {
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-secondary, #6B7280);
}

.ac-iata {
    flex: 0 0 auto;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--primary, #23408E);
}

.ac-empty {
    padding: 14px 12px;
    font-size: 13px;
    color: var(--text-secondary, #6B7280);
    text-align: center;
}

/* Visually hidden live region carrying the match count. */
.ac-status {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 575px) {
    .ac-option {
        min-height: 52px;
        gap: 10px;
    }

    .ac-name {
        font-size: 15px;
    }
}
