/* EDAP Assistant — chat popup (matches the site: white surfaces, navy ink, indigo accent) */

/* Launcher */
.ec-fab {
  position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 90;
  display: inline-flex; align-items: center; gap: 0.5rem; height: 46px; padding: 0 1.15rem 0 1rem;
  background: var(--navy); color: #fff; border-radius: 999px; font-size: 0.875rem; font-weight: 500;
  box-shadow: 0 10px 28px -10px rgba(10,37,64,.55), 0 0 0 1px rgba(255,255,255,.06) inset;
  transition: transform .2s var(--ease), opacity .2s, background .15s;
}
.ec-fab:hover { background: var(--navy-2); transform: translateY(-1px); }
.ec-fab svg { width: 18px; height: 18px; }
.ec-fab.hidden { opacity: 0; pointer-events: none; transform: translateY(8px) scale(.96); }

/* Window */
.ec-win {
  position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 100;
  width: 400px; height: min(640px, calc(100vh - 3rem)); display: flex; flex-direction: column;
  background: #fff; border-radius: 16px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(10,37,64,.08), 0 30px 70px -20px rgba(10,37,64,.35);
  opacity: 0; visibility: hidden; transform: translateY(14px) scale(.97); transform-origin: bottom right;
  transition: opacity .22s, transform .26s var(--ease), visibility .22s;
}
.ec-win.on { opacity: 1; visibility: visible; transform: none; }

/* Header */
.ec-head { display: flex; align-items: center; gap: 0.7rem; padding: 0.85rem 0.75rem 0.85rem 1rem; border-bottom: 1px solid var(--line-2); }
.ec-title { flex: 1; min-width: 0; }
.ec-title strong { display: block; font-family: var(--display); font-size: 0.9375rem; font-weight: 500; color: var(--navy); }
.ec-title span { display: block; font-size: 0.75rem; color: var(--slate-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ec-icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; color: var(--slate-2); transition: background .15s, color .15s; }
.ec-icon-btn:hover { background: var(--bg-2); color: var(--navy); }
.ec-icon-btn svg { width: 18px; height: 18px; }

/* Avatar (EDAP logo) */
.ec-avatar { width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px var(--line); display: grid; place-items: center; flex-shrink: 0; overflow: hidden; }
.ec-avatar img { width: 72%; height: 72%; object-fit: contain; }
.ec-avatar--lg { width: 36px; height: 36px; }
.ec-avatar--xl { width: 48px; height: 48px; margin-bottom: 1rem; }

/* Body */
.ec-body { flex: 1; overflow-y: auto; padding: 1.25rem 1rem 1rem; display: flex; flex-direction: column; gap: 1rem; scroll-behavior: smooth; }

/* Welcome */
.ec-welcome { margin-top: auto; padding: 0.25rem 0.25rem 0; animation: ecIn .35s var(--ease); }
.ec-welcome h3 { font-size: 1.125rem; font-weight: 500; margin-bottom: 0.35rem; }
.ec-welcome > p { font-size: 0.875rem; color: var(--slate); line-height: 1.55; margin-bottom: 1.1rem; }
.ec-suggest { display: grid; border-radius: 12px; box-shadow: 0 0 0 1px var(--line); overflow: hidden; }
.ec-suggest button { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.8rem 0.95rem; text-align: left; font-size: 0.875rem; color: var(--navy); background: #fff; transition: background .15s; }
.ec-suggest button + button { border-top: 1px solid var(--line-2); }
.ec-suggest button:hover { background: var(--bg-2); }
.ec-suggest svg { width: 16px; height: 16px; color: var(--slate-2); flex-shrink: 0; transition: transform .2s var(--ease), color .15s; }
.ec-suggest button:hover svg { transform: translateX(2px); color: var(--accent); }

/* Messages */
.ec-msg { display: flex; gap: 0.55rem; align-items: flex-end; max-width: 92%; animation: ecIn .25s var(--ease); }
.ec-msg.user { align-self: flex-end; justify-content: flex-end; }
.ec-msg.bot { align-self: flex-start; align-items: flex-start; }
.ec-msg.bot .ec-avatar { margin-top: 2px; }
.ec-col { display: flex; flex-direction: column; min-width: 0; }
.ec-bubble { font-size: 0.875rem; line-height: 1.55; padding: 0.6rem 0.85rem; border-radius: 14px; overflow-wrap: anywhere; }
.ec-msg.bot .ec-bubble { background: var(--bg-2); color: var(--navy); border-top-left-radius: 4px; }
.ec-msg.user .ec-bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.ec-bubble p + p, .ec-bubble p + ul, .ec-bubble ul + p { margin-top: 0.5rem; }
.ec-bubble p { color: inherit; }
.ec-bubble ul { padding-left: 1.05rem; list-style: disc; }
.ec-bubble li { margin: 0.2rem 0; }
.ec-bubble li::marker { color: var(--accent); }
.ec-bubble a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.ec-bubble strong { font-weight: 600; color: inherit; }
@keyframes ecIn { from { opacity: 0; transform: translateY(6px); } }

/* Feedback */
.ec-fb { display: flex; align-items: center; gap: 0.1rem; margin-top: 0.3rem; font-size: 0.75rem; color: var(--slate-2); }
.ec-fb span { margin-right: 0.3rem; }
.ec-fb button { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; color: var(--muted); transition: background .15s, color .15s; }
.ec-fb button:hover { color: var(--navy); background: var(--bg-2); }
.ec-fb button.on { color: var(--accent); background: var(--accent-soft); }
.ec-fb svg { width: 14px; height: 14px; }

/* Typing */
.ec-dots { display: inline-flex; gap: 4px; padding: 0.85rem 0.9rem; }
.ec-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--slate-2); animation: ecDot 1.2s infinite; }
.ec-dots span:nth-child(2) { animation-delay: .15s; }
.ec-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes ecDot { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }

/* Input */
.ec-input { padding: 0.75rem 0.85rem 0.6rem; border-top: 1px solid var(--line-2); }
.ec-field { display: flex; align-items: flex-end; gap: 0.4rem; padding: 0.35rem 0.35rem 0.35rem 0.85rem; border-radius: 14px; background: #fff; box-shadow: 0 0 0 1px #DCE2EA; transition: box-shadow .15s; }
.ec-field:focus-within { box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px rgba(91,79,240,.14); }
.ec-field textarea {
  flex: 1; resize: none; border: 0; padding: 0.45rem 0; background: transparent; color: var(--navy);
  font-size: 0.875rem; line-height: 1.45; min-height: 34px; max-height: 120px; overflow-y: auto; scrollbar-width: thin;
}
.ec-field textarea:focus { outline: none; }
.ec-field textarea::placeholder { color: #A3ACB9; }
.ec-send { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; flex-shrink: 0; transition: background .15s, opacity .15s; }
.ec-send:hover:not(:disabled) { background: var(--accent-hover); }
.ec-send:disabled { background: var(--bg-3); color: var(--muted); cursor: default; }
.ec-send svg { width: 17px; height: 17px; }
.ec-foot { margin-top: 0.5rem; font-size: 0.6875rem; color: var(--slate-2); text-align: center; }
.ec-foot a { color: var(--accent); }

/* Rating sheet */
.ec-rate { position: absolute; inset: 0; z-index: 2; display: flex; align-items: flex-end; background: rgba(10,37,64,.28); opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s; }
.ec-rate.on { opacity: 1; visibility: visible; }
.ec-rate-sheet { width: 100%; padding: 1.5rem 1.25rem 1.25rem; background: #fff; border-radius: 16px 16px 0 0; text-align: center; transform: translateY(16px); transition: transform .28s var(--ease); }
.ec-rate.on .ec-rate-sheet { transform: none; }
.ec-rate-sheet strong { display: block; font-family: var(--display); font-size: 1.0625rem; font-weight: 500; color: var(--navy); }
.ec-rate-sheet p { font-size: 0.8125rem; color: var(--slate-2); margin: 0.3rem 0 1.1rem; }
.ec-rate-opts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.45rem; }
.ec-rate-opts button { padding: 0.6rem 0.25rem; border-radius: 10px; background: #fff; box-shadow: 0 0 0 1px var(--line); font-size: 0.8125rem; color: var(--navy); transition: box-shadow .15s, background .15s, color .15s; }
.ec-rate-opts button:hover { box-shadow: 0 0 0 1px var(--accent); color: var(--accent); }
.ec-rate-opts button.on { background: var(--accent); box-shadow: none; color: #fff; }
.ec-rate-skip { margin-top: 0.9rem; font-size: 0.8125rem; color: var(--slate-2); }
.ec-rate-skip:hover { color: var(--navy); text-decoration: underline; text-underline-offset: 2px; }

/* Phone: full screen */
@media (max-width: 600px) {
  .ec-fab { right: 1rem; bottom: 1rem; }
  .ec-win { right: 0; bottom: 0; width: 100%; height: 100%; max-height: none; border-radius: 0; box-shadow: none; transform-origin: bottom center; }
  .ec-input { padding-bottom: max(0.6rem, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .ec-win, .ec-fab, .ec-msg, .ec-welcome, .ec-rate, .ec-rate-sheet { transition: none; animation: none; }
}
