/* =========================================================
   airport-modal.css — Full-screen airport picker modal
   Mobile only (≤ 767px). Desktop: native input/autocomplete.
   aeroplan.bg booking engine
   ========================================================= */

/* ── Backdrop ──────────────────────────────────────────────────── */
#airport-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9000;
    -webkit-overflow-scrolling: touch;
}

#airport-modal.am-open {
    display: flex;
    flex-direction: column;
}

.am-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    -webkit-tap-highlight-color: transparent;
}

/* ── Bottom sheet ──────────────────────────────────────────────── */
.am-sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    /* Always full height — keeps input pinned at top regardless of result count */
    height: calc(100dvh - 48px);
    height: calc(100vh - 48px);
    background: #fff;
    border-radius: 20px 20px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* GPU layer */
    -webkit-transform: translateY(100%) translateZ(0);
    transform: translateY(100%) translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: transform;
    transition:
        -webkit-transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    transition:
        transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    /* Safe area for Dynamic Island / home indicator */
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

#airport-modal.am-open .am-sheet {
    -webkit-transform: translateY(0) translateZ(0);
    transform: translateY(0) translateZ(0);
}

/* ── Drag handle ───────────────────────────────────────────────── */
.am-drag-handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: #d1d5db;
    margin: 10px auto 0;
    flex-shrink: 0;
}

/* ── Header row ────────────────────────────────────────────────── */
.am-header {
    display: flex;
    align-items: center;
    padding: 12px 16px 8px;
    gap: 10px;
    flex-shrink: 0;
}

.am-title {
    flex: 1;
    font-size: 1rem;
    font-weight: 700;
    color: #002955;
    margin: 0;
    font-family: 'Montserrat', sans-serif;
}

.am-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f3f4f6;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #374151;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.am-close-btn:active {
    background: #e5e7eb;
}

/* ── Search bar ────────────────────────────────────────────────── */
.am-search-bar {
    padding: 4px 16px 12px;
    flex-shrink: 0;
}

.am-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: #f3f4f6;
    border-radius: 12px;
    border: 1.5px solid transparent;
    transition: border-color 0.15s;
}

.am-search-wrap:focus-within {
    border-color: #48abd6;
    background: #fff;
}

.am-search-icon {
    padding: 0 10px;
    color: #6b7280;
    font-size: 0.95rem;
    pointer-events: none;
}

#am-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 13px 12px 13px 0;
    font-size: 1rem;
    font-family: 'Montserrat', sans-serif;
    color: #111827;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    /* Prevent iOS zoom */
    font-size: 16px;
}

#am-input::-webkit-input-placeholder { color: #9ca3af; }
#am-input::placeholder               { color: #9ca3af; }

.am-clear-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #d1d5db;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: #6b7280;
    margin-right: 8px;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    /* Hidden by default */
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.15s;
}

.am-clear-btn.am-visible {
    visibility: visible;
    opacity: 1;
}

/* ── Results list ──────────────────────────────────────────────── */
#am-results {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}

/* Section label (e.g. "Популярни летища") */
.am-section-label {
    padding: 10px 16px 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7280;
    font-family: 'Montserrat', sans-serif;
}

/* Inherit IATA styles but override padding for full-width touch targets */
#am-results .iata-city-header,
#am-results .iata-airport-item,
#am-results .iata-item {
    padding: 12px 16px;
    border-radius: 0;
    min-height: 52px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
/* Airports belonging to a city keep a visible indent under that city's
   header — the rule above flattened both to the same left padding,
   which erased the grouping hierarchy the desktop dropdown already has. */
#am-results .iata-airport-item {
    padding-left: 34px;
}

#am-results .iata-city-header:active,
#am-results .iata-airport-item:active,
#am-results .iata-item:active {
    background: #f0f9ff;
}

/* Larger touch targets for airport items */
#am-results .iata-item-name {
    font-size: 0.95rem;
}

#am-results .iata-item-code {
    font-size: 0.8rem;
}

/* ── Desktop: modal is completely hidden ───────────────────────── */
@media (min-width: 768px) {
    #airport-modal {
        display: none !important;
    }
}