/* ---------------------------------------------------------------
   RARE SIGHT — shop assistant

   Floating launcher bottom-right (the discount tab lives bottom-left,
   so the two never collide). Not a modal — no backdrop — so it never
   blocks the page the way the discount capture does.
   --------------------------------------------------------------- */

.chat { position: fixed; inset: auto; z-index: 2500; }
.chat[hidden] { display: none; }

/* --- launcher -------------------------------------------------------- */

.chat__bubble {
  position: fixed;
  right: 6px; bottom: 6px;
  z-index: 2501;
  width: 132px; height: 132px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.32));
}
.chat__bubble:focus-visible { outline: 2px solid #000000; outline-offset: 4px; }

/* The ship never sits still — it hovers on a slow, uneven loop (drift +
   a touch of roll) so it reads as flying in place rather than a static
   icon. Two mismatched durations keep the loop from feeling mechanical. */
.chat__bubble-ship {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  transform-origin: 50% 65%;
  animation: chatShipDrift 4.6s ease-in-out infinite, chatShipRoll 7.4s ease-in-out infinite;
  transition: transform 0.15s ease;
}
.chat__bubble:hover .chat__bubble-ship { transform: scale(1.05); animation-play-state: paused; }

@keyframes chatShipDrift {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -12px; }
}
@keyframes chatShipRoll {
  0%, 100% { rotate: -3deg; }
  50% { rotate: 3deg; }
}

/* --- panel -------------------------------------------------------------- */

.chat__panel {
  position: fixed;
  right: 18px; bottom: 148px;
  z-index: 2501;
  width: min(360px, calc(100vw - 36px));
  height: min(520px, 68vh);
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
  overflow: hidden;

  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.98);
  transform-origin: bottom right;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
}
.chat__panel.is-on {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s;
}

.chat__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  background: #000000;
  color: #ffffff;
  flex: 0 0 auto;
}
.chat__avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.chat__head-text { flex: 1 1 auto; min-width: 0; }
.chat__name { margin: 0; font-size: 13px; font-weight: 700; }
.chat__status {
  margin: 2px 0 0;
  display: flex; align-items: center; gap: 5px;
  font-size: 10.5px; color: rgba(255,255,255,0.68);
}
.chat__dot { width: 6px; height: 6px; border-radius: 50%; background: #5ff28c; flex: 0 0 auto; }

.chat__close {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  background: none; border: 0;
  color: #ffffff; font-size: 20px; line-height: 1;
  cursor: pointer; opacity: 0.75;
}
.chat__close:hover { opacity: 1; }
.chat__close:focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }

/* --- thread --------------------------------------------------------------- */

.chat__thread {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f6f6f6;
}

.chat__msg { display: flex; }
.chat__msg--user { justify-content: flex-end; }
.chat__msg--bot { justify-content: flex-start; }

.chat__bubble-text {
  max-width: 84%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 12.5px;
  line-height: 1.5;
}
.chat__msg--bot .chat__bubble-text { background: #ffffff; color: #111111; border: 1px solid #e6e6e6; border-bottom-left-radius: 3px; }
.chat__msg--user .chat__bubble-text { background: #000000; color: #ffffff; border-bottom-right-radius: 3px; }

.chat__typing { display: inline-flex; gap: 3px; padding: 2px 0; }
.chat__typing span {
  width: 5px; height: 5px; border-radius: 50%;
  background: #b3b3b3;
  animation: chatTyping 1.1s infinite ease-in-out;
}
.chat__typing span:nth-child(2) { animation-delay: 0.15s; }
.chat__typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatTyping { 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }

/* product rows the bot can show, built from real catalogue data */
.chat__pcard {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  margin-top: 6px;
  padding: 6px;
  background: #ffffff;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.chat__pcard:hover { border-color: #bbbbbb; }
.chat__pcard:focus-visible { outline: 2px solid #000000; outline-offset: 1px; }
.chat__pcard img { width: 38px; height: 38px; object-fit: contain; background: #f4f4f4; border-radius: 5px; flex: 0 0 auto; }
.chat__pcard-info { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.chat__pcard-info b { font-size: 11.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat__pcard-info span { font-size: 10.5px; color: #767676; }
.chat__pcard-info span s { color: #aaaaaa; margin-right: 4px; }

.chat__viewall {
  display: block;
  margin-top: 6px;
  padding: 8px 10px;
  width: 100%;
  background: none;
  border: 1px dashed #cccccc;
  border-radius: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.03em;
  color: #111111;
  cursor: pointer;
  text-align: center;
}
.chat__viewall:hover { border-color: #000000; }

/* --- quick chips ------------------------------------------------------------ */

.chat__quick {
  flex: 0 0 auto;
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 12px 0;
  background: #f6f6f6;
}
.chat__chip {
  padding: 6px 10px;
  background: #ffffff;
  border: 1px solid #dddddd;
  border-radius: 999px;
  font-size: 10.5px; font-weight: 700;
  color: #111111;
  cursor: pointer;
}
.chat__chip:hover { border-color: #000000; }

/* --- input ------------------------------------------------------------------- */

.chat__form {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: #ffffff;
  border-top: 1px solid #eeeeee;
}
.chat__form input {
  flex: 1 1 auto; min-width: 0;
  padding: 10px 12px;
  background: #f6f6f6;
  border: 1px solid #e6e6e6;
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
}
.chat__form input:focus-visible { outline: 2px solid #000000; outline-offset: 2px; }

.chat__send {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: #000000;
  color: #ffffff;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.chat__send svg { width: 15px; height: 15px; fill: currentColor; }
.chat__send:hover { background: #262626; }
.chat__send:focus-visible { outline: 2px solid #000000; outline-offset: 2px; }

@media (max-width: 460px) {
  .chat__bubble { right: 2px; bottom: 2px; width: 96px; height: 96px; }
  .chat__panel { right: 10px; bottom: 104px; width: calc(100vw - 20px); height: min(72vh, 560px); }
}

@media (prefers-reduced-motion: reduce) {
  .chat__panel { transition: none; }
  .chat__typing span { animation: none; }
  .chat__bubble-ship { animation: none; }
}
