/* AI Chat Consultant Widget */
#ai-chat-fab {
  position: fixed; bottom: 20px; right: 20px; z-index: 9999;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent, #e94560);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  transition: transform 0.2s, opacity 0.2s;
}
#ai-chat-fab:hover { transform: scale(1.1); }
#ai-chat-fab.hidden { opacity: 0; pointer-events: none; transform: scale(0.5); }

#ai-chat-win {
  position: fixed; bottom: 20px; right: 20px; z-index: 10000;
  width: 320px; height: 420px;
  background: #fff; border-radius: 14px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none; transform: translateY(20px) scale(0.95);
  transition: all 0.25s ease;
  overflow: hidden;
}
#ai-chat-win.open {
  opacity: 1; pointer-events: all; transform: translateY(0) scale(1);
}

.aic-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: var(--accent, #e94560); color: #fff;
  flex-shrink: 0;
}
.aic-hinfo { display: flex; align-items: center; gap: 8px; }
.aic-avatar { font-size: 24px; line-height: 1; }
.aic-hname { font-weight: 700; font-size: 13px; }
.aic-hstatus { font-size: 10px; opacity: 0.85; display: flex; align-items: center; gap: 4px; }
.aic-dot { width: 6px; height: 6px; border-radius: 50%; background: #4ade80; display: inline-block; }
.aic-close {
  background: none; border: none; color: #fff; font-size: 20px;
  cursor: pointer; padding: 0 4px; line-height: 1; opacity: 0.8;
}
.aic-close:hover { opacity: 1; }

.aic-body {
  flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
  background: #f8f9fa;
}

.aic-msg { display: flex; }
.aic-assistant { justify-content: flex-start; }
.aic-user { justify-content: flex-end; }

.aic-bubble {
  max-width: 88%; padding: 8px 12px;
  border-radius: 14px; font-size: 13px; line-height: 1.45;
  word-break: break-word;
}
.aic-assistant .aic-bubble {
  background: #fff; color: #333;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.aic-user .aic-bubble {
  background: var(--accent, #e94560); color: #fff;
  border-bottom-right-radius: 4px;
}

/* Quick action chips */
.aic-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 4px 0 2px;
}
.aic-chip {
  display: inline-block;
  padding: 5px 10px;
  background: #fff;
  border: 1px solid #e0e4ea;
  border-radius: 16px;
  font-size: 12px;
  color: #444;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.aic-chip:hover {
  background: var(--accent, #e94560);
  color: #fff;
  border-color: var(--accent, #e94560);
}

/* Typing dots */
.aic-dots { display: flex; gap: 4px; padding: 10px 16px; }
.aic-dots span {
  width: 6px; height: 6px; border-radius: 50%; background: #bbb;
  animation: aicBounce 1.2s infinite;
}
.aic-dots span:nth-child(2) { animation-delay: 0.15s; }
.aic-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes aicBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

/* Product cards in chat */
.aic-product {
  display: flex; gap: 8px; padding: 6px;
  background: #f0f0f0; border-radius: 8px;
  text-decoration: none; color: #333;
  margin-top: 4px; transition: background 0.15s;
}
.aic-product:hover { background: #e8e8e8; }
.aic-product img { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; }
.aic-pinfo { display: flex; flex-direction: column; justify-content: center; }
.aic-pname { font-size: 11px; font-weight: 600; line-height: 1.3; }
.aic-pprice { font-size: 11px; color: var(--accent, #e94560); font-weight: 700; margin-top: 2px; }

.aic-footer {
  display: flex; padding: 8px 10px; gap: 6px;
  border-top: 1px solid #eee; background: #fff;
  flex-shrink: 0;
}
.aic-footer input {
  flex: 1; border: 1px solid #ddd; border-radius: 18px;
  padding: 7px 14px; font-size: 13px; outline: none;
  transition: border-color 0.2s;
}
.aic-footer input:focus { border-color: var(--accent, #e94560); }
#aic-send {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent, #e94560); border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #fff; transition: opacity 0.15s;
  flex-shrink: 0;
}
#aic-send:hover { opacity: 0.85; }

/* Mobile: just bubble, not open by default */
@media (max-width: 768px) {
  #ai-chat-win {
    width: calc(100vw - 16px); height: calc(100vh - 80px);
    bottom: 8px; right: 8px;
    border-radius: 12px;
  }
  #ai-chat-fab { bottom: 16px; right: 16px; width: 50px; height: 50px; }
}
