/* Assistant Himawari — styles isolés sous #hwc-root */
#hwc-root {
  --hwc-color: #2D2A4A;
  --hwc-accent: #F2B705;
  --hwc-paper: #FBF8F1;
  --hwc-ink: #2B2620;
  --hwc-muted: #7A7064;
  --hwc-line: #E8E0D2;
  position: fixed;
  bottom: 20px;
  z-index: 2147483000;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  color: var(--hwc-ink);
}
#hwc-root.hwc-pos-right { right: 20px; }
#hwc-root.hwc-pos-left { left: 20px; }
#hwc-root *, #hwc-root *::before, #hwc-root *::after { box-sizing: border-box; }
#hwc-root button { font: inherit; margin: 0; text-transform: none; letter-spacing: normal; box-shadow: none; min-height: 0; }
#hwc-root svg { display: block; width: 100%; height: 100%; }

/* Bouton flottant */
#hwc-root .hwc-launcher {
  position: relative;
  width: 62px; height: 62px;
  padding: 0;
  border: 0; border-radius: 50%;
  background: var(--hwc-color);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(30, 24, 16, .28);
  transition: transform .2s ease, box-shadow .2s ease;
}
#hwc-root.hwc-pos-right .hwc-launcher { margin-left: auto; }
#hwc-root .hwc-launcher:hover { transform: translateY(-2px) rotate(-8deg); box-shadow: 0 10px 24px rgba(30, 24, 16, .32); }
#hwc-root .hwc-launcher:focus-visible { outline: 3px solid var(--hwc-accent); outline-offset: 3px; }
#hwc-root .hwc-launcher-flower,
#hwc-root .hwc-launcher-close {
  position: absolute; inset: 0; margin: auto;
  transition: opacity .2s ease, transform .3s ease;
}
#hwc-root .hwc-launcher-flower { width: 44px; height: 44px; }
#hwc-root .hwc-launcher-close { width: 24px; height: 24px; opacity: 0; transform: rotate(-90deg); }
#hwc-root.hwc-open .hwc-launcher-flower { opacity: 0; transform: rotate(90deg) scale(.6); }
#hwc-root.hwc-open .hwc-launcher-close { opacity: 1; transform: none; }

/* Panneau */
#hwc-root .hwc-panel {
  position: absolute;
  bottom: 76px;
  width: 370px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  display: flex; flex-direction: column;
  background: var(--hwc-paper);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(30, 24, 16, .25), 0 0 0 1px rgba(30, 24, 16, .06);
  opacity: 0; visibility: hidden;
  transform: translateY(12px) scale(.98);
  transform-origin: bottom right;
  transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
}
#hwc-root.hwc-pos-right .hwc-panel { right: 0; }
#hwc-root.hwc-pos-left .hwc-panel { left: 0; transform-origin: bottom left; }
#hwc-root.hwc-open .hwc-panel {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity .2s ease, transform .2s ease, visibility 0s;
}

/* En-tête */
#hwc-root .hwc-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 12px 14px 16px;
  background: var(--hwc-color);
  color: #fff;
}
#hwc-root .hwc-avatar {
  width: 38px; height: 38px; flex: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  padding: 3px;
}
#hwc-root .hwc-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
#hwc-root .hwc-title strong { font-size: 16px; font-weight: 600; color: #fff; }
#hwc-root .hwc-title span { font-size: 12px; opacity: .75; }
#hwc-root .hwc-icon-btn {
  width: 34px; height: 34px; padding: 8px; flex: none;
  border: 0; border-radius: 8px;
  background: transparent; color: #fff;
  cursor: pointer; opacity: .8;
}
#hwc-root .hwc-icon-btn:hover { background: rgba(255, 255, 255, .12); opacity: 1; }
#hwc-root .hwc-icon-btn:focus-visible { outline: 2px solid var(--hwc-accent); }

/* Corps */
#hwc-root .hwc-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#hwc-root .hwc-log {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex; flex-direction: column; gap: 8px;
  overscroll-behavior: contain;
}
#hwc-root .hwc-msg {
  max-width: 86%;
  padding: 9px 13px;
  border-radius: 16px;
  word-wrap: break-word; overflow-wrap: anywhere;
  animation: hwc-in .2s ease;
}
#hwc-root .hwc-assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--hwc-line);
  border-bottom-left-radius: 5px;
}
#hwc-root .hwc-user {
  align-self: flex-end;
  background: var(--hwc-color);
  color: #fff;
  border-bottom-right-radius: 5px;
  white-space: pre-wrap;
}
#hwc-root .hwc-assistant a { color: var(--hwc-color); text-decoration: underline; text-underline-offset: 2px; }
#hwc-root .hwc-assistant strong { font-weight: 600; }
#hwc-root .hwc-error { background: #FDF1EC; border-color: #F2D3C6; color: #7A3418; }

#hwc-root .hwc-typing { display: inline-flex; gap: 4px; padding: 13px 14px; }
#hwc-root .hwc-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--hwc-muted);
  animation: hwc-dot 1.2s infinite ease-in-out;
}
#hwc-root .hwc-typing span:nth-child(2) { animation-delay: .15s; }
#hwc-root .hwc-typing span:nth-child(3) { animation-delay: .3s; }

/* Formulaire d'inscription dans la conversation */
#hwc-root .hwc-signup { width: 86%; border-color: var(--hwc-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hwc-accent) 22%, transparent); }
#hwc-root .hwc-signup.hwc-done { width: auto; box-shadow: none; border-color: var(--hwc-line); }
#hwc-root .hwc-signup-title { display: block; margin-bottom: 8px; font-weight: 600; }
#hwc-root .hwc-signup-form { display: flex; flex-direction: column; gap: 7px; margin: 0; }
#hwc-root .hwc-signup-form input[type=text],
#hwc-root .hwc-signup-form input[type=email] {
  width: 100%; height: 38px; margin: 0; padding: 0 11px;
  border: 1px solid var(--hwc-line); border-radius: 9px;
  background: var(--hwc-paper); color: var(--hwc-ink);
  font: inherit; font-size: 14px; box-shadow: none;
}
#hwc-root .hwc-signup-form input:focus { outline: 0; border-color: var(--hwc-color); background: #fff; }
#hwc-root .hwc-signup-form .hwc-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
#hwc-root .hwc-consent { display: flex; gap: 7px; align-items: flex-start; margin: 2px 0; font-size: 12.5px; line-height: 1.4; color: var(--hwc-ink); cursor: pointer; }
#hwc-root .hwc-consent input { flex: none; width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--hwc-color); }
#hwc-root .hwc-signup-btn {
  height: 38px; padding: 0 14px;
  border: 0; border-radius: 9px;
  background: var(--hwc-color); color: #fff;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
#hwc-root .hwc-signup-btn:disabled { opacity: .6; cursor: default; }
#hwc-root .hwc-signup-err { margin: 0; font-size: 12.5px; color: #A23B12; }
#hwc-root .hwc-signup-err:empty { display: none; }
#hwc-root .hwc-signup-note { margin: 0; font-size: 11.5px; color: var(--hwc-muted); }

/* Suggestions */
#hwc-root .hwc-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 14px 10px; }
#hwc-root .hwc-chips[hidden] { display: none; }
#hwc-root .hwc-chip {
  padding: 6px 12px;
  border: 1px solid var(--hwc-color);
  border-radius: 999px;
  background: transparent;
  color: var(--hwc-color);
  font-size: 13px; line-height: 1.3;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
#hwc-root .hwc-chip:hover { background: var(--hwc-color); color: #fff; }

/* Pied */
#hwc-root .hwc-footer { padding: 10px 12px 8px; border-top: 1px solid var(--hwc-line); background: var(--hwc-paper); }
#hwc-root .hwc-newsletter {
  display: block;
  margin: 0 0 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--hwc-accent);
  color: var(--hwc-ink);
  font-size: 14px; font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: filter .15s ease, transform .15s ease;
}
#hwc-root button.hwc-newsletter { width: 100%; border: 0; cursor: pointer; line-height: 1.5; }
#hwc-root .hwc-newsletter:hover { filter: brightness(1.06); transform: translateY(-1px); color: var(--hwc-ink); }
#hwc-root .hwc-form {
  display: flex; align-items: flex-end; gap: 6px;
  padding: 4px 4px 4px 12px;
  background: #fff;
  border: 1px solid var(--hwc-line);
  border-radius: 14px;
}
#hwc-root .hwc-form:focus-within { border-color: var(--hwc-color); }
#hwc-root .hwc-input {
  flex: 1;
  min-height: 0; height: 24px; max-height: 120px;
  margin: 7px 0; padding: 0;
  border: 0; outline: 0; resize: none;
  background: transparent;
  color: var(--hwc-ink);
  font: inherit; font-size: 15px; line-height: 24px;
  box-shadow: none;
}
#hwc-root .hwc-send {
  width: 38px; height: 38px; padding: 9px; flex: none;
  border: 0; border-radius: 10px;
  background: var(--hwc-color); color: #fff;
  cursor: pointer;
}
#hwc-root .hwc-send:disabled { opacity: .45; cursor: default; }
#hwc-root .hwc-note { margin: 6px 2px 0; font-size: 11px; line-height: 1.4; color: var(--hwc-muted); text-align: center; }
#hwc-root .hwc-note a { color: inherit; text-decoration: underline; }

@keyframes hwc-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes hwc-dot { 0%, 80%, 100% { transform: scale(.6); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }

/* Mobile : plein écran */
@media (max-width: 520px) {
  #hwc-root { bottom: 16px; }
  #hwc-root.hwc-pos-right { right: 16px; }
  #hwc-root.hwc-pos-left { left: 16px; }
  #hwc-root .hwc-panel {
    position: fixed; inset: 0;
    width: 100%; max-width: none; height: 100%; max-height: none;
    border-radius: 0;
  }
  #hwc-root.hwc-open .hwc-launcher { display: none; }
  #hwc-root .hwc-input { font-size: 16px; } /* évite le zoom iOS */
}

@media (prefers-reduced-motion: reduce) {
  #hwc-root *, #hwc-root *::before, #hwc-root *::after { animation: none !important; transition: none !important; }
}
