/* ==========================================================================
   LMR Price Calendar — Styles complets
   Cohérence visuelle :
   - Libre (free)    : blanc
   - Occupé (busy)   : aplat rose doux
   - Sans tarif      : aplat bleu pâle + hachures
   - Transition      : 50/50 (gauche nuit J-1 / droite nuit J), hachures seulement côté noprice
   ========================================================================== */

/* ===== Palette & variables ===== */
.lmr-cal{
  --free-bg:    #ffffff;
  --busy-bg:    #f8d8d4;
  --noprice-bg: #e9f2ff;

  --ink:        #161616;
  --muted:      #6b7280;
  --border:     #e6e6e6;

  --range-bg:   #fff0e6;
  --primary:    #d77b5d;
  --primary-2:  #b85f45;

  --weekend-bg: #fafafa;
}

/* ===== Container ===== */
.lmr-cal{
  background:#fff;
  color:var(--ink);
  border:1px solid var(--border);
  border-radius:18px;
  padding:12px;
  max-width: 760px;
  margin: 16px auto;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* ===== Header ===== */
.lmr-cal-header{
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:8px;
}
.lmr-month{
  font-weight:700; text-transform:capitalize;
}
.lmr-prev,.lmr-next{
  border:none; background:#fff; color:var(--primary);
  font-size:20px; padding:6px 10px; border-radius:12px; cursor:pointer;
}
.lmr-prev:hover,.lmr-next:hover,
.lmr-prev:focus-visible,.lmr-next:focus-visible{
  color:var(--primary-2);
  box-shadow:0 0 0 3px rgba(215,123,93,.15);
}

/* Toggle "Afficher le passé" */
.lmr-toggle-past{
  margin-left:8px; font-size:12px;
  padding:4px 8px; border:1px solid var(--border); border-radius:8px;
  background:#fff; color:var(--ink); cursor:pointer;
}
.lmr-toggle-past.is-on{ background:#fff7f2; border-color:#f3d0c4; }

/* ===== Grid ===== */
.lmr-grid{ display:grid; gap:6px; }
.lmr-row{ display:grid; grid-template-columns:repeat(7,1fr); gap:6px; }
.lmr-row.lmr-head span{
  font-size:12px; color:var(--muted); text-align:center;
}

/* ===== Jours ===== */
.lmr-day{
  position:relative;
  background: var(--free-bg);
  border:1px solid var(--border);
  border-radius:10px;
  min-height:56px;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  line-height:1.1;
  overflow:hidden;
  cursor:pointer;
  transition: box-shadow .15s ease;
}
.lmr-day em{ font-style:normal; font-weight:700; }
.lmr-day i{ font-size:12px; color:var(--muted); opacity:.95; }

/* Weekends (subtil) */
.lmr-weekend{ background: var(--weekend-bg); }

/* Today (point discret) */
.lmr-today::after{
  content:""; position:absolute; bottom:6px; width:6px; height:6px;
  border-radius:50%; background: var(--primary); opacity:.75;
}

/* ===== États "purs" (aplats, aucune diagonale) ===== */
.lmr-day.pure-free    { background: var(--free-bg) !important; }
.lmr-day.pure-busy    { background: var(--busy-bg) !important; }
.lmr-day.pure-noprice { background: var(--noprice-bg) !important; }

/* Supprimer toute superposition sur les aplats */
.lmr-day.pure-free::before, .lmr-day.pure-free::after,
.lmr-day.pure-busy::before, .lmr-day.pure-busy::after,
.lmr-day.pure-noprice::before, .lmr-day.pure-noprice::after{
  content:none !important; display:none !important;
}

/* ===== Transitions (moitié gauche = nuit J-1, moitié droite = nuit J) ===== */
.lmr-day.is-transition{
  --half-left:  var(--free-bg);
  --half-right: var(--free-bg);
  background:
    linear-gradient(90deg, var(--half-left) 0 50%, var(--half-right) 50% 100%) !important;
  box-shadow: inset -1px 0 0 rgba(0,0,0,.05); /* petite ligne centrale */
}

/* Mappage des demi-couleurs */
.lmr-day.is-transition.half-left-busy    { --half-left:  var(--busy-bg); }
.lmr-day.is-transition.half-left-noprice { --half-left:  var(--noprice-bg); }
.lmr-day.is-transition.half-right-busy    { --half-right: var(--busy-bg); }
.lmr-day.is-transition.half-right-noprice { --half-right: var(--noprice-bg); }

/* Hachures UNIQUEMENT côté noprice (jamais sur busy/free) */
.lmr-day.is-transition.half-left-noprice::before{
  content:""; position:absolute; left:0; top:0; width:50%; height:100%;
  pointer-events:none;
  background-image: repeating-linear-gradient(45deg,
    rgba(0,0,0,.07) 0 6px, transparent 6px 12px);
}
.lmr-day.is-transition.half-right-noprice::after{
  content:""; position:absolute; left:50%; top:0; width:50%; height:100%;
  pointer-events:none;
  background-image: repeating-linear-gradient(45deg,
    rgba(0,0,0,.07) 0 6px, transparent 6px 12px);
}

/* ===== Sélection ===== */
.lmr-day.lmr-range{
  background: var(--range-bg) !important;
  box-shadow: inset 0 0 0 2px rgba(215,123,93,.22);
}
.lmr-day.lmr-in, .lmr-day.lmr-out{
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Pas de hachures visibles pendant la plage sélectionnée (lisibilité) */
.lmr-day.lmr-range.is-transition::before,
.lmr-day.lmr-range.is-transition::after{ display:none !important; }

/* ===== Past / Disabled / Hover ===== */
.lmr-day.lmr-past{
  opacity:.55; filter: grayscale(.1);
}
.lmr-day[data-disabled="1"]{
  cursor:not-allowed; opacity:.6;
}
.lmr-day:not([data-disabled="1"]):hover{
  box-shadow: inset 0 0 0 2px rgba(215,123,93,.18);
}

/* Petit wiggle quand refus */
@keyframes lmr-wiggle{
  0%{transform:translateX(0)} 25%{transform:translateX(-3px)}
  50%{transform:translateX(3px)} 100%{transform:translateX(0)}
}
.lmr-day.lmr-denied{ animation: lmr-wiggle .18s linear; }

/* ===== Légende ===== */
.lmr-legend{
  display:flex; flex-wrap:wrap; gap:8px 14px; margin-top:8px; font-size:12px; color:var(--muted);
}
.lmr-legend .dot{
  display:inline-block; width:12px; height:12px; border-radius:3px; margin-right:6px; vertical-align:middle;
  border:1px solid var(--border);
}
.lmr-legend .lg-start .dot{ background:#fff; border-color: var(--primary); box-shadow: inset 0 0 0 2px var(--primary); }
.lmr-legend .lg-end   .dot{ background:#fff; border-color: var(--primary); box-shadow: inset 0 0 0 2px var(--primary); }
.lmr-legend .lg-range .dot{ background: var(--range-bg); }
.lmr-legend .lg-busy  .dot{ background: var(--busy-bg); }
.lmr-legend .lg-noprice .dot{
  background: var(--noprice-bg);
  background-image: repeating-linear-gradient(45deg, rgba(0,0,0,.10) 0 6px, transparent 6px 12px);
}

/* ===== Résumé ===== */
.lmr-summary{
  display:grid; grid-template-columns:repeat(2, minmax(0,1fr));
  gap:8px; margin-top:10px;
}
.lmr-line{
  display:flex; justify-content:space-between; align-items:center;
  padding:8px 10px; border:1px dashed var(--border); border-radius:10px;
}

/* ===== Hints (min/max) & Alternatives ===== */
.lmr-hint{ margin-top:6px; }
.lmr-hint .lmr-hint-inner{
  background:#fff8e6; color:#3b2f10;
  border:1px solid #f2cc7b; border-radius:10px; padding:8px 10px;
  animation: fadeIn .25s ease-in;
}
.lmr-hint-apply{
  display:block; width:100%; margin-top:6px; text-align:left;
  background:#fff; color:var(--ink);
  border:1px dashed var(--border); border-radius:10px; padding:8px 10px; cursor:pointer;
  transition: all .2s;
}
.lmr-hint-apply:hover{ background:var(--range-bg); border-color:var(--primary); transform: translateX(2px); }

.lmr-suggest{
  margin-top:6px; max-height:140px; overflow-y:auto; padding:4px;
  border:1px solid var(--border); border-radius:10px; background:#f9f9f9;
}
.lmr-alt-btn{
  display:block; width:100%; text-align:left;
  background:#fff; color:var(--ink); border:1px dashed var(--border); border-radius:10px; padding:8px 10px;
  cursor:pointer; margin-bottom:6px; transition: background .2s, border-color .2s, transform .1s;
}
.lmr-alt-btn:hover{ background:var(--range-bg); border-color:var(--primary); }
.lmr-alt-btn:active{ transform: scale(.99); }

/* ===== CTA ===== */
.lmr-cta{
  display:flex; gap:8px; justify-content:flex-end; margin-top:10px;
}
.lmr-cta .lmr-clear{
  background:#fff; color:var(--ink); border:1px solid var(--border);
  padding:8px 10px; border-radius:10px; cursor:pointer;
}
.lmr-cta .lmr-clear:hover,
.lmr-cta .lmr-clear:focus-visible{
  border-color:var(--primary);
  box-shadow:0 0 0 3px rgba(215,123,93,.15);
}
.lmr-cta .lmr-send{
  display:inline-block; background:var(--primary); color:#fff;
  padding:10px 12px; border-radius:10px; text-decoration:none;
}
.lmr-cta .lmr-send:hover,
.lmr-cta .lmr-send:focus-visible{
  background:var(--primary-2);
  box-shadow:0 0 0 3px rgba(215,123,93,.15);
}

/* ===== Loading (spinner discret) ===== */
.lmr-loading::after{
  content:''; border:2px solid var(--border); border-top:2px solid var(--primary);
  border-radius:50%; width:16px; height:16px; animation: spin 1s linear infinite;
  margin: 20px auto; display:block;
}
@keyframes spin{ 0%{transform:rotate(0)} 100%{transform:rotate(360deg)} }
@keyframes fadeIn{ from{opacity:0; transform:translateY(-4px)} to{opacity:1; transform:translateY(0)} }

/* ===== Responsive ===== */
@media (max-width:640px){
  .lmr-row{ gap:4px; }
  .lmr-day{ min-height:48px; }
  .lmr-summary{ grid-template-columns:1fr; }
}

/* --- Demi-surlignage de sélection sur les bords --- */
/* On réutilise ::before (gauche) et ::after (droite).
   On masque les hachures noprice sur la moitié sélectionnée,
   et on peint la moitié en couleur de sélection (--range-bg). */

/* 1) Arrivée : teinte la moitié DROITE */
.lmr-day.lmr-in::after{
  content:"";
  position:absolute;
  left:50%; top:0; width:50%; height:100%;
  background: var(--range-bg);
  box-shadow: inset 0 0 0 2px rgba(215,123,93,.22);
  pointer-events:none;
  z-index: 1;
}
/* Si la moitié droite avait des hachures noprice, on les cache sous la teinte sélection */
.lmr-day.lmr-in.is-transition.half-right-noprice::after{
  /* la règle ci-dessus écrase déjà la hachure, rien à faire de plus */
}

/* 2) Départ : teinte la moitié GAUCHE */
.lmr-day.lmr-out::before{
  content:"";
  position:absolute;
  left:0; top:0; width:50%; height:100%;
  background: var(--range-bg);
  box-shadow: inset 0 0 0 2px rgba(215,123,93,.22);
  pointer-events:none;
  z-index: 1;
}
/* Si la moitié gauche avait des hachures noprice, on les masque aussi */
.lmr-day.lmr-out.is-transition.half-left-noprice::before{
  /* idem : la teinte de sélection passe au-dessus */
}

/* 3) Ne cache pas ces demi-teintes par les règles “masquer hachures en plage”
   (on cible seulement le cas .lmr-range pour couper les hachures internes,
    mais on laisse libres les bords in/out que l’on surligne à moitié) */
.lmr-day.lmr-range.is-transition::before,
.lmr-day.lmr-range.is-transition::after{
  display: none !important;
}

/* 4) BONUS : un contour un peu plus appuyé sur in/out pour bien lire l’ancrage */
.lmr-day.lmr-in,
.lmr-day.lmr-out{
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
/* ==== Rendre le contenu (jour + prix) au-dessus des overlays ==== */
.lmr-day em,
.lmr-day i {
  position: relative;
  z-index: 3;            /* le texte passe devant les ::before/::after */
}

/* ==== Les demi-surcouches restent derrière le contenu ==== */
.lmr-day::before,
.lmr-day::after {
  z-index: 1;
}

/* ==== Badge prix lisible partout ==== */
.lmr-day i {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 999px;
  line-height: 1;
  background: rgba(255,255,255,0.92);  /* “pill” blanc semi-opaque */
  border: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0,0,0,.04);
  font-weight: 600;
}

/* Un peu plus de contraste si case occupée / sans tarif */
.lmr-day.pure-busy i,
.lmr-day.pure-noprice i,
.lmr-day.is-transition i {
  background: rgba(255,255,255,0.96);
}

/* ==== Demi-teintes sélection : restent derrière le texte ==== */
.lmr-day.lmr-in::after,
.lmr-day.lmr-out::before {
  z-index: 2;            /* sous le texte (z=3), au-dessus du fond (z=1) */
}

/* ==== Option : agrandir un poil le prix au survol/sélection ==== */
.lmr-day:not([data-disabled="1"]):hover i,
.lmr-day.lmr-range i,
.lmr-day.lmr-in i,
.lmr-day.lmr-out i {
  transform: translateY(-1px);
}

/* ==== Option mobile : prix un peu plus gros ==== */
@media (max-width:640px){
  .lmr-day i { font-size: 13px; }
}

/* === Lisibilité générale des prix === */
.lmr-day i {
  position: relative;
  z-index: 3;
  font-weight: 600;
  color: #3a3a3a; /* un gris légèrement plus foncé pour meilleure lisibilité */
  text-shadow: 0 1px 0 rgba(255,255,255,.8); /* léger relief sur fond coloré */
  background: transparent;
  border: none;
  padding: 0;
  font-size: 12.5px;
}

/* === Prix un peu plus contrasté sur fonds colorés === */
.lmr-day.pure-busy i,
.lmr-day.is-transition i {
  color: #2c2c2c;
  text-shadow: 0 1px 0 rgba(255,255,255,.9);
}

/* === Cases sans tarif (noprice) : plus lisibles mais toujours douces === */
.lmr-day.pure-noprice {
  background: #dae9ff !important; /* un bleu légèrement plus soutenu */
  border-color: #c2d8ff;
}
.lmr-day.is-transition.half-left-noprice::before,
.lmr-day.is-transition.half-right-noprice::after {
  background-image: repeating-linear-gradient(45deg,
    rgba(0,0,0,.09) 0 4px, transparent 4px 10px);
  opacity: 0.8;
}

/* === Pour ne pas cacher le texte ou le prix === */
.lmr-day em,
.lmr-day i {
  position: relative;
  z-index: 3;
}
.lmr-day::before,
.lmr-day::after {
  z-index: 1;
}
.lmr-day.lmr-in::after,
.lmr-day.lmr-out::before {
  z-index: 2; /* demi-teinte de sélection sous le texte */
}

/* === Bonus UX : le jour sans tarif reste identifiable au survol === */
.lmr-day.pure-noprice:hover {
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.05);
  filter: brightness(1.04);
}
/* === Numéros de jours === */
.lmr-day em {
  position: relative;
  z-index: 3;
  font-weight: 600;
  font-size: 13px;
  color: #2f2f2f; /* gris foncé neutre, bon contraste sur fond clair */
  text-shadow: 0 1px 0 rgba(255,255,255,0.8);
}

/* === Sur fonds foncés (occupé, sélection, etc.) === */
.lmr-day.pure-busy em,
.lmr-day.is-transition.half-left-busy em,
.lmr-day.is-transition.half-right-busy em,
.lmr-day.lmr-range em,
.lmr-day.lmr-in em,
.lmr-day.lmr-out em {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* === Sans tarif : ton plus doux (bleu/gris clair) === */
.lmr-day.pure-noprice em,
.lmr-day.is-transition.half-left-noprice em,
.lmr-day.is-transition.half-right-noprice em {
  color: #385273;
  text-shadow: 0 1px 0 rgba(255,255,255,0.9);
}

/* === Weekend : léger contraste ocre === */
.lmr-day.lmr-weekend em:not(.lmr-busy) {
  color: #594a34;
}

/* === Survol : renforce un peu le contraste === */
.lmr-day:not([data-disabled="1"]):hover em {
  filter: brightness(0.9);
}
/* --- Transition slide mois --- */
.lmr-cal .lmr-grid{
  transition: opacity .22s ease, transform .22s ease;
}
.lmr-cal .lmr-grid.is-exit-left  { opacity:0; transform: translateX(-14px); }
.lmr-cal .lmr-grid.is-exit-right { opacity:0; transform: translateX( 14px); }
.lmr-cal .lmr-grid.is-enter      { opacity:1; transform: translateX(0); }