/* ==========================================================================
   THE KITCHEN DISTRICT — AI Sales Assistant Widget (light theme)
   ========================================================================== */

.ai-launcher {
  position: fixed; bottom: 28px; right: 28px; z-index: 700;
  display: flex; align-items: center; gap: 12px;
  background: #fff;
  border: 1px solid var(--tkd-line-strong);
  border-radius: 100px; padding: 8px 8px 8px 20px;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast);
}
.ai-launcher:hover { transform: translateY(-3px); border-color: var(--tkd-brass); }
.ai-launcher-text { display: flex; flex-direction: column; line-height: 1.2; }
.ai-launcher-text b { font-size: 13px; color: var(--tkd-ink); }
.ai-launcher-text span { font-size: 10.5px; color: var(--tkd-grey); }
.ai-launcher-icon {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--tkd-ink);
  display: flex; align-items: center; justify-content: center; color: #fff;
  position: relative;
}
.ai-launcher-icon svg { width: 20px; height: 20px; }
.ai-launcher-pulse {
  position: absolute; inset: -4px; border-radius: 50%; border: 1.5px solid var(--tkd-brass);
  animation: aiPulse 2.4s ease-out infinite;
}
@keyframes aiPulse { 0% { transform: scale(0.9); opacity: 0.8; } 100% { transform: scale(1.5); opacity: 0; } }
.ai-launcher.open { display: none; }

@media (max-width: 640px) {
  .ai-launcher-text { display: none; }
  .ai-launcher { padding: 8px; right: 20px; bottom: 20px; }
  .back-to-top { left: 20px; bottom: 20px; }
}

.ai-panel {
  position: fixed; bottom: 28px; right: 28px; z-index: 700;
  width: 400px; max-width: calc(100vw - 40px);
  height: min(640px, calc(100vh - 100px));
  background: #fff;
  border: 1px solid var(--tkd-line-strong);
  border-radius: 20px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(24px) scale(0.97);
  transition: opacity var(--dur-med) var(--ease-out), transform var(--dur-med) var(--ease-out), visibility var(--dur-med);
}
.ai-panel.open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }

.ai-header {
  display: flex; align-items: center; gap: 12px; padding: 18px 18px;
  border-bottom: 1px solid var(--tkd-line);
  background: var(--tkd-surface-alt);
}
.ai-header-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--tkd-ink);
  display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0;
}
.ai-header-avatar svg { width: 20px; height: 20px; }
.ai-header-info { flex: 1; line-height: 1.3; }
.ai-header-info b { font-size: 14px; display: block; color: var(--tkd-ink); }
.ai-header-status { font-size: 11px; color: var(--tkd-green); display: flex; align-items: center; gap: 6px; }
.ai-header-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--tkd-green); }
.ai-header-close { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--tkd-grey); }
.ai-header-close:hover { background: #fff; color: var(--tkd-ink); }

.ai-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; background: #fff; }
.ai-body::-webkit-scrollbar { width: 6px; }

.ai-msg { display: flex; gap: 10px; max-width: 92%; }
.ai-msg.bot { align-self: flex-start; }
.ai-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.ai-msg-avatar { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.ai-msg.bot .ai-msg-avatar { background: var(--tkd-ink); color: #fff; }
.ai-msg.bot .ai-msg-avatar svg { width: 14px; height: 14px; }
.ai-msg.user .ai-msg-avatar { background: var(--tkd-surface-alt); }
.ai-bubble { padding: 12px 15px; border-radius: 14px; font-size: 13.5px; line-height: 1.55; }
.ai-msg.bot .ai-bubble { background: var(--tkd-surface-alt); border: 1px solid var(--tkd-line); border-top-left-radius: 4px; color: var(--tkd-ink-soft); }
.ai-msg.user .ai-bubble { background: var(--tkd-ink); color: #fff; border-top-right-radius: 4px; font-weight: 500; }
.ai-bubble p + p { margin-top: 8px; }
.ai-bubble ul { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.ai-bubble li { font-size: 13px; padding-left: 14px; position: relative; }
.ai-bubble li::before { content: '—'; position: absolute; left: 0; color: var(--tkd-brass); }

.ai-typing { display: flex; gap: 4px; padding: 4px 0; }
.ai-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--tkd-grey); animation: aiTyping 1.2s infinite; }
.ai-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes aiTyping { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-4px); opacity: 1; } }

.ai-quick-replies { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; align-self: flex-start; max-width: 100%; }
.ai-chip {
  padding: 8px 14px; border-radius: 100px; border: 1px solid var(--tkd-line-strong);
  font-size: 12px; color: var(--tkd-ink-soft); transition: all var(--dur-fast);
  background: #fff;
}
.ai-chip:hover { border-color: var(--tkd-brass); color: var(--tkd-brass-dim); }

.ai-product-card {
  display: flex; gap: 12px; background: var(--tkd-surface-alt); border: 1px solid var(--tkd-line);
  border-radius: 12px; padding: 10px; margin-top: 8px; align-items: center;
}
.ai-product-card img { width: 52px; height: 52px; object-fit: cover; transform: scale(1.2); background: #fff; border-radius: 8px; flex-shrink: 0; }
.ai-product-card-info { flex: 1; min-width: 0; }
.ai-product-card-info b { font-size: 12.5px; display: block; color: var(--tkd-ink); }
.ai-product-card-info span { font-size: 11px; color: var(--tkd-grey); }
.ai-product-card-link { font-size: 11px; color: var(--tkd-brass-dim); font-weight: 600; flex-shrink: 0; }

.ai-lead-form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; background: var(--tkd-surface-alt); border: 1px solid var(--tkd-line); border-radius: 12px; padding: 14px; }
.ai-lead-form input { background: #fff; border: 1px solid var(--tkd-line-strong); border-radius: 8px; padding: 10px 12px; font-size: 13px; color: var(--tkd-ink); }
.ai-lead-form input:focus { outline: none; border-color: var(--tkd-brass); }

.ai-footer { padding: 14px; border-top: 1px solid var(--tkd-line); display: flex; gap: 10px; align-items: center; background: #fff; }
.ai-input {
  flex: 1; background: var(--tkd-surface-alt); border: 1px solid var(--tkd-line-strong); border-radius: 100px;
  padding: 12px 18px; font-size: 13.5px; color: var(--tkd-ink);
}
.ai-input:focus { outline: none; border-color: var(--tkd-brass); }
.ai-send {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: var(--tkd-ink); color: #fff;
  display: flex; align-items: center; justify-content: center; transition: transform var(--dur-fast);
}
.ai-send:hover { transform: scale(1.06); background: #000; }
.ai-send svg { width: 17px; height: 17px; }

@media (max-width: 480px) {
  .ai-panel { right: 0; bottom: 0; width: 100vw; max-width: 100vw; height: 100svh; border-radius: 0; }
}
