/**
 * Aircraft class picker for the FP listing charter form.
 */

.fpn-class-picker {
    --fpn-menu-bg: rgba(255, 255, 255, 0.96);
    --fpn-menu-border: rgba(60, 60, 67, 0.12);
    --fpn-menu-shadow:
        0 10px 36px rgba(0, 0, 0, 0.14),
        0 0 0 0.5px rgba(0, 0, 0, 0.06);
    --fpn-option-hover: rgba(68, 93, 239, 0.1);
    --fpn-option-selected: rgba(68, 93, 239, 0.14);

    position: relative;
    grid-column: 1 / 3;
    min-width: 0;
    width: 100%;
    z-index: 20;
}

.fpn-class-picker.is-open {
    z-index: 60;
}

:root[data-theme="dark"] .fpn-class-picker {
    --fpn-menu-bg: rgba(40, 42, 50, 0.96);
    --fpn-menu-border: rgba(255, 255, 255, 0.12);
    --fpn-menu-shadow:
        0 14px 40px rgba(0, 0, 0, 0.5),
        0 0 0 0.5px rgba(255, 255, 255, 0.1);
    --fpn-option-hover: rgba(68, 93, 239, 0.16);
    --fpn-option-selected: rgba(68, 93, 239, 0.22);
}

.fpn-class-picker__trigger {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    min-height: 2.75rem;
    padding: 0.4rem 0.55rem 0.45rem 0.7rem;
    border: none;
    border-radius: 10px;
    background: var(--fpn-fill);
    color: var(--fpn-text);
    font-family: var(--fpn-font);
    text-align: left;
    cursor: pointer;
    transition: box-shadow 0.15s ease, filter 0.15s ease;
}

.fpn-class-picker__trigger:hover {
    filter: brightness(0.98);
}

:root[data-theme="dark"] .fpn-class-picker__trigger:hover {
    filter: brightness(1.08);
}

.fpn-class-picker__trigger:focus-visible,
.fpn-class-picker.is-open .fpn-class-picker__trigger {
    outline: none;
    filter: none;
    box-shadow:
        inset 0 0 0 1px rgba(68, 93, 239, 0.5),
        0 0 0 3px rgba(68, 93, 239, 0.12);
}

.fpn-class-picker.is-error .fpn-class-picker__trigger {
    background: rgb(255 59 48 / 5%);
    box-shadow:
        inset 0 0 0 1px rgb(255 59 48 / 55%),
        0 0 0 3px rgb(255 59 48 / 10%);
}

.fpn-class-picker.is-error .fpn-class-picker__label {
    color: #d70015;
}

.fpn-class-picker__meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.1rem;
    min-width: 0;
    flex: 1 1 auto;
}

.fpn-class-picker__label {
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--fpn-muted);
    line-height: 1.2;
}

.fpn-class-picker__value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: -0.018em;
    line-height: 1.25;
    color: var(--fpn-text);
}

.fpn-class-picker__chevron {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--fpn-muted);
    font-size: 0.55rem;
    transition: transform 0.15s ease, color 0.15s ease;
}

.fpn-class-picker.is-open .fpn-class-picker__chevron {
    transform: rotate(180deg);
    color: var(--fpn-accent);
}

.fpn-class-picker__menu {
    position: absolute;
    z-index: 140;
    left: 0;
    right: 0;
    top: calc(100% + 0.35rem);
    bottom: auto;
    box-sizing: border-box;
    display: none;
    width: 100%;
    margin: 0;
    padding: 0.35rem;
    border: none;
    border-radius: 12px;
    background: var(--fpn-menu-bg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    box-shadow: var(--fpn-menu-shadow);
    max-height: min(320px, 50vh);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.fpn-class-picker.is-open .fpn-class-picker__menu {
    display: block;
}

.fpn-class-picker.is-drop-up .fpn-class-picker__menu {
    top: auto;
    bottom: calc(100% + 0.35rem);
}

/* Portaled to body — escapes overflow:auto/hidden ancestors (modals, slots). */
.fpn-class-picker__menu.is-portaled {
    display: block;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    width: auto;
    z-index: 10200;
}

.fpn-class-picker__option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    width: 100%;
    min-height: 2.25rem;
    margin: 0;
    padding: 0.5rem 0.7rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--fpn-text);
    font-family: var(--fpn-font);
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: -0.016em;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s ease;
}

.fpn-class-picker__option:hover,
.fpn-class-picker__option:focus-visible {
    outline: none;
    background: var(--fpn-option-hover);
}

.fpn-class-picker__option[aria-selected="true"] {
    background: var(--fpn-option-selected);
    font-weight: 600;
    color: var(--fpn-text);
}

.fpn-class-picker__check {
    flex-shrink: 0;
    color: var(--fpn-accent);
    font-size: 0.7rem;
    opacity: 0;
}

.fpn-class-picker__option[aria-selected="true"] .fpn-class-picker__check {
    opacity: 1;
}

.fpn-class-picker__empty {
    padding: 0.75rem 0.65rem;
    font-size: 0.8125rem;
    color: var(--fpn-muted);
    text-align: center;
    line-height: 1.35;
}

.fpn-class-picker.is-disabled .fpn-class-picker__trigger {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Hidden native select — never paint OS dropdown */
.fpn-class-picker__native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}

@media (max-width: 560px) {
    .fpn-class-picker {
        grid-column: 1;
        width: 100%;
    }

    .fpn-class-picker__menu {
        max-height: min(72vh, 440px);
        padding: 0.4rem;
    }

    .fpn-class-picker__option {
        min-height: 2.5rem;
        padding: 0.6rem 0.75rem;
    }
}
