:root {
    --brand-blue: #0052cc;
    --brand-blue-hover: #0041a3;
    --text-primary: #172b4d;
    --text-secondary: #6b778c;
    --bg-page: #f7f8fa;
    --bg-surface: #ffffff;
    --border-color: #dfe1e6;
    --shadow: 0px 4px 8px rgba(23, 43, 77, 0.07), 0px 0px 1px rgba(23, 43, 77, 0.2);
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --border-radius: 8px;
}

/* --- Base & Global Styles --- */
body {
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font-family);
    margin: 0;
    line-height: 1.5;
}

.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.primary-heading-group {
    text-align: center;
    margin: 2.5rem 0;
    padding: 0 1rem;
}
.primary-heading-group h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
}
.primary-heading-group p {
    margin-bottom: 1.5rem;
}


/* --- Form Container & Sections --- */
.booking-form-wrapper {
    background-color: var(--bg-surface);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

#travel-segments-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-division {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.form-division-header {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
}

.form-division-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
}
.form-division-controls .form-division-header {
    width: 100%;
    margin-bottom: 0.5rem;
}

.journey-style-selector {
    display: inline-flex;
    background-color: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 4px;
    margin-bottom: 1.5rem;
    gap: 4px;
}
.journey-style-selector input[type="radio"] { display: none; }
.journey-style-selector label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease-in-out;
    white-space: nowrap;
}
.journey-style-selector input[type="radio"]:checked + label {
    background-color: var(--bg-surface);
    color: var(--brand-blue);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(23, 43, 77, 0.1);
}
.journey-style-selector input[type="radio"]:not(:checked) + label:hover { color: var(--text-primary); }

.journey-style-selector svg {
    display: none; /* Hide icons on desktop */
    width: 20px;
    height: 20px;
    stroke-width: 2.5;
}

/* --- Form Inputs & Groups --- */
.input-field-group { display: flex; flex-direction: column; }
.input-field-group label { font-weight: 500; font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 0.25rem; }
.icon-adorned-input { position: relative; display: flex; align-items: center; }
.icon-adorned-input svg { position: absolute; left: 12px; color: var(--text-secondary); pointer-events: none; }

input[type="text"], input[type="number"], select {
    width: 100%; box-sizing: border-box; height: 44px; padding: 0 12px; border: 1px solid var(--border-color);
    border-radius: var(--border-radius); background-color: var(--bg-surface);
    font-family: var(--font-family); font-size: 1rem; transition: border-color 0.2s, box-shadow 0.2s;
}
.icon-adorned-input input { padding-left: 40px; }
input:focus, select:focus {
    outline: none; border-color: var(--brand-blue); box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.2);
}

/* --- Travel Segment Layout --- */
.travel-segment {
    display: grid; grid-template-columns: 1fr auto 1fr 1.2fr 100px auto;
    gap: 1rem; align-items: flex-end;
}
.stay-length-input { text-align: center; }
.swap-locations-button {
    display: flex; align-items: center; justify-content: center; height: 44px; width: 44px;
    border-radius: 50%; border: 1px solid var(--border-color); background-color: var(--bg-surface);
    cursor: pointer; transition: all 0.2s; color: var(--text-secondary);
}
.swap-locations-button:hover { color: var(--brand-blue); border-color: var(--brand-blue); transform: rotate(180deg); }
.remove-segment-button {
    background: transparent; border: none; color: var(--text-secondary); height: 44px; width: 44px;
    font-size: 1.5rem; line-height: 1; cursor: pointer; transition: all 0.2s;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.remove-segment-button:hover { background-color: #fee2e2; color: #ef4444; }

/* --- Passenger Options & Actions Layout --- */
.passenger-options-layout {
    display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end;
    flex-grow: 1;
}
.passenger-options-layout .passenger-count-widget { width: 160px; flex-shrink: 0; }
.passenger-options-layout .cabin-select-group { flex-grow: 1; min-width: 180px; }

.numeric-incrementor {
    display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--border-color);
    padding: 6px; border-radius: var(--border-radius); height: 44px; box-sizing: border-box;
}
.incrementor-button {
    width: 30px; height: 30px; border: none; background: var(--bg-page); color: var(--text-secondary);
    font-size: 1.5rem; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.incrementor-button:hover { background-color: #dfe1e6; }
.incrementor-button:disabled { opacity: 0.5; cursor: not-allowed; }

.main-controls-area {
    display: flex;
    gap: 1rem;
}

.action-button {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    height: 44px; padding: 0 1.5rem; border-radius: var(--border-radius);
    border: 1px solid transparent; font-family: var(--font-family); font-weight: 600;
    font-size: 1rem; cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.action-button-main { background-color: var(--brand-blue); color: white; }
.action-button-main:hover { background-color: var(--brand-blue-hover); }
.action-button-alt { background-color: var(--bg-page); color: var(--text-primary); border-color: var(--border-color); }
.action-button-alt:hover { background-color: #e9ecef; }
.add-segment-link { display: none; }


/* --- Typeahead (Autocomplete) Styles --- */
.typeahead-container { position: relative; }
.typeahead-suggestions {
    position: absolute; top: 100%; left: 0; right: 0; background-color: var(--bg-surface);
    border: 1px solid var(--border-color); border-radius: var(--border-radius);
    box-shadow: var(--shadow); margin-top: 4px; max-height: 300px;
    overflow-y: auto; z-index: 1000; list-style: none; padding: 0.5rem;
    margin: 8px 0 0;
}
.suggestion-entry {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.6rem 0.75rem; border-radius: 6px; cursor: pointer; transition: background-color 0.15s;
}
.suggestion-entry.is-active-suggestion, .suggestion-entry:hover { background-color: #eaf2ff; }
.suggestion-primary-info .suggestion-location { font-weight: 600; }
.suggestion-primary-info .suggestion-airport-name { font-size: 0.875rem; color: var(--text-secondary); }
.suggestion-iata-code { font-weight: 700; color: var(--brand-blue); font-size: 1.1rem; }
.no-suggestions-found { padding: 0.6rem 0.75rem; color: var(--text-secondary); }

/* --- Results Page: Overlay Styles --- */
#search-overlay-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 2000;
    display: none; align-items: flex-start; justify-content: center;
}
#search-overlay-container.is-visible { display: flex; }
.overlay-backdrop {
    position: absolute; width: 100%; height: 100%;
    background-color: rgba(9, 30, 66, 0.54);
}
.overlay-content-box {
    position: relative; z-index: 1; background-color: var(--bg-page);
    border-radius: 12px; margin-top: 5vh; width: 90%; max-width: 1200px;
    max-height: 90vh; display: flex; flex-direction: column;
}
.overlay-title-bar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-color);
}
.overlay-title-bar h2 { margin: 0; }
#close-overlay-button {
    background: none; border: none; font-size: 2rem; color: var(--text-secondary);
    cursor: pointer; padding: 0; line-height: 1;
}
.overlay-body { overflow-y: auto; padding: 1.5rem; }
.overlay-body .booking-form-wrapper { box-shadow: none; border: none; padding: 0; }

/* --- Results Page: Spinner & Itinerary Items --- */
#journey-options-display {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}
.loading-indicator-wrapper {
    grid-column: 1 / -1; text-align: center; padding: 4rem 1rem;
    color: var(--text-secondary);
}
.loading-indicator-animation {
    display: inline-block; width: 50px; height: 50px; border: 4px solid var(--border-color);
    border-top-color: var(--brand-blue); border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state-message { grid-column: 1 / -1; text-align: center; font-size: 1.2rem; padding: 4rem 1rem; }

.itinerary-item {
    background-color: var(--bg-surface); border: 1px solid var(--border-color);
    border-radius: var(--border-radius); box-shadow: var(--shadow);
    display: flex; flex-direction: column;
    cursor: pointer;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

.itinerary-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(23, 43, 77, 0.12);
}

.itinerary-item.is-highlighted {
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.25);
    transform: translateY(-3px);
}

.item-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-color);
}
.carrier-label { font-weight: 600; }
.fare-display { font-weight: 700; font-size: 1.5rem; color: var(--brand-blue); }
.item-details {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.25rem;
}
.schedule-block { text-align: center; }
.hour-minute { font-size: 1.5rem; font-weight: 600; }
.iata-locator { color: var(--text-secondary); font-weight: 500; }
.route-summary { text-align: center; flex-grow: 1; padding: 0 1rem; }
.travel-time { font-size: 0.875rem; }
.route-connector {
    height: 1px; background-color: var(--border-color);
    margin: 0.25rem 0;
}
.connection-info { font-size: 0.875rem; color: var(--text-secondary); }

/* --- Floating Action Button (FAB) for Refine Search --- */
.floating-action-trigger {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: 56px;
    padding: 0 1.5rem;
    background-color: var(--brand-blue);
    color: white;
    border-radius: 28px;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 600;
}

.floating-action-trigger:hover {
    background-color: var(--brand-blue-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2), 0 3px 6px rgba(0, 0, 0, 0.1);
}

.floating-action-trigger svg {
    flex-shrink: 0;
}

/* --- Responsive Design --- */
@media (max-width: 992px) {
    .form-division-controls {
        flex-direction: column; align-items: stretch;
    }
    .main-controls-area {
        flex-direction: column-reverse; width: 100%;
    }
    .action-button { width: 100%; justify-content: center; }
}

@media (max-width: 768px) {
    .primary-heading-group h1 { font-size: 2rem; }
    .booking-form-wrapper { padding: 1rem; }
    
    .journey-style-selector {
        display: flex;
        width: 100%;
        justify-content: space-around;
    }
    .journey-style-selector label {
        flex-grow: 1;
        justify-content: center;
        padding: 0.75rem 0.5rem;
        gap: 0;
    }
    .journey-style-selector .journey-style-label {
        display: none; /* Hide text on mobile */
    }
    .journey-style-selector svg {
        display: block; /* Show icons on mobile */
    }

    .travel-segment {
        grid-template-columns: 1fr 1fr; grid-template-rows: auto auto;
        grid-template-areas: "origin destination" "dates dates";
        row-gap: 1rem; position: relative;
    }
    .travel-segment .departure-group { grid-area: origin; }
    .travel-segment .arrival-group { grid-area: destination; }
    .travel-segment .date-select-group { grid-area: dates; }
    .travel-segment .stay-length-group { display: none; }
    .travel-segment .remove-segment-button {
        position: absolute; top: -12px; right: -12px; z-index: 5; background-color: var(--bg-surface);
    }
    .travel-segment .swap-locations-button {
        position: absolute; top: 37px; left: 50%;
        transform: translateX(-50%); z-index: 10; height: 38px; width: 38px;
    }
    
    .floating-action-trigger {
        width: 56px;
        height: 56px;
        padding: 0;
        justify-content: center;
        right: 1.5rem;
        bottom: 1.5rem;
    }
    
    .floating-action-trigger .floating-trigger-label {
        display: none;
    }
}