/* Tunnel réservation type Trainline — sheet mobile, sticky bar, galerie */

/* Galerie photo */
.photo-gallery { width: 100%; }
.photo-gallery-main {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--accent), #0a6f70);
  aspect-ratio: 16 / 10;
}
.photo-gallery--compact .photo-gallery-main { aspect-ratio: 2 / 1; border-radius: var(--r-sm); }
.photo-gallery--inline .photo-gallery-main { border-radius: var(--r-md) var(--r-md) 0 0; }
.photo-gallery-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-gallery-fallback {
  width: 100%;
  height: 100%;
  min-height: 120px;
  background: linear-gradient(135deg, var(--accent), #0a6f70);
}
.photo-gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--sh-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-gallery-prev { left: 10px; }
.photo-gallery-next { right: 10px; }
.photo-gallery-counter {
  position: absolute;
  bottom: 10px;
  right: 10px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(11, 27, 43, 0.65);
  color: #fff;
}
.photo-gallery-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.photo-gallery-thumbs::-webkit-scrollbar { display: none; }
.photo-gallery-thumb {
  flex: none;
  width: 64px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  padding: 0;
  background: var(--paper);
  cursor: pointer;
}
.photo-gallery-thumb.on { border-color: var(--accent); }
.photo-gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Hero search landing */
.hero-search {
  margin: 28px 0 28px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-md);
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}
.hero-search .fld { margin: 0; min-width: 0; }
.hero-search label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  margin-bottom: 7px;
}
.hero-search .inp,
.hero-search select {
  width: 100%;
  box-sizing: border-box;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14px;
  color: var(--ink);
}
.hero-search input[type="date"] {
  padding-right: 10px;
  min-height: 44px;
  -webkit-appearance: none;
  appearance: none;
}
.hero-search .hero-search-submit { align-self: end; }
.hero-search .hero-search-submit label { visibility: hidden; height: 0; margin: 0; overflow: hidden; }
.hero-search .btn {
  height: 44px;
  white-space: nowrap;
  width: 100%;
  min-width: 120px;
}
.hero-after-search { margin-top: 4px; }

/* Layout carte + liste recherche */
.search-map-layout {
  --search-map-offset: 300px;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  align-items: stretch;
  min-height: calc(100vh - var(--search-map-offset));
  min-height: calc(100dvh - var(--search-map-offset));
}
.search-map-layout .map {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  min-height: calc(100vh - var(--search-map-offset));
  min-height: calc(100dvh - var(--search-map-offset));
  height: 100%;
}
.search-map-layout .map #leafletMap {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.search-map-layout .map .leaflet-container {
  width: 100% !important;
  height: 100% !important;
  border-radius: inherit;
  z-index: 1;
}
.search-map-layout > .card {
  min-height: 0;
  max-height: calc(100vh - var(--search-map-offset));
  max-height: calc(100dvh - var(--search-map-offset));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#searchList {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* Marqueurs pastilles de prix */
.map-price-marker {
  background: none !important;
  border: none !important;
}
.map-price-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  box-shadow: var(--sh-md);
  font-family: var(--display);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
  cursor: pointer;
  transform: translate(-50%, -100%);
  transition: background 0.15s, color 0.15s, transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.map-price-pill::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  transform: translateX(-50%) rotate(45deg);
  width: 8px;
  height: 8px;
  background: var(--surface);
  border-right: 1.5px solid var(--line);
  border-bottom: 1.5px solid var(--line);
}
.map-price-pill {
  position: relative;
}
.map-price-pill:hover,
.map-price-pill.is-active,
.map-price-pill.is-preview {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  transform: translate(-50%, -100%) scale(1.06);
  box-shadow: var(--sh-lg);
  z-index: 2;
}
.map-price-pill:hover::after,
.map-price-pill.is-active::after,
.map-price-pill.is-preview::after {
  background: var(--accent);
  border-color: var(--accent);
}

/* Carte aperçu flottante */
.map-preview-card {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: min(300px, calc(100% - 32px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-xl);
  overflow: hidden;
  z-index: 1000;
  pointer-events: auto;
}
.map-preview-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--sh-sm);
}
.map-preview-photo {
  height: 140px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--accent), #0a6f70);
}
.map-preview-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.map-preview-photo-fallback { min-height: 140px; }
.map-preview-body { padding: 14px 16px 16px; }
.map-preview-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
  margin-right: 28px;
}
.map-preview-sub {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 2px;
}
.map-preview-meta {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.map-preview-cnt { color: var(--ink-3); font-weight: 400; }
.map-preview-price {
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-2);
}
.map-preview-price b {
  font-family: var(--display);
  font-size: 20px;
  color: var(--ink);
}
.map-preview-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.map-preview-actions .btn { flex: 1; justify-content: center; }

/* Surbrillance liste */
#searchList .lrow.is-active {
  background: var(--accent-soft);
}

@media (max-width: 1080px) {
  .search-map-layout { grid-template-columns: 1fr; }
  .search-map-layout .map {
    min-height: min(52vh, 480px);
  }
  .search-map-layout > .card {
    max-height: none;
  }
}

.space-card-media { position: relative; height: 160px; overflow: hidden; }
.space-card-media .photo-gallery,
.space-card-media .photo-gallery-main { height: 100%; aspect-ratio: unset; border-radius: 0; }

/* Tunnel booking sheet */
#bookBack.book-sheet-open {
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
}
#bookBack.book-sheet-open .modal.book-sheet {
  max-width: none;
  width: 100%;
  height: 100%;
  max-height: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}
#bookBack .modal.book-sheet .modal-body {
  flex: 1;
  min-height: 0;
  padding-bottom: 88px;
}
.book-sheet .modal-head { flex: none; padding: 14px 16px; }
.book-sheet .modal-head h3 { font-size: 16px; }
.book-stepper-dots {
  display: none;
  justify-content: center;
  gap: 8px;
  padding: 0 16px 12px;
}
.book-stepper-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line);
  transition: background 0.2s, transform 0.2s;
}
.book-stepper-dots .dot.on { background: var(--accent); transform: scale(1.15); }
.book-stepper-dots .dot.done { background: color-mix(in srgb, var(--accent) 45%, var(--line)); }

/* Sticky bar prix + CTA */
.book-sticky-bar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2100;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(11, 27, 43, 0.08);
  align-items: center;
  gap: 12px;
}
.book-sticky-bar.open { display: flex; }
.book-sticky-price { flex: 1; min-width: 0; }
.book-sticky-price .lbl { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.book-sticky-price .val {
  font-family: var(--display);
  font-weight: 700;
  font-size: 20px;
  color: var(--ink);
  line-height: 1.2;
}
.book-sticky-price .sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.book-sticky-bar .btn { flex: none; min-height: 44px; }

#bookBack.book-sheet-open .book-sticky-bar.in-modal {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
}
#bookBack.book-sheet-open .modal-foot.book-foot-desktop { display: none !important; }

/* Options dans récap */
.book-recap-options {
  margin: 16px 0;
  padding-top: 16px;
  border-top: 1px solid var(--line-2);
}
.book-recap-options h4 {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 10px;
}

/* Bottom nav invité mobile */
.guest-bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  justify-content: space-around;
  gap: 4px;
}
.guest-bottom-nav button,
.guest-bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  text-decoration: none;
  border: none;
  background: none;
  border-radius: 10px;
  min-height: 44px;
  justify-content: center;
}
.guest-bottom-nav button.on,
.guest-bottom-nav a.on { color: var(--accent-press); background: var(--accent-soft); }
body.guest-mode .guest-bottom-nav { display: flex; }
body.guest-mode .main { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
body.guest-mode .side { display: none; }
body.guest-mode .app { grid-template-columns: 1fr; }
body.guest-mode .topbar-app #burger { display: inline-flex !important; }

/* Slots scrollables mobile */
.slots { display: flex; flex-wrap: wrap; gap: 8px; }
.slots .slot { min-height: 44px; min-width: 88px; }

/* Détail modal galerie */
.detail-hero-gallery { margin: -8px -8px 16px; }

@media (max-width: 720px) {
  .hero-search {
    grid-template-columns: 1fr 1fr;
  }
  .hero-search .hero-search-submit { grid-column: 1 / -1; }
  .hero-search .btn { width: 100%; }

  #bookBack.book-sheet-open .stepper { display: none; }
  #bookBack.book-sheet-open .book-stepper-dots { display: flex; }

  .book-picker .slots {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }

  #searchMap.search-map-mobile .map {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    width: 100%;
    height: min(48vh, 420px);
    min-height: 280px;
    z-index: auto;
    border-radius: var(--r-lg);
    box-shadow: none;
  }
  #searchMap.search-map-mobile {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px;
    align-items: stretch;
  }
  #searchMap.search-map-mobile .card {
    margin-top: 0;
    max-height: none;
  }
  .map-preview-card {
    left: 12px;
    right: 12px;
    width: auto;
    transform: none;
  }
}

@media (min-width: 721px) {
  #bookBack.open .book-sticky-bar.in-modal { display: none; }
  #bookBack.open .modal-foot.book-foot-desktop { display: flex; }
}

@media (max-width: 900px) {
  .hero-search { grid-template-columns: 1fr 1fr; }
  .hero-search .hero-search-submit { grid-column: 1 / -1; }
}
