/* Website assistant widget, moved out of the old homepage.
   Its colours are mapped onto the v4 tokens here, so the widget's own rules stay as written. */
.chat-widget {
  --coral: var(--maroon);
  --coral-pale: var(--tint);
  --green: var(--maroon-deep);
  --cream: var(--soft);
  --cream-3: var(--line);
  --warm-gray: var(--muted);
  --warm-gray-lt: var(--muted);
  --border: var(--line);
  --white: #FFFFFF;
  --font: var(--sans);
}

/* ── CHATBOT WIDGET ────────────────────────── */
.chat-widget {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1rem;
  /* Container must not swallow clicks in its empty panel-area.
     Children that should receive clicks re-enable pointer-events. */
  pointer-events: none;
}

.chat-widget .chat-toggle { pointer-events: auto; }

.chat-toggle {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--red);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 28px rgba(125,29,48,.45);
  transition: transform .25s, box-shadow .25s;
  flex-shrink: 0;
  position: relative;
}

.chat-toggle:hover {
  transform: scale(1.07);
  box-shadow: 0 10px 36px rgba(125,29,48,.6);
}

.chat-toggle svg {
  width: 26px; height: 26px;
  fill: var(--white);
  transition: opacity .2s, transform .2s;
  position: absolute;
}

.chat-toggle .icon-chat  { opacity: 1;  transform: scale(1) rotate(0deg); }
.chat-toggle .icon-close { opacity: 0;  transform: scale(.6) rotate(-30deg); }

.chat-widget.open .chat-toggle .icon-chat  { opacity: 0;  transform: scale(.6) rotate(30deg); }
.chat-widget.open .chat-toggle .icon-close { opacity: 1;  transform: scale(1) rotate(0deg); }

.chat-notif {
  position: absolute;
  top: 2px; right: 2px;
  width: 14px; height: 14px;
  background: #E8453C;
  border-radius: 50%;
  border: 2px solid var(--cream);
  animation: pulse-notif 2s infinite;
}

@keyframes pulse-notif {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.18); }
}

.chat-panel {
  width: 370px;
  max-height: 560px;
  background: var(--white);
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 40px rgba(74,16,32,.15), 0 2px 8px rgba(0,0,0,.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(18px) scale(.96);
  pointer-events: none;
  transition: opacity .28s ease, transform .28s ease;
}

.chat-widget.open .chat-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.chat-head {
  background: var(--green);
  padding: 1.1rem 1.35rem;
  display: flex;
  align-items: center;
  gap: .85rem;
  flex-shrink: 0;
}

.chat-head-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--coral);
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  color: var(--white);
}

.chat-head-info { flex: 1; }

.chat-head-name {
  font-size: .92rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
}

.chat-head-status {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .72rem;
  color: rgba(255,255,255,.5);
  margin-top: .15rem;
}

.chat-head-status .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #D4A853;
  box-shadow: 0 0 5px rgba(107,203,139,.7);
  flex-shrink: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--cream-3); border-radius: 4px; }

.msg {
  display: flex;
  align-items: flex-end;
  gap: .5rem;
  max-width: 88%;
  animation: msg-in .22s ease;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg.bot  { align-self: flex-start; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }

.msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--coral);
  display: grid;
  place-items: center;
  font-size: .72rem;
  color: var(--white);
  font-weight: 800;
  flex-shrink: 0;
  margin-bottom: 2px;
}

.msg-bubble {
  padding: .65rem .9rem;
  border-radius: 16px;
  font-size: .855rem;
  line-height: 1.58;
}

.msg.bot .msg-bubble {
  background: var(--cream);
  color: #2D3748;
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
}

.msg.user .msg-bubble {
  background: var(--green);
  color: rgba(255,255,255,.9);
  border-bottom-right-radius: 4px;
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: .5rem;
  align-self: flex-start;
  animation: msg-in .22s ease;
}

.typing-dots {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  padding: .65rem .9rem;
  display: flex;
  gap: .3rem;
  align-items: center;
}

.typing-dots span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--warm-gray-lt);
  animation: typing-bounce .9s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: .15s; }
.typing-dots span:nth-child(3) { animation-delay: .3s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%            { transform: translateY(-6px); }
}

.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  padding: 0 1.1rem .75rem;
}

.qr-chip {
  background: var(--cream);
  border: 1.5px solid var(--border);
  color: var(--warm-gray);
  font-size: .76rem;
  font-weight: 600;
  padding: .38rem .8rem;
  border-radius: 20px;
  cursor: pointer;
  font-family: var(--font);
  transition: border-color .18s, color .18s, background .18s;
  white-space: nowrap;
}

.qr-chip:hover {
  border-color: var(--coral);
  color: var(--coral);
  background: var(--coral-pale);
}

.chat-input-row {
  padding: .85rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: .6rem;
  align-items: center;
  background: var(--white);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 22px;
  padding: .58rem 1rem;
  font-size: .875rem;
  font-family: var(--font);
  color: #2D3748;
  background: var(--cream);
  outline: none;
  transition: border-color .18s;
  resize: none;
}

.chat-input:focus { border-color: var(--coral); background: var(--white); }
.chat-input::placeholder { color: #C4BAB3; }

.chat-send {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--coral);
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(125,29,48,.3);
  transition: transform .18s, box-shadow .18s;
}

.chat-send:hover { transform: scale(1.08); box-shadow: 0 4px 16px rgba(125,29,48,.45); }
.chat-send svg { width: 16px; height: 16px; fill: var(--white); }@media (max-width: 420px) {
  .chat-widget { bottom: 1.1rem; right: 1.1rem; }
  .chat-panel { width: calc(100vw - 2.2rem); max-height: 500px; }
}
