/* ============================================================
   LOHAR STUDIO — CHATBOT WIDGET CSS
   File: public/frontend_assets/css/chatbot.css
   Uses design tokens from category.css (--ls-gold, --ls-dark2, ...)
============================================================ */

.ls-chat-widget {
  position: fixed;
  right: 18px;
  bottom: 90px;
  z-index: 100000;
  font-family: 'Inter', sans-serif;
}

/* ===== Toggle button ===== */
.ls-chat-toggle {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: var(--ls-gold, #FFB800);
  color: #111;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 10px 26px rgba(0,0,0,.45);
  transition: transform .2s ease, box-shadow .2s ease;
}
.ls-chat-toggle:hover { transform: scale(1.06); box-shadow: 0 14px 32px rgba(0,0,0,.5); }
.ls-chat-toggle-icon--close { display: none; }
.ls-chat-widget.ls-chat-open .ls-chat-toggle-icon--open { display: none; }
.ls-chat-widget.ls-chat-open .ls-chat-toggle-icon--close { display: block; }

.ls-chat-toggle-avatar {
  font-size: 30px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lsChatAvatarWiggle 3.5s ease-in-out infinite;
}
@keyframes lsChatAvatarWiggle {
  0%, 80%, 100% { transform: rotate(0deg); }
  85% { transform: rotate(-8deg); }
  90% { transform: rotate(8deg); }
  95% { transform: rotate(-4deg); }
}

.ls-chat-toggle-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(255,184,0,.55);
  animation: lsChatRingPulse 2.4s ease-out infinite;
  pointer-events: none;
}
.ls-chat-widget.ls-chat-open .ls-chat-toggle-ring { display: none; }
@keyframes lsChatRingPulse {
  0% { box-shadow: 0 0 0 0 rgba(255,184,0,.55); }
  100% { box-shadow: 0 0 0 16px rgba(255,184,0,0); }
}

/* ===== Greeting speech bubble ===== */
.ls-chat-toggle-greeting {
  position: absolute;
  right: 68px;
  bottom: 16px;
  background: #1c1c1c;
  color: #fff;
  border: 1px solid rgba(255,184,0,.4);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0,0,0,.4);
  animation: lsChatGreetBounce 2.6s ease-in-out infinite;
}
.ls-chat-toggle-greeting::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 6px 0 6px 7px;
  border-style: solid;
  border-color: transparent transparent transparent #1c1c1c;
}
.ls-chat-wave { display: inline-block; animation: lsChatWaveHand 1.4s ease-in-out infinite; }
@keyframes lsChatWaveHand {
  0%, 60%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(18deg); }
  40% { transform: rotate(-12deg); }
}
@keyframes lsChatGreetBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
.ls-chat-widget.ls-chat-seen .ls-chat-toggle-greeting,
.ls-chat-widget.ls-chat-open .ls-chat-toggle-greeting { display: none; }

@media (max-width: 480px) {
  .ls-chat-toggle-greeting { right: 64px; font-size: 12.5px; padding: 6px 12px; }
}

.ls-chat-toggle-badge {
  position: absolute;
  top: -2px; right: -2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #e53935;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0d0d0d;
}
.ls-chat-widget.ls-chat-open .ls-chat-toggle-badge,
.ls-chat-widget.ls-chat-seen .ls-chat-toggle-badge { display: none; }

/* ===== Panel ===== */
.ls-chat-panel {
  position: fixed;
  right: 18px;
  bottom: 160px;
  width: 370px;
  max-width: calc(100vw - 36px);
  height: min(70vh, 560px);
  background: #151515;
  border: 1px solid rgba(255,184,0,.2);
  border-radius: var(--ls-radius, 14px);
  box-shadow: 0 30px 70px rgba(0,0,0,.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(.98);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}
.ls-chat-widget.ls-chat-open .ls-chat-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ===== Header ===== */
.ls-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px;
  background: linear-gradient(120deg, var(--ls-gold-dark, #D49A00), var(--ls-gold, #FFB800));
  flex-shrink: 0;
}
.ls-chat-header-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(0,0,0,.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.ls-chat-header-info { flex: 1; min-width: 0; }
.ls-chat-header-title { font-size: 14.5px; font-weight: 800; color: #171310; }
.ls-chat-header-status { font-size: 11.5px; color: #171310; display: flex; align-items: center; gap: 5px; opacity: .85; }
.ls-chat-dot { width: 7px; height: 7px; border-radius: 50%; background: #1b9e3f; display: inline-block; }
.ls-chat-close {
  background: rgba(0,0,0,.15);
  border: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  color: #171310;
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ls-chat-close:hover { background: rgba(0,0,0,.28); }

/* ===== Body ===== */
.ls-chat-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Messages */
.ls-chat-messages {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  flex-direction: column;
  gap: 10px;
}
.ls-chat-widget.ls-chat-started .ls-chat-messages { display: flex; }

/* Skip button shown inline inside a bot bubble for optional onboarding steps */
.ls-chat-skip-btn {
  display: inline-block;
  margin-top: 8px;
  background: transparent;
  border: 1px solid var(--ls-gold, #FFB800);
  color: var(--ls-gold, #FFB800);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.ls-chat-skip-btn:hover { background: var(--ls-gold, #FFB800); color: #171310; }

.ls-chat-msg { display: flex; }
.ls-chat-msg--bot { justify-content: flex-start; }
.ls-chat-msg--user { justify-content: flex-end; }
.ls-chat-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  word-wrap: break-word;
}
.ls-chat-msg--bot .ls-chat-bubble {
  background: #202020;
  color: #eee;
  border-bottom-left-radius: 4px;
}
.ls-chat-msg--bot .ls-chat-bubble a { color: var(--ls-gold, #FFB800); text-decoration: underline; }
.ls-chat-msg--user .ls-chat-bubble {
  background: var(--ls-gold, #FFB800);
  color: #171310;
  font-weight: 600;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.ls-chat-typing {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 0 18px 10px;
}
.ls-chat-widget.ls-chat-typing-active .ls-chat-typing { display: flex; }
.ls-chat-typing span {
  width: 6px; height: 6px;
  background: #888;
  border-radius: 50%;
  animation: lsChatTyping 1s infinite ease-in-out;
}
.ls-chat-typing span:nth-child(2) { animation-delay: .15s; }
.ls-chat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes lsChatTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Input row */
.ls-chat-input-row {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.ls-chat-widget.ls-chat-started .ls-chat-input-row { display: flex; }
.ls-chat-input {
  flex: 1;
  background: #0d0d0d;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 30px;
  padding: 10px 16px;
  color: #fff;
  font-size: 13.5px;
  outline: none;
}
.ls-chat-input:focus { border-color: var(--ls-gold, #FFB800); }
.ls-chat-send {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--ls-gold, #FFB800);
  color: #171310;
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .2s ease;
}
.ls-chat-send:hover { background: var(--ls-gold-light, #FFD154); }

/* ===== Tablet ===== */
@media (max-width: 991px) {
  .ls-chat-widget { right: 14px; bottom: 90px; }
  .ls-chat-panel { right: 14px; bottom: 150px; width: 340px; height: min(65vh, 520px); }
}

/* ===== Mobile: full-screen chat ===== */
@media (max-width: 576px) {
  .ls-chat-widget { right: 14px; bottom: 90px; }
  .ls-chat-panel {
    right: 0; left: 0; bottom: 0; top: 0;
    width: 100%; max-width: 100%;
    height: 100%; height: 100dvh;
    border-radius: 0;
    border: none;
  }
  .ls-chat-header { padding-top: max(16px, env(safe-area-inset-top)); }
  .ls-chat-input-row { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}
