/* =========================================================================
   Nova, assistante CFR Motors
   Reprend les variables, les rayons, les rythmes et la typographie du site.
   Le cyan est reserve a l identite numerique de Nova, il ne deborde jamais
   sur le reste de l interface.
   ========================================================================= */

.nova {
  --nova-cyan:   #5fd9f5;
  --nova-cyan-2: #2aa8cc;
  --nova-glow:   rgba(95, 217, 245, .28);
  --nova-panel:  #101216;
  --nova-line:   rgba(233, 231, 226, .12);
  --nova-line-2: rgba(233, 231, 226, .22);
  --nova-w: 396px;
  --nova-h: 588px;
  font-family: var(--sans, "Archivo", Helvetica, Arial, sans-serif);
}

/* ----------------------------------------------------------- lanceur */

.nova__open {
  position: fixed;
  right: clamp(16px, 2.4vw, 30px);
  bottom: clamp(16px, 2.4vw, 30px);
  z-index: 86;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 20px 8px 8px;
  background: color-mix(in srgb, var(--ink-800, #101216) 92%, transparent);
  color: var(--on-ink, #e9e7e2);
  border: 1px solid var(--nova-line-2);
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit; font-size: .8rem; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase;
  box-shadow: 0 18px 40px -22px rgba(0, 0, 0, .9);
  transition: border-color .3s var(--ease, ease), transform .3s var(--ease, ease), background .3s var(--ease, ease);
}
.nova__open:hover { border-color: var(--nova-cyan-2); transform: translateY(-1px); }
.nova__open[hidden] { display: none; }
.nova__open-core { width: 42px; height: 42px; flex: 0 0 42px; }
.nova__open-label { white-space: nowrap; }

/* Sur telephone, la barre d actions du site occupe deja le bas de l ecran. */
@media (max-width: 900px) {
  .nova__open {
    right: 14px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    padding: 6px 16px 6px 6px;
    font-size: .72rem;
  }
  .nova__open-core { width: 36px; height: 36px; flex-basis: 36px; }
}

/* ------------------------------------------------------------ fenetre */

.nova__panel {
  position: fixed;
  right: clamp(16px, 2.4vw, 30px);
  bottom: clamp(16px, 2.4vw, 30px);
  z-index: 95;
  width: var(--nova-w);
  max-width: calc(100vw - 24px);
  height: min(var(--nova-h), calc(100vh - 120px));
  display: flex; flex-direction: column;
  background: var(--nova-panel);
  border: 1px solid var(--nova-line-2);
  border-radius: var(--r-l, 14px);
  overflow: hidden;
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, .95);
  opacity: 0; transform: translateY(14px) scale(.985);
  transition: opacity .28s var(--ease, ease), transform .28s var(--ease, ease);
}
.nova__panel[hidden] { display: none; }
.nova.is-open .nova__panel { opacity: 1; transform: none; }

@media (max-width: 640px) {
  .nova__panel {
    right: 0; left: 0; bottom: 0;
    width: auto; max-width: none;
    height: 88dvh; max-height: 88dvh;
    border-radius: var(--r-l, 14px) var(--r-l, 14px) 0 0;
    border-left: 0; border-right: 0; border-bottom: 0;
  }
}

/* ------------------------------------------------------------- entete */

.nova__head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 12px 14px 16px;
  border-bottom: 1px solid var(--nova-line);
  background: var(--ink-900, #0b0c0e);
}
.nova__head-core { width: 40px; height: 40px; flex: 0 0 40px; }
.nova__id { min-width: 0; flex: 1; }
.nova__name {
  font-size: .95rem; font-weight: 650; letter-spacing: .02em;
  color: var(--white, #f7f6f3); line-height: 1.2;
}
.nova__sub {
  display: flex; align-items: center; gap: 7px;
  font-size: .72rem; color: var(--on-ink-dim, #767b85); margin-top: 2px;
}
.nova__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--nova-cyan); flex: 0 0 6px;
}
.nova__head-btns { display: flex; gap: 2px; }
.nova__icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0;
  background: transparent; border: 0; border-radius: var(--r-s, 3px);
  color: var(--on-ink-soft, #a7abb4); cursor: pointer;
  transition: background .2s var(--ease, ease), color .2s var(--ease, ease);
}
.nova__icon:hover { background: rgba(233, 231, 226, .07); color: var(--white, #f7f6f3); }
.nova__icon[aria-pressed="true"] { color: var(--nova-cyan); }

/* --------------------------------------------------------- fil de discussion */

.nova__log {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 18px 16px 6px;
  display: flex; flex-direction: column; gap: 14px;
  scrollbar-width: thin;
}

.nova__msg { max-width: 88%; }
.nova__msg p { margin: 0 0 .55em; }
.nova__msg p:last-child { margin-bottom: 0; }

.nova__msg--nova {
  align-self: flex-start;
  font-size: .9rem; line-height: 1.58;
  color: var(--on-ink, #e9e7e2);
  border-left: 2px solid var(--nova-cyan-2);
  padding-left: 12px;
}
.nova__msg--user {
  align-self: flex-end;
  background: var(--ink-600, #20242b);
  border: 1px solid var(--nova-line);
  border-radius: var(--r-m, 8px);
  padding: 10px 13px;
  font-size: .88rem; line-height: 1.5;
  color: var(--on-ink, #e9e7e2);
}
.nova__msg--note {
  align-self: flex-start; max-width: 100%;
  font-size: .76rem; color: var(--on-ink-dim, #767b85);
}

/* ------------------------------------------------------------- cartes */

.nova__cards { align-self: stretch; display: flex; flex-direction: column; gap: 8px; }
.nova__card {
  display: flex; align-items: stretch; gap: 0;
  text-decoration: none; color: inherit;
  background: var(--ink-700, #171a1f);
  border: 1px solid var(--nova-line);
  border-radius: var(--r-m, 8px);
  overflow: hidden;
  transition: border-color .25s var(--ease, ease), transform .25s var(--ease, ease);
}
.nova__card:hover { border-color: var(--nova-cyan-2); transform: translateY(-1px); }
.nova__card-img {
  width: 84px; flex: 0 0 84px;
  object-fit: cover; height: auto; align-self: stretch;
  background: var(--ink-600, #20242b);
}
.nova__card-body { padding: 11px 13px; min-width: 0; flex: 1; }
.nova__card-t {
  font-size: .86rem; font-weight: 600; line-height: 1.25;
  color: var(--white, #f7f6f3);
}
.nova__card-m {
  font-size: .72rem; color: var(--on-ink-dim, #767b85);
  margin-top: 3px;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.nova__card-b {
  display: inline-block;
  padding: 1px 7px; border-radius: 999px;
  border: 1px solid var(--nova-line-2);
  font-size: .66rem; letter-spacing: .04em; text-transform: uppercase;
  color: var(--on-ink-soft, #a7abb4);
}
.nova__card-go {
  font-size: .74rem; font-weight: 600; color: var(--nova-cyan);
  margin-top: 7px;
}

/* -------------------------------------------------------- recapitulatif */

.nova__recap {
  align-self: stretch;
  border: 1px solid var(--nova-line-2);
  border-radius: var(--r-m, 8px);
  padding: 14px 15px;
  background: var(--ink-800, #101216);
}
.nova__recap-t {
  font-size: .7rem; font-weight: 650; letter-spacing: .1em; text-transform: uppercase;
  color: var(--on-ink-dim, #767b85); margin-bottom: 10px;
}
.nova__recap-row {
  display: flex; gap: 10px; justify-content: space-between;
  font-size: .82rem; padding: 5px 0;
  border-top: 1px solid var(--nova-line);
}
.nova__recap-row:first-of-type { border-top: 0; }
.nova__recap-k { color: var(--on-ink-dim, #767b85); flex: 0 0 auto; }
.nova__recap-v { color: var(--on-ink, #e9e7e2); text-align: right; min-width: 0; word-break: break-word; }
.nova__recap-act { display: flex; gap: 8px; margin-top: 13px; flex-wrap: wrap; }
.nova__recap-note { font-size: .72rem; color: var(--on-ink-dim, #767b85); margin-top: 10px; }

/* ------------------------------------------------------------- boutons */

.nova__btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 10px 18px;
  font-family: inherit; font-size: .76rem; font-weight: 650;
  letter-spacing: .06em; text-transform: uppercase;
  color: #fff; background: var(--blue, #1e3ec8);
  border: 1px solid transparent; border-radius: var(--r-s, 3px);
  cursor: pointer; text-decoration: none;
  transition: background .25s var(--ease, ease), border-color .25s var(--ease, ease);
}
.nova__btn:hover { background: var(--blue-deep, #14297f); }
.nova__btn--ghost { background: transparent; border-color: var(--nova-line-2); color: var(--on-ink, #e9e7e2); }
.nova__btn--ghost:hover { background: rgba(233, 231, 226, .06); border-color: var(--on-ink-soft, #a7abb4); }

.nova__chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 8px 16px 0; }
.nova__chip {
  padding: 8px 13px;
  background: transparent;
  border: 1px solid var(--nova-line-2);
  border-radius: 999px;
  color: var(--on-ink-soft, #a7abb4);
  font-family: inherit; font-size: .76rem;
  cursor: pointer; text-align: left;
  transition: border-color .2s var(--ease, ease), color .2s var(--ease, ease);
}
.nova__chip:hover { border-color: var(--nova-cyan-2); color: var(--white, #f7f6f3); }

/* ---------------------------------------------------------- saisie */

.nova__form {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--nova-line);
  background: var(--ink-900, #0b0c0e);
}
.nova__input {
  flex: 1; min-width: 0;
  max-height: 108px;
  padding: 11px 13px;
  background: var(--ink-700, #171a1f);
  border: 1px solid var(--nova-line);
  border-radius: var(--r-m, 8px);
  color: var(--on-ink, #e9e7e2);
  font-family: inherit; font-size: 16px; line-height: 1.45;
  resize: none;
}
.nova__input:focus { outline: none; border-color: var(--nova-cyan-2); }
.nova__input::placeholder { color: var(--on-ink-dim, #767b85); }

.nova__send {
  flex: 0 0 44px; width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--blue, #1e3ec8); color: #fff;
  border: 0; border-radius: var(--r-m, 8px);
  cursor: pointer;
  transition: background .25s var(--ease, ease), opacity .25s var(--ease, ease);
}
.nova__send:hover { background: var(--blue-deep, #14297f); }
.nova__send:disabled { opacity: .4; cursor: default; }

.nova__foot {
  padding: 0 16px 10px;
  font-size: .68rem; color: var(--on-ink-dim, #767b85);
  background: var(--ink-900, #0b0c0e);
}

/* ------------------------------------------------------- etat reflexion */

.nova__thinking {
  align-self: flex-start;
  display: flex; align-items: center; gap: 9px;
  font-size: .8rem; color: var(--on-ink-dim, #767b85);
}
.nova__thinking span {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--nova-cyan-2);
  animation: nova-pulse 1.25s var(--ease-soft, ease) infinite;
}
.nova__thinking span:nth-child(2) { animation-delay: .16s; }
.nova__thinking span:nth-child(3) { animation-delay: .32s; }
@keyframes nova-pulse {
  0%, 100% { opacity: .28; transform: scale(.8); }
  40%      { opacity: 1;   transform: scale(1); }
}

.nova__error {
  align-self: stretch;
  border: 1px solid rgba(195, 146, 44, .4);
  border-left-width: 2px;
  border-radius: var(--r-m, 8px);
  padding: 11px 13px;
  font-size: .82rem; line-height: 1.5;
  color: var(--on-ink-soft, #a7abb4);
}

/* ----------------------------------------------------- accessibilite */

.nova__sr {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.nova :focus-visible { outline: 2px solid var(--nova-cyan); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .nova__panel { transition: none; }
  .nova__thinking span { animation: none; opacity: .7; }
  .nova__card:hover, .nova__open:hover { transform: none; }
}
