/* =====================================================================
   AI SHARE — Widget de support LYS EDEN
   Réutilise les tokens de assets/css/styles.css (suit donc automatiquement
   le thème clair/sombre du site). Aucune dépendance externe.
   ===================================================================== */

.ais-chat { position: fixed; right: 20px; bottom: 20px; z-index: 1200; }

.ais-chat__bubble {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-hover);
  transition: transform var(--transition), box-shadow var(--transition);
}
.ais-chat__bubble:hover { transform: translateY(-3px); }
.ais-chat__bubble svg { width: 26px; height: 26px; }
.ais-chat__bubble .ais-chat__icon-close { display: none; }
.ais-chat.is-open .ais-chat__bubble .ais-chat__icon-chat { display: none; }
.ais-chat.is-open .ais-chat__bubble .ais-chat__icon-close { display: block; }

.ais-chat__panel {
  position: fixed;
  right: 20px;
  bottom: 92px;
  width: 372px;
  max-width: calc(100vw - 32px);
  height: min(560px, calc(100vh - 120px));
  background: var(--navy-light);
  border: 1px solid var(--navy-lighter);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
}
.ais-chat.is-open .ais-chat__panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.ais-chat__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--navy);
  border-bottom: 1px solid var(--navy-lighter);
  flex-shrink: 0;
}
.ais-chat__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ais-chat__avatar svg { width: 18px; height: 18px; }
.ais-chat__header-text { min-width: 0; flex: 1; }
.ais-chat__header-title {
  font-family: var(--font-title);
  color: var(--white);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}
.ais-chat__header-status {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}
.ais-chat__header-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.ais-chat__close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  transition: color var(--transition), background var(--transition);
}
.ais-chat__close:hover { color: var(--text); background: var(--navy-lighter); }
.ais-chat__close svg { width: 18px; height: 18px; }

.ais-chat__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ais-chat__msg {
  max-width: 84%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.5;
  word-wrap: break-word;
}
.ais-chat__msg strong { color: inherit; }
.ais-chat__msg--bot {
  align-self: flex-start;
  background: var(--navy);
  border: 1px solid var(--navy-lighter);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.ais-chat__msg--user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--navy);
  border-bottom-right-radius: 4px;
}
.ais-chat__msg--error {
  align-self: flex-start;
  background: transparent;
  border: 1px dashed var(--navy-lighter);
  color: var(--text-muted);
  font-size: 13.5px;
}

.ais-chat__typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 11px 14px;
  background: var(--navy);
  border: 1px solid var(--navy-lighter);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}
.ais-chat__typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: ais-chat-bounce 1.2s infinite ease-in-out;
}
.ais-chat__typing span:nth-child(2) { animation-delay: 0.15s; }
.ais-chat__typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ais-chat-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .ais-chat__typing span { animation: none; opacity: 0.8; }
}

.ais-chat__telegram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0 16px 12px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  flex-shrink: 0;
  transition: background var(--transition);
}
.ais-chat__telegram:hover { background: var(--accent-line); color: var(--accent); }
.ais-chat__telegram svg { width: 16px; height: 16px; flex-shrink: 0; }

.ais-chat__form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--navy-lighter);
  flex-shrink: 0;
}
.ais-chat__input {
  flex: 1;
  resize: none;
  max-height: 96px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--navy-lighter);
  background: var(--navy);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.4;
}
.ais-chat__input:focus { outline: 2px solid var(--accent-line); outline-offset: 1px; }
.ais-chat__input::placeholder { color: var(--text-muted); }

.ais-chat__send {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
}
.ais-chat__send:hover { transform: translateY(-1px); }
.ais-chat__send:disabled { opacity: 0.5; cursor: default; transform: none; }
.ais-chat__send svg { width: 17px; height: 17px; }

@media (max-width: 480px) {
  .ais-chat { right: 14px; bottom: 14px; }
  .ais-chat__panel {
    right: 14px;
    left: 14px;
    bottom: 84px;
    width: auto;
    max-width: none;
    height: min(72vh, calc(100vh - 110px));
  }
}
