/* ============================================================
   flights-grouped.css  —  Phase 1 grouped search results
   ============================================================ */

/* ---- Stats / Sort bar ---- */
#grouped-stats-bar { font-size: 0.875rem; }
.sort-btn {
  font-size: 0.8rem;
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  transition: all .2s ease;
}
.sort-btn.active {
  background: #0d6efd;
  color: #fff;
  border-color: #0d6efd;
  box-shadow: 0 4px 10px rgba(13,110,253,.22);
}

/* ---- Flight Group Card ---- */
.fg-card {
  background: #fff;
  border: 1px solid #e0e4ea;
  border-radius: 10px;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  position: relative;
}
.fg-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); }

.fg-group-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 5;
  background: #0d6efd;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
}

.fg-card-main {
  display: flex;
  align-items: stretch;
}

.fg-card-itins {
  flex: 1 1 auto;
  min-width: 0;
}

.fg-card-sidefare {
  width: 280px;
  border-left: 1px solid #eef2f7;
  background: #fafcff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

/* ---- Itinerary row ---- */
.fg-itin-row {
  padding: 16px 20px 14px;
  border-bottom: 1px solid #f0f2f5;
  background: #fafbfc;
}
.fg-itin-row + .fg-itin-row { border-top: 2px dashed #e0e4ea; }

.fg-itin-header {
  font-size: 0.72rem;
  font-weight: 600;
  color: #888;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.fg-segments {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}

.fg-seg {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fg-seg-dep, .fg-seg-arr {
  text-align: center;
  min-width: 78px;
}
.fg-seg-iata {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}
.fg-seg-time {
  font-size: 0.95rem;
  font-weight: 600;
  color: #222;
}
.fg-seg-date {
  font-size: 0.72rem;
  color: #888;
}
.fg-seg-terminal {
  font-size: 0.68rem;
  color: #aaa;
}
.fg-seg-nextday {
  font-size: 0.68rem;
  color: #e07b00;
  font-weight: 600;
}

.fg-seg-middle {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 110px;
  padding: 0 8px;
}
.fg-seg-carrier {
  font-size: 0.72rem;
  color: #555;
  font-weight: 600;
}
.fg-seg-line {
  width: 82px;
  height: 1px;
  background: #bbb;
  margin: 2px 0;
  position: relative;
}
.fg-seg-aircraft {
  font-size: 0.65rem;
  color: #aaa;
}
.fg-seg-codeshare {
  font-size: 0.65rem;
  color: #e07b00;
  font-style: italic;
}

/* layover badge */
.fg-layover {
  display: flex;
  align-items: center;
  padding: 2px 8px;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 12px;
  font-size: 0.7rem;
  color: #664d03;
  margin: 0 4px;
  white-space: nowrap;
}

/* Summary: stops + duration badges */
.fg-itin-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.fg-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
}
.fg-badge-nonstop { background: #d1fae5; color: #065f46; }
.fg-badge-stop    { background: #fee2e2; color: #7f1d1d; }
.fg-badge-dur     { background: #eff6ff; color: #1e40af; }
.fg-badge-codeshare { background: #fef9c3; color: #713f12; }

/* ---- Fare columns area ---- */
.fg-fares-wrapper {
  display: flex;
  overflow-x: auto;
  padding: 14px 20px 16px;
  gap: 14px;
  -webkit-overflow-scrolling: touch;
}

.fg-fare-col {
  flex: 0 0 180px;
  min-width: 160px;
  border: 2px solid #e0e4ea;
  border-radius: 8px;
  padding: 12px;
  position: relative;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fg-fare-col:hover { border-color: #0d6efd; box-shadow: 0 2px 8px rgba(13,110,253,.2); }
.fg-fare-col-single {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.fg-fare-single-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.fg-fare-price-total {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.1;
}
.fg-fare-price-sub {
  font-size: 0.7rem;
  color: #888;
}
.fg-fare-cabin {
  font-size: 0.75rem;
  font-weight: 600;
  color: #0d6efd;
  background: #eff6ff;
  padding: 1px 6px;
  border-radius: 4px;
  display: inline-block;
  margin-top: 2px;
}
.fg-fare-basis {
  font-size: 0.68rem;
  color: #666;
  font-family: monospace;
}
.fg-fare-refund {
  font-size: 0.68rem;
  color: #888;
}
.fg-fare-refund.is-refundable { color: #065f46; font-weight: 600; }

.fg-fare-baggage {
  font-size: 0.7rem;
  color: #444;
}

.fg-fare-ltd {
  font-size: 0.65rem;
  color: #b45309;
}

.fg-fare-pax {
  margin-top: 4px;
  border-top: 1px solid #f0f2f5;
  padding-top: 4px;
}
.fg-fare-pax-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: #666;
}

.fg-fare-select-btn {
  margin-top: auto;
  padding-top: 8px;
}
.fg-fare-select-btn .btn {
  width: 100%;
  font-size: 0.8rem;
  padding: 5px 8px;
}

.fg-fare-loading {
  opacity: .5;
  pointer-events: none;
}

/* ---- Empty / Loading states ---- */
#grouped-loading { padding: 60px 0; }
#grouped-empty   { padding: 60px 0; }

/* ---- Error alert ---- */
#grouped-error {
  margin: 16px auto;
  max-width: 700px;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .fg-card-main {
    display: block;
  }
  .fg-card-sidefare {
    width: 100%;
    border-left: 0;
    border-top: 1px solid #eef2f7;
    padding: 10px 12px 12px;
    background: #fff;
  }
  .fg-fare-col { flex: 0 0 150px; min-width: 140px; }
  .fg-seg-iata { font-size: 0.95rem; }
  .fg-seg-time { font-size: 0.85rem; }
}
