/* LuspadaChat Widget — Zipchat-inspired */

:root {
  --lc-color: #000000;
  --lc-wild-sand: #f5f5f4;
  --lc-cod-gray: #1a1a1a;
  --lc-radius: 24px;
  --lc-shadow: rgba(0,0,0,0.02) 0 6px 6px 0, rgba(0,0,0,0.12) 0 8px 24px 0;
}

/* ── Bubble ──────────────────────────────────────────────────── */
#luspada-chat-bubble {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--lc-color);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  transition: transform 0.2s ease;
  border: none;
  outline: none;
}

#luspada-chat-bubble:hover {
  transform: scale(1.06);
}

#luspada-chat-bubble svg {
  width: 28px;
  height: 28px;
  fill: #fff;
  pointer-events: none;
}

#luspada-chat-bubble .lc-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── Panel ───────────────────────────────────────────────────── */
#luspada-chat-panel {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 400px;
  height: min(704px, calc(100% - 104px));
  background: #fff;
  border-radius: var(--lc-radius);
  box-shadow: var(--lc-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999;
  opacity: 0;
  transform: scale(0.97);
  transform-origin: right bottom;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0, 1.2, 1, 1), opacity 0.2s ease-out;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--lc-cod-gray);
}

#luspada-chat-panel.open {
  opacity: 1;
  transform: scale(1);
  pointer-events: all;
}

/* Prevent flash on page load — panel starts invisible, JS adds .lc-ready after init */
#luspada-chat-panel:not(.lc-ready) {
  transition: none !important;
}


/* ── Header (minimal, no colored bar) ───────────────────────── */
.lc-header {
  display: flex;
  justify-content: flex-end;
  padding: 12px 16px 0;
  flex-shrink: 0;
}

.lc-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: #999;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.15s;
}

.lc-close-btn:hover {
  color: #000;
}

.lc-close-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

/* Hide old header parts that might still render */
.lc-header-avatar, .lc-header-info, .lc-header-name, .lc-header-status {
  display: none;
}

/* ── Messages ────────────────────────────────────────────────── */
.lc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.lc-messages::-webkit-scrollbar {
  display: none;
}

/* Bot message — avatar + bubble, with meta below */
.lc-msg-bot {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  margin-left: 16px;
  margin-right: 64px;
  animation: lc-fade-in 0.18s ease;
}

.lc-msg-bot::before {
  content: 'A';
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--lc-color);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lc-msg-bot .lc-msg-bubble {
  background: var(--lc-wild-sand);
  color: #000;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
  max-width: calc(100% - 40px);
  min-width: 0;
}

.lc-msg-bot .lc-msg-bubble p {
  margin: 0;
}

.lc-msg-bot .lc-msg-bubble p + p {
  margin-top: 10px;
}

.lc-msg-bot .lc-msg-bubble strong {
  font-weight: 700;
}

.lc-msg-bot .lc-msg-bubble em {
  font-style: italic;
}

.lc-msg-bot .lc-msg-bubble ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.lc-msg-bot .lc-msg-bubble li {
  margin: 2px 0;
}

.lc-msg-bot .lc-msg-bubble a {
  color: #000;
  text-decoration: underline;
  font-weight: 500;
}

/* User message — black bubble, right-aligned */
.lc-msg-user {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: 64px;
  margin-right: 16px;
  animation: lc-fade-in 0.18s ease;
}

.lc-msg-user .lc-msg-bubble {
  background: var(--lc-color);
  color: #fff;
  border-radius: 18px;
  padding: 10px 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  max-width: 85%;
}

@keyframes lc-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Bot message meta (label + thumbs + disclaimer) ─────────── */
.lc-msg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  padding-left: 40px;
  font-size: 12px;
  color: #999;
  width: 100%;
}

.lc-msg-label {
  font-weight: 500;
  color: #888;
}

.lc-msg-thumbs {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.lc-thumb {
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px;
  color: #ccc;
  display: flex;
  align-items: center;
  border-radius: 4px;
  transition: color 0.15s;
}

.lc-thumb:hover {
  color: #888;
}

.lc-thumb-active {
  color: var(--lc-color) !important;
}

/* ── Message timestamp ───────────────────────────────────────── */
.lc-msg-time {
  font-size: 11px;
  color: #bbb;
  margin-top: 3px;
  width: 100%;
}

.lc-msg-user .lc-msg-time {
  text-align: right;
}

/* ── Disclaimer (per-message, below bot meta) ───────────────── */
.lc-msg-bot .lc-disclaimer {
  text-align: center;
  font-size: 11px;
  color: #bbb;
  padding: 4px 0 0;
  width: 100%;
  line-height: 1.4;
}

/* ── Typing indicator ────────────────────────────────────────── */
.lc-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
  background: var(--lc-wild-sand);
  border-radius: 12px;
  width: fit-content;
  margin-left: 56px;
  animation: lc-fade-in 0.18s ease;
}

.lc-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9ca3af;
  animation: lc-bounce 1.2s infinite ease-in-out;
}

.lc-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.lc-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes lc-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-6px); }
}

/* ── Quick replies (Zipchat-style: gray pills, centered, vertical) ─ */
.lc-quick-replies {
  padding: 0 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.lc-quick-reply {
  background: var(--lc-wild-sand);
  border: none;
  color: var(--lc-cod-gray);
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: background 0.15s;
}

.lc-quick-reply:hover {
  background: #ebebe8;
}

/* ── Product cards (Zipchat-style: vertical, image on top) ──── */
.lc-product-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: calc(100% - 32px);
  margin: 0 16px;
}

.lc-product-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.15s;
  cursor: pointer;
}

.lc-product-card:hover {
  border-color: var(--lc-color);
  transform: translateY(-2px);
}

.lc-product-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--lc-wild-sand);
  display: block;
}

.lc-product-card-info {
  padding: 10px 12px 12px;
}

.lc-product-card-title {
  font-size: 13px;
  font-weight: 500;
  color: #111;
  line-height: 1.4;
  word-wrap: break-word;
}

.lc-product-card-price {
  display: none;
}

/* ── Disclaimer ──────────────────────────────────────────────── */
.lc-disclaimer {
  text-align: center;
  font-size: 11px;
  color: #9ca3af;
  padding: 4px 16px 8px;
  flex-shrink: 0;
  line-height: 1.4;
}

/* ── Input area (Zipchat-style: big, top-shadow, no border) ── */
.lc-input-area {
  padding: 20px 20px 28px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: #fff;
  border-top: none;
  border-top-left-radius: var(--lc-radius);
  border-top-right-radius: var(--lc-radius);
  box-shadow: -4px -4px 10px rgba(0,0,0,0.08);
  flex-shrink: 0;
  position: relative;
}

.lc-input {
  flex: 1;
  border: none;
  border-radius: 0;
  padding: 8px 0;
  font-size: 15px;
  line-height: 1.4;
  outline: none !important;
  box-shadow: none !important;
  resize: none;
  font-family: inherit;
  color: var(--lc-cod-gray);
  background: transparent;
  max-height: 120px;
  min-height: 24px;
  overflow-y: auto;
  scrollbar-width: none;
  -webkit-appearance: none;
  appearance: none;
}

.lc-input:focus,
.lc-input:focus-visible,
.lc-input:active {
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
}

.lc-input::-webkit-scrollbar {
  display: none;
}

.lc-input::placeholder {
  color: #9ca3af;
  font-size: 15px;
}

.lc-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--lc-color);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.15s;
}

.lc-send:hover {
  opacity: 0.85;
}

.lc-send:active {
  transform: scale(0.92);
}

.lc-send:disabled {
  background: #e5e5e5;
  cursor: not-allowed;
  opacity: 1;
}

.lc-send svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lc-send:disabled svg {
  stroke: #999;
}

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #luspada-chat-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
  }

  #luspada-chat-bubble {
    bottom: 16px;
    right: 16px;
  }
}
