/* Site assistant widget (templates/partials/assistant-widget.twig,
   public/assets/assistant-widget.js). Friendly pastel style matching the
   homepage banner: navy text, teal accents, coral highlights. */

.la-widget {
  --la-ink: #1A1F36;
  --la-muted: #5B6481;
  --la-teal: #0E8F8A;
  --la-teal-dark: #0E7C86;
  --la-coral: #F25C54;
  --la-bot: #E8F2FF;
  --la-user: #E2F7EC;
  --la-line: #E3E9F4;
  --la-shadow: 0 18px 50px rgba(36, 64, 128, 0.18), 0 4px 14px rgba(36, 64, 128, 0.08);
  --la-gap: 24px;
  --la-lift: 0px;            /* raised above the cookie bar / rating popup (JS) */
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--la-ink);
}

/* ---------- launcher ---------- */
.la-launcher {
  position: fixed;
  right: var(--la-gap);
  bottom: calc(var(--la-gap) + var(--la-lift));
  z-index: 120;
  width: 76px;
  height: 76px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 8px 16px rgba(36, 64, 128, 0.22));
  transition: transform 0.2s ease, filter 0.2s ease, bottom 0.25s ease, opacity 0.2s ease;
}

.la-launcher[hidden] {
  display: none;
}

.la-launcher img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.la-launcher:hover {
  transform: scale(1.06);
  filter: drop-shadow(0 12px 22px rgba(36, 64, 128, 0.3));
}

.la-launcher:focus-visible,
.la-widget button:focus-visible,
.la-widget a:focus-visible {
  outline: 3px solid #2F80ED;
  outline-offset: 3px;
}

.la-launcher.is-intro {
  animation: la-launcher-in 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.2) both, la-pulse 1.6s 0.7s ease-out 1;
}

@keyframes la-launcher-in {
  from { opacity: 0; transform: translateY(16px) scale(0.7); }
  to { opacity: 1; transform: none; }
}

@keyframes la-pulse {
  0% { filter: drop-shadow(0 0 0 rgba(47, 128, 237, 0.55)); }
  50% { filter: drop-shadow(0 0 14px rgba(47, 128, 237, 0.55)); }
  100% { filter: drop-shadow(0 8px 16px rgba(36, 64, 128, 0.22)); }
}

/* Closed launcher breathes softly - a fading ring and a slight swell -
   so it reads as alive without nagging (2026-10-01). Stops while the
   panel is open, on hover and with reduced motion. */
.la-widget:not(.is-open) .la-launcher::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  animation: la-ring 2.8s ease-out 1.5s infinite;
}

.la-widget:not(.is-open) .la-launcher img {
  animation: la-breathe 2.8s ease-in-out 1.5s infinite;
}

.la-launcher:hover::before,
.la-launcher:hover img {
  animation-play-state: paused;
}

@keyframes la-ring {
  0% { box-shadow: 0 0 0 0 rgba(47, 128, 237, 0.42); }
  70% { box-shadow: 0 0 0 14px rgba(47, 128, 237, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 128, 237, 0); }
}

@keyframes la-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

/* ---------- panel ---------- */
.la-panel {
  position: fixed;
  right: var(--la-gap);
  bottom: calc(var(--la-gap) + 76px + 14px + var(--la-lift));
  z-index: 121;
  display: flex;
  flex-direction: column;
  width: 400px;
  max-height: min(720px, calc(100vh - 32px - 90px - var(--la-lift)));
  border-radius: 30px;
  background: #FBFDFF;
  box-shadow: var(--la-shadow);
  overflow: hidden;
  transform-origin: 100% 100%;
}

.la-panel[hidden] {
  display: none;
}

.la-panel.is-opening {
  animation: la-panel-in 0.26s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes la-panel-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* header with pastel blobs */
.la-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 16px 18px 20px;
  background: linear-gradient(135deg, #EEF6FF 0%, #F4F9FF 60%, #FFF6EE 100%);
  overflow: hidden;
  flex-shrink: 0;
}

.la-header::before,
.la-header::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.la-header::before {
  width: 150px;
  height: 120px;
  left: -40px;
  top: -60px;
  background: rgba(186, 216, 255, 0.45);
}

.la-header::after {
  width: 170px;
  height: 130px;
  right: -50px;
  bottom: -80px;
  background: rgba(202, 236, 226, 0.6);
}

.la-header > * {
  position: relative;
  z-index: 1;
}

.la-header-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 4px 12px rgba(36, 64, 128, 0.15);
  flex-shrink: 0;
}

.la-header-text {
  flex: 1;
  min-width: 0;
}

.la-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 900;
  line-height: 1.2;
  color: var(--la-ink);
}

.la-status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 4px 0 0;
  color: var(--la-muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.la-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22C55E;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.la-close {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
  color: var(--la-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  align-self: flex-start;
}

.la-close:hover {
  background: #fff;
  color: var(--la-ink);
}

/* ---------- messages ---------- */
.la-body {
  flex: 1 1 auto;
  min-height: 140px;
  padding: 18px 16px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fff;
  border-radius: 24px 24px 0 0;
  margin-top: -10px;
  position: relative;
  z-index: 1;
}

.la-body:focus-visible {
  outline: 2px solid #BFD7FF;
  outline-offset: -4px;
}

.la-msg {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  animation: la-msg-in 0.22s ease both;
}

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

.la-msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(36, 64, 128, 0.12);
}

.la-msg-col {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  min-width: 0;
}

.la-bubble {
  padding: 11px 15px;
  border-radius: 20px;
  font-size: 0.95rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.la-msg-bot .la-bubble {
  background: var(--la-bot);
  border-top-left-radius: 8px;
}

.la-msg-user {
  justify-content: flex-end;
}

.la-msg-user .la-msg-col {
  align-items: flex-end;
}

.la-msg-user .la-bubble {
  background: var(--la-user);
  border-top-right-radius: 8px;
}

.la-bubble p {
  margin: 0;
}

.la-bubble p + p,
.la-bubble p + .la-links {
  margin-top: 8px;
}

.la-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.la-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  color: #1D4ED8;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease;
}

.la-links a::after {
  content: "→";
  margin-left: auto;
  color: var(--la-teal);
}

.la-links a:hover {
  background: #fff;
  transform: translateX(2px);
}

/* "Найти тему": every topic hub of the site as small pills */
.la-msg-col.la-msg-wide {
  width: 88%;
  max-width: 88%;
}

.la-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.la-topics a {
  display: inline-block;
  padding: 6px 11px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #D3E5FF;
  color: var(--la-ink);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.la-topics a:hover {
  background: var(--la-teal);
  border-color: var(--la-teal);
  color: #fff;
}

.la-time {
  margin-top: 4px;
  padding: 0 6px;
  color: #8A93AD;
  font-size: 0.75rem;
}

.la-msg-user .la-time::after {
  content: " ✓✓";
  color: #2F80ED;
  letter-spacing: -2px;
}

.la-typing .la-bubble {
  display: inline-flex;
  gap: 4px;
  padding: 14px 16px;
}

.la-typing .la-bubble span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8AA6D6;
  animation: la-dot 1s infinite ease-in-out;
}

.la-typing .la-bubble span:nth-child(2) { animation-delay: 0.15s; }
.la-typing .la-bubble span:nth-child(3) { animation-delay: 0.3s; }

@keyframes la-dot {
  0%, 80%, 100% { opacity: 0.35; transform: none; }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* ---------- quick actions ---------- */
.la-quick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 14px 4px;
  background: #fff;
  flex-shrink: 0;
}

.la-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 18px;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--la-ink);
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.la-chip svg {
  flex-shrink: 0;
}

.la-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(36, 64, 128, 0.1);
}

.la-chip-blue { background: #EAF3FF; border-color: #D3E5FF; }
.la-chip-mint { background: #E5F7F0; border-color: #CDEFE2; }
.la-chip-yellow { background: #FFF5DC; border-color: #FBE7B5; }
.la-chip-pink { background: #FDEBF2; border-color: #F8D3E2; }

/* ---------- input ---------- */
.la-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 14px;
  background: #fff;
  flex-shrink: 0;
}

.la-field {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  height: 52px;
  padding: 0 18px;
  border: 1px solid var(--la-line);
  border-radius: 26px;
  background: #F7FAFF;
  box-shadow: inset 0 1px 2px rgba(36, 64, 128, 0.05);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.la-field:focus-within {
  border-color: #9EC3FF;
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.15);
  background: #fff;
}

.la-field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 1rem;
  color: var(--la-ink);
  outline: none;
}

.la-field input::placeholder {
  color: #8A93AD;
}

.la-send {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #17A9A3, var(--la-teal-dark));
  box-shadow: 0 8px 18px rgba(14, 124, 134, 0.35);
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.la-send:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 22px rgba(14, 124, 134, 0.42);
}

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .la-panel {
    width: 360px;
  }
}

@media (max-width: 600px) {
  .la-widget {
    --la-gap: 16px;
  }

  .la-launcher {
    width: 66px;
    height: 66px;
  }

  .la-panel {
    left: 12px;
    right: 12px;
    bottom: calc(12px + var(--la-lift));
    width: auto;
    height: min(78vh, calc(100vh - 24px - var(--la-lift)));
    height: min(78dvh, calc(100dvh - 24px - var(--la-lift)));
    max-height: none;
    border-radius: 26px;
  }

  /* on phones the open panel covers the launcher corner */
  .la-widget.is-open .la-launcher {
    opacity: 0;
    pointer-events: none;
  }

  .la-chip {
    min-height: 48px;
    font-size: 0.84rem;
  }

  .la-title {
    font-size: 1rem;
  }

  .la-header-avatar {
    width: 48px;
    height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .la-launcher,
  .la-launcher.is-intro,
  .la-launcher::before,
  .la-launcher img,
  .la-panel.is-opening,
  .la-msg,
  .la-typing .la-bubble span {
    animation: none !important;
    transition: none !important;
  }
}

@media print {
  .la-widget {
    display: none !important;
  }
}
