/* ==========================================================================
   FAREGRAM ADVANCED FLIGHT RESULTS, SIDEBAR, RECOMMENDATIONS & DETAILS STYLES
   ========================================================================== */

/* 1. STICKY PERSISTENT MODIFY-SEARCH BAR */
.fg-modify-search-sticky {
  position: sticky;
  top: 60px; /* Sticks precisely below the 60px brand header */
  z-index: 1010;
  background: #ffffff;
  border-bottom: 1px solid var(--fg-line-200, #e2e8f0);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
  transition: all 0.2s ease-in-out;
}

.fg-modify-search-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  min-height: 52px;
  gap: 12px;
}

.fg-search-pills-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fg-search-pill-badge {
  background: var(--fg-surface-sub, #f8fafc);
  color: var(--fg-ink-800, #1e293b);
  font-weight: 600;
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: var(--fg-radius-sm, 6px);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--fg-line-200, #e2e8f0);
}
.fg-search-pill-badge .route-city {
  font-weight: 700;
  color: var(--fg-navy-900, #0b2239);
}
.fg-search-pill-badge .route-arrow {
  color: var(--fg-blue-600, #0878f9);
}

.fg-modify-drawer {
  background: var(--fg-surface-sub, #f8fafc);
  border-top: 1px solid var(--fg-line-200, #e2e8f0);
  padding: 18px;
  border-radius: 0 0 var(--fg-radius-md, 10px) var(--fg-radius-md, 10px);
  box-shadow: var(--fg-shadow-md);
  animation: fgSlideDown 0.2s ease-out;
}

@keyframes fgSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 2. COMPACT RECOMMENDATION STRIP (110px - 140px height) */
.fg-recommendation-bar,
.fg-rec-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.fg-rec-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  text-align: left;
  user-select: none;
  min-height: 110px;
  max-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.fg-rec-card:hover {
  border-color: #0284c7;
  background: #f8fafc;
}

.fg-rec-card.active {
  border-color: #0284c7;
  background: #f0f9ff;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

.fg-rec-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.fg-rec-badge.best-value { color: #0284c7; }
.fg-rec-badge.nonstop { color: #16a34a; }
.fg-rec-badge.pick { color: #7c3aed; }

.fg-rec-price {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}

.fg-rec-desc {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
  line-height: 1.3;
}

/* Mobile Recommendation Rail */
@media (max-width: 768px) {
  .fg-recommendation-bar,
  .fg-rec-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 10px;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .fg-recommendation-bar::-webkit-scrollbar,
  .fg-rec-grid::-webkit-scrollbar {
    display: none;
  }
  .fg-rec-card {
    min-width: 240px;
    max-width: 280px;
    flex-shrink: 0;
    scroll-snap-align: start;
  }
}

/* 3. DESKTOP FILTER SIDEBAR */
.fg-filter-sidebar {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.fg-filter-sidebar.sticky-lg {
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.fg-filter-group {
  padding: 14px 0;
  border-bottom: 1px solid #f1f5f9;
}

.fg-filter-group:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.fg-filter-title {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #1e293b;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fg-filter-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
  user-select: none;
}

.fg-filter-option:hover {
  color: #0284c7;
}

.fg-filter-option.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.fg-filter-check-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fg-filter-count {
  font-size: 11.5px;
  color: #94a3b8;
  font-weight: 500;
}

.fg-filter-subfare {
  font-size: 11px;
  color: #64748b;
  margin-left: 4px;
}

/* Time Window Pills */
.fg-time-window-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.fg-time-pill {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 6px 8px;
  text-align: center;
  cursor: pointer;
  background: #ffffff;
  transition: all 0.15s ease;
}

.fg-time-pill:hover {
  border-color: #0284c7;
  background: #f8fafc;
}

.fg-time-pill.active {
  border-color: #0284c7;
  background: #f0f9ff;
  color: #0284c7;
  font-weight: 600;
}

.fg-time-pill-label {
  font-size: 11.5px;
  display: block;
  font-weight: 600;
}

.fg-time-pill-hours {
  font-size: 9.5px;
  color: #64748b;
}

/* 4. EXPANDABLE ITINERARY DETAILS */
.fg-itinerary-details-panel {
  border-top: 1px dashed #cbd5e1;
  background: #f8fafc;
  padding: 20px;
  animation: fgFadeIn 0.2s ease-in-out;
}

@keyframes fgFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fg-details-tablist {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.fg-details-tab {
  all: unset;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #64748b;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  border-radius: 6px 6px 0 0;
  transition: all 0.15s ease;
}

.fg-details-tab:hover {
  color: #0f172a;
}

.fg-details-tab.active {
  color: #0284c7;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-bottom-color: #ffffff;
  margin-bottom: -2px;
}

.fg-details-tab:focus-visible {
  outline: 2px solid #0284c7;
  outline-offset: -2px;
}

/* Segment Row Timeline in Details */
.fg-segment-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

.fg-segment-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px 18px;
}

.fg-segment-meta-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 8px;
  margin-bottom: 12px;
  font-size: 12px;
  color: #64748b;
}

.fg-segment-points {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.fg-layover-notice {
  background: #fffbeb;
  border: 1px solid #fef3c7;
  color: #b45309;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

/* Provider Offer List Table inside Details */
.fg-provider-offers-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px;
}

.fg-provider-offer-row {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

.fg-provider-offer-row td {
  padding: 10px 14px;
  vertical-align: middle;
  font-size: 13px;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
}

.fg-provider-offer-row td:first-child {
  border-left: 1px solid #e2e8f0;
  border-radius: 6px 0 0 6px;
}

.fg-provider-offer-row td:last-child {
  border-right: 1px solid #e2e8f0;
  border-radius: 0 6px 6px 0;
}

.fg-provider-offer-row.selected {
  background: #f0f9ff;
  border-color: #0284c7;
}

.fg-provider-offer-row.selected td {
  border-color: #0284c7;
}

/* Mobile Filter Bottom Sheet */
.fg-mobile-filter-modal {
  position: fixed;
  inset: 0;
  z-index: 1060;
  display: none;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.fg-mobile-filter-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  border-radius: 20px 20px 0 0;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  animation: fgSheetUp 0.25s ease-out;
}

@keyframes fgSheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.fg-mobile-sheet-head {
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fg-mobile-sheet-body {
  padding: 16px 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
}

.fg-mobile-sheet-foot {
  padding: 14px 20px;
  border-top: 1px solid #e2e8f0;
  background: #fafbfc;
  display: flex;
  gap: 12px;
}


/* Direct Commit Cleanups & Filter Chips */
.fg-filter-chip-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}
.fg-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  font-size: 12px;
  color: #334155;
  font-weight: 500;
}
.fg-filter-chip button {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}
.fg-filter-chip button:hover {
  color: #0f172a;
}
.fg-clear-all-chips {
  font-size: 12px;
  color: #0284c7;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}
.fg-clear-all-chips:hover {
  text-decoration: underline;
}

/* Infinite Loading Sentinel & States */
.fg-infinite-sentinel {
  height: 20px;
  margin: 20px 0;
}
.fg-infinite-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  color: #64748b;
  font-size: 14px;
  font-weight: 500;
}
.fg-infinite-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #e2e8f0;
  border-top-color: #0284c7;
  border-radius: 50%;
  animation: fgSpin 0.7s linear infinite;
}
@keyframes fgSpin {
  to { transform: rotate(360deg); }
}
.fg-end-of-results {
  text-align: center;
  padding: 24px;
  color: #64748b;
  font-size: 13.5px;
  font-weight: 500;
  border-top: 1px dashed #cbd5e1;
  margin-top: 20px;
}
.fg-load-error-alert {
  text-align: center;
  padding: 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #991b1b;
  margin-top: 16px;
}

/* ==========================================================================
   RESULTS PAGE RESPONSIVE SIDEBAR & FLIGHT DETAILS DEPTH
   ========================================================================== */

/* Equal weight and layout symmetry for Outbound and Return sectors */
.fg-segment-direction-row {
  position: relative;
}

.fg-sector-badge {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.fg-sector-badge-outbound {
  background: rgba(3, 105, 161, 0.1);
  color: #0284c7;
}

.fg-sector-badge-return {
  background: rgba(71, 85, 105, 0.1);
  color: #334155;
}

/* Center-lane flight route layout: duration above, stops & layovers below */
.fg-center-lane {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  min-width: 140px;
}

.fg-center-duration {
  font-size: 11px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 2px;
}

.fg-center-track-wrap {
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px 0;
}

.fg-center-track-line {
  width: 100%;
  height: 2px;
  background: #cbd5e1;
  position: relative;
}

.fg-center-track-arrow {
  position: absolute;
  right: 0;
  top: -4px;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 6px solid #94a3b8;
}

.fg-center-stops-badge {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  padding: 1px 8px;
  font-size: 9.5px;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
}

.fg-center-layover-sub {
  font-size: 10px;
  color: #64748b;
  margin-top: 2px;
  white-space: nowrap;
}

/* 5 Distinct Flight Details Panels Styling */
.fg-details-provenance-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 11px;
  color: #64748b;
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.fg-rule-timeline-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  background: #ffffff;
  margin-bottom: 10px;
}

.fg-rule-timeline-card.before-dept {
  border-left: 4px solid #0284c7;
}

.fg-rule-timeline-card.after-dept {
  border-left: 4px solid #f59e0b;
}

.fg-rule-timeline-card.non-refundable {
  border-left: 4px solid #ef4444;
}

.fg-state-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.fg-state-badge-available { background: #dcfce7; color: #15803d; }
.fg-state-badge-partial { background: #fef9c3; color: #854d0e; }
.fg-state-badge-confirmation { background: #e0f2fe; color: #0369a1; }
.fg-state-badge-unavailable { background: #f1f5f9; color: #475569; }

/* Mobile Bottom Sheet for Flight Details on Narrow Screens */
@media (max-width: 768px) {
  .fg-itinerary-details-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1070;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    animation: fgFadeIn 0.2s ease-out;
  }
  .fg-itinerary-details-panel > div.fg-details-sheet-container {
    background: #ffffff;
    border-radius: 20px 20px 0 0;
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.2);
    animation: fgSheetUp 0.25s ease-out;
  }
  .fg-details-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 12px;
    margin-bottom: 16px;
  }
}


/* =========================================================================
   FAREGRAM NATIVE-STYLE MOBILE APP SHELL & DESKTOP SEARCH SURFACE
   ========================================================================= */

/* Desktop Search Surface */
.fg-desktop-search-surface {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  margin-bottom: 20px;
  gap: 12px;
}

.fg-search-segments-rail {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-grow: 1;
}

.fg-surface-segment {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fg-surface-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #0284c7;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fg-surface-label {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.1;
}

.fg-surface-val {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}

.fg-surface-sub {
  font-size: 11px;
  color: #64748b;
  line-height: 1.1;
}

.fg-surface-separator {
  width: 1px;
  height: 32px;
  background: #e2e8f0;
}

.fg-btn-desktop-modify {
  padding: 8px 18px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 13px;
}

/* Mobile Search Summary Surface (Sticky under App Header) */
.fg-mobile-search-summary-surface {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 56px;
  padding: 0 12px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 1025;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.fg-mobile-route-info {
  flex: 1 1 auto;
  min-width: 0;
  cursor: pointer;
  padding: 2px 4px;
}

.fg-mobile-route-title {
  font-size: 14px;
  font-weight: 700;
  color: #071f33;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
}

.fg-mobile-route-sub {
  font-size: 11px;
  color: #64748b;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-fg-modify-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  background: #EEF6FF;
  border: 1px solid #BAE6FD;
  border-radius: 17px;
  color: #0878F9;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-fg-modify-pill:hover,
.btn-fg-modify-pill:active {
  background: #0878F9;
  border-color: #0878F9;
  color: #ffffff;
}

/* Mobile Back Button - Shared across all mobile views and screens */
.fg-mobile-back-btn {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  border-radius: 50% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #071F33 !important;
  background: #F1F5F9 !important;
  border: 1px solid #E2E8F0 !important;
  cursor: pointer !important;
  padding: 0 !important;
  text-decoration: none !important;
  transition: all 0.2s ease !important;
  flex-shrink: 0 !important;
}

.fg-mobile-back-btn:hover,
.fg-mobile-back-btn:active {
  background: #E2E8F0 !important;
  color: #0878F9 !important;
}

.fg-mobile-back-btn svg {
  width: 20px !important;
  height: 20px !important;
  stroke: currentColor !important;
  stroke-width: 2.2 !important;
  display: block !important;
}

/* Fullscreen Views (Modify Search, Filter Flights, Flight Details) */
.fg-mobile-fullscreen-view {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100dvh;
  background: #f8fafc;
  z-index: 2060 !important;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Header and sticky bar stay fixed; content scrolls */
}

/* Header inside fullscreen view MUST ALWAYS BE VISIBLE with high contrast */
.fg-mobile-fullscreen-view .fg-mobile-app-header,
.fg-mobile-app-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  height: 56px !important;
  min-height: 56px !important;
  padding: 0 14px !important;
  background: #ffffff !important;
  color: #071f33 !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 2070 !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

.fg-mobile-fullscreen-view .fg-mobile-header-title,
.fg-mobile-header-title {
  font-size: 16px !important;
  font-weight: 700 !important;
  color: #071f33 !important;
  text-align: center !important;
  letter-spacing: -0.01em !important;
}

.fg-mobile-header-subtitle {
  font-size: 11px;
  color: #64748b;
  text-align: center;
}

/* Persistent Floating Bottom Dock (Filters & Sort By) */
.fg-mobile-floating-dock {
  display: none;
}

@media (max-width: 768px) {
  .fg-mobile-floating-dock {
    display: flex;
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: #001f3f;
    border-radius: 28px;
    padding: 4px;
    box-shadow: 0 8px 24px rgba(0, 31, 63, 0.35);
    z-index: 1040;
    gap: 4px;
    align-items: center;
  }
  .fg-dock-btn {
    border: none;
    background: transparent;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 24px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
  }
  .fg-dock-btn:active {
    background: rgba(255, 255, 255, 0.15);
  }
  .fg-dock-divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
  }
}

/* Fullscreen Views controlled above */

.fg-mobile-app-content {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 90px; /* Safe space for sticky actions */
}

/* Mobile Sticky Action Bar inside Details/Modify Views */
.fg-mobile-sticky-action-bar {
  position: relative; /* inside flex column, stays pinned at bottom without being covered */
  flex-shrink: 0;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  padding: 12px 16px;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
  z-index: 1090 !important;
  pointer-events: auto !important;
}

/* Bottom Sort Action Sheet */
.fg-mobile-sheet-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 1080;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.fg-mobile-sheet-content {
  background: #ffffff;
  border-radius: 20px 20px 0 0;
  padding: 20px 16px 24px;
  max-height: 80vh;
  overflow-y: auto;
}

.fg-mobile-sort-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  color: #0f172a;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.fg-mobile-sort-option:hover,
.fg-mobile-sort-option.active {
  background: #f0f9ff;
  color: #0284c7;
  font-weight: 700;
}

/* Provider Offer Selection Cards */
.fg-offer-compare-card {
  transition: all 0.2s ease-in-out;
  background: #ffffff;
}

.fg-offer-compare-card:hover {
  border-color: #0284c7 !important;
  background: #f8fafc;
}

.fg-offer-compare-card.selected {
  border-color: #0284c7 !important;
  background: #f0f9ff !important;
  box-shadow: 0 0 0 1px #0284c7;
}

/* Coexistence: suppress floating WhatsApp when full-screen or sheets are open */
body.fg-fullscreen-active .faregram-whatsapp-fab,
body.fg-fullscreen-active .fg-mobile-floating-dock,
body.fg-sheet-active .faregram-whatsapp-fab,
body.fg-sheet-active .fg-mobile-floating-dock,
body.fg-details-active .faregram-whatsapp-fab {
  display: none !important;
}


/* Floating Dock High Z-Index & Clean Floating Plane */
@media (max-width: 768px) {
  .fg-mobile-floating-dock {
    z-index: 1050 !important;
  }
}


/* Floating Dock Action Button Styles & Positioning */
@media (max-width: 768px) {
  .fg-mobile-floating-dock {
    position: fixed !important;
    bottom: 24px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 1050 !important;
    pointer-events: auto !important;
  }
  .btn-fg-dock-action,
  .fg-dock-btn {
    border: none !important;
    background: transparent !important;
    color: #ffffff !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    padding: 10px 18px !important;
    border-radius: 24px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    cursor: pointer !important;
    white-space: nowrap !important;
  }
  .btn-fg-dock-action:active,
  .fg-dock-btn:active {
    background: rgba(255, 255, 255, 0.15) !important;
  }
}


/* Sticky Action Bar High Z-Index */
.fg-mobile-sticky-action-bar {
  z-index: 1080 !important;
}

/* Ensure 0px horizontal overflow across all mobile viewports */
@media (max-width: 576px) {
  .fg-segment-direction-row .d-flex.align-items-center.gap-3 {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .fg-segment-direction-row .d-flex.align-items-center.gap-3 > div[style*="min-width: 120px"] {
    min-width: 0 !important;
    flex-grow: 1 !important;
  }
  .fg-segment-direction-row .d-flex.align-items-center.gap-3 > .flex-grow-1 {
    width: 100% !important;
    flex-basis: 100% !important;
    margin-top: 6px !important;
  }
  .fg-rec-grid {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    max-width: 100% !important;
  }
}

/* Ensure search results do not overflow horizontally on mobile */
.container-fg-results {
  width: 100% !important;
  max-width: 100% !important;
  padding-inline: 16px !important;
  box-sizing: border-box !important;
}
@media (max-width: 768px) {
  .fg-results-layout,
  .fg-results-grid {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .fg-itinerary-card {
    width: 100% !important;
    max-width: 100% !important;
  }
}


/* =========================================================================
   DEDICATED NATIVE MOBILE FLIGHT CARD ARCHITECTURE (<= 768px)
   ========================================================================= */
@media (max-width: 768px) {
  .fg-flight-result-card {
    border-radius: 16px !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05) !important;
    margin-bottom: 16px !important;
    background: #ffffff !important;
    overflow: hidden !important;
  }
  .fg-flight-result-card .card-body {
    padding: 14px !important;
  }
  /* Mobile stack for direction rows */
  .fg-flight-result-card .fg-segment-direction-row {
    padding-bottom: 12px !important;
    margin-bottom: 12px !important;
  }
  .fg-flight-result-card .fg-segment-direction-row .d-flex.align-items-center.gap-3 {
    display: grid !important;
    grid-template-columns: 44px 1fr !important;
    row-gap: 10px !important;
    column-gap: 12px !important;
    align-items: center !important;
  }
  /* Airline details in grid */
  .fg-flight-result-card .fg-segment-direction-row .d-flex.align-items-center.gap-3 > div:nth-child(2) {
    min-width: 0 !important;
    width: 100% !important;
  }
  /* Route times and timeline spans full width */
  .fg-flight-result-card .fg-segment-direction-row .d-flex.align-items-center.gap-3 > .flex-grow-1 {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    background: #f8fafc !important;
    border-radius: 10px !important;
    padding: 8px 10px !important;
  }
  /* Times layout */
  .fg-flight-result-card .fg-center-lane {
    padding: 0 6px !important;
  }
  .fg-flight-result-card .fg-center-duration {
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #64748b !important;
    margin-bottom: 2px !important;
  }
  .fg-flight-result-card .fg-center-stops-badge {
    font-size: 10px !important;
    font-weight: 600 !important;
    padding: 2px 6px !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 10px !important;
    color: #0369a1 !important;
  }
  /* Price & action footer on mobile */
  .fg-flight-result-card .col-lg-4 {
    border-top: 1px dashed #e2e8f0 !important;
    padding-top: 12px !important;
    margin-top: 6px !important;
  }
  .fg-flight-result-card .col-lg-4 .d-flex {
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
  }
  .fg-flight-result-card .card-price-val {
    font-size: 20px !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    line-height: 1.1 !important;
  }
  .fg-flight-result-card .card-gate-val {
    font-size: 11px !important;
    color: #64748b !important;
  }
  .fg-flight-result-card .btn-toggle-details {
    min-height: 44px !important;
    padding: 8px 14px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    border-radius: 22px !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
  }
  .fg-flight-result-card .card-book-btn {
    min-height: 44px !important;
    padding: 8px 18px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    border-radius: 22px !important;
    background: #001f3f !important;
    border-color: #001f3f !important;
  }
  /* Guarantee inert/backdrop recovery invariant */
  .fg-modal-backdrop:not(.active),
  .fg-mobile-sheet-overlay[style*="display: none"] {
    pointer-events: none !important;
    opacity: 0 !important;
  }
}


/* =========================================================================
   MOBILE SORT ACTION SHEET COMPONENT (ATOMIC & ERROR-FREE)
   ========================================================================= */
.fg-mobile-sheet-overlay {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(15, 23, 42, 0.6) !important;
  backdrop-filter: blur(2px) !important;
  -webkit-backdrop-filter: blur(2px) !important;
  z-index: 1080 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-end !important;
  align-items: center !important;
  pointer-events: auto !important;
}

.fg-mobile-sheet-overlay[style*="display: none"],
.fg-mobile-sheet-overlay:not(.active):not([style*="display: flex"]):not([style*="display: block"]) {
  display: none !important;
  pointer-events: none !important;
  opacity: 0 !important;
}

.fg-mobile-sheet-dialog {
  position: fixed !important;
  inset-inline: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  max-height: min(72dvh, 620px) !important;
  border-radius: 22px 22px 0 0 !important;
  background: #ffffff !important;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  z-index: 1090 !important;
  animation: fgSheetUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  padding-bottom: max(16px, env(safe-area-inset-bottom)) !important;
}

.fg-mobile-sheet-handle {
  width: 36px;
  height: 4px;
  background: #cbd5e1;
  border-radius: 2px;
  margin: 10px auto 4px auto;
  flex-shrink: 0;
}

.fg-mobile-sheet-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 12px 20px 14px 20px !important;
  border-bottom: 1px solid #f1f5f9 !important;
  flex-shrink: 0 !important;
}

.fg-mobile-sheet-header .sheet-title {
  font-size: 17px !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  margin: 0 !important;
}

.fg-mobile-sheet-options {
  padding: 10px 16px !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  flex: 1 1 auto !important;
}

.fg-sort-option-btn {
  width: 100% !important;
  min-height: 52px !important;
  padding: 12px 16px !important;
  margin-bottom: 6px !important;
  border: 1px solid #f1f5f9 !important;
  border-radius: 12px !important;
  background: #ffffff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  color: #1e293b !important;
}

.fg-sort-option-btn:hover,
.fg-sort-option-btn:active {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

.fg-sort-option-btn.active {
  background: #eff6ff !important;
  border-color: #3b82f6 !important;
  color: #1d4ed8 !important;
}

.fg-sort-option-btn .opt-title {
  font-size: 15px !important;
  font-weight: 600 !important;
}

.fg-sort-option-btn.active .opt-title {
  font-weight: 700 !important;
}

.fg-sort-radio-outer {
  width: 20px !important;
  height: 20px !important;
  border-radius: 50% !important;
  border: 2px solid #cbd5e1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  transition: all 0.15s ease !important;
}

.fg-sort-option-btn.active .fg-sort-radio-outer {
  border-color: #2563eb !important;
  background: #2563eb !important;
}

.fg-sort-radio-inner {
  width: 8px !important;
  height: 8px !important;
  border-radius: 50% !important;
  background: #ffffff !important;
  display: none !important;
}

.fg-sort-option-btn.active .fg-sort-radio-inner {
  display: block !important;
}

/* =========================================================================
   SYMMETRICAL & NON-OBSTRUCTIVE MOBILE FILTER & SORT BAR (< 768px)
   ========================================================================= */
.fg-mobile-filter-sort-bar {
  display: none;
}

@media (max-width: 767.98px) {
  .fg-mobile-filter-sort-bar {
    display: block;
    position: sticky;
    top: 56px;
    z-index: 1030;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 8px 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  }
  .fg-filter-sort-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .fg-filter-sort-btn {
    height: 44px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    color: #071f33;
    font-size: 13.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .fg-filter-sort-btn:active {
    background: #edf2f7;
    border-color: #cbd5e1;
    transform: scale(0.98);
  }
  .fg-carrier-logo-container {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  }
  .fg-carrier-logo-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 3px;
    display: block;
  }
  /* Suppress old floating dock so it never obstructs results */
  .fg-mobile-floating-dock {
    display: none !important;
  }
  /* Strict WhatsApp and Bottom Nav suppression during details/sheet modal */
  body.fg-fullscreen-active .faregram-whatsapp-fab,
  body.fg-sheet-active .faregram-whatsapp-fab,
  body.fg-details-active .faregram-whatsapp-fab,
  body.fg-fullscreen-active .fg-traveller-bottom-nav,
  body.fg-details-active .fg-traveller-bottom-nav {
    display: none !important;
  }
}

