/* CLIK.ma - the "Créer" button and its panel (__clik_create.tpl, js/core/clik-create.js, includes/clik-create.php).
   One 8 px grid: the button 16 px from the screen's corner (beside the chat bar from 1200 px), the panel 8 px above it,
   8 px inside, 8 px between its parts; on phones the panel is a sheet from edge to edge above the bottom bar. */

.clik-nw {
  --cr-end: 16px;
  --cr-bottom: 16px;
  --cr-lift: 0px;
  --cr-fab: 56px;
  --cr-bg: #fff;
  --cr-ink: #050505;
  --cr-muted: #65676b;
  --cr-line: rgba(15, 23, 42, .08);
  --cr-soft: #f0f2f5;
  --cr-focus: #0866FF;
  font-family: inherit;
}
body.night-mode .clik-nw {
  --cr-bg: #242526;
  --cr-ink: #e4e6eb;
  --cr-muted: #b0b3b8;
  --cr-line: rgba(255, 255, 255, .1);
  --cr-soft: #3a3b3c;
}

/* the page keeps 94 px for the chat bar from 1200 px: the button sits beside it */
@media (min-width: 1200px) {
  body:has(.chat-sidebar) .clik-nw { --cr-end: 110px; }
}
/* the other corner: beside the left menu (its width, --side-w, from 768 px) */
.clik-nw { --cr-start: 16px; }
@media (min-width: 768px) {
  .clik-nw { --cr-start: calc(var(--side-w, 0px) + 16px); }
}

/* ---------- the button: one round shape, the "+" straight in it ---------- */
.clik-nw-fab {
  position: fixed;
  z-index: 1040;
  /* its lift over a bar is a `translate` (7 Nov): a moving `bottom` counted as a layout shift for Google (CLS) */
  bottom: var(--cr-bottom);
  inset-inline-end: var(--cr-end);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  height: var(--cr-fab);
  min-width: var(--cr-fab);
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #3B82FF 0%, #0866FF 48%, #0047D6 100%);
  box-shadow: 0 10px 24px -6px rgba(8, 102, 255, .55), 0 2px 6px rgba(0, 0, 0, .18), inset 0 1px 0 rgba(255, 255, 255, .35);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: bottom .25s ease, transform .3s cubic-bezier(.2, .8, .2, 1), translate .5s cubic-bezier(.3, 1.3, .45, 1), opacity .25s ease, box-shadow .2s ease, background .25s ease, padding .25s ease;
}
.clik-nw.is-start .clik-nw-fab { inset-inline-end: auto; inset-inline-start: var(--cr-start); }
/* the cube's three colours as a thin ring that turns slowly */
.clik-nw-fab::before {
  content: "";
  position: absolute;
  inset: -3px;
  z-index: -1;
  border-radius: inherit;
  background: conic-gradient(from var(--cr-a, 0deg), #0A5CFF, #F5104F, #FFD200, #0A5CFF);
  opacity: .9;
}
.clik-nw-fab::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, #3B82FF 0%, #0866FF 48%, #0047D6 100%);
  z-index: -1;
  transition: background .25s ease;
}
.clik-nw-plus { display: grid; place-items: center; width: var(--cr-fab); height: var(--cr-fab); flex: none; }
.clik-nw-plus svg { width: 26px; height: 26px; transition: transform .3s cubic-bezier(.2, .8, .2, 1); filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .25)); }
.clik-nw-word {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .01em;
  opacity: 0;
  transition: max-width .3s ease, opacity .2s ease, margin .3s ease;
}
/* "Créer" beside the "+" at the top of the page and on hover (a computer) */
.clik-nw.has-label.is-wide .clik-nw-fab .clik-nw-word { max-width: 160px; opacity: 1; margin-inline-end: 22px; margin-inline-start: -6px; }
@media (hover: hover) {
  .clik-nw.has-label .clik-nw-fab:hover .clik-nw-word { max-width: 160px; opacity: 1; margin-inline-end: 22px; margin-inline-start: -6px; }
  .clik-nw-fab:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -6px rgba(8, 102, 255, .6), 0 3px 8px rgba(0, 0, 0, .2), inset 0 1px 0 rgba(255, 255, 255, .35); }
}
.clik-nw-fab:active { transform: translateY(0) scale(.95); }
.clik-nw.is-open .clik-nw-fab:hover { transform: none; }
.clik-nw-fab:focus { outline: none; }
.clik-nw-fab:focus-visible { box-shadow: 0 0 0 3px var(--cr-bg), 0 0 0 6px var(--cr-focus); }
/* open: the "+" turns into a ×, the button goes ink (white at night) */
.clik-nw.is-open .clik-nw-plus svg { transform: rotate(135deg); }
.clik-nw.is-open .clik-nw-fab::after { background: #1c1e21; }
.clik-nw.is-open .clik-nw-word { max-width: 0 !important; opacity: 0 !important; margin: 0 !important; }
body.night-mode .clik-nw.is-open .clik-nw-fab { color: #1c1e21; }
body.night-mode .clik-nw.is-open .clik-nw-fab::after { background: #fff; }

/* it steps aside: scrolling down, a window open, typing on a phone, a tall fixed box under it */
.clik-nw.is-away:not(.is-open) .clik-nw-fab,
.clik-nw.is-blocked:not(.is-open) .clik-nw-fab,
body.modal-open .clik-nw:not(.is-open) .clik-nw-fab {
  transform: translateY(calc(100% + 32px)) scale(.6);
  opacity: 0;
  pointer-events: none;
}

/* ---------- the panel ---------- */
.clik-nw-panel {
  position: fixed;
  z-index: 1041;
  bottom: calc(var(--cr-bottom) + var(--cr-lift) + var(--cr-fab) + 8px);
  inset-inline-end: var(--cr-end);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(440px, calc(100vw - 2 * var(--cr-end)));
  max-height: calc(100vh - 56px - var(--cr-bottom) - var(--cr-lift) - var(--cr-fab) - 24px);
  padding: 8px;
  overflow: hidden;
  border-radius: 16px;
  color: var(--cr-ink);
  background: var(--cr-bg);
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, .28), 0 0 0 1px var(--cr-line);
  transform-origin: right bottom;
  opacity: 0;
  transform: translateY(8px) scale(.96);
  transition: opacity .18s ease, transform .22s cubic-bezier(.2, .8, .2, 1), translate .5s cubic-bezier(.3, 1.3, .45, 1);
}
[dir="rtl"] .clik-nw-panel, .clik-nw.is-start .clik-nw-panel { transform-origin: left bottom; }
[dir="rtl"] .clik-nw.is-start .clik-nw-panel { transform-origin: right bottom; }
.clik-nw.is-start .clik-nw-panel { inset-inline-end: auto; inset-inline-start: var(--cr-start); }
.clik-nw-panel[hidden] { display: none; }
.clik-nw-panel:focus { outline: none; }
.clik-nw-panel > * { margin: 0 !important; }
.clik-nw.is-open .clik-nw-panel { opacity: 1; transform: none; }

.clik-nw-head { display: flex; align-items: center; gap: 8px; min-height: 36px; padding-inline-start: 8px; }
.clik-nw-title { display: flex; align-items: center; flex-wrap: nowrap; gap: 10px; flex: 1 1 auto; min-width: 0; margin: 0; font-size: 20px; font-weight: 800; line-height: 1.2; color: var(--cr-ink); }
.clik-nw-title > span { min-width: 0; }
.clik-nw-title .clik-brand.is-inline { flex: none; margin: 0; }
.clik-nw-x {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #606770;
  background: #e4e6eb;
  cursor: pointer;
  transition: transform .2s ease, background .2s ease;
}
body.night-mode .clik-nw-x { color: #e4e6eb; background: #3a3b3c; }
.clik-nw-x:hover { transform: rotate(90deg); }
.clik-nw-x:focus { outline: none; }
.clik-nw-x:focus-visible { box-shadow: 0 0 0 3px var(--cr-focus); }

.clik-nw-find { position: relative; display: flex; align-items: center; }
.clik-nw-find > svg { position: absolute; inset-inline-start: 12px; color: var(--cr-muted); pointer-events: none; }
.clik-nw-find input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  padding-inline-start: 38px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 15px;
  color: var(--cr-ink);
  background: var(--cr-soft);
  outline: none;
  transition: border-color .15s ease, background .15s ease;
}
.clik-nw-find input:focus { border-color: var(--cr-focus); background: var(--cr-bg); }
.clik-nw-find input::placeholder { color: var(--cr-muted); }

/* a visitor: one line and "Se connecter" on its middle, 8 px inside a soft box (every entry asks for the sign-in too) */
.clik-nw-join { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 12px; background: var(--cr-soft); }
.clik-nw-join > span { flex: 1 1 auto; min-width: 0; font-size: 13px; line-height: 1.35; color: var(--cr-ink); }
.clik-nw-join-btn { flex: none; display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 16px; border: 0; border-radius: 999px; font: inherit; font-size: 14px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #3B82FF 0%, #0866FF 48%, #0047D6 100%); cursor: pointer; white-space: nowrap; }
.clik-nw-join-btn:hover { filter: brightness(1.08); }
.clik-nw-join-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--cr-bg), 0 0 0 5px var(--cr-focus); }
.clik-nw-recent { display: flex; align-items: center; gap: 8px; min-width: 0; padding-inline-start: 8px; }
.clik-nw-recent[hidden] { display: none; }
.clik-nw-sub { flex: none; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--cr-muted); }
.clik-nw-chips { display: flex; gap: 8px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.clik-nw-chips::-webkit-scrollbar { display: none; }
.clik-nw-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  height: 32px;
  padding: 0 12px 0 6px;
  padding-inline: 6px 12px;
  border: 0;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--cr-ink);
  background: color-mix(in srgb, var(--c) 12%, var(--cr-bg));
  cursor: pointer;
}
.clik-nw-chip i { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; background: var(--c); }
.clik-nw-chip svg { width: 13px; height: 13px; }
.clik-nw-chip:hover { background: color-mix(in srgb, var(--c) 20%, var(--cr-bg)); }
.clik-nw-chip:focus { outline: none; }
.clik-nw-chip:focus-visible { box-shadow: 0 0 0 2px var(--cr-focus); }

.clik-nw-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  scrollbar-width: thin;
}
.clik-nw-list > li { min-width: 0; margin: 0; padding: 0; transform-origin: 50% 100%; }
.clik-nw-list > li[hidden] { display: none; }
.clik-nw-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 100%;
  padding: 8px;
  border-radius: 12px;
  color: var(--cr-ink) !important;
  text-decoration: none !important;
  background: transparent;
  transition: background .15s ease, transform .15s ease;
}
.clik-nw-item:hover, .clik-nw-item.is-cur { background: color-mix(in srgb, var(--c) 10%, var(--cr-bg)); }
.clik-nw-item:active { transform: scale(.98); }
.clik-nw-item:focus { outline: none; }
.clik-nw-item:focus-visible { box-shadow: inset 0 0 0 2px var(--cr-focus); }
.clik-nw-ic {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, transparent);
  transition: transform .2s ease, color .2s ease, background .2s ease;
}
.clik-nw-item:hover .clik-nw-ic, .clik-nw-item.is-cur .clik-nw-ic { color: #fff; background: var(--c); transform: rotate(-6deg) scale(1.05); }
.clik-nw-tx { display: flex; flex-direction: column; min-width: 0; }
.clik-nw-tx b { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 14px; font-weight: 700; line-height: 1.25; }
.clik-nw-tx b em { flex: none; padding: 1px 6px; border-radius: 999px; font-size: 10px; font-style: normal; font-weight: 800; color: #8a5a00; background: #FFE8A3; }
.clik-nw-tx small { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 12px; line-height: 1.3; color: var(--cr-muted); }
.clik-nw-none { margin: 0; padding: 16px 8px; text-align: center; color: var(--cr-muted); }
.clik-nw-none[hidden] { display: none; }
.clik-nw-keys { margin: 0; padding: 8px 8px 0; border-top: 1px solid var(--cr-line); font-size: 12px; color: var(--cr-muted); }
.clik-nw-keys kbd { padding: 1px 6px; border-radius: 6px; font-family: inherit; font-size: 11px; font-weight: 700; color: var(--cr-ink); background: var(--cr-soft); box-shadow: inset 0 -1px 0 var(--cr-line); }
@media (hover: none) { .clik-nw-keys { display: none; } }

/* ---------- phones: above the bottom bar; the panel a sheet from edge to edge ---------- */
/* the page dimmed behind the phone's sheet (a tap on it closes the sheet) */
.clik-nw-dim { display: none; }
@media (max-width: 668px) {
  .clik-nw-dim:not([hidden]) { position: fixed; inset: 0; z-index: 1040; display: block; background: rgba(0, 0, 0, .4); opacity: 0; transition: opacity .2s ease; }
  .clik-nw.is-open .clik-nw-dim { opacity: 1; }
  .clik-nw { --cr-end: 12px; --cr-bottom: calc(45px + env(safe-area-inset-bottom, 0px) + 12px); --cr-fab: 52px; }
  .clik-nw.no-phone .clik-nw-fab { display: none; }
  /* the sheet covers the corner: its own × closes it */
  .clik-nw.is-open .clik-nw-fab { opacity: 0; pointer-events: none; }
  .clik-nw { --cr-start: 12px; }
  .clik-nw-panel, .clik-nw.is-start .clik-nw-panel {
    inset-inline: 0;
    bottom: calc(45px + env(safe-area-inset-bottom, 0px));
    width: 100%;
    max-height: calc(100vh - 45px - env(safe-area-inset-bottom, 0px) - 56px);
    max-height: calc(100dvh - 45px - env(safe-area-inset-bottom, 0px) - 56px);
    border-radius: 16px 16px 0 0;
    transform-origin: 50% 100%;
    box-shadow: 0 -12px 40px -8px rgba(0, 0, 0, .3);
  }
  .clik-nw:not(.is-open) .clik-nw-panel { transform: translateY(24px); }
  .clik-nw-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .clik-nw-title { font-size: clamp(18px, 5vw, 22px); }
}
@media (max-width: 359px) {
  .clik-nw-list { grid-template-columns: 1fr; }
}

/* ---------- motion ---------- */
@property --cr-a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@media (prefers-reduced-motion: no-preference) {
  .clik-nw:not(.no-motion) .clik-nw-fab::before { animation: clik-nw-ring 6s linear infinite; }
  .clik-nw:not(.no-motion).is-open .clik-nw-list > li { animation: clik-nw-in .28s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i) * 22ms); }
  .clik-nw:not(.no-motion) .clik-nw-fab.is-pop { animation: clik-nw-pop .5s cubic-bezier(.2, .8, .2, 1); }
}
@keyframes clik-nw-ring { to { --cr-a: 360deg; } }
/* the entries grow into place - never slide from below: a moved entry stuck out of the list, a scroll bar came and went
   for the opening and the entries' words re-wrapped ("Texte, photos, vidéo, sondage…" on one line, then two) */
@keyframes clik-nw-in { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes clik-nw-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .clik-nw-fab, .clik-nw-panel, .clik-nw-plus svg, .clik-nw-word, .clik-nw-item, .clik-nw-ic { transition: none !important; }
}
.clik-nw.no-motion .clik-nw-fab, .clik-nw.no-motion .clik-nw-panel, .clik-nw.no-motion .clik-nw-plus svg, .clik-nw.no-motion .clik-nw-ic { transition: none; }

/* printing: never on paper */
@media print { .clik-nw { display: none !important; } }

/* it keeps clear of the chat boxes (the owner, 24 Oct: "the + button hides send button of the chat"): clik-create.js's
   avoid() sets --cr-dx - the button (and its panel) slide to the free side of the box, 8 px away, with a little squash and
   hop on arrival; `translate` / `scale` compose with the transforms of its other states */
.clik-nw-fab { translate: var(--cr-dx, 0px) calc(-1 * var(--cr-lift, 0px)); }
.clik-nw-panel { translate: var(--cr-dx, 0px) 0; }
@media (prefers-reduced-motion: no-preference) {
  .clik-nw:not(.no-motion).is-hop .clik-nw-fab { animation: clik-nw-hop .55s cubic-bezier(.2, 1.4, .4, 1); }
}
@keyframes clik-nw-hop { 0% { scale: 1; } 30% { scale: .88 1.08; } 65% { scale: 1.06 .95; } 100% { scale: 1; } }

/* scrolling down: a little smaller, never gone (the owner, 25 Oct: "while scrolling + button gone") */
.clik-nw.is-small:not(.is-open):not(.is-away):not(.is-blocked) .clik-nw-fab { transform: scale(.84); }
@media (prefers-reduced-motion: reduce) { .clik-nw.is-small .clik-nw-fab { transition: none; } }
/* lifted over a panel's buttons (the reels rail, a phone's conversation): the round + only, no word beside it */
.clik-nw.is-lifted .clik-nw-word { max-width: 0 !important; opacity: 0 !important; margin: 0 !important; }

/* ---------- round 28 Oct (the owner: "Shorten names here to fit each item in one line", "Connexion full width only for the right edge"): every entry's name on one line - Vidéo courte, Collecte de fonds, and the others' short names where the whole one would wrap (fitNames() in clik-create.js, AdminCP clik_cr_short); the "New" chip of "Annonce magique" sits on its icon tile's corner, so its name keeps the whole line; the visitor's "Connexion" reaches the box's end edge ---------- */
.clik-nw-tx b { flex-wrap: nowrap; }
.clik-nw-t { min-width: 0; }
.clik-nw-ic { position: relative; }
.clik-nw-new { position: absolute; z-index: 1; top: -6px; inset-inline-end: -6px; padding: 2px 5px; border-radius: 999px; font-size: 9.5px; font-style: normal; font-weight: 800; line-height: 1; letter-spacing: .01em; color: #fff; background: linear-gradient(90deg, #0A5CFF, #7C3AED 55%, #F5104F); box-shadow: 0 0 0 2px var(--cr-bg); pointer-events: none; }
@media (prefers-reduced-motion: no-preference) {
  .clik-nw.is-open:not(.no-motion) .clik-nw-new { animation: clik-nw-new-pop .5s cubic-bezier(.3, 1.6, .5, 1) .35s backwards, clik-nw-new-glow 2.2s ease-in-out .9s infinite; }
}
@keyframes clik-nw-new-pop { from { opacity: 0; transform: scale(.4); } }
@keyframes clik-nw-new-glow { 0%, 100% { opacity: 1; } 50% { opacity: .82; } }
.clik-nw-join { padding-inline-end: 0; }
/* phones: while a Le Mag article's reading bar shows, the button stays a round + (its word reached the bar - round 12b) */
@media (max-width: 668px) {
  body.clik-hdock.clik-hdock.clik-hdock .clik-nw .clik-nw-word { max-width: 0 !important; opacity: 0 !important; margin: 0 !important; }
}

/* « Utilisés récemment »: a round clock in place of the words, the chips sliding by wheel, mouse drag or finger, their
   ends fading where more chips wait (clik-create.js: .is-fade-s / .is-fade-e, mirrored in Arabic) */
.clik-nw-sub.is-clock { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--cr-muted); background: var(--cr-soft); text-transform: none; letter-spacing: 0; }
.clik-nw-sub.is-clock svg { display: block; }
.clik-nw-recent { padding-inline-start: 0; }
.clik-nw-chips { flex: 1 1 auto; overscroll-behavior-x: contain; touch-action: pan-x pan-y; cursor: grab; -webkit-user-select: none; user-select: none; }
.clik-nw-chips.is-drag { cursor: grabbing; }
.clik-nw-chips.is-drag .clik-nw-chip { pointer-events: none; }
.clik-nw-chips.is-fade-e { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
.clik-nw-chips.is-fade-s { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent); }
.clik-nw-chips.is-fade-s.is-fade-e { -webkit-mask-image: linear-gradient(to right, transparent, #000 28px, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, transparent, #000 28px, #000 calc(100% - 28px), transparent); }
[dir="rtl"] .clik-nw-chips.is-fade-e { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent); }
[dir="rtl"] .clik-nw-chips.is-fade-s { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
