/*
 * Omamori - Widget de chat (v1.16).
 *
 * Identite teal/turquoise Omamori, mobile-first, coexiste avec le
 * bouton flottant WhatsApp deja present (decale vers le haut quand
 * la bulle de chat est presente).
 */

/* Couleurs Omamori (alignees avec omamori.css). */
:root {
  --oma-chat-teal:   #1ea69a;
  --oma-chat-teal-d: #178c81;
  --oma-chat-ink:    #0f2c2a;
  --oma-chat-gray-1: #f4f7f7;
  --oma-chat-gray-2: #e3eae9;
  --oma-chat-gray-3: #7c8b87;
}

/* ---- Bulle declenchee (bas-droite) -------------------------------- */
#oma-chat-bubble {
  position: fixed;
  right: 18px;
  bottom: 88px; /* au-dessus du bouton WhatsApp (bottom: 18px + ~62px) */
  z-index: 9998;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--oma-chat-teal);
  color: #fff;
  border: none;
  box-shadow: 0 6px 18px rgba(15, 44, 42, 0.28);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
#oma-chat-bubble:hover {
  background: var(--oma-chat-teal-d);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 44, 42, 0.32);
}
#oma-chat-bubble:focus-visible {
  outline: 3px solid #ffd75e;
  outline-offset: 2px;
}
#oma-chat-bubble svg {
  width: 26px;
  height: 26px;
}
#oma-chat-bubble.oma-chat-bubble-hidden {
  transform: scale(0);
  pointer-events: none;
}
.oma-chat-bubble-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 10px;
  height: 10px;
  background: #ffd75e;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--oma-chat-teal);
}

/* ---- Panneau de conversation -------------------------------------- */
#oma-chat-panel {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9999;
  width: 380px;
  max-width: calc(100vw - 36px);
  height: 560px;
  max-height: calc(100vh - 36px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(15, 44, 42, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s ease, opacity 0.22s ease;
  font-family: inherit;
}
#oma-chat-panel.oma-chat-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.oma-chat-head {
  background: var(--oma-chat-teal);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.oma-chat-head-title strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}
.oma-chat-head-sub {
  display: block;
  font-size: 12px;
  opacity: 0.85;
  margin-top: 2px;
}
.oma-chat-close {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0.9;
}
.oma-chat-close:hover { opacity: 1; }

.oma-chat-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px;
  background: var(--oma-chat-gray-1);
}
.oma-chat-msg {
  display: flex;
  margin-bottom: 10px;
  animation: oma-chat-fade-in 0.2s ease;
}
@keyframes oma-chat-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.oma-chat-msg-bubble {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
}
.oma-chat-msg-user {
  justify-content: flex-end;
}
.oma-chat-msg-user .oma-chat-msg-bubble {
  background: var(--oma-chat-teal);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.oma-chat-msg-assistant .oma-chat-msg-bubble {
  background: #fff;
  color: var(--oma-chat-ink);
  border: 1px solid var(--oma-chat-gray-2);
  border-bottom-left-radius: 4px;
}
.oma-chat-msg-assistant .oma-chat-msg-bubble a {
  color: var(--oma-chat-teal-d);
  text-decoration: underline;
}

.oma-chat-msg-pending .oma-chat-msg-bubble {
  font-style: italic;
  color: var(--oma-chat-gray-3);
}
.oma-chat-thinking .oma-chat-msg-bubble::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 4px;
  background: var(--oma-chat-gray-3);
  border-radius: 50%;
  animation: oma-chat-blink 1.2s infinite;
}
@keyframes oma-chat-blink {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

.oma-chat-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--oma-chat-gray-2);
  background: #fff;
}
.oma-chat-input {
  flex: 1 1 auto;
  resize: none;
  border: 1px solid var(--oma-chat-gray-2);
  border-radius: 10px;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  background: var(--oma-chat-gray-1);
  color: var(--oma-chat-ink);
  outline: none;
  max-height: 120px;
  min-height: 38px;
}
.oma-chat-input:focus {
  border-color: var(--oma-chat-teal);
  background: #fff;
}
.oma-chat-send {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--oma-chat-teal);
  color: #fff;
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease;
}
.oma-chat-send:hover {
  background: var(--oma-chat-teal-d);
  transform: translateY(-1px);
}
.oma-chat-send svg {
  width: 18px;
  height: 18px;
}

.oma-chat-foot {
  padding: 6px 14px 10px;
  font-size: 11px;
  color: var(--oma-chat-gray-3);
  background: #fff;
  text-align: center;
  border-top: 1px solid var(--oma-chat-gray-2);
}

/* ---- Mobile ------------------------------------------------------- */
@media (max-width: 540px) {
  #oma-chat-panel {
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  #oma-chat-bubble {
    right: 14px;
    bottom: 78px;
  }
}
