/* Sélecteur de dates — plein écran, défilement continu.
 *
 * POURQUOI ON A CHANGÉ. L'ancien calendrier tenait dans la carte de
 * réservation : un mois à la fois, deux flèches pour avancer, et les dates
 * prises en rouge barré d'une croix. Trois défauts. On ne voyait jamais si
 * le mois suivant était plus libre sans cliquer. Le rouge criait l'échec
 * là où il fallait simplement effacer. Et la carte, déjà chargée, se
 * retrouvait à porter un calendrier qu'elle n'avait pas la place d'afficher.
 *
 * CE QUI REMPLACE. Une surface à part, qui ne fait que ça. Les mois
 * s'enchaînent verticalement : on fait défiler comme on ferait défiler une
 * liste, sans jamais chercher un bouton. Les dates prises sont grises et
 * barrées — elles s'effacent au lieu de crier.
 *
 * PAS DE TAILWIND ICI. Le CSS servi est figé : toute classe qu'on
 * générerait en JS serait absente du fichier et ne ferait rien du tout.
 * Tout ce que ce panneau utilise est défini dans ce fichier.
 */

:root {
  --ds-encre: #160F0C;
  --ds-or: #C68F45;
  --ds-or-fonce: #AB7530;
  --ds-bande: #FDF4EA;
  --ds-trait: #EFE7E0;
  --ds-gris: #8a8078;
}

.lv-ds {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  visibility: hidden;
  pointer-events: none;
}

.lv-ds.lv-ds--on {
  visibility: visible;
  pointer-events: auto;
}

.lv-ds__voile {
  position: absolute;
  inset: 0;
  background: rgba(22, 15, 12, 0.42);
  opacity: 0;
  transition: opacity 0.32s ease;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.lv-ds--on .lv-ds__voile { opacity: 1; }

.lv-ds__panneau {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  height: 100%;
  max-height: 100%;
  background: #FFFFFF;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1);
}

.lv-ds--on .lv-ds__panneau { transform: translateY(0); }

/* --- Barre haute : fermer, et effacer quand il y a quelque chose à effacer --- */

.lv-ds__haut {
  position: relative;
  z-index: 3;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 10px;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
}

.lv-ds__fermer {
  width: 34px;
  height: 34px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--ds-encre);
  cursor: pointer;
  transition: background 0.18s ease;
}

.lv-ds__fermer:hover { background: #F5EFE8; }
.lv-ds__fermer svg { width: 17px; height: 17px; }

.lv-ds__effacer {
  border: none;
  background: none;
  padding: 6px 2px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ds-encre);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.lv-ds__effacer.lv-ds--visible {
  opacity: 1;
  pointer-events: auto;
}

/* --- Le titre dit où on en est : arrivée, départ, puis la durée --- */

.lv-ds__entete {
  flex: none;
  padding: 2px 22px 16px;
}

.lv-ds__titre {
  margin: 0;
  font-size: 23px;
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -0.015em;
  color: var(--ds-encre);
  text-wrap: balance;
}

.lv-ds__sous {
  margin: 5px 0 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ds-gris);
}

.lv-ds__note {
  margin: 12px 22px 0;
  padding: 9px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  background: #FDF3EA;
  color: #8A5A2B;
}

.lv-ds__note[hidden] { display: none; }

/* --- Les jours de semaine restent en vue pendant qu'on fait défiler --- */

.lv-ds__semaine {
  position: sticky;
  top: 0;
  z-index: 2;
  flex: none;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 10px 14px;
  border-bottom: 1px solid var(--ds-trait);
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
}

.lv-ds__semaine span {
  font-size: 12px;
  font-weight: 600;
  color: var(--ds-gris);
  text-align: center;
}

.lv-ds__defile {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 4px 14px 22px;
}

.lv-ds__defile[data-verrou="1"] {
  pointer-events: none;
  opacity: 0.42;
}

.lv-ds__mois { padding-top: 18px; }

.lv-ds__mnom {
  margin: 0 0 10px 4px;
  font-size: 17px;
  font-weight: 700;
  color: var(--ds-encre);
}

/* Aucun écart entre colonnes : la bande de séjour doit courir d'un jour au
   suivant sans être coupée. L'espacement se fait par les lignes. */
.lv-ds__grille {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 4px;
}

/* Deux couches par jour, et c'est voulu. La CELLULE porte la bande du
   séjour, qui doit courir d'un jour au suivant sans coupure ; le BOUTON
   porte la pastille ronde. Tout mettre sur le bouton obligerait à
   reconstituer la bande avec des demi-fonds qui ne se rejoignent jamais
   proprement d'une colonne à l'autre. */
.lv-ds__c {
  position: relative;
  aspect-ratio: 1;
}

.lv-ds__c::before {
  content: '';
  position: absolute;
  inset: 2px -1px;
  background: transparent;
}

.lv-ds__c--dans::before { background: var(--ds-bande); }

/* L'arrivée n'ouvre la bande que vers la droite, le départ que vers la
   gauche : sinon le séjour semble déborder de part et d'autre. */
.lv-ds__c--debut::before {
  background: linear-gradient(to right, transparent 50%, var(--ds-bande) 50%);
}

.lv-ds__c--fin::before {
  background: linear-gradient(to left, transparent 50%, var(--ds-bande) 50%);
}

.lv-ds__j {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border: none;
  padding: 0;
  background: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--ds-encre);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.lv-ds__j span { position: relative; z-index: 1; line-height: 1.1; }

.lv-ds__j::before {
  content: '';
  position: absolute;
  inset: 2px 0;
  border-radius: 50%;
  background: transparent;
  transition: background 0.16s ease, transform 0.16s ease;
}

.lv-ds__j--vide { visibility: hidden; cursor: default; }

.lv-ds__j:disabled { cursor: default; }

/* Passé et hors-portée : on les laisse lisibles mais éteints. */
.lv-ds__j--passe {
  color: #C9C1B9;
  cursor: default;
}

/* Pris : gris barré. Le rouge d'avant transformait chaque indisponibilité
   en alerte, alors qu'il n'y a rien d'alarmant à ce qu'une date soit prise. */
.lv-ds__j--pris {
  color: #C0B8B0;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  cursor: default;
}

/* Le survol ne touche pas les deux extrémités du séjour : sinon on repeint
   la pastille dorée en crème et le chiffre, resté blanc, disparaît. */
.lv-ds__j--dispo:not(.lv-ds__j--debut):not(.lv-ds__j--fin):hover::before {
  background: #F5EFE8;
  transform: scale(0.94);
}

.lv-ds__j--debut::before,
.lv-ds__j--fin::before {
  background: linear-gradient(140deg, var(--ds-or), var(--ds-or-fonce));
  box-shadow: 0 6px 16px rgba(198, 143, 69, 0.32);
}

.lv-ds__j--debut,
.lv-ds__j--fin {
  color: #FFFFFF;
  font-weight: 700;
}

.lv-ds__j--aujourdhui span::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 3px;
  height: 3px;
  margin-left: -1.5px;
  border-radius: 50%;
  background: currentColor;
}

.lv-ds__p {
  position: relative;
  z-index: 1;
  text-decoration: none;
  font-size: 9.5px;
  font-weight: 600;
  color: #B57F35;
  line-height: 1;
  white-space: nowrap;
}

.lv-ds__j--debut .lv-ds__p,
.lv-ds__j--fin .lv-ds__p { color: rgba(255, 255, 255, 0.92); }
.lv-ds__j--pris .lv-ds__p,
.lv-ds__j--passe .lv-ds__p { color: #CFC7BF; }

/* --- Barre basse : ce que ça coûte, et le bouton pour valider --- */

.lv-ds__bas {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--ds-trait);
  background: rgba(255, 255, 255, 0.88);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
}

.lv-ds__prix {
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ds-encre);
}

.lv-ds__prix--attente {
  font-weight: 600;
  color: var(--ds-gris);
}

.lv-ds__prix b {
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.lv-ds__etoile {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ds-encre);
}

.lv-ds__etoile svg { width: 12px; height: 12px; }
.lv-ds__etoile[hidden] { display: none; }

.lv-ds__valider {
  flex: none;
  padding: 14px 30px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--ds-or), var(--ds-or-fonce));
  font-family: inherit;
  font-size: 15.5px;
  font-weight: 700;
  color: #FFFFFF;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 8px 20px rgba(171, 117, 48, 0.28);
}

.lv-ds__valider:active { transform: scale(0.97); }

.lv-ds__valider:disabled {
  background: #EDE7E1;
  color: #B4ABA3;
  box-shadow: none;
  cursor: default;
}

/* --- Sur grand écran, ce n'est plus une feuille mais une fenêtre --- */

@media (min-width: 768px) {
  .lv-ds { align-items: center; padding: 24px; }

  .lv-ds__panneau {
    height: auto;
    max-height: min(760px, calc(100vh - 48px));
    border-radius: 22px;
    box-shadow: 0 30px 80px rgba(22, 15, 12, 0.28);
    transform: translateY(14px) scale(0.985);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.24s ease;
  }

  .lv-ds--on .lv-ds__panneau {
    transform: translateY(0) scale(1);
    opacity: 1;
  }

  /* Des cases carrées font 78 px de haut dans un panneau de 560 : on ne
     voit qu'un mois et demi, avec beaucoup de vide autour des chiffres. */
  .lv-ds__c {
    aspect-ratio: auto;
    height: 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lv-ds__voile,
  .lv-ds__panneau,
  .lv-ds__j::before,
  .lv-ds__valider { transition: none; }
}

/* Le fond ne défile pas derrière la feuille. */
body.lv-ds-ouvert { overflow: hidden; }
