/*
* Flight time selection on the flight search results (see js/flightsearch/flightTimeSelection.js).
* Separate file with a file-time version, so changes reach visitors without a main.css rebuild.
*/

.flight-time {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3rem 0.75rem;
    border: 1.5px solid #B9A98D;
    border-radius: 999px;
    background-color: rgba(185, 169, 141, 0.15);
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    animation: flight-time-pulse 2s ease-in-out infinite;
}

.flight-time:hover {
    background-color: rgba(185, 169, 141, 0.3);
}

.flight-time .icon {
    font-size: 1.15em;
}

/* Invisible button over the whole field, opens the time slot picker */
.flight-time__trigger {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: inherit;
    background: transparent;
    cursor: pointer;
}

.flight-time:has(.flight-time__trigger:focus-visible) {
    outline: 2px solid #B9A98D;
    outline-offset: 2px;
}

.flight-time.is-set {
    animation: none;
    background-color: transparent;
    border-color: rgba(185, 169, 141, 0.6);
}

.flight-time.is-error {
    border-color: #E3342F;
    background-color: rgba(227, 52, 47, 0.12);
    animation: flight-time-shake 0.4s ease-in-out;
}

.flight-time--card {
    color: #000000;
    font-size: 1rem;
}

/* Date and time stacked, the date column is too narrow for both side by side */
.card--flightresult .card__meta-item--datetime {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.flight-time--summary {
    color: #ffffff;
    padding: 0.15rem 0.6rem;
}

.flight-time-hint {
    color: #E3342F;
    font-weight: 600;
    text-align: right;
}

/* Time slot picker: popover below the time field, bottom sheet on phones */
.flight-time-picker[hidden] {
    display: none !important;
}

.flight-time-picker__backdrop {
    display: none;
}

.flight-time-picker__panel {
    position: absolute;
    z-index: 10000;
    width: 25rem;
    max-width: calc(100vw - 1rem);
    padding: 1.25rem;
    border-radius: 1rem;
    background-color: #ffffff;
    color: #000000;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    font-size: 1rem;
    text-align: left;
}

.flight-time-picker__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.flight-time-picker__title {
    font-weight: 600;
    font-size: 1.125rem;
}

.flight-time-picker__leg {
    margin-top: 0.125rem;
    font-size: 0.875rem;
    font-weight: 300;
}

.flight-time-picker__close {
    display: inline-flex;
    padding: 0.25rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.flight-time-picker__close:hover {
    background-color: rgba(0, 0, 0, 0.06);
}

.flight-time-picker__group + .flight-time-picker__group {
    margin-top: 0.75rem;
}

.flight-time-picker__group-title {
    margin-bottom: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6b6b6b;
}

.flight-time-picker__slots {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.375rem;
}

.flight-time-picker__slot {
    padding: 0.5rem 0;
    border: 1px solid #e2e2e2;
    border-radius: 0.5rem;
    background-color: #ffffff;
    color: #000000;
    font: inherit;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.flight-time-picker__slot:hover,
.flight-time-picker__slot:focus-visible {
    border-color: #B9A98D;
    background-color: rgba(185, 169, 141, 0.18);
    outline: none;
}

.flight-time-picker__slot.is-selected {
    border-color: #B9A98D;
    background-color: #B9A98D;
    font-weight: 600;
}

.flight-time-picker__custom {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #ececec;
    font-size: 0.9rem;
}

.flight-time-picker__custom label {
    flex: 1;
    font-weight: 600;
}

.flight-time-picker__custom-input {
    padding: 0.375rem 0.5rem;
    border: 1px solid #e2e2e2;
    border-radius: 0.5rem;
    color: #000000;
    font: inherit;
    font-size: 16px; /* prevents zoom on iOS */
}

.flight-time-picker__custom-apply {
    padding: 0.45rem 0.9rem;
    border: 0;
    border-radius: 999px;
    background-color: #B9A98D;
    color: #000000;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.flight-time-picker__note {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: #6b6b6b;
}

@media (max-width: 768px) {
    body.flight-time-picker-open {
        overflow: hidden;
    }

    .flight-time-picker {
        position: fixed;
        inset: 0;
        z-index: 10000;
        display: flex;
        align-items: flex-end;
    }

    .flight-time-picker__backdrop {
        display: block;
        position: absolute;
        inset: 0;
        background-color: rgba(0, 0, 0, 0.55);
    }

    .flight-time-picker__panel {
        position: relative;
        width: 100%;
        max-width: none;
        max-height: 85vh;
        overflow-y: auto;
        padding: 1.25rem 1rem calc(1rem + env(safe-area-inset-bottom));
        border-radius: 1rem 1rem 0 0;
        animation: flight-time-sheet 0.2s ease-out;
    }

    .flight-time-picker__slots {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
    }

    .flight-time-picker__slot {
        padding: 0.75rem 0;
        font-size: 1rem;
    }
}

@keyframes flight-time-sheet {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

@keyframes flight-time-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(185, 169, 141, 0.55); }
    50%      { box-shadow: 0 0 0 6px rgba(185, 169, 141, 0); }
}

@keyframes flight-time-shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-4px); }
    75%      { transform: translateX(4px); }
}

@media (prefers-reduced-motion: reduce) {
    .flight-time,
    .flight-time.is-error,
    .flight-time-picker__panel {
        animation: none;
    }
}
