/* Elio, the Peques chat assistant: styles shared by every public page.
   Moved out of the pages on 28 October 2026 (approved by Margarita); the rules
   are unchanged. Colours and fonts come from each page's :root variables. */
/* ========================================================
   PEQUES AI CHAT WIDGET
======================================================== */
#pq-chat-toggle {
  position: fixed; bottom: 28px; right: 28px; z-index: 900;
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--sage-dark); color: #fff;
  border: none; cursor: pointer;
  box-shadow: 0 6px 28px rgba(159,184,122,0.55);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.22s ease, box-shadow 0.22s ease, opacity 0.4s ease;
  font-size: 1.45rem;
}
#pq-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 10px 36px rgba(159,184,122,0.65);
}
#pq-chat-toggle.open { background: var(--ink-mid); }

/* ── Chat tooltip bubble ── */
@keyframes tooltipFadeIn {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}
#pq-chat-tooltip {
  position: fixed;
  bottom: 36px;
  right: 98px;
  background: #fff;
  color: var(--ink);
  font-family: 'Raleway', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.5;
  padding: 10px 16px;
  border-radius: 20px 20px 4px 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.13);
  white-space: nowrap;
  z-index: 899;
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.4s ease, transform 0.35s ease;
  pointer-events: none;
  animation: tooltipFadeIn 0.6s ease 1.2s both;
}
#pq-chat-tooltip.hidden {
  opacity: 0;
  transform: translateX(10px);
  pointer-events: none;
  animation: none;
}
#pq-chat-tooltip::after {
  content: '';
  position: absolute;
  right: -8px;
  bottom: 10px;
  border-width: 6px 0 6px 8px;
  border-style: solid;
  border-color: transparent transparent transparent #fff;
}
.pq-chat-pulse {
  position: absolute; top: 2px; right: 2px;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--peach-dk);
  border: 2px solid var(--warm-white);
  animation: pqPulse 2.2s ease-in-out infinite;
}
@keyframes pqPulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.25); opacity: 0.7; }
}

#pq-chat-window {
  position: fixed; bottom: 100px; right: 28px; z-index: 900;
  width: 360px; max-height: 560px;
  background: var(--warm-white);
  border-radius: 20px;
  box-shadow: 0 24px 72px rgba(0,0,0,0.16), 0 4px 16px rgba(0,0,0,0.07);
  display: flex; flex-direction: column;
  overflow: hidden;
  transform: translateY(18px) scale(0.96);
  opacity: 0; pointer-events: none;
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), opacity 0.22s ease;
}
#pq-chat-window.open {
  transform: translateY(0) scale(1);
  opacity: 1; pointer-events: all;
}

.pq-chat-header {
  background: var(--ink);
  padding: 18px 20px 16px;
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
  position: relative;
}
.pq-chat-header::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--sage-dark), var(--peach-dk), var(--taupe));
}
.pq-chat-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1.5px solid rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; flex-shrink: 0;
}
.pq-chat-header-info { flex: 1; }
.pq-chat-header-name {
  font-size: 0.83rem; font-weight: 700; color: #fff; line-height: 1.2;
}
.pq-chat-header-status {
  font-size: 0.67rem; color: rgba(255,255,255,0.5); margin-top: 2px;
  display: flex; align-items: center; gap: 5px;
}
.pq-status-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--sage-mid);
}
.pq-chat-close {
  background: none; border: none; color: rgba(255,255,255,0.45);
  cursor: pointer; font-size: 1.1rem; padding: 4px;
  transition: color 0.18s ease;
}
.pq-chat-close:hover { color: #fff; }

.pq-chat-messages {
  flex: 1; overflow-y: auto; padding: 18px 16px;
  display: flex; flex-direction: column; gap: 14px;
  scroll-behavior: smooth;
}
.pq-chat-messages::-webkit-scrollbar { width: 4px; }
.pq-chat-messages::-webkit-scrollbar-track { background: transparent; }
.pq-chat-messages::-webkit-scrollbar-thumb { background: var(--taupe); border-radius: 4px; }

.pq-msg {
  display: flex; gap: 9px; align-items: flex-end;
  animation: pqFadeIn 0.28s ease;
}
@keyframes pqFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.pq-msg.user { flex-direction: row-reverse; }
.pq-msg-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
}
.pq-msg.bot .pq-msg-avatar  { background: transparent; }
.pq-msg.user .pq-msg-avatar { background: var(--taupe); color: var(--ink); }
.pq-msg-bubble {
  max-width: 82%; padding: 10px 14px;
  font-size: 0.87rem; line-height: 1.75; border-radius: 16px;
  letter-spacing: 0.01em; word-spacing: 0.04em;
}
.pq-msg.bot  .pq-msg-bubble {
  background: #fff; color: var(--ink);
  border-radius: 4px 16px 16px 16px;
  box-shadow: var(--sh-sm);
  font-weight: 400;
}
.pq-msg.bot .pq-msg-bubble a {
  color: #7A9A5A; text-decoration: underline;
  word-break: break-all; display: inline-block;
  margin: 2px 0;
}
.pq-msg.user .pq-msg-bubble {
  background: var(--sage-dark); color: #fff;
  border-radius: 16px 4px 16px 16px;
}
.pq-typing {
  display: flex; gap: 5px; padding: 12px 16px; align-items: center;
}
.pq-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--taupe-dark);
  animation: pqTyping 1.2s ease-in-out infinite;
}
.pq-typing span:nth-child(2) { animation-delay: 0.2s; }
.pq-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pqTyping {
  0%,60%,100% { transform: translateY(0);  opacity: 0.4; }
  30%          { transform: translateY(-5px); opacity: 1; }
}

.pq-quick-replies {
  padding: 0 16px 10px; display: flex; flex-wrap: wrap; gap: 7px;
}
.pq-qr {
  background: #fff; border: 1.5px solid var(--taupe);
  border-radius: 50px; padding: 6px 13px;
  font-size: 0.72rem; font-weight: 600; color: var(--ink-mid);
  cursor: pointer; transition: all 0.18s ease;
  font-family: 'Raleway', sans-serif;
}
.pq-qr:hover { background: var(--sage); border-color: var(--sage-mid); color: var(--ink); }

.pq-chat-footer {
  border-top: 1px solid var(--cream-3);
  padding: 12px 14px; display: flex; gap: 10px; align-items: center;
  flex-shrink: 0;
}
#pq-chat-input {
  flex: 1; border: 1.5px solid var(--taupe);
  border-radius: 50px; padding: 9px 16px;
  font-family: 'Raleway', sans-serif; font-size: 0.82rem;
  color: var(--ink); background: #fff; outline: none;
  transition: border-color 0.18s ease;
}
#pq-chat-input:focus { border-color: var(--sage-dark); }
#pq-chat-input::placeholder { color: var(--ink-lt); }
#pq-chat-send {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--sage-dark); border: none; cursor: pointer;
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 1rem; transition: background 0.18s ease, transform 0.18s ease;
  flex-shrink: 0;
}
#pq-chat-send:hover { background: #88a660; transform: scale(1.07); }
#pq-chat-send:disabled { background: var(--taupe); cursor: not-allowed; transform: none; }

.pq-chat-branding {
  text-align: center; padding: 6px 0 10px;
  font-size: 0.6rem; color: var(--ink-lt); letter-spacing: 0.06em;
  flex-shrink: 0;
}

/* ── Mobile: chat widget ── */
@media(max-width: 768px) {
  /* Elio button: lower position on mobile */
  #pq-chat-toggle { right: 20px; bottom: 24px; }

  /* Tooltip: beside Elio button, two lines, arrow pointing right */
  #pq-chat-tooltip {
    bottom: 26px;
    right: 90px;
    left: auto;
    width: 160px;
    white-space: normal;
    text-align: left;
    border-radius: 12px 12px 12px 4px;
    font-size: 0.78rem;
    line-height: 1.5;
    animation: tooltipFadeInMobile 0.6s ease 1.2s both;
  }
  #pq-chat-tooltip::after {
    right: -8px;
    bottom: 14px;
    top: auto;
    border-width: 6px 0 6px 8px;
    border-color: transparent transparent transparent #fff;
  }

  /* Elio mobile behaviour */
  #pq-chat-tooltip {
    display: none !important;
  }
  #pq-chat-toggle {
    bottom: 24px !important;
    right: 16px !important;
  }
  #pq-chat-window {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 85vh !important;
    max-height: 85vh !important;
    border-radius: 20px 20px 0 0 !important;
    box-shadow: 0 -4px 32px rgba(46,42,34,0.18) !important;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }
  #pq-chat-window.open {
    transform: translateY(0) !important;
  }
}

@keyframes tooltipFadeInMobile {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

@media(max-width: 420px) {
  #pq-chat-window { width: calc(100vw - 24px); right: 12px; bottom: 90px; }
  #pq-chat-toggle { right: 16px; bottom: 24px; }

  #pq-chat-tooltip {
    bottom: 26px;
    right: 86px;
    left: auto;
    width: 148px;
    white-space: normal;
    text-align: left;
    border-radius: 12px 12px 12px 4px;
    font-size: 0.75rem;
    line-height: 1.5;
  }
  #pq-chat-tooltip::after {
    right: -8px;
    bottom: 14px;
    top: auto;
    border-width: 6px 0 6px 8px;
    border-color: transparent transparent transparent #fff;
  }
}
