/* ── Site assistant (floating chat) ── */
.site-assistant-launcher {
  position: fixed;
  z-index: 55;
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  left: 1.25rem;
  animation: site-assistant-float 3.2s ease-in-out 1.1s infinite;
}

.site-assistant-fab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.75rem;
  height: 3.75rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: linear-gradient(145deg, var(--color-brand-hover) 0%, var(--color-brand) 55%, color-mix(in srgb, var(--color-brand) 80%, #1e293b) 100%);
  color: #fff;
  box-shadow:
    0 8px 28px rgba(var(--color-brand-rgb), 0.45),
    0 0 0 0 rgba(var(--color-brand-rgb), 0.35);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  animation:
    site-assistant-enter 0.5s ease 0.6s both,
    site-assistant-glow 2.4s ease-in-out infinite;
  overflow: visible;
}

.site-assistant-fab__rings {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.site-assistant-fab__ring {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px solid rgba(var(--color-brand-rgb), 0.45);
  animation: site-assistant-pulse 2.4s ease-out infinite;
}

.site-assistant-fab__ring--delay {
  animation-delay: 1.2s;
}

.site-assistant-fab:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow:
    0 14px 36px rgba(var(--color-brand-rgb), 0.5),
    0 0 24px rgba(var(--color-brand-rgb), 0.35);
}

.site-assistant-fab:hover .site-assistant-fab__tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

.site-assistant-fab__icon {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.site-assistant-fab__icon--chat svg {
  width: 1.55rem;
  height: 1.55rem;
  filter: drop-shadow(0 2px 6px rgba(15, 23, 42, 0.2));
  animation: site-assistant-icon-pop 2.8s ease-in-out infinite;
}

.site-assistant-fab__icon--close {
  display: none;
}

.site-assistant-fab__tooltip {
  position: absolute;
  right: calc(100% + 0.75rem);
  top: 50%;
  transform: translateX(8px) translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  background: #0f172a;
  color: #fff;
  line-height: 1.25;
  white-space: nowrap;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
}

.site-assistant-fab__tooltip::after {
  content: '';
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-left-color: #0f172a;
}

.site-assistant-fab__title {
  font-size: 0.8rem;
  font-weight: 800;
}

.site-assistant-fab__hint {
  font-size: 0.68rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.78);
}

.site-assistant-fab__online {
  position: absolute;
  top: 0.2rem;
  right: 0.2rem;
  z-index: 2;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
  background: #22c55e;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3);
  animation: site-assistant-online-blink 2s ease-in-out infinite;
}

.site-assistant-launcher.is-open .site-assistant-fab,
.site-assistant-fab.is-open {
  animation: none;
  background: #475569;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
}

.site-assistant-launcher.is-open,
.site-assistant-launcher:has(.site-assistant-fab.is-open) {
  animation: none;
}

.site-assistant-launcher.is-open .site-assistant-fab__rings,
.site-assistant-fab.is-open .site-assistant-fab__rings,
.site-assistant-launcher.is-open .site-assistant-fab__tooltip,
.site-assistant-fab.is-open .site-assistant-fab__tooltip,
.site-assistant-launcher.is-open .site-assistant-fab__online,
.site-assistant-fab.is-open .site-assistant-fab__online {
  display: none;
}

.site-assistant-launcher.is-open .site-assistant-fab__icon--chat,
.site-assistant-fab.is-open .site-assistant-fab__icon--chat {
  display: none;
}

.site-assistant-launcher.is-open .site-assistant-fab__icon--close,
.site-assistant-fab.is-open .site-assistant-fab__icon--close {
  display: inline-flex;
}

.site-assistant-launcher.is-open .site-assistant-fab__icon--close svg,
.site-assistant-fab.is-open .site-assistant-fab__icon--close svg {
  width: 1.5rem;
  height: 1.5rem;
  animation: none;
}

@keyframes site-assistant-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes site-assistant-float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

@keyframes site-assistant-glow {
  0%, 100% {
    box-shadow:
      0 8px 28px rgba(var(--color-brand-rgb), 0.45),
      0 0 0 0 rgba(var(--color-brand-rgb), 0.25);
  }
  50% {
    box-shadow:
      0 10px 32px rgba(var(--color-brand-rgb), 0.55),
      0 0 0 10px rgba(var(--color-brand-rgb), 0);
  }
}

@keyframes site-assistant-pulse {
  0% {
    transform: scale(1);
    opacity: 0.75;
  }
  70% {
    transform: scale(1.35);
    opacity: 0;
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

@keyframes site-assistant-icon-pop {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

@keyframes site-assistant-online-blink {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3);
  }
  50% {
    opacity: 0.75;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
  }
}

.site-assistant-fab__badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 4px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

.site-assistant-fab__badge.is-visible {
  display: inline-flex;
}

.site-assistant-panel {
  position: fixed;
  z-index: 56;
  bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px));
  left: 1rem;
  width: min(22rem, calc(100vw - 2rem));
  height: min(44rem, calc(100vh - 5.5rem));
  max-height: min(44rem, calc(100vh - 5.5rem));
  background: #fff;
  border: 1px solid #e8edf2;
  border-radius: 1.25rem;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.96);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
}

.site-assistant-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.site-assistant-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  background: linear-gradient(135deg, rgba(var(--color-brand-rgb), 0.1), #fff);
  border-bottom: 1px solid #eef2f6;
  flex-shrink: 0;
}

.site-assistant-head__avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: var(--color-brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.site-assistant-head__avatar svg {
  width: 1.15rem;
  height: 1.15rem;
}

.site-assistant-head__title {
  font-size: 0.9rem;
  font-weight: 800;
  color: #1a1a2e;
  line-height: 1.2;
}

.site-assistant-head__sub {
  font-size: 0.68rem;
  color: #64748b;
  margin-top: 2px;
}

.site-assistant-head__actions {
  margin-right: auto;
  display: flex;
  gap: 4px;
}

.site-assistant-icon-btn {
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 0.55rem;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.site-assistant-icon-btn:hover {
  background: #f1f5f9;
  color: #1a1a2e;
}

.site-assistant-icon-btn svg {
  width: 1rem;
  height: 1rem;
}

.site-assistant-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: #f8fafc;
}

.site-assistant-msg {
  max-width: 92%;
  padding: 0.6rem 0.75rem;
  border-radius: 0.9rem;
  font-size: 0.8rem;
  line-height: 1.65;
  word-break: break-word;
  white-space: pre-wrap;
}

.site-assistant-msg--bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e8edf2;
  color: #334155;
  border-bottom-right-radius: 0.25rem;
}

.site-assistant-msg--user {
  align-self: flex-end;
  background: var(--color-brand);
  color: #fff;
  border-bottom-left-radius: 0.25rem;
}

.site-assistant-links {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.site-assistant-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.55rem;
  border-radius: 0.75rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  text-decoration: none;
  color: #1a1a2e;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.site-assistant-link:hover {
  border-color: rgba(var(--color-brand-rgb), 0.45);
  background: rgba(var(--color-brand-rgb), 0.05);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(var(--color-brand-rgb), 0.12);
}

.site-assistant-link__icon {
  width: 2rem;
  height: 2rem;
  border-radius: 0.6rem;
  background: rgba(var(--color-brand-rgb), 0.1);
  color: var(--color-brand-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.site-assistant-link__icon svg {
  width: 1rem;
  height: 1rem;
}

.site-assistant-link__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: right;
}

.site-assistant-link__title {
  font-size: 0.74rem;
  font-weight: 800;
  color: #1a1a2e;
  line-height: 1.35;
}

.site-assistant-link__meta {
  font-size: 0.62rem;
  font-weight: 500;
  color: #94a3b8;
  direction: ltr;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-assistant-link__arrow {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.site-assistant-link__arrow svg {
  width: 0.8rem;
  height: 0.8rem;
}

.site-assistant-link:hover .site-assistant-link__arrow {
  background: var(--color-brand);
  color: #fff;
}

.site-assistant-msg--user .site-assistant-link {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: none;
}

.site-assistant-msg--user .site-assistant-link:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: none;
}

.site-assistant-msg--user .site-assistant-link__icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.site-assistant-msg--user .site-assistant-link__title {
  color: #fff;
}

.site-assistant-msg--user .site-assistant-link__meta {
  color: rgba(255, 255, 255, 0.75);
}

.site-assistant-msg--user .site-assistant-link__arrow {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.site-assistant-msg--user .site-assistant-link:hover .site-assistant-link__arrow {
  background: rgba(255, 255, 255, 0.32);
  color: #fff;
}

.site-assistant-msg--typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  min-height: 2rem;
}

.site-assistant-msg--typing span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #94a3b8;
  animation: site-assistant-dot 1.2s infinite ease-in-out;
}

.site-assistant-msg--typing span:nth-child(2) { animation-delay: 0.15s; }
.site-assistant-msg--typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes site-assistant-dot {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.site-assistant-discount {
  margin-top: 0.45rem;
  padding: 0.45rem 0.55rem;
  border-radius: 0.55rem;
  background: rgba(var(--color-brand-rgb), 0.08);
  border: 1px dashed rgba(var(--color-brand-rgb), 0.35);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-brand-dark);
  cursor: pointer;
  user-select: all;
}

.site-assistant-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0 0.85rem 0.55rem;
  background: #f8fafc;
  flex-shrink: 0;
}

.site-assistant-chip {
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.site-assistant-chip:hover {
  border-color: rgba(var(--color-brand-rgb), 0.4);
  color: var(--color-brand-dark);
  background: rgba(var(--color-brand-rgb), 0.04);
}

.site-assistant-composer {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  padding: 0.65rem 0.75rem;
  border-top: 1px solid #eef2f6;
  background: #fff;
  flex-shrink: 0;
}

.site-assistant-input {
  flex: 1;
  min-height: 2.35rem;
  max-height: 6rem;
  resize: none;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 0.5rem 0.65rem;
  font: inherit;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #1a1a2e;
  background: #f8fafc;
}

.site-assistant-input:focus {
  outline: none;
  border-color: rgba(var(--color-brand-rgb), 0.5);
  background: #fff;
}

.site-assistant-send {
  width: 2.35rem;
  height: 2.35rem;
  border: none;
  border-radius: 0.75rem;
  background: var(--color-brand);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.site-assistant-send:hover:not(:disabled) {
  background: var(--color-brand-hover);
}

.site-assistant-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.site-assistant-send svg {
  width: 1rem;
  height: 1rem;
}

@media (max-width: 1023px) {
  .site-assistant-launcher {
    bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px));
    left: 0.75rem;
  }

  .site-assistant-fab__tooltip {
    display: none;
  }

  .site-assistant-panel {
    bottom: calc(8.75rem + env(safe-area-inset-bottom, 0px));
    left: 0.75rem;
    width: calc(100vw - 1.5rem);
    height: min(40rem, calc(100vh - 8.5rem));
    max-height: min(40rem, calc(100vh - 8.5rem));
  }
}
