/* Reset et typographie */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: 'Segoe UI', sans-serif;
  background: #f8f9fa;
  color: #333;
}

/* En-tête du site */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.header-photos {
  display: flex;
  gap: 1rem;
}
.header-photo {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid #dee2e6;
}

/* Carte Leaflet */
#map {
  height: 60vh;
  margin: 1rem 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* Sections */
section {
  margin: 2rem;
  background: #fff;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
section h2 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
  border-bottom: 2px solid #adb5bd;
  padding-bottom: 0.5rem;
}

/* Liste des villes */
#city-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
}
#city-list li {
  background: #e9ecef;
  padding: 0.5rem 1rem;
  border-radius: 4px;
}

/* Tableau des étapes et distances - disposition desktop */
#distance-table {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
#distance-table th {
  background: #f1f3f5;
  font-weight: 600;
  text-align: center;
  border-bottom: 1px solid #e9ecef;
  padding: 0.75rem 1rem;
}
#distance-table td {
  border-bottom: 1px solid #e9ecef;
  padding: 0.75rem 1rem;
  vertical-align: top;
}
#distance-table tbody tr:hover {
  background: #e9ecef;
}

/* Largeur des colonnes desktop */
#distance-table th:nth-child(1),
#distance-table td:nth-child(1) {
  width: 60%;
  text-align: left;
}
#distance-table th:nth-child(2),
#distance-table td:nth-child(2) {
  width: 15%;
  text-align: right;
}
#distance-table th:nth-child(3),
#distance-table td:nth-child(3) {
  width: 15%;
  text-align: right;
}
#distance-table th:nth-child(4),
#distance-table td:nth-child(4) {
  width: 10%;
  text-align: center;
}

/* Pied de tableau */
#distance-table tfoot {
  background: #f1f3f5;
}
#distance-table tfoot .total-row td {
  font-weight: 600;
  border-top: 2px solid #dee2e6;
}

/* Responsive mobile (<600px) */
@media (max-width: 600px) {
  #distance-table,
  #distance-table thead,
  #distance-table tbody,
  #distance-table th,
  #distance-table td,
  #distance-table tr {
    display: block;
    width: 100%;
  }
  #distance-table thead tr {
    display: none;
  }
  #distance-table tbody tr {
    margin-bottom: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  }
  #distance-table td {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    font-size: 0.9rem;
  }
  #distance-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #555;
  }
  #distance-table tfoot,
  #distance-table tfoot tr,
  #distance-table tfoot td {
    display: table-row;
    width: auto;
  }
}

/* Popups Leaflet */
.leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.popup-container {
  width: 220px;
  padding: 0.5rem;
}
.popup-header {
  margin-bottom: 0.5rem;
  text-align: center;
  color: #007bff;
  border-bottom: 1px solid #e9ecef;
  padding-bottom: 0.3rem;
}
.popup-desc {
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: #333;
}
.popup-lodging {
  margin-bottom: 0.75rem;
  font-size: 0.75rem;
  color: #555;
  font-style: italic;
}

/* Bouton upload */
.upload-btn {
  width: 100%;
  padding: 0.5rem;
  background: #007bff;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
}
.upload-btn:hover {
  background: #0056b3;
}

/* Miniatures */
.photo-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: center;
  margin-top: 0.5rem;
}
.photo-preview img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.2s;
}
.photo-preview img:hover {
  transform: scale(1.1);
}

/* Numéros sur marqueurs */
.marker-number {
  display: block;       /* supprimer le flex */
  width: 30px;
  height: 30px;
  line-height: 30px;    /* centrage vertical */
  text-align: center;   /* centrage horizontal */
  background: #007bff;
  color: #fff;
  border-radius: 50%;
  border: 2px solid #fff;
  font-weight: bold;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  font-size: 1rem;
}

/* Lightbox */
#lightbox {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 9999;
}

#lightbox img {
  max-width: 90%;
  max-height: 80vh;
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(0,0,0,0.7);
}

.lightbox-title {
  position: absolute;
  top: 20px;
  font-size: 1.8em;
  color: white;
  background: rgba(0,0,0,0.6);
  padding: 6px 14px;
  border-radius: 8px;
  z-index: 10001;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 2em;
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  z-index: 10001;
}

.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3em;
  background: rgba(0,0,0,0.3);
  color: white;
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  cursor: pointer;
  z-index: 10001;
  transition: background 0.2s;
}
.lightbox-arrow:hover {
  background: rgba(255,255,255,0.2);
}

.arrow-left  { left: 30px; }
.arrow-right { right: 30px; }

.lightbox-counter {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  background: rgba(0, 0, 0, 0.6);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
}


/* Marqueur “Moi” */
.user-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
.user-marker-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 2px rgba(0,0,0,0.5);
}
.user-marker-label {
  margin-top: 4px;
  background: rgba(255,255,255,0.9);
  color: #007bff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Bouton suivre position */
.track-btn {
  display: block;
  margin: 1rem 2rem;
  padding: 0.5rem 1rem;
  background: #28a745;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: background 0.2s;
}
.track-btn:hover {
  background: #218838;
}

/* Pied de page */
.site-footer {
  background: #f1f3f5;
  padding: 1rem 2rem;
  text-align: center;
  font-size: 0.9rem;
  color: #555;
  border-top: 1px solid #dee2e6;
  margin-top: 2rem;
}
.site-footer .container {
  max-width: 1200px;
  margin: 0 auto;
}
#reservations {
  margin: 2rem;
  background: #fff;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
#reservations h2 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
  border-bottom: 2px solid #adb5bd;
  padding-bottom: .5rem;
}
.table-responsive {
  overflow-x: auto;
}
#reservations-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .95rem;
}
#reservations-table th,
#reservations-table td {
  padding: .75rem 1rem;
  border: 1px solid #dee2e6;
  text-align: left;
}
#reservations-table thead {
  background: #e9ecef;
}
#reservations-table tbody tr:nth-child(odd) {
  background: #f8f9fa;
}

#timeline-filters {
  margin: 2rem;
}
#timeline-filters .filters {
  margin-bottom: 1rem;
  display: flex; gap: 1rem;
}
#timeline {
  display: flex;
  overflow-x: auto;
  padding-bottom: 1rem;
}
.timeline-item {
  flex: 0 0 auto;
  width: 200px;
  margin-right: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  background: #fff;
  text-align: center;
  padding: .5rem;
}
.timeline-item img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-top-left-radius:8px;
  border-top-right-radius:8px;
}
.timeline-item h4 {
  margin: .5rem 0 .25rem;
  font-size: 1rem;
}
.timeline-item p {
  font-size: .85rem;
  color: #555;
}
/* classes pour filtrage */
.timeline-item.village    { /* rien spécial */ }
.timeline-item.point      { opacity: .9; }
.timeline-item.hebergement{ border: 2px solid #007bff; }
.timeline-item.hidden     { display: none; }

#current-position {
  background: white;
  padding: 10px 15px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  max-width: 300px;
  margin: 0 auto 10px auto; /* centrage + espacement */
  text-align: left;
  font-size: 15px;
}

.trip-intro {
  max-width: 800px;
  margin: 1.5rem auto;
  padding: 1rem 1.5rem;
  text-align: center;
}

.trip-summary p {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

#toggle-intro {
  background-color: #444;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.95rem;
}

#full-intro {
  margin-top: 1rem;
  padding: 1rem;
  background-color: #fafafa;
  border-radius: 10px;
  text-align: left;
  display: none;
}

#full-intro.show {
  display: block;
}

.hidden {
  display: none;
}

.countdown-label {
  font-size: 1rem;
  margin-left: 1rem;
  background-color: #f5f5f5;
  color: #333;
  padding: 0.2rem 0.6rem;
  border-radius: 5px;
  font-weight: normal;
  vertical-align: middle;
}

.timeline-item.passed {
  background-color: #e0e0e0; /* gris clair */
  opacity: 0.7;
}
.timeline-item.current {
  background-color: #c8e6c9; /* vert clair */
  border: 2px solid #4caf50;
}
.timeline-item.upcoming {
  background-color: #fff;
}

#city-list li {
  position: relative;
  padding: 6px 12px;
  background: #f0f0f0;
  margin-bottom: 4px;
  border-radius: 4px;
  overflow: hidden;
}

#city-list li .progress-bar {
  position: absolute;
  left: 0; top: 0;
  height: 100%;
  background-color: #007bff;
  z-index: 0;
  transition: width 0.4s ease;
  opacity: 0.2;
}

#city-list li .label {
  position: relative;
  z-index: 1;
}

.upload-fixed-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.8rem 1.2rem;
  background-color: white;
  border: 2px solid #333;
  border-radius: 8px;
  font-size: 1rem;
  z-index: 9999;
  cursor: pointer;
}

/* Container de la timeline */
#city-list {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  position: relative;
  margin: 2rem 1rem;
  padding: 2rem 0;
}

/* La ligne centrale */
#city-list::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 4%;
  right: 4%;
  height: 4px;
  background: #e0e0e0;
  transform: translateY(-50%);
  z-index: 0;
}

/* Chaque étape */
#city-list li.timeline-item {
  position: relative;
  flex: 1;
  max-width: 200px;
  padding: 1rem;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  text-align: center;
  transition: transform 0.3s, box-shadow 0.3s;
  z-index: 1;
}



/* Réinitialiser le compteur */
#city-list {
  counter-reset: step;
}

/* Barre de progression interne (optionnelle) */
#city-list li .progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  background: #4caf50;
  transition: width 0.4s ease;
  z-index: 3;
}

/* États passés / actuels / à venir */
#city-list li.passed {
  opacity: 0.6;
  transform: scale(0.95);
}
#city-list li.passed::before {
  background: #9e9e9e;
  color: #fff;
}
#city-list li.current {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
#city-list li.current::before {
  background: #4caf50;
  color: #fff;
}
#city-list li.upcoming::before {
  background: #e0e0e0;
  color: #555;
}

/* Titres et dates à l’intérieur */
#city-list li h4 {
  margin-top: 1.5rem; /* pour libérer l’espace du cercle */
  font-size: 1rem;
  color: #333;
}
#city-list li p {
  font-size: 0.85rem;
  color: #777;
  margin-top: 0.25rem;
}

/* Hover pour mettre en avant */
#city-list li:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

/* Responsive : empilement vertical sous 600px */
@media (max-width: 600px) {
  #city-list {
    flex-direction: column;
    align-items: flex-start;
    padding: 0;
    margin: 1rem;
  }
  #city-list::before {
    top: 4%;
    left: 50%;
    width: 4px;
    height: 92%;
    transform: translateX(-50%);
  }
  #city-list li {
    max-width: none;
    width: 100%;
    margin-bottom: 2rem;
    text-align: left;
  }
  #city-list li::before {
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
  }
  #city-list li h4 {
    margin-top: 1rem;
  }
}
/* -- timeline de base -- */
.timeline-item {
  position: relative;
  margin: 0 .5rem;
  padding: 1rem;
  border-radius: 8px;
  background: #fff;
  transition: transform .3s, box-shadow .3s, border-color .3s;
}

/* ligne grise par défaut */
.timeline-item.upcoming {
  background-color: #f7f7f7;
  color: #555;
  border: 2px solid transparent;
}

/* passé / actuel restent inchangés */
.timeline-item.passed {
  opacity: .6;
  transform: scale(.97);
}
.timeline-item.current {
  background-color: #c8e6c9;
  border: 2px solid #4caf50;
  transform: scale(1.1);
}

/* 1) hébergement → bleuté */
.timeline-item.hebergement {
  border: 2px solid #007bff;
}

/* 2) point clé → vert foncé */
.timeline-item.point {
  border: 2px solid #388e3c;
}

/* 3) village plus beaux → doré */
.timeline-item.village {
  border: 2px dashed #bbb;
}

/* (optionnel) autres → gris léger */
.timeline-item.other {
  border: 2px dashed #bbb;
}

/* hover pour tout le monde */
.timeline-item:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transform: scale(1.03);
}

/* contenu interne */
.timeline-item h4 {
  margin: .5rem 0 .25rem;
  font-size: 1rem;
}
.timeline-item p {
  font-size: .85rem;
  color: #666;
  margin: 0;
}
.timeline-item .progress-bar {
  position: absolute;
  bottom: 0; left: 0;
  height: 4px;
  background: #007bff;
  width: 0%;
  transition: width .4s ease;
}

/* responsive vertical sous 600px */
@media (max-width:600px) {
  #city-list { flex-direction: column; }
  .timeline-item { width: 100%; margin: .5rem 0; }
}

/* ───── Amélioration mobile ───── */
@media (max-width: 600px) {
  /* Centre la timeline et verticalise-la */
  #city-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    margin: 1rem auto;
    padding: 1rem 0;
  }

  /* Ligne centrale verticale */
  #city-list::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    background: #e0e0e0;
    transform: translateX(-50%);
    z-index: 0;
  }

  /* Chaque item prend presque toute la largeur */
  .timeline-item {
    width: calc(100% - 2rem);
    max-width: 400px;
    margin: 1rem 0;
    text-align: center;
    padding-top: 2rem; /* pour laisser passer le cercle numéroté */
  }
  .timeline-item::before {
    /* repositionne le cercle sur le haut de chaque carte */
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  .timeline-item h4,
  .timeline-item p {
    text-align: center;
  }

  /* ───── Tableau Étapes & distances ───── */
  #distance-table {
    border: none;
    box-shadow: none;
  }
  /* Affiche chaque <tr> comme une “carte” */
  #distance-table tbody tr {
    display: block;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 1rem;
    padding: 1rem;
  }
  /* Chaque cellule en ligne, avec label avant via CSS */
  #distance-table td {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.95rem;
  }
  #distance-table td::before {
    content: attr(data-label) ":";
    font-weight: 600;
    color: #555;
    margin-right: 0.5rem;
    white-space: nowrap;
  }
  /* Cache l’en-tête et pied de table par défaut */
  #distance-table thead,
  #distance-table tfoot {
    display: none;
  }
}
@media (max-width:600px) {
  /* transforme chaque ligne en grille 2 colonnes */
  #distance-table tbody tr {
    display: grid;
    grid-template-columns: 140px 1fr; /* label + contenu */
    grid-gap: 0.5rem 1rem;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 1rem;
    padding: 1rem;
  }

  /* on injecte le label via pseudo-élément, mais repositionné */
  #distance-table td {
    display: block;
    padding: 0;
  }
  #distance-table td::before {
    content: attr(data-label);
    font-weight: 600;
    display: block;
    margin-bottom: 0.25rem;
  }

  /* on masque l’entête/pied comme avant */
  #distance-table thead,
  #distance-table tfoot {
    display: none;
  }
}
/* Timeline Desktop : autoriser les retours à la ligne et ajuster la largeur minimale */
#city-list {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 1rem;
  margin: 0 auto;
}

.timeline-item {
  flex: 0 0 auto;           /* ne pas laisser l’item rétrécir */
  min-width: 140px;         /* largeur minimum confortable */
  max-width: 200px;         /* largeur maximum pour garder un alignement */
  margin: 0 .5rem;
  padding: 1rem;
  text-align: center;
  white-space: normal;      /* autorise le passage à la ligne */
}

/* Le titre s’adapte et peut couper les mots si besoin */
.timeline-item h4 {
  font-size: 1rem;
  line-height: 1.2;
  margin-bottom: .5rem;
  white-space: normal;
  word-wrap: break-word;    /* couper les mots trop longs */
  overflow-wrap: anywhere;  /* à la rigueur, couper n’importe où */
}

/* On centre le texte et ajuste la date */
.timeline-item p {
  font-size: .85rem;
  color: #555;
  margin: 0;
}
