/* =============================================================
   Liora · Inventory Chatbot Widget
   Reuses the site theme tokens (--bg, --panel, --ink, --accent, --bg-dark).
   Floating bottom-right. Mobile collapses to full-screen bottom sheet.
   ============================================================= */

#liora-chat-root {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: "Manrope", system-ui, sans-serif;
  color: var(--ink);
}

@media (max-width: 640px) {
  #liora-chat-root {
    bottom: 0;
    right: 0;
    left: 0;
  }
}

/* ---------- Launcher button ---------- */
.liora-chat-launch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  background: var(--bg-dark);
  color: var(--ink-inverse);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: transform 0.18s ease, background 0.18s ease;
}
.liora-chat-launch:hover {
  transform: translateY(-1px);
  background: var(--accent-deep);
}
.liora-chat-launch.is-open {
  display: none;
}
.liora-chat-launch-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-soft);
  display: inline-block;
}

/* ---------- Panel ---------- */
.liora-chat-panel {
  width: 380px;
  max-width: 100vw;
  height: 560px;
  max-height: 80vh;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-large);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  display: none;
}
.liora-chat-panel.is-open {
  display: flex;
}
@media (max-width: 640px) {
  .liora-chat-panel {
    width: 100vw;
    height: 80vh;
    max-height: 80vh;
    border-radius: 20px 20px 0 0;
    border: none;
  }
}

.liora-chat-header {
  padding: 16px 18px;
  background: var(--bg-dark);
  color: var(--ink-inverse);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
}
.liora-chat-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.liora-chat-brand-title {
  font-family: "Instrument Serif", serif;
  font-size: 18px;
  letter-spacing: 0.02em;
  line-height: 1.2;
}
.liora-chat-brand-sub {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--on-dark-soft);
}
.liora-chat-close {
  background: transparent;
  border: none;
  color: var(--ink-inverse);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 999px;
  transition: background 0.15s ease;
}
.liora-chat-close:hover {
  background: rgba(255, 248, 242, 0.12);
}

/* ---------- Messages ---------- */
.liora-chat-log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--panel);
}

.liora-chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.liora-chat-msg.bot {
  align-self: flex-start;
  background: var(--panel-pure);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
  color: var(--ink);
}
.liora-chat-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--ink-inverse);
  border-bottom-right-radius: 4px;
}
.liora-chat-msg.bot.liora-chat-welcome {
  background: var(--bg-soft);
  color: var(--ink-taupe);
  font-style: italic;
}

/* ---------- Product card inside chat ---------- */
.liora-chat-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: flex-start;
  max-width: 85%;
  width: 100%;
}
.liora-chat-card {
  background: var(--panel-pure);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
}
.liora-chat-card-img {
  width: 56px;
  height: 70px;
  border-radius: 8px;
  background: var(--oat-depth) center / cover no-repeat;
  flex: 0 0 56px;
}
.liora-chat-card-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.liora-chat-card-name {
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}
.liora-chat-card-variant {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 2px;
  letter-spacing: 0.02em;
}
.liora-chat-card-meta {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.35;
}
.liora-chat-card-price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 4px;
}
.liora-chat-card-price {
  font-weight: 700;
  color: var(--accent-deep);
  font-size: 14px;
}
.liora-chat-card-compare {
  text-decoration: line-through;
  font-size: 12px;
  color: var(--ink-soft);
}
.liora-chat-card-stock {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 999px;
  align-self: flex-start;
  margin-top: 2px;
}
.liora-chat-card-stock.in {
  background: var(--pastel-3);
  color: #2d4a1f;
}
.liora-chat-card-stock.low {
  background: var(--pastel-1);
  color: #5d3b1d;
}
.liora-chat-card-stock.out {
  background: rgba(29, 23, 20, 0.08);
  color: var(--ink-soft);
}

/* ---------- Quick prompts ---------- */
.liora-chat-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-self: flex-start;
  max-width: 85%;
}
.liora-chat-quick button {
  background: var(--panel-pure);
  border: 1px solid var(--line);
  color: var(--ink-taupe);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.liora-chat-quick button:hover {
  background: var(--bg-soft);
  border-color: var(--accent-soft);
}

/* ---------- Input ---------- */
.liora-chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: var(--bg-soft);
  border-top: 1px solid var(--line);
  flex: 0 0 auto;
}
.liora-chat-input {
  flex: 1 1 auto;
  border: 1px solid var(--line);
  background: var(--panel-pure);
  border-radius: 999px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease;
}
.liora-chat-input:focus {
  border-color: var(--accent);
}
.liora-chat-input::placeholder {
  color: var(--ink-soft);
}
.liora-chat-send {
  background: var(--accent);
  color: var(--ink-inverse);
  border: none;
  padding: 0 18px;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.liora-chat-send:hover {
  background: var(--accent-deep);
}
.liora-chat-send:disabled {
  background: var(--accent-soft);
  cursor: not-allowed;
}

.liora-chat-typing {
  align-self: flex-start;
  background: var(--panel-pure);
  border: 1px solid var(--line);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--ink-soft);
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.liora-chat-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-soft);
  opacity: 0.5;
  animation: liora-chat-typing 1.1s infinite ease-in-out;
}
.liora-chat-typing-dot:nth-child(2) { animation-delay: 0.18s; }
.liora-chat-typing-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes liora-chat-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ---------- Footer / disclaimer ---------- */
.liora-chat-foot {
  padding: 6px 16px 12px;
  background: var(--bg-soft);
  text-align: center;
  font-size: 11px;
  color: var(--ink-soft);
  flex: 0 0 auto;
}
