@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --aria-accent:       #4f8ef7;
  --aria-accent-dark:  #2563eb;
  --aria-accent-light: rgba(79,142,247,0.1);
  --aria-bg:           #ffffff;
  --aria-surface:      #f4f6fb;
  --aria-border:       #e2e8f0;
  --aria-text:         #1e293b;
  --aria-text-muted:   #94a3b8;
  --aria-radius:       18px;
  --aria-font:         'DM Sans', system-ui, sans-serif;
}

#aria-chat-root *, #aria-chat-root *::before, #aria-chat-root *::after { box-sizing:border-box; margin:0; padding:0; }
#aria-chat-root { font-family:var(--aria-font); position:fixed; z-index:999999; bottom:24px; }
#aria-chat-root.aria-pos-right { right:24px; }
#aria-chat-root.aria-pos-left  { left:24px; }

/* ── Toggle ── */
#aria-toggle {
  width:60px; height:60px; border-radius:50%; border:none; cursor:pointer;
  background:var(--aria-accent); color:#fff; font-size:24px;
  display:flex; align-items:center; justify-content:center;
  box-shadow:0 4px 20px rgba(79,142,247,.45);
  transition:transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
  position:relative;
}
#aria-toggle:hover { transform:scale(1.1); }
#aria-toggle:active { transform:scale(.95); }
#aria-toggle.aria-open { background:#64748b; box-shadow:0 4px 14px rgba(0,0,0,.2); }
@keyframes aria-pulse {
  0%   { box-shadow:0 0 0 0 rgba(79,142,247,.4),0 4px 20px rgba(79,142,247,.45); }
  70%  { box-shadow:0 0 0 13px rgba(79,142,247,0),0 4px 20px rgba(79,142,247,.45); }
  100% { box-shadow:0 0 0 0 rgba(79,142,247,0),0 4px 20px rgba(79,142,247,.45); }
}
#aria-toggle:not(.aria-open) { animation:aria-pulse 2.5s ease-out infinite; }
#aria-badge {
  position:absolute; top:-3px; right:-3px;
  background:#ef4444; color:#fff; font-size:10px; font-weight:700;
  width:19px; height:19px; border-radius:50%;
  display:flex; align-items:center; justify-content:center; border:2px solid #fff;
}
#aria-badge.aria-hidden { display:none; }

/* ── Window ── */
#aria-window {
  position:absolute; bottom:72px; width:370px; height:580px;
  background:var(--aria-bg); border-radius:var(--aria-radius);
  box-shadow:0 24px 60px rgba(0,0,0,.16), 0 4px 16px rgba(0,0,0,.08);
  border:1px solid var(--aria-border);
  display:flex; flex-direction:column; overflow:hidden;
  transform-origin:bottom center;
  transition:opacity .22s ease, transform .28s cubic-bezier(.34,1.56,.64,1);
}
#aria-window.aria-pos-right { right:0; }
#aria-window.aria-pos-left  { left:0; }
#aria-window.aria-hidden { opacity:0; transform:scale(.93) translateY(14px); pointer-events:none; }

/* ── Header ── */
#aria-header {
  position:relative; min-height:115px;
  padding:20px 18px 18px;
  display:flex; align-items:flex-end; gap:13px;
  flex-shrink:0; overflow:hidden; background:var(--aria-accent);
}
#aria-header-bg { position:absolute; inset:0; background-size:cover; background-position:center; z-index:0; }
#aria-header-overlay { position:absolute; inset:0; background:linear-gradient(to bottom,rgba(0,0,0,.1) 0%,rgba(0,0,0,.55) 100%); z-index:1; }
#aria-header-content { position:relative; z-index:2; display:flex; align-items:flex-end; gap:13px; width:100%; }
.aria-avatar {
  width:48px; height:48px; border-radius:50%;
  background:rgba(255,255,255,.2); display:flex; align-items:center; justify-content:center;
  font-size:20px; color:#fff; flex-shrink:0; border:2.5px solid rgba(255,255,255,.7); overflow:hidden;
}
.aria-avatar img { width:100%; height:100%; object-fit:cover; border-radius:50%; }
.aria-header-info { flex:1; }
.aria-header-name  { font-size:16px; font-weight:700; color:#fff; text-shadow:0 1px 4px rgba(0,0,0,.35); }
.aria-header-status { display:flex; align-items:center; gap:5px; margin-top:3px; font-size:12px; color:rgba(255,255,255,.88); }
.aria-dot { width:7px; height:7px; border-radius:50%; background:#4ade80; box-shadow:0 0 5px #4ade80; flex-shrink:0; }
#aria-close-btn {
  position:absolute; top:12px; right:12px; z-index:3;
  width:28px; height:28px; border-radius:8px; border:none;
  background:rgba(255,255,255,.2); color:#fff; font-size:14px; cursor:pointer;
  display:flex; align-items:center; justify-content:center; backdrop-filter:blur(4px);
  transition:background .15s;
}
#aria-close-btn:hover { background:rgba(255,255,255,.35); }

/* ── Messages ── */
#aria-messages {
  flex:1; overflow-y:auto; padding:18px 14px;
  display:flex; flex-direction:column; gap:14px;
  background:var(--aria-surface);
}
#aria-messages::-webkit-scrollbar { width:4px; }
#aria-messages::-webkit-scrollbar-thumb { background:var(--aria-border); border-radius:2px; }

.aria-row { display:flex; align-items:flex-end; gap:9px; animation:aria-fadein .22s ease; }
.aria-row.aria-user { flex-direction:row-reverse; }
@keyframes aria-fadein { from{opacity:0;transform:translateY(7px)} to{opacity:1;transform:translateY(0)} }

.aria-msg-avatar {
  width:32px; height:32px; border-radius:50%;
  background:var(--aria-accent-light); color:var(--aria-accent);
  font-size:14px; display:flex; align-items:center; justify-content:center;
  flex-shrink:0; overflow:hidden; border:1.5px solid var(--aria-border);
}
.aria-msg-avatar img { width:100%; height:100%; object-fit:cover; border-radius:50%; }
.aria-row.aria-user .aria-msg-avatar { background:#e2e8f0; color:#64748b; border-color:#e2e8f0; }

.aria-bubble-wrap { display:flex; flex-direction:column; max-width:76%; }
.aria-admin-label { font-size:10.5px; color:#059669; font-weight:600; margin-bottom:4px; padding-left:2px; }

/* ─── BULLES : padding généreux ─── */
.aria-bubble {
  padding: 12px 16px;
  font-size: 14.5px;
  line-height: 1.75;           /* ← interligne confortable */
  letter-spacing: 0.01em;
  font-family: var(--aria-font);
  word-break: break-word;
}
.aria-row.aria-bot .aria-bubble {
  background: var(--aria-bg);
  border: 1px solid var(--aria-border);
  border-radius: 18px 18px 18px 5px;
  color: var(--aria-text);
  box-shadow: 0 2px 14px rgba(0,0,0,.07);
}
.aria-row.aria-user .aria-bubble {
  background: var(--aria-accent);
  color: #fff;
  border-radius: 18px 18px 5px 18px;
  box-shadow: 0 2px 12px rgba(79,142,247,.35);
}
.aria-bubble-admin {
  background:#f0fdf4 !important;
  border:1px solid #bbf7d0 !important;
  color:#14532d !important;
  border-radius:18px 18px 18px 5px !important;
}

/* Typing */
.aria-typing {
  display:flex; align-items:center; gap:5px;
  padding:15px 22px;
  background:var(--aria-bg); border:1px solid var(--aria-border);
  border-radius:18px 18px 18px 5px; width:fit-content;
  box-shadow:0 2px 14px rgba(0,0,0,.07);
}
.aria-typing span {
  width:7px; height:7px; border-radius:50%;
  background:var(--aria-text-muted); display:block;
  animation:aria-bounce 1.2s ease-in-out infinite;
}
.aria-typing span:nth-child(2){animation-delay:.18s}
.aria-typing span:nth-child(3){animation-delay:.36s}
@keyframes aria-bounce{0%,80%,100%{transform:translateY(0);opacity:.4}40%{transform:translateY(-5px);opacity:1}}

/* System */
.aria-system { text-align:center; font-size:11.5px; color:var(--aria-text-muted); padding:2px 16px; font-style:italic; }

/* ── Choice buttons ── */
.aria-choices {
  display:flex; flex-direction:column; gap:9px;
  padding:4px 14px 4px 54px;
  animation:aria-fadein .25s ease;
}
.aria-choice-btn {
  width:100%; padding:10px 16px;
  border-radius:12px; border:1.5px solid var(--aria-border);
  background:var(--aria-bg); color:var(--aria-text);
  font-size:14px; font-family:var(--aria-font); font-weight:500;
  cursor:pointer; text-align:left;
  transition:all .18s; box-shadow:0 1px 4px rgba(0,0,0,.06);
}
.aria-choice-btn:hover { border-color:var(--aria-accent); background:var(--aria-accent-light); color:var(--aria-accent); transform:translateY(-1px); }
.aria-choice-primary { border-color:var(--aria-accent); color:var(--aria-accent); background:var(--aria-accent-light); }
.aria-choice-primary:hover { background:var(--aria-accent); color:#fff; }

/* ── Phone bar ── */
#aria-phone-bar {
  display:flex; gap:7px; padding:12px 14px;
  border-top:1px solid var(--aria-border); background:#fafbff;
  flex-shrink:0; align-items:center; animation:aria-fadein .2s ease;
}
#aria-phone-bar.aria-hidden { display:none; }
#aria-phone-input {
  flex:1; padding:11px 14px;
  border:1px solid var(--aria-border); border-radius:10px;
  font-size:14.5px; font-family:var(--aria-font); outline:none; color:var(--aria-text);
}
#aria-phone-input:focus { border-color:var(--aria-accent); }
#aria-phone-send {
  padding:11px 16px; background:var(--aria-accent); color:#fff;
  border:none; border-radius:10px; font-size:13.5px; font-weight:600;
  cursor:pointer; font-family:var(--aria-font); transition:background .15s;
}
#aria-phone-send:hover { background:var(--aria-accent-dark); }
#aria-phone-cancel {
  width:35px; height:35px; border:1px solid var(--aria-border);
  background:transparent; border-radius:10px; cursor:pointer;
  color:var(--aria-text-muted); font-size:14px;
  display:flex; align-items:center; justify-content:center;
}
#aria-phone-cancel:hover { background:#fee2e2; border-color:#fca5a5; color:#dc2626; }

/* ── Footer input ── */
#aria-footer {
  padding:13px 14px; border-top:1px solid var(--aria-border);
  background:var(--aria-bg); display:flex; gap:9px; align-items:flex-end; flex-shrink:0;
}
#aria-input {
  flex:1; min-height:44px; max-height:100px;
  padding:12px 16px; font-size:14.5px; font-family:var(--aria-font);
  color:var(--aria-text); background:var(--aria-surface);
  border:1px solid var(--aria-border); border-radius:12px;
  outline:none; resize:none; line-height:1.5; transition:border-color .18s;
  scrollbar-width:none;
}
#aria-input:focus { border-color:var(--aria-accent); background:#fff; }
#aria-input::placeholder { color:var(--aria-text-muted); }
#aria-send-btn {
  width:44px; height:44px; border-radius:12px; border:none;
  background:var(--aria-accent); color:#fff; cursor:pointer;
  display:flex; align-items:center; justify-content:center; flex-shrink:0;
  transition:background .18s,transform .18s,opacity .18s;
  box-shadow:0 2px 8px rgba(79,142,247,.35);
}
#aria-send-btn:hover  { background:var(--aria-accent-dark); transform:scale(1.05); }
#aria-send-btn:active { transform:scale(.93); }
#aria-send-btn:disabled { opacity:.4; cursor:default; transform:none; }

/* ── Branding ── */
#aria-branding {
  text-align:center; padding:5px 0 9px;
  font-size:10px; color:#cbd5e1; font-family:var(--aria-font);
  background:var(--aria-bg); flex-shrink:0; letter-spacing:.03em;
}

@media (max-width:420px) {
  #aria-window { width:calc(100vw - 20px); right:10px !important; left:10px !important; }
}

/* ── File button ── */
#aria-file-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--aria-border);
  background: var(--aria-surface);
  color: var(--aria-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, color .15s, border-color .15s;
}
#aria-file-btn:hover {
  background: var(--aria-accent-light);
  color: var(--aria-accent);
  border-color: var(--aria-accent);
}

/* ── Teaser bubble ── */
#aria-teaser {
  position: absolute;
  bottom: 70px;
  right: 0;
  background: #fff;
  color: var(--aria-text);
  padding: 12px 18px;
  border-radius: 20px 20px 4px 20px;
  font-size: 14px;
  font-family: var(--aria-font);
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid var(--aria-border);
  animation: aria-fadein .3s ease;
  transition: transform .15s, box-shadow .15s;
  max-width: 240px;
  white-space: normal;
}
#aria-teaser:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0,0,0,.2);
}
#aria-chat-root.aria-pos-left #aria-teaser {
  right: auto;
  left: 0;
  border-radius: 20px 20px 20px 4px;
}

/* ── File button ── */
#aria-file-btn {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 1px solid var(--aria-border);
  background: var(--aria-surface);
  color: var(--aria-text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: background .15s, color .15s, border-color .15s;
}
#aria-file-btn:hover {
  background: var(--aria-accent-light);
  color: var(--aria-accent);
  border-color: var(--aria-accent);
}
