/* Page de détail d'un voyage + sélection des sièges.
   Reprend les jetons (--bus-*) déclarés par .bus-marketplace dans
   transport-search.css : les deux feuilles se chargent ensemble. */

.bus-trip-page {
  /* Les trois états du plan reprennent exactement les couleurs des badges de
     légende : vert menthe = disponible, marine = réservé, bleu = sélectionné. */
  --seat-free: #5ce0a8;
  --seat-free-edge: #35cb8c;
  --seat-taken: #343b4f;
  --seat-taken-edge: #262c3c;
  --seat-picked: #55a9ef;
  --seat-picked-edge: #2f8adb;
  padding-bottom: 72px;
}

/* ---------------------------------------------------------------- Bandeau */

.bus-trip-hero {
  position: relative;
  overflow: hidden;
  padding: 26px 0 92px;
  color: #fff;
  background:
    radial-gradient(circle at 84% 8%, rgba(50, 116, 255, 0.34), transparent 32%),
    radial-gradient(circle at 8% 120%, rgba(28, 196, 147, 0.16), transparent 38%),
    linear-gradient(135deg, #07152e 0%, #10264a 54%, #0c1b37 100%);
}

.bus-trip-hero::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(to right, #000, transparent 78%);
}

.bus-trip-hero .container {
  position: relative;
  z-index: 1;
}

.bus-trip-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin-bottom: 22px;
  padding: 0;
  list-style: none;
  font-size: 0.78rem;
  font-weight: 600;
}

.bus-trip-breadcrumb li {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: rgba(255, 255, 255, 0.45);
}

.bus-trip-breadcrumb a {
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  transition: color 160ms ease;
}

.bus-trip-breadcrumb a:hover {
  color: #fff;
}

.bus-trip-breadcrumb li[aria-current] {
  color: rgba(255, 255, 255, 0.95);
}

.bus-trip-hero__head {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  justify-content: space-between;
  align-items: flex-end;
}

.bus-trip-hero__operator {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  padding: 6px 13px 6px 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 0.8rem;
  font-weight: 700;
}

.bus-trip-hero__logo {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  color: #9db9f5;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.9rem;
}

.bus-trip-hero__logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bus-trip-hero__type {
  padding: 2px 8px;
  border-radius: 6px;
  color: #0a1833;
  background: #5ce0b7;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.bus-marketplace .bus-trip-hero h1 {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 0;
  color: #fff !important;
  font-size: clamp(1.6rem, 3.2vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.08;
}

.bus-marketplace .bus-trip-hero h1 i {
  color: #5ce0b7;
  font-size: 0.8em;
}

.bus-trip-hero__stations {
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.84rem;
  font-weight: 500;
}

.bus-trip-hero__price {
  text-align: right;
}

.bus-trip-hero__price span {
  display: block;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.bus-trip-hero__price strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

/* --------------------------------------------------------- Bande de faits */

.bus-trip-shell {
  position: relative;
  z-index: 2;
  margin-top: -56px;
}

.bus-trip-card,
.bus-trip-facts {
  border: 0;
  border-radius: var(--bus-radius) !important;
  background: var(--bus-surface);
  box-shadow: 0 14px 42px rgba(22, 34, 56, 0.08) !important;
}

.bus-trip-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 24px;
  padding: 20px 24px;
}

.bus-trip-facts > div {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding-right: 18px;
  border-right: 1px solid var(--bus-line);
}

.bus-trip-facts > div:last-child {
  padding-right: 0;
  border-right: 0;
}

.bus-trip-facts i {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  color: var(--bus-blue);
  background: #eef4ff;
  font-size: 1.1rem;
}

.bus-trip-facts span {
  display: block;
  color: var(--bus-muted);
  font-size: 0.71rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.bus-trip-facts strong {
  display: block;
  margin-top: 2px;
  color: var(--bus-ink);
  font-size: 0.98rem;
  font-weight: 750;
  letter-spacing: -0.015em;
}

.bus-trip-facts small {
  display: block;
  color: var(--bus-muted);
  font-size: 0.76rem;
}

/* --------------------------------------------------------------- Cartouche */

.bus-trip-card__head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--bus-line);
}

.bus-trip-card__head h2 {
  display: flex;
  gap: 9px;
  align-items: center;
  margin: 0;
  color: var(--bus-ink);
  font-size: 1.06rem;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.bus-trip-card__head h2 i {
  color: var(--bus-blue);
}

.bus-trip-card__body {
  padding: 24px;
}

.bus-trip-pill {
  padding: 5px 11px;
  border-radius: 999px;
  color: var(--bus-green);
  background: rgba(11, 157, 112, 0.1);
  font-size: 0.75rem;
  font-weight: 750;
}

.bus-trip-pill--low {
  color: var(--bus-red);
  background: rgba(223, 59, 73, 0.1);
}

/* -------------------------------------------------------- Plan des sièges */

.seat-map {
  position: relative;
  width: fit-content;
  min-width: 240px;
  max-width: 100%;
  margin: 0 auto;
  padding: 16px 20px 22px;
  border: 1px solid var(--bus-line);
  border-radius: 26px 26px 18px 18px;
  background:
    linear-gradient(180deg, #f6f9fe 0%, #fff 22%);
}

.seat-map__cockpit {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 2px dashed var(--bus-line);
}

.seat-map__driver {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  color: #5b6478;
  background: #e9edf5;
  font-size: 1.15rem;
}

.seat-map__door {
  color: var(--bus-muted);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.seat-map__grid {
  display: grid;
  gap: 9px;
  justify-content: center;
}

.seat {
  position: relative;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 1.5px solid var(--seat-free-edge);
  border-radius: 11px 11px 7px 7px;
  color: #fff;
  background: var(--seat-free);
  font-size: 0.82rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: transform 160ms var(--bus-ease-out), border-color 160ms ease,
    background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

/* Accoudoirs : deux barres latérales qui donnent la silhouette d'un siège. */
.seat::before,
.seat::after {
  position: absolute;
  top: 9px;
  width: 3px;
  height: 20px;
  border-radius: 2px;
  background: var(--seat-free-edge);
  content: "";
  transition: background-color 160ms ease;
}

.seat::before {
  left: -1.5px;
}

.seat::after {
  right: -1.5px;
}

.seat:hover:not(:disabled) {
  border-color: var(--seat-picked-edge);
  background: var(--seat-picked);
  transform: translateY(-2px);
}

.seat:hover:not(:disabled)::before,
.seat:hover:not(:disabled)::after {
  background: var(--seat-picked-edge);
}

.seat:focus-visible {
  outline: 2px solid var(--bus-blue-dark);
  outline-offset: 3px;
}

.seat.is-selected {
  border-color: var(--seat-picked-edge);
  color: #fff;
  background: var(--seat-picked);
  box-shadow: 0 6px 16px rgba(85, 169, 239, 0.4);
  transform: translateY(-2px);
}

.seat.is-selected::before,
.seat.is-selected::after {
  background: var(--seat-picked-edge);
}

.seat.is-booked {
  border-color: var(--seat-taken-edge);
  border-style: solid;
  color: rgba(255, 255, 255, 0.85);
  background: var(--seat-taken);
  cursor: not-allowed;
}

.seat.is-booked::before,
.seat.is-booked::after {
  background: var(--seat-taken-edge);
}

.seat--driver {
  border-color: #d5dbe7;
  color: #6b7488;
  background: #e9edf5;
  cursor: default;
}

.seat--driver::before,
.seat--driver::after {
  background: #dde4ef;
}

.seat--aisle,
.seat--empty {
  visibility: hidden;
}

.seat-map__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: center;
  margin-top: 22px;
}

.seat-map__legend span {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: var(--bus-muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.seat-map__legend i {
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--seat-free-edge);
  border-radius: 5px;
  background: var(--seat-free);
}

.seat-map__legend i.is-selected {
  border-color: var(--seat-picked-edge);
  background: var(--seat-picked);
}

.seat-map__legend i.is-booked {
  border-color: var(--seat-taken-edge);
  background: var(--seat-taken);
}

.seat-map__hint {
  margin: 18px 0 0;
  color: var(--bus-muted);
  font-size: 0.78rem;
  text-align: center;
}

/* --------------------------------------------------- Passagers & résumé */

.passenger-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--bus-line);
  border-radius: 15px;
}

.passenger-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.passenger-table thead th {
  padding: 13px 16px;
  border-bottom: 1px solid var(--bus-line);
  color: var(--bus-muted);
  background: #f7f9fd;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.passenger-table thead th span[aria-hidden] {
  color: var(--bus-red);
}

.passenger-table tbody tr + tr > * {
  border-top: 1px solid var(--bus-line);
}

.passenger-table tbody th,
.passenger-table tbody td {
  padding: 12px 16px;
  vertical-align: middle;
}

.passenger-table tbody th {
  width: 76px;
  font-weight: 400;
  text-align: left;
}

.passenger-table__seat {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px 10px 7px 7px;
  color: #fff;
  background: var(--seat-picked);
  font-size: 0.82rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.passenger-table .form-control {
  height: 42px;
  border: 1px solid var(--bus-line);
  border-radius: 10px;
  background: #fff;
  font-size: 0.88rem;
}

.passenger-table .form-control:focus {
  border-color: var(--bus-blue);
  box-shadow: 0 0 0 3px rgba(36, 107, 253, 0.12);
}

.passenger-table .form-control.is-invalid {
  border-color: var(--bus-red);
}

.passenger-table__action {
  width: 52px;
  text-align: right;
}

.passenger-table__action button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--bus-line);
  border-radius: 9px;
  color: var(--bus-muted);
  background: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.passenger-table__action button:hover {
  border-color: rgba(223, 59, 73, 0.35);
  color: var(--bus-red);
  background: rgba(223, 59, 73, 0.08);
}


.bus-trip-empty {
  padding: 34px 20px;
  border: 1px dashed var(--bus-line);
  border-radius: 15px;
  background: #fbfcfe;
  text-align: center;
}

.bus-trip-empty i {
  display: grid;
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  place-items: center;
  border-radius: 15px;
  color: var(--bus-blue);
  background: #eef4ff;
  font-size: 1.5rem;
}

.bus-trip-empty p {
  margin: 0;
  color: var(--bus-muted);
  font-size: 0.88rem;
}

.bus-trip-empty strong {
  display: block;
  margin-bottom: 5px;
  color: var(--bus-ink);
  font-size: 1rem;
  font-weight: 750;
}

/* ------------------------------------------------------------- Récapitulatif */

.booking-summary__rows {
  display: grid;
  gap: 11px;
  margin-bottom: 16px;
}

.booking-summary__rows > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--bus-muted);
  font-size: 0.86rem;
}

.booking-summary__rows b {
  color: var(--bus-ink);
  font-weight: 700;
  text-align: right;
}

.booking-summary__total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 16px;
  border-top: 1px solid var(--bus-line);
}

.booking-summary__total span {
  color: var(--bus-ink);
  font-size: 0.92rem;
  font-weight: 750;
}

.booking-summary__total strong {
  color: var(--bus-blue);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.booking-submit {
  display: inline-flex;
  gap: 9px;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin-top: 18px;
  padding: 14px 18px;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: var(--bus-blue);
  font-size: 0.95rem;
  font-weight: 750;
  cursor: pointer;
  transition: background-color 160ms ease, transform 160ms var(--bus-ease-out),
    box-shadow 160ms ease;
}

.booking-submit:hover:not(:disabled) {
  background: var(--bus-blue-dark);
  box-shadow: 0 10px 24px rgba(36, 107, 253, 0.28);
  transform: translateY(-1px);
}

.booking-submit:disabled {
  color: #98a2b3;
  background: #e8ecf3;
  cursor: not-allowed;
}

.booking-secure {
  display: flex;
  gap: 7px;
  justify-content: center;
  align-items: center;
  margin: 12px 0 0;
  color: var(--bus-muted);
  font-size: 0.75rem;
}

.booking-secure i {
  color: var(--bus-green);
}

.booking-alert {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 11px;
  color: var(--bus-red);
  background: rgba(223, 59, 73, 0.08);
  font-size: 0.82rem;
  font-weight: 650;
}

.booking-alert i {
  flex: 0 0 auto;
  margin-top: 1px;
  font-size: 1rem;
}

.bus-trip-amenities {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--bus-line);
}

.bus-trip-amenities span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 6px 11px;
  border: 1px solid var(--bus-line);
  border-radius: 999px;
  color: #4b5568;
  background: #fbfcfe;
  font-size: 0.76rem;
  font-weight: 650;
}

.bus-trip-amenities i {
  color: var(--bus-blue);
}

/* ------------------------------------------------------------- Responsive */

/* Sous 768px, un tableau à 4 colonnes force un défilement horizontal pénible
   à la saisie : chaque ligne devient un bloc étiqueté par data-label. */
@media (max-width: 767.98px) {
  .passenger-table-wrap {
    overflow-x: visible;
    border: 0;
  }

  .passenger-table {
    min-width: 0;
  }

  .passenger-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .passenger-table tbody tr {
    position: relative;
    display: block;
    margin-bottom: 14px;
    padding: 16px;
    border: 1px solid var(--bus-line);
    border-radius: 15px;
    background: #fbfcfe;
  }

  .passenger-table tbody tr + tr > * {
    border-top: 0;
  }

  .passenger-table tbody th,
  .passenger-table tbody td {
    display: block;
    width: auto;
    padding: 0 0 12px;
  }

  .passenger-table tbody td:last-of-type,
  .passenger-table tbody td:nth-last-of-type(2) {
    padding-bottom: 0;
  }

  .passenger-table tbody td[data-label]::before {
    display: block;
    margin-bottom: 6px;
    color: #4b5568;
    content: attr(data-label);
    font-size: 0.76rem;
    font-weight: 750;
  }

  .passenger-table__action {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 0 !important;
  }
}

@media (max-width: 991.98px) {
  .bus-trip-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }

  .bus-trip-facts > div:nth-child(2n) {
    padding-right: 0;
    border-right: 0;
  }
}

@media (max-width: 575.98px) {
  .bus-trip-hero {
    padding-bottom: 78px;
  }

  .bus-trip-hero__head {
    align-items: flex-start;
  }

  .bus-trip-hero__price {
    text-align: left;
  }

  .bus-trip-facts {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .bus-trip-facts > div {
    padding-right: 0;
    border-right: 0;
  }

  .bus-trip-card__body {
    padding: 18px;
  }

  .seat {
    width: 40px;
    height: 40px;
  }

  .seat-map {
    padding: 14px 12px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .seat,
  .booking-submit {
    transition: none;
  }

  .seat:hover:not(:disabled),
  .seat.is-selected,
  .booking-submit:hover:not(:disabled) {
    transform: none;
  }
}
