/* ==========================================================================
   Laven Asistan — AI Satış Danışmanı Chatbot Widget
   Site marka renkleriyle uyumlu (burgundy #7A0B1E / gold #957127 / cream #f5f2e9)
   ========================================================================== */

.lvn-chat-widget {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 99998;
  font-family: 'Jost', sans-serif;
}

.lvn-chat-widget * {
  box-sizing: border-box;
}

/* ---------- Toggle Button ---------- */
.lvn-chat-toggle {
  position: relative;
  width: 62px;
  height: 62px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--primary, #7a0b1e) 0%, #4e0303 100%);
  color: #fdf6e8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(122, 11, 30, 0.4), 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.lvn-chat-toggle:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 12px 28px rgba(122, 11, 30, 0.5), 0 2px 8px rgba(0, 0, 0, 0.2);
}

.lvn-chat-toggle-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1.5px solid var(--primary-2, #957127);
  opacity: 0.55;
  animation: lvnPulseRing 2.6s ease-out infinite;
}

@keyframes lvnPulseRing {
  0% { transform: scale(0.85); opacity: 0.6; }
  70% { transform: scale(1.18); opacity: 0; }
  100% { transform: scale(1.18); opacity: 0; }
}

.lvn-chat-ic {
  width: 26px;
  height: 26px;
  position: absolute;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.lvn-ic-close { opacity: 0; transform: rotate(-45deg) scale(0.6); }
.lvn-ic-open { opacity: 1; transform: rotate(0) scale(1); }

.lvn-chat-widget.is-open .lvn-ic-open { opacity: 0; transform: rotate(45deg) scale(0.6); }
.lvn-chat-widget.is-open .lvn-ic-close { opacity: 1; transform: rotate(0) scale(1); }
.lvn-chat-widget.is-open .lvn-chat-toggle-ring { display: none; }

.lvn-chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--primary-2, #957127);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fdf6e8;
}

.lvn-chat-badge.d-none,
.lvn-chat-widget.is-open .lvn-chat-badge {
  display: none;
}

/* ---------- Chat Window ---------- */
.lvn-chat-window {
  position: absolute;
  left: 0;
  bottom: 78px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 130px);
  background: #fffdf9;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25), 0 4px 16px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.97);
  transform-origin: bottom left;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
  border: 1px solid rgba(149, 113, 39, 0.18);
}

.lvn-chat-widget.is-open .lvn-chat-window {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ---------- Header ---------- */
.lvn-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px;
  background: linear-gradient(120deg, var(--primary, #7a0b1e), #56081a 65%, #3d0512);
  color: #fff;
  flex-shrink: 0;
}

.lvn-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1.5px solid var(--primary-2, #d4b04c);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lvn-chat-avatar svg {
  width: 20px;
  height: 20px;
  color: #f0d998;
}

.lvn-chat-headtext {
  flex: 1;
  min-width: 0;
}

.lvn-chat-title {
  font-family: 'Playfair Display', serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.2px;
  line-height: 1.2;
}

.lvn-chat-title .fst-italic {
  font-style: italic;
  color: #f0d998;
}

.lvn-chat-status {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.75);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.lvn-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.25);
  flex-shrink: 0;
}

.lvn-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.lvn-chat-iconbtn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.lvn-chat-iconbtn:hover { background: rgba(255, 255, 255, 0.22); }
.lvn-chat-iconbtn svg { width: 15px; height: 15px; }

/* ---------- Body / Messages ---------- */
.lvn-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg, #f5f2e9);
  scrollbar-width: thin;
  scrollbar-color: rgba(122, 11, 30, 0.25) transparent;
}

.lvn-chat-body::-webkit-scrollbar { width: 6px; }
.lvn-chat-body::-webkit-scrollbar-thumb {
  background: rgba(122, 11, 30, 0.25);
  border-radius: 10px;
}

.lvn-msg {
  max-width: 86%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: lvnMsgIn 0.28s ease;
}

@keyframes lvnMsgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.lvn-msg.user { align-self: flex-end; align-items: flex-end; }
.lvn-msg.bot { align-self: flex-start; align-items: flex-start; }

.lvn-msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}

.lvn-msg.user .lvn-msg-bubble {
  background: var(--primary, #7a0b1e);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.lvn-msg.bot .lvn-msg-bubble {
  background: #ffffff;
  color: #262626;
  border: 1px solid rgba(149, 113, 39, 0.15);
  border-left: 3px solid var(--primary-2, #957127);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Typing indicator */
.lvn-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 2px;
}

.lvn-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary-2, #957127);
  opacity: 0.5;
  animation: lvnTypingBounce 1.2s infinite ease-in-out;
}

.lvn-typing span:nth-child(2) { animation-delay: 0.15s; }
.lvn-typing span:nth-child(3) { animation-delay: 0.3s; }

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

/* Product cards */
.lvn-products {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.lvn-product-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid rgba(149, 113, 39, 0.2);
  border-radius: 14px;
  padding: 8px;
  width: 100%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.lvn-product-thumb {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--bg, #f5f2e9);
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.lvn-product-info {
  flex: 1;
  min-width: 0;
}

.lvn-product-name {
  font-family: 'Playfair Display', serif;
  font-size: 12.5px;
  font-weight: 600;
  color: #262626;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lvn-product-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary, #7a0b1e);
  margin-top: 2px;
}

.lvn-product-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 5px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: #fff;
  background: var(--primary, #7a0b1e);
  border: none;
  border-radius: 999px;
  padding: 5px 12px;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.15s ease;
}

.lvn-product-cta:hover {
  background: var(--primary-2, #957127);
  color: #fff;
  transform: translateY(-1px);
}

/* ---------- Quick suggestions ---------- */
.lvn-chat-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 10px;
  flex-shrink: 0;
  background: var(--bg, #f5f2e9);
}

.lvn-chat-quick.d-none { display: none; }

.lvn-quick-btn {
  font-size: 11.5px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(122, 11, 30, 0.3);
  background: #fff;
  color: var(--primary, #7a0b1e);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.lvn-quick-btn:hover {
  background: var(--primary, #7a0b1e);
  color: #fff;
  border-color: var(--primary, #7a0b1e);
}

/* ---------- Input row ---------- */
.lvn-chat-inputrow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: #fff;
  border-top: 1px solid rgba(149, 113, 39, 0.15);
  flex-shrink: 0;
}

.lvn-chat-inputrow input {
  flex: 1;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: var(--bg, #f5f2e9);
  border-radius: 999px;
  padding: 11px 16px;
  font-size: 13.5px;
  font-family: 'Jost', sans-serif;
  color: #262626;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.lvn-chat-inputrow input:focus {
  border-color: var(--primary-2, #957127);
  box-shadow: 0 0 0 3px rgba(149, 113, 39, 0.12);
}

.lvn-chat-inputrow input::placeholder { color: #9c9c9c; }

#lvnChatSend {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--primary, #7a0b1e);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease, transform 0.15s ease;
}

#lvnChatSend:hover { background: var(--primary-2, #957127); transform: scale(1.05); }
#lvnChatSend:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
#lvnChatSend svg { width: 17px; height: 17px; }

.lvn-chat-footnote {
  text-align: center;
  font-size: 10px;
  color: #9c9c9c;
  padding: 6px 10px 10px;
  background: #fff;
  flex-shrink: 0;
}

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
  .lvn-chat-widget { left: 14px; bottom: 14px; }

  .lvn-chat-window {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .lvn-chat-toggle { width: 56px; height: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  .lvn-chat-toggle-ring { animation: none; }
  .lvn-msg { animation: none; }
}
