/* ─────────────────────────────────────────────────────────────────────────
   Sélecteur de date maison — habillage partagé (site, espace client,
   espace partenaire, back-office). Voir assets/js/datepicker.js.

   Les couleurs se calent sur la charte du contexte : variables de l'espace
   client (--ec-*) si présentes, sinon celles du back-office (--brand, --ink…),
   sinon des valeurs de repli.
   ───────────────────────────────────────────────────────────────────────── */
.ctp-dp,
.ctp-dp-panel {
  --dp-accent:  var(--ec-accent, var(--brand, #e1231b));
  --dp-accent-t:var(--ec-accent-soft, var(--brand-t, #fdecec));
  --dp-ink:     var(--ec-ink, var(--ink, #1b2236));
  --dp-muted:   var(--ec-muted, var(--soft, #697086));
  --dp-line:    var(--line-2, #e2e4ec);
  --dp-hover:   var(--bg, #f3f5fb);
  --dp-surface: #fff;
}

/* ── Champ ─────────────────────────────────────────────────────────── */
.ctp-dp { position: relative; display: block; }
.ctp-dp--month, .ctp-dp--time { display: inline-block; }

/* Le champ natif reste dans le formulaire (name, value, required) mais
   invisible ; il couvre le champ visible pour que la bulle de validation
   HTML5 pointe au bon endroit. */
.ctp-dp-native {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  opacity: 0; pointer-events: none;
  padding: 0; margin: 0; border: 0; background: none;
  box-shadow: none !important; box-sizing: border-box;
}

.ctp-dp-display { padding-left: 34px !important; cursor: pointer; caret-color: transparent; box-sizing: border-box; }
.ctp-dp-display::selection { background: transparent; }
.ctp-dp-ico {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--dp-muted); pointer-events: none; z-index: 1;
}
.ctp-dp.dp-open .ctp-dp-ico, .ctp-dp.is-filled .ctp-dp-ico { color: var(--dp-accent); }
.ctp-dp.is-invalid .ctp-dp-display { border-color: var(--dp-accent); }

/* Barres de filtres du back-office : champ compact, sans bordure propre. */
.fb-field .ctp-dp { display: inline-flex; width: auto; }
.fb-field .ctp-dp-display {
  width: auto; min-width: 118px; border: none; background: transparent;
  height: 36px; padding: 0 2px 0 24px !important; font-size: .86rem; border-radius: 0;
}
.fb-field .ctp-dp-display:focus { box-shadow: none; border: none; }
.fb-field .ctp-dp-ico { left: 2px; }

/* ── Panneau ───────────────────────────────────────────────────────── */
.ctp-dp-panel {
  /* Au-dessus des modales du site (max 5000) et des panneaux du back-office. */
  position: fixed; left: 0; top: 0; z-index: 9500; display: none;
  background: var(--dp-surface);
  border: 1px solid var(--dp-line); border-radius: 14px;
  box-shadow: 0 12px 34px rgba(16, 24, 40, .16), 0 2px 6px rgba(16, 24, 40, .06);
  padding: 12px 12px 8px;
  font-family: inherit; font-size: .9rem; color: var(--dp-ink);
  -webkit-user-select: none; user-select: none;
}
.ctp-dp-panel.is-open { display: block; animation: ctpDpIn .12s ease-out; }
@keyframes ctpDpIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.ctp-dp-body { display: flex; gap: 12px; align-items: stretch; }
.ctp-dp-cal { width: 252px; flex: 0 0 auto; }

.ctp-dp-head { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.ctp-dp-nav {
  width: 30px; height: 30px; flex: 0 0 auto; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: none; border-radius: 9px; cursor: pointer;
  color: var(--dp-muted); transition: background .12s, color .12s;
}
.ctp-dp-nav svg { width: 15px; height: 15px; }
.ctp-dp-nav--next svg { transform: rotate(180deg); }
.ctp-dp-nav:hover { background: var(--dp-hover); color: var(--dp-ink); }
.ctp-dp-title {
  flex: 1; height: 30px; padding: 0 8px; border: none; background: none; cursor: pointer;
  font: inherit; font-size: .88rem; font-weight: 700; color: var(--dp-ink);
  border-radius: 9px; transition: background .12s;
}
.ctp-dp-title:hover:not(:disabled) { background: var(--dp-hover); }
.ctp-dp-title:disabled { cursor: default; }

.ctp-dp-wds { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 2px; }
.ctp-dp-wds span {
  text-align: center; font-size: .66rem; font-weight: 700; letter-spacing: .04em;
  color: var(--dp-muted); padding: 4px 0;
}
.ctp-dp-grid { display: grid; gap: 2px; }
.ctp-dp-grid--days { grid-template-columns: repeat(7, 1fr); }
.ctp-dp-grid--months { grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 6px 0; }

.ctp-dp-day, .ctp-dp-cell {
  border: none; background: none; cursor: pointer; font: inherit; color: var(--dp-ink);
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px; transition: background .12s, color .12s;
}
.ctp-dp-day { height: 32px; font-size: .82rem; }
.ctp-dp-cell { height: 40px; font-size: .82rem; font-weight: 600; }
.ctp-dp-day:hover:not(:disabled), .ctp-dp-cell:hover:not(:disabled) { background: var(--dp-hover); }
.ctp-dp-day.is-out { color: var(--dp-muted); opacity: .4; }
.ctp-dp-day.is-today, .ctp-dp-cell.is-today { color: var(--dp-accent); font-weight: 800; }
.ctp-dp-day.is-cur { box-shadow: inset 0 0 0 1.5px var(--dp-line); }
.ctp-dp-day.is-sel, .ctp-dp-cell.is-sel {
  background: var(--dp-accent) !important; color: #fff !important; font-weight: 700;
}
.ctp-dp-day:disabled, .ctp-dp-cell:disabled { color: var(--dp-muted); opacity: .3; cursor: not-allowed; }

/* ── Colonnes heure / minute ───────────────────────────────────────── */
.ctp-dp-time { border-left: 1px solid var(--dp-line); padding-left: 12px; display: flex; flex-direction: column; }
.ctp-dp--time .ctp-dp-time { border-left: none; padding-left: 0; }
.ctp-dp-time-lbl {
  font-size: .66rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--dp-muted); padding: 8px 0 6px; text-align: center;
}
.ctp-dp-cols { display: flex; gap: 6px; flex: 1; min-height: 0; }
.ctp-dp-col {
  width: 52px; max-height: 214px; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin;
}
.ctp-dp-col::-webkit-scrollbar { width: 5px; }
.ctp-dp-col::-webkit-scrollbar-thumb { background: var(--dp-line); border-radius: 3px; }
.ctp-dp-tick {
  flex: 0 0 auto; height: 30px; border: none; background: none; cursor: pointer;
  font: inherit; font-size: .82rem; color: var(--dp-ink); border-radius: 8px;
  transition: background .12s, color .12s;
}
.ctp-dp-tick:hover { background: var(--dp-hover); }
.ctp-dp-tick.is-sel { background: var(--dp-accent); color: #fff; font-weight: 700; }

/* ── Pied ──────────────────────────────────────────────────────────── */
.ctp-dp-foot {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--dp-line);
}
.ctp-dp-action {
  border: none; background: none; cursor: pointer; font: inherit; font-size: .76rem; font-weight: 600;
  color: var(--dp-muted); padding: 5px 9px; border-radius: 8px; transition: background .12s, color .12s;
}
.ctp-dp-action:hover { background: var(--dp-hover); color: var(--dp-ink); }
.ctp-dp-action--accent { color: var(--dp-accent); }
.ctp-dp-action--accent:hover { background: var(--dp-accent-t); color: var(--dp-accent); }
.ctp-dp-ok {
  border: none; cursor: pointer; font: inherit; font-size: .78rem; font-weight: 700;
  color: #fff; background: var(--dp-accent); padding: 7px 15px; border-radius: 9px;
  margin-left: auto; transition: filter .12s;
}
.ctp-dp-ok:hover { filter: brightness(1.06); }

@media (max-width: 560px) {
  .ctp-dp-panel { padding: 10px 10px 6px; }
  .ctp-dp-cal { width: 238px; }
  .ctp-dp-col { width: 46px; max-height: 180px; }
}
