/* flights-search component styles */

/* ===========================================
   COLLAPSED STATE: Search trigger button
   =========================================== */
.search-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0.75rem 1rem;
    background: rgba(0, 102, 204, 0.1);
    color: #0066cc;
    border: 1px solid rgba(0, 102, 204, 0.3);
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    margin: 1rem auto;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.search-trigger:hover {
    background: rgba(0, 102, 204, 0.2);
    border-color: rgba(0, 102, 204, 0.5);
}

.search-trigger:active {
    background: rgba(0, 102, 204, 0.3);
    border-color: rgba(0, 102, 204, 0.6);
}

.search-trigger svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* ===========================================
   EXPANDED STATE: Full screen overlay
   =========================================== */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
}

.search-overlay.active {
    transform: translateY(0);
}

/* ===========================================
   TOP BAR (title + close button)
   =========================================== */
.search-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    flex-shrink: 0;
}

.search-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
}

.search-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    background: #f5f5f5;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.15s;
}

.search-close:hover {
    background: #e8e8e8;
}

.search-close svg {
    width: 1.125rem;
    height: 1.125rem;
    color: #666;
}

/* ===========================================
   COMPACT SEARCH FORM (3-column Grid)
   =========================================== */
.search-compact {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.5rem 0.75rem;
    padding: 0 0.75rem 0.75rem;
    background: #fff;
    flex-shrink: 0;
    align-items: end;
}

/* Flight number spans full width */
.input-full-width {
    grid-column: 1 / -1;
}

/* Arrow between From/To */
.route-arrow {
    color: #999;
    font-size: 1.25rem;
    align-self: end;
    padding-bottom: 0.5rem;
    text-align: center;
    min-width: 1.5rem;
}

/* Row 3: Date chips container (col 1) - two equal buttons */
.date-chips {
    display: flex;
    gap: 0.375rem;
}

.date-chips .date-chip {
    flex: 1;
}

/* Date input wrapper (col 3) */
.date-input-wrapper {
    position: relative;
}

.date-input {
    width: 100%;
    padding-right: 2.25rem;
}

/* Hide native browser date picker icon */
.date-input::-webkit-calendar-picker-indicator {
    opacity: 0;
    position: absolute;
    right: 0;
    width: 2.25rem;
    height: 100%;
    cursor: pointer;
}

.calendar-icon {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.125rem;
    height: 1.125rem;
    color: #999;
    pointer-events: none;
}

/* Input with label (uses flexbox for vertical stack) */
.input-with-label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.input-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.search-input {
    width: 100%;
    height: 2.5rem;
    padding: 0 0.625rem;
    border: 1px solid #e0e0e0;
    border-radius: 0.5rem;
    font-size: 1rem;  /* 16px minimum prevents Safari iOS zoom on focus */
    background: #fafafa;
    transition: border-color 0.15s, background 0.15s;
}

.search-input:focus {
    outline: none;
    border-color: #1a1a1a;
    background: #fff;
}

.search-input::placeholder {
    color: #999;
}

/* Clearable input wrapper */
.input-clearable {
    position: relative;
    display: flex;
    align-items: center;
}

.input-clearable .search-input {
    padding-right: 2rem; /* Make room for clear button */
}

.input-clear-btn {
    position: absolute;
    right: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    background: #e0e0e0;
    border: none;
    border-radius: 50%;
    font-size: 1rem;
    line-height: 1;
    color: #666;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.input-clear-btn:hover {
    background: #ccc;
    color: #333;
}

.input-clear-btn:active {
    background: #bbb;
}

/* Date chips */
.date-chip {
    height: 2.5rem;
    padding: 0 0.625rem;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #666;
    cursor: pointer;
    transition: all 0.15s;
}

.date-chip:hover:not(:disabled) {
    border-color: #1a1a1a;
    color: #1a1a1a;
}

.date-chip.active {
    background: rgba(0, 102, 204, 0.1);
    border-color: rgba(0, 102, 204, 0.3);
    color: #0066cc;
}

.date-chip:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.calendar-btn {
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

.hidden-date-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.search-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

.route-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

@media (min-width: 35em) {
    .search-card {
        padding: 1.25rem;
        border-radius: 1rem;
    }

    .search-grid {
        gap: 0.875rem;
    }

    .route-grid {
        gap: 0.625rem;
    }
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    position: relative;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper .input-field {
    padding-right: 2rem;
}

.input-clear {
    position: absolute;
    right: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    background: transparent;
    border: none;
    color: #999;
    font-size: 1.125rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: color 0.15s;
}

.input-clear:hover {
    color: #1a1a1a;
}

.input-label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: #666;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.input-field {
    width: 100%;
    padding: 0.5rem 0.625rem;
    border: 1px solid #e0e0e0;
    border-radius: 0.5rem;
    font-size: 1rem;  /* 16px minimum prevents Safari iOS zoom on focus */
    font-weight: 500;
    transition: all 0.2s;
    background: #fafafa;
}

.input-field:focus {
    outline: none;
    border-color: #1a1a1a;
    background: #fff;
}

.input-field::placeholder {
    color: #999;
    font-weight: 400;
}

/* Override browser autofill yellow background */
.input-field:-webkit-autofill,
.input-field:-webkit-autofill:hover,
.input-field:-webkit-autofill:focus,
.search-input:-webkit-autofill,
.search-input:-webkit-autofill:hover,
.search-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #fafafa inset;
    -webkit-text-fill-color: #1a1a1a;
    transition: background-color 5000s ease-in-out 0s;
}

.chip-group {
    display: flex;
    gap: 0.375rem;
    margin-bottom: 0.375rem;
}

.chip {
    flex: 1;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    color: #666;
    padding: 0.375rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.chip:hover {
    background: #fff;
    border-color: #1a1a1a;
    color: #1a1a1a;
}

.chip.active {
    background: rgba(0, 102, 204, 0.1);
    color: #0066cc;
    border-color: rgba(0, 102, 204, 0.3);
}

.date-helper {
    font-size: 0.6875rem;
    color: #999;
    margin-top: 0.25rem;
    min-height: 1em;
}

.divider {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #999;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e8e8e8;
}

.results-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 0 1rem;
}

.results-header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 0 0.25rem;
    flex-shrink: 0;
}

.results-header {
    font-size: 0.75rem;
    color: #666;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.clear-filters-btn {
    font-size: 0.6875rem;
    color: #666;
    background: transparent;
    border: 1px solid #e0e0e0;
    border-radius: 0.375rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.clear-filters-btn:hover {
    color: #1a1a1a;
    border-color: #1a1a1a;
    background: #fafafa;
}

.results-scroll {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    padding-bottom: 1rem;
    -webkit-overflow-scrolling: touch;
}

.flight-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto auto auto;
    grid-template-areas:
        "number airline date"
        "origin arrow dest"
        "takeoff . landing"
        ". . track";
    gap: 0.375rem 0.5rem;
    background: #fafafa;
    border-radius: 0.625rem;
    padding: 0.625rem;
    margin-bottom: 0.5rem;
    border: 1px solid #e8e8e8;
    transition: all 0.2s;
    cursor: pointer;
}

.flight-card:hover {
    border-color: #1a1a1a;
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.flight-number {
    grid-area: number;
    font-size: 0.75rem;
    font-weight: 500;
    color: #666;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
}

.flight-airline {
    grid-area: airline;
    font-size: 0.75rem;
    font-weight: 500;
    color: #666;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flight-date {
    grid-area: date;
    font-size: 0.75rem;
    font-weight: 500;
    color: #666;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.flight-origin {
    grid-area: origin;
    font-size: 0.75rem;
    font-weight: 500;
    color: #666;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
}

.flight-arrow {
    grid-area: arrow;
    font-size: 0.875rem;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flight-dest {
    grid-area: dest;
    font-size: 0.75rem;
    font-weight: 500;
    color: #666;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.flight-takeoff {
    grid-area: takeoff;
    font-size: 0.75rem;
    font-weight: 500;
    color: #666;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.flight-landing {
    grid-area: landing;
    font-size: 0.75rem;
    font-weight: 500;
    color: #666;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.empty-state {
    text-align: center;
    padding: 1.5rem 1rem;
    color: #999;
}

.empty-state-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.stats-display {
    font-size: 0.6875rem;
    color: #666;
    margin-top: 0.5rem;
    padding: 0 0.25rem;
}


/* Awesomplete overrides to match design system */
.awesomplete {
    display: block;
    width: 100%;
}

.awesomplete > ul {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 0.5rem;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
    margin-top: 0.25rem;
    max-height: 12rem;
    overflow-y: auto;
}

.awesomplete > ul:before {
    display: none;
}

.awesomplete > ul > li {
    padding: 0.5rem 0.625rem;
    font-size: 0.875rem;
    color: #1a1a1a;
    cursor: pointer;
    transition: background 0.15s;
}

.awesomplete > ul > li:hover {
    background: #f5f5f5;
}

.awesomplete > ul > li[aria-selected="true"] {
    background: #A4C7FF;
    color: #1a1a1a;
}

.awesomplete mark {
    background: transparent;
    color: inherit;
    font-weight: 600;
}

.awesomplete li[aria-selected="true"] mark {
    background: transparent;
}

.track-btn {
    grid-area: track;
    min-height: 2.25rem;
    padding: 0.5rem 0.875rem;
    background: rgba(0, 102, 204, 0.1);
    color: #0066cc;
    border: 1px solid rgba(0, 102, 204, 0.3);
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    /* iOS Safari: prevent tap delay */
    touch-action: manipulation;
}

.track-btn:hover {
    background: rgba(0, 102, 204, 0.2);
    border-color: rgba(0, 102, 204, 0.5);
    color: #0066cc;
}

@media (min-width: 35em) {
    .flight-card {
        /* Desktop: horizontal layout, constrained width, centered */
        display: grid;
        grid-template-columns: auto auto auto auto auto auto;
        grid-template-rows: auto auto;
        grid-template-areas:
            "number origin  arrow dest    airline track"
            "date   takeoff .     landing airline track";
        gap: 0.25rem 1rem;
        padding: 0.75rem 1rem;

        /* KEY FIX: Constrain card width so grid doesn't stretch on wide screens */
        max-width: 550px;
        margin-left: auto;
        margin-right: auto;
        margin-bottom: 0.5rem;
    }

    .flight-origin {
        text-align: right;
        justify-self: end;
    }

    .flight-takeoff {
        text-align: right;
        justify-self: end;
    }

    .flight-dest {
        text-align: left;
        justify-self: start;
    }

    .flight-landing {
        text-align: left;
        justify-self: start;
    }

    .flight-airline {
        text-align: right;
        justify-self: end;
        align-self: center;
    }

    .track-btn {
        align-self: center;
        justify-self: end;
    }
}

/* ===========================================
   TIME FILTER CHIP
   =========================================== */
.time-filter-row {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    padding-top: 0.25rem;
}

/* ===========================================
   TIME FILTER - Mode Buttons + Slider
   =========================================== */

/* Time filter row - contains both mode buttons */
.time-filter-row {
    display: flex;
    gap: 0.5rem;
}

/* Wrapper for button + clear button */
.time-mode-clearable {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
}

/* Time mode buttons (Dep/Arr) */
.time-mode-btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    padding-right: 1.75rem;  /* Room for clear button */
    border: 1px solid #e0e0e0;
    border-radius: 0.5rem;
    background: #fafafa;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    min-width: 0;
    text-align: left;
}

.time-mode-btn:hover {
    border-color: #1a1a1a;
    color: #1a1a1a;
}

.time-mode-btn.active {
    background: rgba(0, 102, 204, 0.1);
    border-color: rgba(0, 102, 204, 0.3);
    color: #0066cc;
}

/* Clear button (×) overlaid on time mode button */
.time-clear-btn {
    position: absolute;
    right: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    padding: 0;
    background: #ddd;
    border: none;
    border-radius: 50%;
    font-size: 0.875rem;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1;
}

.time-clear-btn:hover {
    background: #ccc;
    color: #333;
}

.time-clear-btn:active {
    background: #bbb;
}

/* Time slider row */
.time-slider-row {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.4rem 0.75rem 0.6rem;
    background: #f5f5f5;
    border-radius: 0.5rem;
    margin-top: 0.25rem;
}

/* Dual-thumb range slider - compositor-path optimized */
.time-slider {
    --s: 25;  /* Start percentage */
    --e: 75;  /* End percentage */
    position: relative;
    width: 100%;
    height: 40px;
}

/* Base track (gray background) */
.time-slider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 11px;
    right: 11px;
    height: 5px;
    transform: translateY(-50%);
    border-radius: 2.5px;
    background: rgba(0, 0, 0, 0.15);
}

/* Highlight track - TRUE compositor path using transform only */
.time-slider::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 11px;
    right: 11px;
    height: 5px;
    border-radius: 2.5px;
    background: #0066cc;

    /*
     * COMPOSITOR-ONLY ANIMATION:
     * - transform-origin: left center (scale from left edge)
     * - translateY(-50%): vertical centering
     * - translateX(--s%): position start of highlight
     * - scaleX((--e - --s) / 100): width as ratio of track
     *
     * Unlike clip-path, transform NEVER triggers paint.
     * This runs entirely on the GPU compositor thread.
     */
    transform-origin: 0 50%;
    transform:
        translateY(-50%)
        translateX(calc(var(--s) * 1%))
        scaleX(calc((var(--e) - var(--s)) / 100));
    will-change: transform;
}

/* Range inputs stacked */
.time-slider input {
    position: absolute;
    width: 100%;
    height: 36px;
    top: 50%;
    transform: translateY(-50%);
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
}

/* Thumbs */
.time-slider input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    background: #0066cc;
    border-radius: 50%;
    pointer-events: auto;
    cursor: grab;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.2));
    transition: box-shadow 0.15s, transform 0.15s;
}

.time-slider input::-moz-range-thumb {
    width: 22px;
    height: 22px;
    background: #0066cc;
    border-radius: 50%;
    pointer-events: auto;
    cursor: grab;
    border: none;
    transition: box-shadow 0.15s, transform 0.15s;
}

.time-slider input:active::-webkit-slider-thumb,
.time-slider input:focus::-webkit-slider-thumb {
    cursor: grabbing;
    transform: scale(1.15);
    box-shadow: 0 0 0 8px rgba(0, 102, 204, 0.2);
}

.time-slider input:active::-moz-range-thumb,
.time-slider input:focus::-moz-range-thumb {
    cursor: grabbing;
    transform: scale(1.15);
    box-shadow: 0 0 0 8px rgba(0, 102, 204, 0.2);
}

/* Remove default focus outline since we have custom highlight */
.time-slider input:focus {
    outline: none;
}

/* Time labels above slider */
.time-slider-labels {
    display: flex;
    justify-content: space-between;
    padding: 0 1rem;
    font-size: 0.6875rem;
    color: #999;
}
