/* Assistant IA Alberto Cabale — design Shopify Release (module acassistant).
   z-index : au-dessus du header sticky (--z-header: 800), sous rien d'autre. */

#ac-assistant {
  font-family: var(--font-body-family, inherit);
}

/* Bulle flottante */
#ac-assistant-toggle {
  position: fixed;
  inset-block-end: 2rem;
  inset-inline-end: 2rem;
  z-index: 1190;
  width: 5.6rem;
  height: 5.6rem;
  border: none;
  border-radius: 50%;
  background: #111;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
  transition: transform .2s ease, box-shadow .2s ease;
}
#ac-assistant-toggle:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .3);
}
#ac-assistant-toggle .acas-icon-close { display: none; }
#ac-assistant.acas-open #ac-assistant-toggle .acas-icon-chat { display: none; }
#ac-assistant.acas-open #ac-assistant-toggle .acas-icon-close { display: block; }

/* Fenêtre — l'attribut hidden doit gagner sur display:flex, sinon le chat
   apparaît ouvert au chargement et la croix semble sans effet. */
#ac-assistant-window[hidden] { display: none !important; }
#ac-assistant-window {
  position: fixed;
  inset-block-end: 8.8rem;
  inset-inline-end: 2rem;
  z-index: 1200;
  width: 37rem;
  max-width: calc(100vw - 4rem);
  height: 56rem;
  max-height: calc(100dvh - 12rem);
  display: flex;
  flex-direction: column;
  background: #fff;
  color: #111;
  border-radius: var(--card-corner-radius, 12px);
  box-shadow: 0 12px 48px rgba(0, 0, 0, .28);
  overflow: hidden;
}
@media screen and (max-width: 749px) {
  #ac-assistant-window {
    inset-inline-end: 1rem;
    inset-block-end: 8rem;
    max-width: calc(100vw - 2rem);
    height: 48rem;
    max-height: calc(100dvh - 10rem);
  }
  #ac-assistant-toggle {
    inset-block-end: 1.4rem;
    inset-inline-end: 1.4rem;
  }
}

/* En-tête */
.acas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.6rem 1.8rem;
  background: #111;
  color: #fff;
}
.acas-header-txt { display: flex; flex-direction: column; gap: .3rem; }
.acas-title {
  font-family: var(--font-heading-family, inherit);
  font-size: 1.5rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.acas-status {
  font-size: 1.15rem;
  opacity: .75;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.acas-dot {
  width: .8rem;
  height: .8rem;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
}
.acas-header-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: .4rem;
  line-height: 0;
}

/* Formulaire d'accueil (étape 1) — [hidden] doit gagner sur display:flex */
.acas-intro[hidden],
.acas-messages[hidden],
.acas-input[hidden] { display: none !important; }

.acas-intro {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  padding: 1.8rem 1.8rem 2rem;
  background: #faf9f7;
}
.acas-intro-lead {
  margin: 0;
  font-size: 1.3rem;
  line-height: 1.5;
  color: #444;
}
.acas-intro-banner {
  margin: 0;
  padding: 1rem 1.2rem;
  border-radius: .8rem;
  background: #fdf0ef;
  color: #b3261e;
  font-size: 1.25rem;
}
.acas-field {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.acas-field > span {
  font-size: 1.2rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #666;
}
.acas-field > span em {
  font-style: normal;
  color: #b3261e;
}
.acas-field input,
.acas-field textarea {
  font: inherit;
  font-size: 1.35rem;
  color: #111;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .15);
  border-radius: .8rem;
  padding: 1rem 1.2rem;
  outline: none;
  resize: none;
  transition: border-color .15s ease;
}
.acas-field input:focus,
.acas-field textarea:focus { border-color: #111; }
.acas-field input.acas-invalid,
.acas-field textarea.acas-invalid { border-color: #b3261e; }
.acas-field-error {
  font-size: 1.15rem;
  color: #b3261e;
}
.acas-intro-submit {
  margin-top: .4rem;
  padding: 1.2rem;
  border: none;
  border-radius: 4rem;
  background: #111;
  color: #fff;
  font: inherit;
  font-size: 1.3rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity .15s ease;
}
.acas-intro-submit:disabled { opacity: .5; cursor: default; }
.acas-intro-legal {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.45;
  color: #888;
}

/* Messages */
.acas-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.8rem 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  background: #faf9f7;
}
.acas-msg {
  max-width: 85%;
  padding: 1.1rem 1.4rem;
  border-radius: 1.4rem;
  font-size: 1.35rem;
  line-height: 1.5;
  white-space: pre-line;
  overflow-wrap: break-word;
}
.acas-msg--user {
  align-self: flex-end;
  background: #111;
  color: #fff;
  border-end-end-radius: .4rem;
}
.acas-msg--assistant {
  align-self: flex-start;
  background: #fff;
  color: #111;
  border: 1px solid rgba(0, 0, 0, .08);
  border-end-start-radius: .4rem;
}
.acas-msg--assistant a { color: inherit; text-decoration: underline; }
.acas-msg--error {
  align-self: center;
  background: #fdf0ef;
  color: #b3261e;
  font-size: 1.25rem;
  border-radius: .8rem;
}
.acas-msg--handoff {
  border-color: rgba(74, 222, 128, .6);
  background: #f2fbf5;
}

/* Indicateur de frappe */
.acas-typing {
  align-self: flex-start;
  display: flex;
  gap: .5rem;
  padding: 1.2rem 1.4rem;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 1.4rem;
  border-end-start-radius: .4rem;
}
.acas-typing span {
  width: .7rem;
  height: .7rem;
  border-radius: 50%;
  background: #999;
  animation: acas-blink 1.2s infinite both;
}
.acas-typing span:nth-child(2) { animation-delay: .2s; }
.acas-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes acas-blink {
  0%, 80%, 100% { opacity: .25; }
  40% { opacity: 1; }
}

/* Saisie */
.acas-input {
  display: flex;
  align-items: flex-end;
  gap: .8rem;
  padding: 1.2rem 1.4rem;
  border-top: 1px solid rgba(0, 0, 0, .08);
  background: #fff;
}
.acas-input textarea {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  font: inherit;
  font-size: 1.35rem;
  line-height: 1.4;
  max-height: 9rem;
  padding: .6rem 0;
  background: transparent;
  color: #111;
}
.acas-send {
  width: 3.8rem;
  height: 3.8rem;
  border: none;
  border-radius: 50%;
  background: #111;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity .15s ease;
}
.acas-send:disabled { opacity: .4; cursor: default; }
.acas-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}
