/* ==========================================================================
   FAREGRAM PREMIUM SEARCH OVERLAY & FLOATING PANEL SYSTEM
   ========================================================================== */

/* Layer Tokens */
:root {
  --fg-layer-dropdown: 50;
  --fg-layer-sticky: 60;
  --fg-layer-popover: 1050;
  --fg-layer-backdrop: 1150;
  --fg-layer-modal: 1200;
  --fg-layer-toast: 1300;
}

/* Dedicated Viewport Layer Root for Portaled Popovers */
#faregram-selector-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 0;
  overflow: visible;
  z-index: var(--fg-layer-modal);
  pointer-events: none;
}

#faregram-selector-layer > .fg-popover-panel {
  pointer-events: auto;
}

/* Floating Panel Anchor Container */
.fg-popover-panel {
  position: fixed;
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid var(--fg-line-200);
  box-shadow: 0 16px 48px -6px rgba(17, 34, 63, 0.22), 0 6px 18px -2px rgba(17, 34, 63, 0.10);
  z-index: var(--fg-layer-popover);
  display: none;
  opacity: 0;
  color: var(--fg-ink-900);
  overflow: hidden;
  max-height: calc(100vh - 80px);
}

.fg-popover-panel.active {
  display: flex;
  flex-direction: column;
  opacity: 1;
}

/* Panel Header */
.fg-panel-inner-header {
  padding: 18px 24px 14px 24px;
  border-bottom: 1px solid var(--fg-line-150);
  background: #ffffff;
}
.fg-panel-inner-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--fg-ink-950);
  margin-bottom: 2px;
}
.fg-panel-inner-sub {
  font-size: 12px;
  color: var(--fg-ink-500);
  margin: 0;
}

/* Panel Body */
.fg-panel-inner-body {
  padding: 20px 24px;
  overflow-y: auto;
  max-height: 480px;
}

/* Panel Footer */
.fg-panel-inner-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--fg-line-150);
  background: #fafbfc;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.fg-panel-summary-text {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--fg-navy-900);
}

.btn-fg-cancel {
  background: transparent;
  border: none;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  padding: 8px 16px;
  border-radius: var(--fg-radius-sm);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.btn-fg-cancel:hover {
  color: var(--fg-ink-900);
  background: #f1f5f9;
}

.btn-fg-apply {
  background: var(--fg-blue-600);
  color: #ffffff !important;
  border: 1px solid var(--fg-blue-700);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 22px;
  border-radius: var(--fg-radius-full);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(8, 120, 249, 0.25);
  transition: transform 0.15s ease, background 0.15s ease;
}
.btn-fg-apply:hover {
  background: var(--fg-blue-700);
  transform: translateY(-1px);
}

/* Specific Panel Dimensions */
#popover-cabin, #popover-flight-cabin {
  width: 580px;
}
#popover-travellers, #popover-flight-travellers {
  width: 620px;
}
#popover-calendar, #popover-flight-calendar, #popover-hotel-calendar, #popover-holiday-calendar {
  width: 780px;
}
#popover-city-from, #popover-flight-from, #popover-city-to, #popover-flight-to {
  width: 480px;
}
#popover-hotel-dest, #popover-holiday-dest, #popover-holiday-origin {
  width: 480px;
}
#popover-hotel-guests, #popover-holiday-travellers {
  width: 640px;
}
#popover-holiday-duration, #popover-holiday-tier {
  width: 460px;
}

/* Active Segment State when Panel is Open */
.fg-input-segment.panel-open {
  background: var(--fg-blue-50) !important;
  outline: 2px solid var(--fg-blue-600) !important;
  outline-offset: -2px;
  z-index: 10;
}
.fg-input-segment.panel-open .fg-chevron-icon {
  transform: rotate(180deg);
}

/* Mobile Dedicated Bottom Sheet Transformation */
@media (max-width: 991px) {
  .fg-popover-panel {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: min(88dvh, calc(var(--fg-visual-viewport-height, 100vh) - 16px));
    border-radius: 22px 22px 0 0 !important;
    z-index: var(--fg-layer-modal) !important;
    transform: translateY(100%);
    transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.15s ease;
    box-shadow: 0 -8px 36px rgba(0, 0, 0, 0.28);
    display: none;
    opacity: 0;
    margin: 0 !important;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .fg-popover-panel.active {
    display: flex !important;
    flex-direction: column !important;
    transform: translateY(0) !important;
    opacity: 1 !important;
  }

  .fg-panel-inner-header {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    padding: 16px 20px 12px 20px !important;
    border-bottom: 1px solid var(--fg-line-150) !important;
    flex-shrink: 0;
  }

  .fg-panel-inner-body {
    flex: 1 1 auto;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: 16px 20px !important;
    max-height: calc(85dvh - 140px);
  }

  .fg-panel-inner-footer {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 14px 20px !important;
    border-top: 1px solid var(--fg-line-150) !important;
    background: #ffffff !important;
    flex-shrink: 0;
    gap: 12px;
  }

  /* Sheet close button styling */
  .fg-sheet-close-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #64748b;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
  }
  .fg-sheet-close-btn:hover {
    color: #0f172a;
    background: #f1f5f9;
  }

  .fg-modal-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(5, 17, 35, 0.46) !important;
    backdrop-filter: blur(2px) !important;
    -webkit-backdrop-filter: blur(2px) !important;
    z-index: var(--fg-layer-backdrop) !important;
    display: none;
  }
  .fg-modal-backdrop.active {
    display: block !important;
  }
}

/* ==========================================================================
   PRICE STATE & DYNAMIC BADGE TOKENS
   ========================================================================== */
.fg-price-badge.fg-price-request {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
}

.fg-price-container {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  font-weight: 700;
}

.fg-price-prefix {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

.fg-price-currency {
  font-size: 14px;
}

.fg-price-amount {
  font-size: 17px;
  color: var(--fg-navy-900);
}

