/* Export desk chat widget — isolated styles, no Tailwind dependency. */

.jjc {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 70;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
}

/* Launch button ---------------------------------------------------------- */
.jjc-launch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #b8334a, #8f2338);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(184, 51, 74, 0.34);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.jjc-launch:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(184, 51, 74, 0.42);
}

.jjc-launch svg {
  width: 20px;
  height: 20px;
  flex: none;
}

.jjc-open .jjc-launch {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.9);
}

/* Panel ------------------------------------------------------------------ */
.jjc-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(384px, calc(100vw - 32px));
  max-height: min(76vh, 640px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 22px;
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.26);
  overflow: hidden;
  animation: jjc-rise 0.22s ease-out;
}

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

@keyframes jjc-rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.jjc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #0f172a, #1e2a45);
  color: #fff;
}

.jjc-head-title {
  margin: 0;
  font-family: "Outfit", sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.jjc-head-sub {
  margin: 4px 0 0;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.66);
}

.jjc-close {
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  flex: none;
}

.jjc-close:hover {
  background: rgba(255, 255, 255, 0.24);
}

/* Message log ------------------------------------------------------------ */
.jjc-log {
  flex: 1;
  min-height: 180px;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fbfaf8;
}

.jjc-msg {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.jjc-ai {
  align-self: flex-start;
  background: #fff;
  color: #1f2937;
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-bottom-left-radius: 5px;
}

.jjc-user {
  align-self: flex-end;
  background: #b8334a;
  color: #fff;
  border-bottom-right-radius: 5px;
}

.jjc-typing {
  color: #8a6a3f;
  font-style: italic;
}

.jjc-handoff {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #b8334a;
  text-decoration: underline;
}

/* Product cards ---------------------------------------------------------- */
.jjc-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
}

.jjc-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.16s ease, transform 0.16s ease;
}

.jjc-card:hover {
  border-color: rgba(184, 51, 74, 0.45);
  transform: translateY(-1px);
}

.jjc-card img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: #f1efec;
  flex: none;
}

.jjc-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.jjc-card-title {
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jjc-card-meta {
  font-size: 11px;
  color: #6b7280;
}

/* Quick replies ---------------------------------------------------------- */
/* Wrap instead of scrolling: every suggestion stays visible and the pills
   keep a clear gap, so borders never touch or get clipped at the panel edge. */
.jjc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 10px 14px 0;
  background: #fbfaf8;
}

.jjc-chip {
  flex: 0 0 auto;
  max-width: 100%;
  padding: 7px 11px;
  border: 1px solid rgba(184, 51, 74, 0.28);
  border-radius: 999px;
  background: #fff;
  color: #8f2338;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.jjc-chip:hover {
  background: #fdf2f4;
}

.jjc-chip:focus-visible {
  outline: 2px solid #b8334a;
  outline-offset: 2px;
}

/* Input ------------------------------------------------------------------ */
.jjc-form {
  display: flex;
  gap: 8px;
  padding: 12px 14px 6px;
  background: #fbfaf8;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.jjc-input {
  flex: 1;
  min-width: 0;
  padding: 10px 13px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  background: #fff;
  color: #0f172a;
}

.jjc-input:focus {
  outline: none;
  border-color: #b8334a;
  box-shadow: 0 0 0 3px rgba(184, 51, 74, 0.14);
}

.jjc-send {
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.jjc-send:hover {
  background: #1e2a45;
}

.jjc-note {
  margin: 0;
  padding: 0 14px 12px;
  background: #fbfaf8;
  font-size: 10px;
  color: #9ca3af;
}

/* Small screens ---------------------------------------------------------- */
@media (max-width: 480px) {
  .jjc {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }

  .jjc-launch {
    width: 100%;
    justify-content: center;
  }

  .jjc-panel {
    position: fixed;
    inset: auto 0 0 0;
    width: 100%;
    max-height: 84vh;
    border-radius: 20px 20px 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .jjc-panel,
  .jjc-launch,
  .jjc-card {
    animation: none;
    transition: none;
  }
}
