/**
 * Assistant FAQ — Cirque Phénix.
 * Les variables --phx-accent, --phx-ink, --phx-paper sont injectées par PHP.
 */

.phx-chatbot {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9998;
  font-family: "Barlow Semi Condensed", system-ui, sans-serif;
}

/* ---- Bulle ---- */
.phx-launcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 20px 13px 16px;
  background: var(--phx-ink, #141210);
  color: var(--phx-paper, #FCFBF9);
  border: 0;
  border-radius: 0;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(20, 18, 16, 0.28);
  font-size: 14px;
  letter-spacing: 0.02em;
  transition: background 0.3s ease, transform 0.3s ease;
}
.phx-launcher:hover {
  background: var(--phx-accent, #85684a);
  transform: translateY(-2px);
}
.phx-launcher-icon {
  display: inline-flex;
}
.phx-chatbot.is-open .phx-launcher {
  display: none;
}

/* ---- Panneau ---- */
.phx-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(400px, calc(100vw - 28px));
  max-height: min(640px, calc(100vh - 48px));
  background: var(--phx-paper, #FCFBF9);
  color: var(--phx-ink, #141210);
  box-shadow: 0 20px 60px rgba(20, 18, 16, 0.3);
  display: flex;
  flex-direction: column;
  animation: phx-in 0.28s ease;
}
.phx-panel[hidden] {
  display: none;
}
@keyframes phx-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.phx-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: var(--phx-ink, #141210);
  color: var(--phx-paper, #FCFBF9);
}
.phx-panel-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.phx-close {
  background: none;
  border: 0;
  color: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0.8;
}
.phx-close:hover {
  opacity: 1;
}

/* ---- Journal des messages ---- */
.phx-log {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.phx-msg {
  max-width: min(85%, 62ch);
  padding: 11px 14px;
  font-size: 14px;
  line-height: 1.5;
}
.phx-msg a {
  color: var(--phx-accent, #85684a);
  font-weight: 600;
}
.phx-msg-bot {
  align-self: flex-start;
  background: var(--phx-sand, #f0e9da);
  border-left: 2px solid var(--phx-accent, #85684a);
  color: var(--phx-ink, #141210);
}
.phx-msg-wave::before {
  content: "\1F44B";
  margin-right: 7px;
}
.phx-msg-user {
  align-self: flex-end;
  background: var(--phx-accent, #85684a);
  color: #fff;
}

/* ---- Questions ---- */
.phx-questions {
  padding: 4px 18px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  overflow-y: auto;
  max-height: 210px;
}
.phx-q {
  text-align: left;
  padding: 9px 14px;
  background: transparent;
  border: 1px solid rgba(133, 104, 74, 0.4);
  border-radius: 0;
  color: var(--phx-accent, #85684a);
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.phx-q:hover {
  background: var(--phx-accent, #85684a);
  border-color: var(--phx-accent, #85684a);
  color: #fff;
}
/* Un intitulé discret au-dessus des questions. */
.phx-questions::before {
  content: "";
}

/* ---- Bouton d'action ---- */
.phx-cta {
  display: block;
  margin: 0 18px 18px;
  padding: 13px;
  background: var(--phx-accent, #85684a);
  color: #fff;
  text-align: center;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: filter 0.25s ease;
}
.phx-cta:hover {
  filter: brightness(1.1);
}

@media (max-width: 480px) {
  .phx-chatbot {
    right: 14px;
    bottom: 14px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .phx-panel,
  .phx-launcher {
    animation: none;
    transition: none;
  }
}

/* ---- Assistant intégré dans une page ([phenix_faq]) ---- */
.phx-inline {
  position: static;
  max-width: 640px;
  margin: 0 auto;
}
.phx-panel-inline {
  position: static;
  width: 100%;
  max-height: none;
  box-shadow: 0 10px 40px rgba(20, 18, 16, 0.12);
  animation: none;
}
.phx-panel-inline .phx-log {
  max-height: 340px;
}
.phx-panel-inline .phx-questions {
  max-height: none;
  padding-bottom: 20px;
}

/* ---- Champ de saisie ---- */
.phx-form {
  display: flex;
  gap: 8px;
  padding: 0 18px 18px;
}
.phx-input {
  flex: 1;
  padding: 11px 14px;
  border: 1px solid rgba(133, 104, 74, 0.4);
  border-radius: 0;
  font-family: inherit;
  font-size: 14px;
  color: var(--phx-ink, #141210);
  background: #fff;
}
.phx-input:focus {
  outline: none;
  border-color: var(--phx-accent, #85684a);
}
.phx-send {
  flex: 0 0 auto;
  width: 44px;
  border: 0;
  border-radius: 0;
  background: var(--phx-accent, #85684a);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  transition: filter 0.25s ease;
}
.phx-send:hover {
  filter: brightness(1.1);
}

/* ---- Navigation par thèmes ---- */
.phx-nav {
  padding: 4px 18px 16px;
}
.phx-themes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.phx-theme {
  padding: 11px 14px;
  text-align: center;
  background: transparent;
  border: 1px solid rgba(133, 104, 74, 0.4);
  border-radius: 0;
  color: var(--phx-accent, #85684a);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.phx-theme:hover {
  background: var(--phx-accent, #85684a);
  border-color: var(--phx-accent, #85684a);
  color: #fff;
}
/* L'attribut hidden doit l'emporter sur tout display déclaré ensuite :
   sans cette règle, .phx-back{display:inline-flex} rend le bouton « retour »
   visible en permanence, y compris à l'état initial où il ne mène nulle part. */
.phx-chatbot [hidden],
.phx-inline [hidden] {
  display: none !important;
}

.phx-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding: 6px 12px;
  background: none;
  border: 0;
  color: var(--phx-ink, #141210);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  opacity: 0.75;
}
.phx-back:hover {
  opacity: 1;
  color: var(--phx-accent, #85684a);
}
.phx-questions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}

/* ---- Désambiguïsation : « Vous vouliez dire ? » ---- */
.phx-suggest {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.phx-suggest-btn {
  text-align: left;
  padding: 9px 12px;
  background: #fff;
  border: 1px solid rgba(133, 104, 74, 0.35);
  border-left: 3px solid var(--phx-accent, #85684a);
  border-radius: 0;
  color: var(--phx-ink, #141210);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.35;
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease;
}
.phx-suggest-btn:hover,
.phx-suggest-btn:focus-visible {
  background: var(--phx-accent, #85684a);
  border-color: var(--phx-accent, #85684a);
  color: #fff;
  outline: none;
}


/* ---- Accessibilité : focus toujours visible ---- */
.phx-chatbot :focus-visible,
.phx-inline :focus-visible {
  outline: 2px solid var(--phx-accent, #85684a);
  outline-offset: 2px;
}
.phx-msg:focus {
  outline: none;
}
.phx-msg:focus-visible {
  outline: 2px solid var(--phx-accent, #85684a);
  outline-offset: 3px;
}

/* ---- Sortie de secours : contacts affichés quand rien ne correspond ---- */
.phx-help {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.phx-help a {
  padding: 9px 14px;
  border: 1px solid var(--phx-accent, #85684a);
  color: var(--phx-accent, #85684a);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.25s ease, color 0.25s ease;
}
.phx-help a:hover,
.phx-help a:focus-visible {
  background: var(--phx-accent, #85684a);
  color: #fff;
}

/* ---- FAQ dépliante (référencée par Google, elle) ---- */
.phx-faq-list {
  max-width: 760px;
  margin: 0 auto;
}
.phx-faq-theme {
  margin: 0 0 10px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--phx-accent, #85684a);
}
.phx-faq-theme + .phx-faq-item {
  margin-top: 0;
}
.phx-faq-theme:not(:first-child) {
  margin-top: 34px;
}
.phx-faq-item {
  border-bottom: 1px solid rgba(133, 104, 74, 0.28);
}
.phx-faq-item > summary {
  padding: 16px 34px 16px 0;
  position: relative;
  font-size: 17px;
  line-height: 1.4;
  color: var(--phx-ink, #141210);
  cursor: pointer;
  list-style: none;
}
.phx-faq-item > summary::-webkit-details-marker {
  display: none;
}
.phx-faq-item > summary::after {
  content: "+";
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  line-height: 1;
  color: var(--phx-accent, #85684a);
}
.phx-faq-item[open] > summary::after {
  content: "\2212";
}
.phx-faq-answer {
  padding: 0 34px 20px 0;
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--phx-ink-soft, #4a443c);
}
.phx-faq-answer a {
  color: var(--phx-accent, #85684a);
  font-weight: 600;
}
