/* Shared Hostome calendar picker (mission HOSTOME_M46_CLAUDE_R4_RESERVATIONS_
   FILTER_MODEL_AND_SHARED_UI).

   Extracted VERBATIM from css/pages/index.css (Dashboard's own calendar,
   introduced across missions M45-R16/R17) so index.html and
   reservations.html consume the exact same rules - one file, never a fork.
   Dashboard's own markup/behavior is unchanged; only the CSS moved.

   Two consumers:
   - Dashboard (frontend/domains/dashboard/dashboard.page.js): single
     selected date, operational dots (.dash-cal-dot.is-arrival/-departure/
     -stay) + .dash-cal-legend.
   - Reservations (frontend/domains/reservations/reservation-period-picker.js):
     range selection, NEVER renders .dash-cal-legend, uses the additive
     .is-range-start/.is-range-end/.is-in-range cell modifiers below (new
     in this mission, harmless/unused by Dashboard). */

.dash-cal-panel {
  width: 360px;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--ui-shadow-pop, 0 12px 32px rgba(12,12,16,0.12));
  padding: 14px 16px 16px;
  margin: 0;
}

@media (min-width: 861px) {
  .dash-cal-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 60;
  }
}

.dash-cal-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(12,12,16,0.45);
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 700;
}

.dash-cal-modal-overlay[hidden] {
  display: none;
}

@media (max-width: 860px) {
  .dash-cal-modal-overlay:not([hidden]) {
    display: flex;
  }

  .dash-cal-modal-overlay .dash-cal-panel {
    position: static;
    width: 100%;
    max-width: 360px;
    margin: 0;
    border-radius: 20px;
    box-shadow: var(--ui-shadow-pop, 0 24px 64px rgba(12,12,16,0.3));
  }
}

.dash-cal-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.dash-cal-title-btn {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--t1);
  background: transparent;
  border: 0;
  padding: 2px 6px;
  border-radius: 6px;
  cursor: pointer;
}

.dash-cal-title-btn:hover {
  background: var(--surface-2);
}

.dash-cal-title-btn:focus-visible {
  outline: 2px solid var(--hostome-primary);
  outline-offset: 1px;
}

.dash-cal-nav {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--t2);
  cursor: pointer;
  font-size: 11px;
}

.dash-cal-nav:hover {
  background: var(--surface-2);
  color: var(--t1);
}

.dash-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
}

.dash-cal-weekdays span {
  text-align: center;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--t3);
  text-transform: uppercase;
}

.dash-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.dash-cal-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 38px;
  border: 0;
  background: transparent;
  border-radius: 10px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--t1);
  cursor: pointer;
}

.dash-cal-cell.is-muted {
  color: var(--t4);
  font-weight: 400;
  cursor: default;
}

button.dash-cal-cell:hover {
  background: var(--surface-2);
}

.dash-cal-cell.is-selected {
  background: var(--hostome-primary);
  color: var(--hostome-primary-contrast, #fff);
}

/* M46-R5 calendar hover fix: `button.dash-cal-cell:hover` (specificity
   0,2,1) beats `.is-selected`/`.is-range-start`/`.is-range-end`/`.is-in-range`
   (each 0,2,0) on the `background` property alone - `color` is untouched by
   the hover rule, so it stays whatever the winning background rule left it
   (white on these three), producing white text on the hover rule's light
   `--surface-2` background: invisible. Each state gets its own explicit
   :hover rule at specificity 0,3,0 (or 0,3,1 for the .is-in-range button
   selector below), which always wins over the plain 0,2,1 hover rule
   regardless of source order, so background+color stay paired together. */
.dash-cal-cell.is-selected:hover {
  background: var(--hostome-primary);
  color: var(--hostome-primary-contrast, #fff);
  filter: brightness(1.08);
}

.dash-cal-day-num {
  line-height: 1;
}

.dash-cal-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--t4);
}

.dash-cal-dot.is-arrival { background: var(--green); }
.dash-cal-dot.is-departure { background: var(--rose); }
.dash-cal-dot.is-stay { background: var(--hostome-warning, #F5A623); }

.dash-cal-cell.is-selected .dash-cal-dot {
  background: var(--hostome-primary-contrast, #fff);
}

.dash-cal-legend {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.dash-cal-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--t3);
  font-weight: 500;
}

.dash-cal-legend .dash-cal-dot {
  width: 7px;
  height: 7px;
}

/* ── Range selection (Reservations only - additive, Dashboard never sets
   these classes) ─────────────────────────────────────────────────────── */
.dash-cal-cell.is-in-range {
  background: var(--hostome-primary-soft);
  color: var(--t1);
  border-radius: 0;
}
.dash-cal-cell.is-range-start.is-in-range {
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
}
.dash-cal-cell.is-range-end.is-in-range {
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}
.dash-cal-cell.is-range-start,
.dash-cal-cell.is-range-end {
  background: var(--hostome-primary);
  color: var(--hostome-primary-contrast, #fff);
}

/* M46-R5 calendar hover fix (see .is-selected:hover comment above for the
   root cause): explicit :hover pairings for the range endpoints and the
   in-range fill, so hovering never drops the background while keeping the
   endpoint's white text - the exact "day 15 becomes invisible" report. */
.dash-cal-cell.is-range-start:hover,
.dash-cal-cell.is-range-end:hover {
  background: var(--hostome-primary);
  color: var(--hostome-primary-contrast, #fff);
  filter: brightness(1.08);
}
button.dash-cal-cell.is-in-range:hover {
  background: var(--hostome-primary-soft);
  color: var(--t1);
  filter: brightness(0.97);
}

/* ── R17 : selecteur direct mois/annee ("Choisir une annee") ──────────── */
.dash-cal-datejump-head {
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
}

.dash-cal-datejump-title {
  grid-column: 2;
  font-size: 14px;
  font-weight: 700;
  color: var(--t1);
  text-align: center;
}

.dash-cal-datejump-close,
.dash-cal-datejump-back {
  width: 28px; height: 28px;
  border-radius: 8px; border: none; background: var(--surface-2); color: var(--t2);
  display: grid; place-items: center; cursor: pointer; transition: background 0.15s, color 0.15s;
  font-size: 12px;
}
.dash-cal-datejump-back { grid-column: 1; }
.dash-cal-datejump-close { grid-column: 3; }
.dash-cal-datejump-close:hover,
.dash-cal-datejump-back:hover { background: var(--surface-3, var(--surface-2)); color: var(--t1); }
.dash-cal-datejump-close:focus-visible,
.dash-cal-datejump-back:focus-visible { outline: 2px solid var(--hostome-primary); outline-offset: 1px; }

.dash-cal-datejump-range-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--t2);
}

.dash-cal-datejump-range-btn {
  width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--t2);
  display: grid; place-items: center; cursor: pointer; transition: background 0.15s, color 0.15s;
}
.dash-cal-datejump-range-btn:hover { background: var(--surface-2); color: var(--t1); }
.dash-cal-datejump-range-btn:focus-visible { outline: 2px solid var(--hostome-primary); outline-offset: 1px; }

.dash-cal-datejump-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.dash-cal-datejump-cell {
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--t1);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-cal-datejump-cell:hover { background: var(--surface-2); border-color: var(--line-strong); }
.dash-cal-datejump-cell:focus-visible { outline: 2px solid var(--hostome-primary); outline-offset: 1px; }

.dash-cal-datejump-cell.is-today {
  border-color: var(--hostome-primary);
  color: var(--hostome-primary);
}

.dash-cal-datejump-cell.is-selected {
  background: var(--hostome-primary);
  border-color: var(--hostome-primary);
  color: var(--hostome-primary-contrast, #fff);
}

.dash-cal-datejump-cell-month { height: 44px; }

.dash-cal-datejump-foot {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: center;
}

.dash-cal-datejump-today-btn {
  height: 34px;
  padding: 0 16px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--t2);
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.dash-cal-datejump-today-btn:hover { background: var(--surface-2); color: var(--t1); }
.dash-cal-datejump-today-btn:focus-visible { outline: 2px solid var(--hostome-primary); outline-offset: 1px; }
