/* Chat Akyssi : bulle en bas à droite, fenêtre de conversation avec l'équipe.
   Couleurs de la charte (variables de index.html). */
.akc-launcher{
  position: fixed; right: 20px; bottom: 20px; z-index: 900;
  width: 60px; height: 60px; border-radius: 50%; cursor: pointer;
  /* Citron et liseré blanc : visible sur les sections ardoise comme sur le crème.
     Icône ardoise foncé : jamais de blanc sur le citron (charte). */
  background: var(--secondary); color: var(--primary-deep);
  border: 3px solid #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 28px rgba(31,43,54,0.35);
  transition: transform .2s var(--ease), background .2s;
}
.akc-launcher:hover{ background: var(--secondary-dark); transform: translateY(-2px); }
.akc-launcher:focus-visible{ outline: 3px solid var(--primary-deep); outline-offset: 3px; }
.akc-launcher svg{ width: 28px; height: 28px; }
.akc-launcher .akc-close-icon{ display: none; }
.akc-open .akc-launcher .akc-chat-icon{ display: none; }
.akc-open .akc-launcher .akc-close-icon{ display: block; }
.akc-dot{
  position: absolute; top: -3px; right: -3px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--error); border: 3px solid #fff; display: none;
}
.akc-unread .akc-dot{ display: block; }

/* Aperçu de la réponse de l'équipe, au-dessus de la bulle */
.akc-preview{
  position: fixed; right: 20px; bottom: 94px; z-index: 900;
  width: 290px; max-width: calc(100vw - 40px);
  display: flex; align-items: flex-start; gap: 4px;
  background: #fff; border: 1px solid var(--border); border-radius: 16px 16px 4px 16px;
  box-shadow: 0 14px 36px rgba(31,43,54,0.28);
  animation: akc-pop .35s var(--ease) both;
}
.akc-preview[hidden], .akc-open .akc-preview{ display: none; }
@keyframes akc-pop{ from{ opacity: 0; transform: translateY(10px) scale(.96); } to{ opacity: 1; transform: none; } }
.akc-preview-open{
  flex: 1; min-width: 0; text-align: left; background: none; border: none; cursor: pointer;
  font: inherit; padding: 12px 4px 12px 14px; display: flex; flex-direction: column; gap: 2px;
}
.akc-preview-open strong{ font-size: 13px; color: var(--primary); }
.akc-preview-open span{ font-size: 14px; color: var(--text); line-height: 1.4; overflow-wrap: anywhere; }
.akc-preview-x{
  flex-shrink: 0; width: 28px; height: 28px; margin: 6px 6px 0 0; border-radius: 8px;
  background: none; border: none; cursor: pointer; color: var(--text-light); font-size: 18px; line-height: 1;
}
.akc-preview-x:hover{ background: var(--surface-variant); color: var(--text); }

.akc-panel{
  position: fixed; right: 20px; bottom: 92px; z-index: 900;
  width: 370px; max-width: calc(100vw - 40px); height: 600px; max-height: calc(100vh - 116px);
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  display: none; flex-direction: column; overflow: hidden;
}
.akc-open .akc-panel{ display: flex; animation: akc-in .25s var(--ease) both; }
@keyframes akc-in{ from{ opacity: 0; transform: translateY(12px) scale(.98); } to{ opacity: 1; transform: none; } }

.akc-head{
  background: var(--primary); color: var(--on-primary);
  padding: 18px 20px; display: flex; align-items: center; gap: 12px;
}
.akc-head-logo{
  width: 40px; height: 40px; border-radius: 50%; background: #fff; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.akc-head-logo img{ width: 30px; height: 30px; }
.akc-head h2{ margin: 0; font-size: 16px; line-height: 1.25; font-weight: 700; color: #fff; }
.akc-head p{ margin: 2px 0 0; font-size: 13px; color: var(--on-primary-soft); line-height: 1.35; }
.akc-head button{
  margin-left: auto; background: none; border: none; color: var(--on-primary-soft);
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 22px; line-height: 1;
}
.akc-head button:hover{ background: rgba(255,255,255,0.1); color: #fff; }

/* Premier message */
.akc-start{ padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.akc-start p.akc-intro{ margin: 0; font-size: 14px; color: var(--text-secondary); line-height: 1.5; }
.akc-field{ display: flex; flex-direction: column; gap: 5px; }
.akc-field label{ font-size: 13px; font-weight: 600; color: var(--text); }
.akc-field small{ font-weight: 400; color: var(--text-light); }
.akc-field input, .akc-field textarea, .akc-compose textarea{
  width: 100%; font: inherit; font-size: 14px; color: var(--text);
  padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--border); background: #fff;
  resize: none;
}
.akc-field input:focus, .akc-field textarea:focus, .akc-compose textarea:focus{
  outline: none; border-color: var(--secondary-dark); box-shadow: 0 0 0 3px rgba(213,223,54,0.35);
}
.akc-hp{ position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.akc-send{
  border: none; cursor: pointer; font: inherit; font-weight: 700; font-size: 15px;
  background: var(--secondary); color: var(--primary-deep);
  padding: 12px 16px; border-radius: 12px; transition: background .15s;
}
.akc-send:hover:not(:disabled){ background: var(--secondary-dark); }
.akc-send:disabled{ opacity: .6; cursor: default; }
.akc-legal{ margin: 0; font-size: 11.5px; color: var(--text-light); line-height: 1.45; }
.akc-legal a{ text-decoration: underline; }
.akc-error{ margin: 0; font-size: 13px; color: var(--error); }

/* Conversation */
.akc-thread{ flex: 1; display: none; flex-direction: column; min-height: 0; }
.akc-has-chat .akc-start{ display: none; }
.akc-has-chat .akc-thread{ display: flex; }
.akc-messages{
  flex: 1; overflow-y: auto; padding: 16px 16px 8px; background: var(--bg);
  display: flex; flex-direction: column; gap: 10px;
}
.akc-msg{ max-width: 82%; display: flex; flex-direction: column; gap: 3px; }
.akc-msg-body{
  padding: 9px 13px; border-radius: 16px; font-size: 14px; line-height: 1.45;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.akc-msg-meta{ font-size: 11px; color: var(--text-light); padding: 0 4px; }
.akc-msg.visitor{ align-self: flex-end; align-items: flex-end; }
.akc-msg.visitor .akc-msg-body{ background: var(--primary); color: #fff; border-bottom-right-radius: 5px; }
.akc-msg.admin{ align-self: flex-start; }
.akc-msg.admin .akc-msg-body{ background: #fff; color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.akc-note{
  align-self: center; text-align: center; font-size: 12px; color: var(--text-light);
  background: var(--surface-variant); border-radius: var(--r-full); padding: 5px 12px; margin: 4px 0;
}
/* « Équipe Akyssi écrit… » */
.akc-typing{
  align-self: flex-start; display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-light);
}
.akc-typing-dots{
  display: inline-flex; gap: 4px; padding: 11px 13px;
  background: #fff; border: 1px solid var(--border); border-radius: 16px; border-bottom-left-radius: 5px;
}
.akc-typing-dots i{
  width: 7px; height: 7px; border-radius: 50%; background: var(--text-light);
  animation: akc-blink 1.2s infinite ease-in-out;
}
.akc-typing-dots i:nth-child(2){ animation-delay: .15s; }
.akc-typing-dots i:nth-child(3){ animation-delay: .3s; }
@keyframes akc-blink{ 0%, 60%, 100%{ opacity: .3; transform: translateY(0); } 30%{ opacity: 1; transform: translateY(-3px); } }
.akc-preview-typing .akc-preview-open span{ color: var(--text-light); font-style: italic; }

.akc-compose{ display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--border); background: #fff; }
.akc-compose textarea{ max-height: 110px; }
.akc-compose button{
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 12px; border: none; cursor: pointer;
  background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center;
}
.akc-compose button:disabled{ opacity: .5; cursor: default; }
.akc-compose button svg{ width: 20px; height: 20px; }

@media (max-width: 640px){
  .akc-launcher{ right: 16px; bottom: 16px; }
  .akc-preview{ right: 16px; bottom: 88px; }
  .akc-panel{ right: 0; bottom: 0; width: 100vw; max-width: none; height: 100%; max-height: none; border-radius: 0; border: none; }
  .akc-open .akc-launcher{ display: none; }
}
@media print{ .akc-launcher, .akc-panel, .akc-preview{ display: none !important; } }
