/* CLIK.ma - the CLIK calendar and clock on every date / time field of the site (js/core/clik-date.js, compiled from
   clik-date.ts). The browser's field stays in the form, hidden (.clik-dt-nat); the CLIK field takes its place - typed
   jj/mm/aaaa hh:mm (Latin digits, 24 h) or picked. AdminCP -> Types de profil -> "Calendrier CLIK sur tous les champs
   de date et d'heure". Classes clik-dt-. The calendar's look is the birthday calendar's (clik-dob.css). */
:root {
  --dt-blue: #0866FF; --dt-blue2: #6A3DF5; --dt-ink: #1c1e21; --dt-mute: #65676b; --dt-line: #dadde1;
  --dt-card: #fff; --dt-soft: #f0f2f5; --dt-tint: #e7f0ff; --dt-red: #DC2626; --dt-shadow: 0 12px 32px rgba(15, 23, 42, .18), 0 2px 6px rgba(15, 23, 42, .08);
}
body.night-mode {
  --dt-ink: #e4e6eb; --dt-mute: #b0b3b8; --dt-line: #3e4042; --dt-card: #242526; --dt-soft: #3a3b3c; --dt-tint: rgba(76, 154, 255, .16);
  --dt-shadow: 0 12px 32px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .4);
}

/* the browser's own field: out of sight, its value still goes with the form */
input.clik-dt-nat {
  position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important;
  border: 0 !important; opacity: 0 !important; pointer-events: none !important; clip-path: inset(50%) !important; overflow: hidden !important;
}

/* ---------- the CLIK field: the page's own field look, the round button at its end ---------- */
.clik-dt { position: relative; display: block; min-width: 0; width: 100%; }
.clik-dt-in { font-variant-numeric: tabular-nums; letter-spacing: .02em; text-align: left !important; padding-inline-end: calc(var(--dt-b, 36px) + ((var(--dt-h, 48px) - var(--dt-b, 36px)) / 2) + 6px) !important; }
[dir="rtl"] .clik-dt-in { text-align: right !important; }
/* Arabic: the field is written left to right (dir=ltr on the input) but its button sits on the LEFT (the box's end):
   the button's room goes on the left, the words keep 12 px on the right - a narrow field read its date under the button */
[dir="rtl"] .clik-dt-in { padding-inline-start: calc(var(--dt-b, 36px) + ((var(--dt-h, 48px) - var(--dt-b, 36px)) / 2) + 6px) !important; padding-inline-end: 12px !important; }
.clik-dt-in::placeholder { color: var(--dt-mute); opacity: .75; letter-spacing: .04em; }
.clik-dt > .clik-dt-in:not([class*="form-control"]):not(.clik-bz-f) {
  box-sizing: border-box; display: block; width: 100%; height: 40px; margin: 0; padding-inline-start: 12px; border: 1px solid var(--dt-line); border-radius: 10px;
  background: var(--dt-card); color: var(--dt-ink); font-size: 14px;
}
.clik-dt > .clik-dt-in:focus:not([class*="form-control"]) { outline: none; border-color: var(--dt-blue); box-shadow: 0 0 0 3px rgba(8, 102, 255, .2); }
.clik-dt.is-bad > .clik-dt-in, .clik-dt-ele.is-bad > .clik-dt-in { border-color: var(--dt-red) !important; box-shadow: 0 0 0 3px rgba(220, 38, 38, .15) !important; }
/* the floating-label box: the mask under its words once the field has the focus */
.clik-field.clik-dt-ele > .clik-dt-in:focus::placeholder { color: transparent; }

/* ONE round shape, its icon straight in it (the icon-button rule), on the field's middle */
.clik-dt-btn {
  position: absolute; top: calc((var(--dt-h, 48px) - var(--dt-b, 36px)) / 2); inset-inline-end: calc((var(--dt-h, 48px) - var(--dt-b, 36px)) / 2); z-index: 2;
  display: grid; place-items: center; width: var(--dt-b, 36px); height: var(--dt-b, 36px); margin: 0; padding: 0; border: 0; border-radius: 50%;
  color: var(--dt-blue); background: var(--dt-tint); cursor: pointer; transition: background-color .15s, color .15s, transform .15s;
}
.clik-field.clik-dt-ele > .clik-dt-btn { top: calc((56px - var(--dt-b, 36px)) / 2); inset-inline-end: calc((56px - var(--dt-b, 36px)) / 2); }
.clik-dt-btn svg { display: block; width: calc(var(--dt-b, 36px) * .55); height: calc(var(--dt-b, 36px) * .55); padding: 0; background: none; border-radius: 0; }
.clik-dt-btn:hover, .clik-dt-btn[aria-expanded="true"] { color: #fff; background: linear-gradient(135deg, var(--dt-blue), var(--dt-blue2)); }
.clik-dt-btn:active { transform: scale(.92); }
.clik-dt-btn:focus { outline: 0; }
.clik-dt-btn:focus-visible { box-shadow: 0 0 0 3px rgba(8, 102, 255, .45); }
.clik-dt-btn:disabled { opacity: .45; cursor: default; background: var(--dt-soft); color: var(--dt-mute); }
.clik-dt-hint { margin: 8px 0 0; padding: 0 2px; font-size: 13px; font-weight: 600; line-height: 18px; color: var(--dt-red); }
.clik-dt-hint[hidden] { display: none; }
.clik-field + .clik-dt-hint { margin: -17px 0 25px; padding: 0 16px; }
.clik-field + .help-block + .clik-dt-hint { margin: -17px 0 25px; padding: 0 16px; }
body.night-mode .clik-dt-hint { color: #FF6B6B; }

/* ---------- the calendar ---------- */
.clik-dt-pop {
  position: fixed; z-index: 1070; left: 8px; top: 8px; width: min(352px, calc(100vw - 16px));
  display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: 16px; color: var(--dt-ink); background: var(--dt-card);
  box-shadow: var(--dt-shadow); font-size: 14px; line-height: 1.2; text-align: start; overflow: hidden;
}
.clik-dt-pop::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, #0A5CFF, #F5104F, #FFD200); }
:where(.clik-dt-pop) button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
.clik-dt-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; padding: 2px 0 0; }
.clik-dt-tl { display: flex; flex-wrap: nowrap; align-items: center; gap: 10px; min-width: 0; padding-inline-start: 4px; }
.clik-dt-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; font-weight: 800; line-height: 22px; }
@media (max-width: 479px) {
  .clik-dt-title { font-size: 16px; }
}
.clik-dt-x {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
  color: #606770; background: #e4e6eb; cursor: pointer; transition: transform .2s, background-color .15s;
}
.clik-dt-x svg { width: 18px; height: 18px; }
.clik-dt-x:hover { transform: rotate(90deg); }
.clik-dt-x:active { transform: rotate(90deg) scale(.9); }
body.night-mode .clik-dt-x { color: #e4e6eb; background: #3a3b3c; }

.clik-dt-nav { display: flex; align-items: center; gap: 8px; }
.clik-dt-arr, .clik-dt-lbl { height: 36px; border: 0; border-radius: 18px; background: var(--dt-soft); cursor: pointer; transition: background-color .15s, color .15s, transform .15s; }
.clik-dt-arr { flex: none; display: grid; place-items: center; width: 36px; padding: 0; }
.clik-dt-arr svg { width: 18px; height: 18px; }
[dir="rtl"] .clik-dt-arr svg { transform: scaleX(-1); }
.clik-dt-lbl { flex: 1 1 auto; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 12px; font-weight: 800; font-size: 15px; text-transform: capitalize; }
.clik-dt-lbl span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clik-dt-lbl svg { flex: none; width: 16px; height: 16px; color: var(--dt-blue); }
.clik-dt-lbl:disabled { cursor: default; }
.clik-dt-arr:hover:not(:disabled), .clik-dt-lbl:hover:not(:disabled) { color: var(--dt-blue); background: var(--dt-tint); }
.clik-dt-arr:active:not(:disabled), .clik-dt-lbl:active:not(:disabled) { transform: scale(.95); }
.clik-dt-arr:disabled { opacity: .35; cursor: default; }

.clik-dt-grid { display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.clik-dt-wd, .clik-dt-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; direction: ltr; }
[dir="rtl"] .clik-dt-wd, [dir="rtl"] .clik-dt-days { direction: rtl; }
.clik-dt-wd span { display: grid; place-items: center; height: 24px; font-size: 12px; font-weight: 700; color: var(--dt-mute); text-transform: uppercase; }
.clik-dt-day, .clik-dt-cell {
  position: relative; display: grid; place-items: center; padding: 0; border: 0; background: none; cursor: pointer;
  font-variant-numeric: tabular-nums; font-weight: 600; transition: background-color .12s, color .12s, transform .12s;
}
.clik-dt-day { height: 40px; border-radius: 50%; font-size: 14px; aspect-ratio: 1; max-width: 40px; width: 100%; justify-self: center; }
.clik-dt-grid.is-m, .clik-dt-grid.is-y { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 4px 0; }
.clik-dt-grid.is-y { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.clik-dt-cell { height: 48px; border-radius: 24px; font-size: 14px; text-transform: capitalize; background: var(--dt-soft); }
.clik-dt-day:hover:not(:disabled), .clik-dt-cell:hover:not(:disabled) { color: var(--dt-blue); background: var(--dt-tint); }
.clik-dt-day:active:not(:disabled), .clik-dt-cell:active:not(:disabled) { transform: scale(.9); }
.clik-dt-day.is-today::after, .clik-dt-cell.is-today::after {
  content: ""; position: absolute; inset: 2px; border-radius: inherit; box-shadow: inset 0 0 0 1.5px var(--dt-blue); pointer-events: none;
}
.clik-dt-day.is-sel, .clik-dt-cell.is-sel { color: #fff !important; background: linear-gradient(135deg, var(--dt-blue), var(--dt-blue2)) !important; box-shadow: 0 4px 10px rgba(8, 102, 255, .35); }
.clik-dt-day.is-sel::after, .clik-dt-cell.is-sel::after { box-shadow: none; }
.clik-dt-day:disabled, .clik-dt-cell:disabled { opacity: .3; cursor: default; }
.clik-dt-day:focus, .clik-dt-cell:focus { outline: 0; }
.clik-dt-day:focus-visible, .clik-dt-cell:focus-visible { box-shadow: 0 0 0 2px var(--dt-card), 0 0 0 4px var(--dt-blue); }

.clik-dt-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 0 2px; }
.clik-dt-link { height: 32px; padding: 0 12px; border: 0; border-radius: 16px; background: none; color: var(--dt-blue) !important; font-weight: 700; cursor: pointer; }
.clik-dt-link:hover { background: var(--dt-tint); }
.clik-dt-link.is-clear { margin-inline-end: auto; }

/* phones: a sheet from the bottom, above the bottom bar */
.clik-dt-back { position: fixed; inset: 0; z-index: 1069; background: rgba(0, 0, 0, .45); }
.clik-dt-pop.is-sheet {
  left: 0 !important; right: 0; top: auto !important; bottom: calc(45px + env(safe-area-inset-bottom, 0px)); width: 100%;
  max-height: calc(100vh - 45px - 16px); overflow-y: auto; border-radius: 16px 16px 0 0; padding: 8px 8px 12px; z-index: 1070;
}
.clik-dt-pop.is-sheet .clik-dt-day { height: 44px; max-width: 44px; }
@media (min-width: 669px) { .clik-dt-pop.is-sheet { bottom: 0; } }

/* motion (never with "less motion") */
@media (prefers-reduced-motion: no-preference) {
  .clik-dt-pop.is-in { animation: clik-dt-in .2s cubic-bezier(.2, .9, .3, 1.2) both; transform-origin: top center; }
  .clik-dt-pop.is-sheet.is-in { animation-name: clik-dt-up; }
  .clik-dt-pop.is-out { animation: clik-dt-out .15s ease forwards; }
  .clik-dt-back { animation: clik-dt-fade .2s ease both; }
  .clik-dt-grid > *, .clik-dt-grid.is-m > *, .clik-dt-grid.is-y > * { animation: clik-dt-fade .18s ease both; }
    }
@keyframes clik-dt-in { from { opacity: 0; transform: translateY(-6px) scale(.97); } }
@keyframes clik-dt-up { from { opacity: .6; transform: translateY(40px); } }
@keyframes clik-dt-out { to { opacity: 0; transform: translateY(-4px) scale(.98); } }
@keyframes clik-dt-fade { from { opacity: 0; } }
@keyframes clik-dt-flash { 30% { box-shadow: 0 0 0 4px rgba(8, 102, 255, .28); } }
@keyframes clik-dt-hop { 40% { transform: translateY(-4px) scale(1.08); } }


/* the clock: 24 hours in 6 columns, the minutes in 4 */
.clik-dt-grid.is-h, .clik-dt-grid.is-n { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; padding: 4px 0; direction: ltr; }
.clik-dt-grid.is-n { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.clik-dt-cell.is-hm { height: 40px; border-radius: 20px; font-variant-numeric: tabular-nums; text-transform: none; }
.clik-dt-grid.is-n .clik-dt-cell.is-hm { height: 44px; }
.clik-dt-nav.is-time .clik-dt-arr { visibility: hidden; }
.clik-dt-foot .is-now { margin-inline-start: auto; }

@media (prefers-reduced-motion: no-preference) {
  .clik-dt.is-pop > .clik-dt-in, .clik-dt-ele.is-pop > .clik-dt-in { animation: clik-dt-flash .6s ease; }
  .clik-dt.is-pop > .clik-dt-btn, .clik-dt-ele.is-pop > .clik-dt-btn { animation: clik-dt-hop .45s cubic-bezier(.3, 1.6, .5, 1); }
}
.clik-dt-title { padding-inline-start: 4px; }

/* ---------- a start and its end on one calendar (30 Oct): the start and the end as rings / the chosen day, the days
   between on one band (solid colours: two bands never overlap darker), the days before the start off in the end's ---------- */
.clik-dt-pop { --dt-band: #e7f0ff; }
body.night-mode .clik-dt-pop { --dt-band: #23365a; }
.clik-dt-rg { margin: -2px 0 0; padding: 0 4px; font-size: 13px; font-weight: 700; line-height: 18px; color: var(--dt-blue); }
body.night-mode .clik-dt-rg { color: #4C9AFF; }
.clik-dt-rg[hidden] { display: none; }
.clik-dt-day.is-in::before, .clik-dt-day.is-hin::before, .clik-dt-day.is-rs:not(.is-re)::before, .clik-dt-day.is-re:not(.is-rs)::before, .clik-dt-day.is-hend::before {
  content: ""; position: absolute; z-index: -1; inset-block: 2px; inset-inline: -5px; background: var(--dt-band); pointer-events: none;
}
.clik-dt-pop.is-range .clik-dt-days { isolation: isolate; }
.clik-dt-day.is-in, .clik-dt-day.is-hin { color: var(--dt-blue); }
body.night-mode .clik-dt-day.is-in, body.night-mode .clik-dt-day.is-hin { color: #8AB8FF; }
/* the band starts at the start's middle and stops at the end's (mirrored in Arabic by the logical sides) */
.clik-dt-day.is-rs:not(.is-re)::before { inset-inline-start: 50%; }
.clik-dt-day.is-re:not(.is-rs)::before, .clik-dt-day.is-hend::before { inset-inline-end: 50%; }
.clik-dt-pop:not(.is-range) .clik-dt-day.is-rs::before, .clik-dt-pop:not(.is-range) .clik-dt-day.is-re::before { content: none; }
/* only a band when both ends are known (or the mouse shows where the end would go) */
.clik-dt-day.is-rs:not(.is-re):not(:has(~ .is-in, ~ .is-re, ~ .is-hin))::before { content: none; }
.clik-dt-day.is-rs:not(.is-sel), .clik-dt-day.is-re:not(.is-sel), .clik-dt-day.is-hend { color: #fff; background: linear-gradient(135deg, #6EA2FF, #9A7CF8); }
body.night-mode .clik-dt-day.is-rs:not(.is-sel), body.night-mode .clik-dt-day.is-re:not(.is-sel), body.night-mode .clik-dt-day.is-hend { background: linear-gradient(135deg, #2F6FE0, #6A4FD8); }
.clik-dt-day.is-hin, .clik-dt-day.is-hend { transition: none; }

/* ---------- quick times under a time field with the focus: one tap fills it (12 chips, 4 a row) ---------- */
.clik-dt-qk {
  position: fixed; z-index: 1068; display: grid; grid-template-columns: repeat(4, 56px); gap: 4px; padding: 8px; border-radius: 14px;
  color: var(--dt-ink); background: var(--dt-card); box-shadow: var(--dt-shadow); direction: ltr;
}
.clik-dt-qk::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; border-radius: 14px 14px 0 0; background: linear-gradient(90deg, #0A5CFF, #F5104F, #FFD200); }
.clik-dt-qc {
  height: 32px; margin: 0; padding: 0; border: 0; border-radius: 16px; font: inherit; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--dt-ink); background: var(--dt-soft); cursor: pointer; transition: background-color .12s, color .12s, transform .12s; -webkit-tap-highlight-color: transparent;
}
.clik-dt-qc:hover, .clik-dt-qc.is-on { color: var(--dt-blue); background: var(--dt-tint); box-shadow: inset 0 0 0 1.5px var(--dt-blue); }
body.night-mode .clik-dt-qc:hover, body.night-mode .clik-dt-qc.is-on { color: #8AB8FF; box-shadow: inset 0 0 0 1.5px #4C9AFF; }
.clik-dt-qc.is-sel { color: #fff; background: linear-gradient(135deg, var(--dt-blue), var(--dt-blue2)); box-shadow: none; }
.clik-dt-qc:active { transform: scale(.92); }
@media (max-width: 359px) { .clik-dt-qk { grid-template-columns: repeat(4, 52px); } }
@media (prefers-reduced-motion: no-preference) {
  .clik-dt-qk.is-in { animation: clik-dt-in .16s cubic-bezier(.2, .9, .3, 1.2) both; transform-origin: top left; }
  .clik-dt-qk.is-in.is-up { transform-origin: bottom left; }
  .clik-dt-qk.is-in .clik-dt-qc { animation: clik-dt-fade .18s ease both; animation-delay: calc(var(--qi, 0) * 14ms); }
}
