/* ══════════════════════════════════════════════════
   Woo AI Chat — v1.2
   ══════════════════════════════════════════════════ */

/* ── Widget inline ──────────────────────────────── */
.waichat-widget { margin: 16px 0; }

.waichat-input-wrap {
  display: flex;
  align-items: center;
  border: 2px solid #d0cfc9;
  border-radius: 14px;
  overflow: hidden;
  background: #f9f9f7;
  transition: border-color .2s;
}
.waichat-input-wrap:focus-within {
  border-color: #b0ada5;
}

/* Typewriter overlay */
.waichat-typewriter {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-family: "LesSavonnables", -apple-system, Arial, sans-serif;
  font-size: 16px;
  color: #94a3b8;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  z-index: 1;
}
.waichat-typewriter.hidden,
.waichat-widget.has-value .waichat-typewriter { display: none; }

.waichat-widget { position: relative; }

.waichat-input {
  flex: 1;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  padding: 13px 18px !important;
  font-family: "LesSavonnables", -apple-system, Arial, sans-serif !important;
  font-size: 16px !important;
  color: #3f3f3f !important;
  box-shadow: none !important;
  position: relative;
  z-index: 2;
}
.waichat-input::placeholder { color: transparent; }


.waichat-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: radial-gradient(ellipse at left bottom, #5ac9f7, transparent 70%),
              radial-gradient(ellipse at top left, #fbb020, transparent 100%),
              radial-gradient(ellipse at bottom right, #d79dff, transparent 100%),
              #fe3466 !important;
  color: #fff !important;
  border: none !important;
  border-radius: 12px !important;
  padding: 10px 20px !important;
  margin: 4px !important;
  font-family: "LesSavonnablesBold", -apple-system, Arial, sans-serif !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  letter-spacing: .03em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity .2s, transform .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.waichat-btn:hover  { opacity: .88; transform: scale(1.025); }
.waichat-btn:active { transform: scale(.97); }
.waichat-btn svg    { flex-shrink: 0; }

/* ── Overlay ────────────────────────────────────── */
.waichat-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.52);
  z-index: 99998;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.waichat-overlay.active { display: block; }

/* ── Modal — mobile (slide depuis le bas) ───────── */
/* ── Modal — BASE (caché par défaut) ────────────── */
/* ── Modal (injectée dans <body> via wp_footer) ─── */
.waichat-modal {
  display: none !important;
  position: fixed !important;
  bottom: 0;
  left: 0;
  right: 0;
  top: auto;
  z-index: 99999 !important;
  background: #ffffff;
  border-radius: 24px 24px 0 0;
  max-height: 85vh;
  overflow: hidden;
  box-shadow: 0 -8px 50px rgba(0,0,0,.18);
  font-family: "LesSavonnables", -apple-system, Arial, sans-serif;
  flex-direction: column;
  width: 100%;
  box-sizing: border-box;
}
.waichat-modal.active {
  display: flex !important;
  animation: waichat-slide-up .3s cubic-bezier(.22,.61,.36,1);
}
@keyframes waichat-slide-up {
  from { transform: translateY(70px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
/* ── Modal — desktop (centrée) ──────────────────── */
@media (min-width: 768px) {
  .waichat-modal {
    bottom: auto;
    top: 50%;
    left: 50%;
    right: auto;
    transform: translate(-50%, -50%);
    width: 540px;
    max-width: 92vw;
    border-radius: 22px;
    max-height: 82vh;
  }
  .waichat-modal.active {
    animation: waichat-pop-in .3s cubic-bezier(.22,.61,.36,1);
  }
  @keyframes waichat-pop-in {
    from { transform: translate(-50%, -46%); opacity: 0; }
    to   { transform: translate(-50%, -50%); opacity: 1; }
  }
}

/* ── Header produit ─────────────────────────────── */
.waichat-product-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(0,0,0,.07);
  background: #fff;
  flex-shrink: 0;
  position: relative;
}

.waichat-product-img-wrap {
  width: 56px; height: 56px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  background: #f0ede8;
  border: 1px solid rgba(0,0,0,.06);
}
.waichat-product-img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

.waichat-product-info   { flex: 1; min-width: 0; }

.waichat-product-title {
  font-family: "LesSavonnablesBold", -apple-system, Arial, sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 5px;
  line-height: 1.3;
}

.waichat-product-price {
  display: flex;
  align-items: baseline;
  gap: 7px;
}
.waichat-price-regular {
  font-size: 14px;
  color: #555;
  font-weight: 500;
}
.waichat-product-price.has-sale .waichat-price-regular {
  text-decoration: line-through;
  color: rgba(0,0,0,.35);
  font-size: 13px;
}
.waichat-price-sale {
  font-family: "LesSavonnablesBold", -apple-system, Arial, sans-serif;
  font-size: 15px;
  color: #d0021b;
  font-weight: 700;
}

/* Fermer — sticky dans le header, toujours visible */
.waichat-close {
  position: sticky;
  top: 0;
  right: 0;
  align-self: flex-start;
  background: rgba(240,237,232,.95);
  border: none;
  border-radius: 50%;
  width: 32px; height: 32px;
  min-width: 32px;
  font-size: 17px;
  cursor: pointer;
  color: #555;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, color .2s;
  line-height: 1;
  flex-shrink: 0;
  z-index: 10;
  margin-left: auto;
}
.waichat-close:hover { background: #e2ddd6; color: #1a1a1a; }

/* ── Zone de conversation (scrollable) ──────────── */
.waichat-conversation {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

/* ── Bulle QUESTION (droite, style user) ─────────── */
.waichat-bubble-question {
  align-self: flex-end;
  background: #faf0e9;
  color: #000;
  border-radius: 18px 18px 4px 18px;
  padding: 11px 16px;
  font-size: 15px;
  font-family: "LesSavonnablesBold", -apple-system, Arial, sans-serif;
  font-weight: 600;
  max-width: 82%;
  line-height: 1.45;
  word-break: break-word;
}

/* ── Bulle RÉPONSE (gauche, style assistant) ─────── */
.waichat-answer-wrap {
  align-self: flex-start;
  background: #f5f4f2;
  border-radius: 4px 18px 18px 18px;
  padding: 14px 16px;
  max-width: 92%;
  width: 100%;
  box-sizing: border-box;
}

.waichat-answer-text {
  font-size: 15px;
  line-height: 1.68;
  color: #2a2a2a;
}
/* Rendu markdown basique */
.waichat-answer-text strong { font-family: "LesSavonnablesBold", -apple-system, Arial, sans-serif; font-weight: 700; }
.waichat-answer-text em { font-style: italic; }

/* ── Loader (3 points animés) ────────────────────── */
.waichat-loader {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 2px;
  min-height: 28px;
}
.waichat-loader span {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #aaa;
  animation: waichat-bounce .9s ease-in-out infinite;
  flex-shrink: 0;
}
.waichat-loader span:nth-child(1) { animation-delay: 0s; }
.waichat-loader span:nth-child(2) { animation-delay: .18s; }
.waichat-loader span:nth-child(3) { animation-delay: .36s; }
@keyframes waichat-bounce {
  0%, 60%, 100% { transform: translateY(0);   background: #ccc; }
  30%            { transform: translateY(-7px); background: #888; }
}

/* ── Feedback ────────────────────────────────────── */
.waichat-feedback {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-top: 1px solid rgba(0,0,0,.07);
  font-size: 13px;
  color: rgba(0,0,0,.45);
  flex-wrap: wrap;
  flex-shrink: 0;
  background: #fff;
}
.waichat-feedback p { margin: 0; }
.waichat-thumb {
  background: #fff;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 17px;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .15s;
  line-height: 1;
}
.waichat-thumb:hover  { border-color: #02a783; background: rgba(2,167,131,.08); transform: scale(1.1); }
.waichat-thumb.voted  { border-color: #02a783; background: rgba(2,167,131,.12); }

/* ── Follow-up ───────────────────────────────────── */
.waichat-followup {
  padding: 10px 14px 8px;
  border-top: 1px solid rgba(0,0,0,.06);
  flex-shrink: 0;
  background: #fff;
}
.waichat-followup-wrap {
  border-color: #d0cfc9 !important;
  border-radius: 14px !important;
  background: #f9f9f7 !important;
}
.waichat-followup-wrap .waichat-btn {
  padding: 9px 16px !important;
  font-size: 12px !important;
}

/* ── Mobile fine-tuning ──────────────────────────── */
@media (max-width: 480px) {
  .waichat-product-header { padding: 16px 16px; }
  .waichat-conversation   { padding: 16px 14px 8px; }
  .waichat-btn            { padding: 9px 14px !important; font-size: 12px !important; }
}
