/* ============================================
   PINK FLAMINGO AI CHAT WIDGET
   ============================================ */

/* ── Chat Toggle Button ── */
.chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1B5E20, #2E7D32);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(27, 94, 32, 0.35), 0 2px 8px rgba(0,0,0,0.15);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  z-index: 9998;
  -webkit-tap-highlight-color: transparent;
}

.chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(27, 94, 32, 0.45), 0 3px 12px rgba(0,0,0,0.2);
}

.chat-toggle:active {
  transform: scale(0.95);
}

.chat-toggle svg {
  width: 28px;
  height: 28px;
  transition: opacity 0.2s, transform 0.2s;
}

.chat-toggle .chat-icon-close {
  position: absolute;
  opacity: 0;
  transform: rotate(-90deg);
}

.chat-toggle.active .chat-icon-open {
  opacity: 0;
  transform: rotate(90deg);
}

.chat-toggle.active .chat-icon-close {
  opacity: 1;
  transform: rotate(0deg);
}

/* Unread badge */
.chat-toggle-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: #F06292;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.3s, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chat-toggle-badge.visible {
  opacity: 1;
  transform: scale(1);
}

/* ── Chat Window ── */
.chat-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-height: 560px;
  background: var(--bg-primary, #f5f0eb);
  border-radius: 20px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Chat Header ── */
.chat-header {
  background: linear-gradient(135deg, #1B5E20, #2E7D32);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.chat-header-info {
  flex: 1;
  min-width: 0;
}

.chat-header-name {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
}

.chat-header-status {
  font-size: 12px;
  opacity: 0.8;
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat-header-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #81C784;
  display: inline-block;
}

/* ── Chat Messages Area ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 280px;
  max-height: 360px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 5px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.12);
  border-radius: 3px;
}

/* Message bubbles */
.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  animation: chatMsgIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.chat-msg.bot {
  background: #fff;
  color: #1a2e1a;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.chat-msg.user {
  background: linear-gradient(135deg, #1B5E20, #2E7D32);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* Typing indicator */
.chat-typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  align-self: flex-start;
  background: #fff;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.chat-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #aaa;
  animation: typingDot 1.2s ease-in-out infinite;
}

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

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

/* Quick reply chips */
.chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 4px;
  margin-top: 4px;
}

.chat-quick-reply {
  background: rgba(27, 94, 32, 0.08);
  color: #1B5E20;
  border: 1px solid rgba(27, 94, 32, 0.2);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  white-space: nowrap;
}

.chat-quick-reply:hover {
  background: rgba(27, 94, 32, 0.15);
  border-color: rgba(27, 94, 32, 0.35);
  transform: translateY(-1px);
}

.chat-quick-reply:active {
  transform: translateY(0);
}

/* ── Chat Input ── */
.chat-input-wrap {
  padding: 12px 16px;
  border-top: 1px solid rgba(0,0,0,0.06);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
  background: var(--bg-primary, #f5f0eb);
}

.chat-input {
  flex: 1;
  border: 1px solid rgba(0,0,0,0.1);
  background: #fff;
  border-radius: 22px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  resize: none;
  max-height: 80px;
  line-height: 1.4;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: #1B5E20;
}

.chat-input::placeholder {
  color: #999;
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #1B5E20;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}

.chat-send-btn:hover {
  background: #2E7D32;
}

.chat-send-btn:active {
  transform: scale(0.92);
}

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.chat-send-btn svg {
  width: 18px;
  height: 18px;
}

/* ── Dark mode ── */
[data-theme="dark"] .chat-window {
  background: #1a2e1a;
}

[data-theme="dark"] .chat-msg.bot {
  background: #253325;
  color: #e8e0d8;
}

[data-theme="dark"] .chat-input-wrap {
  border-top-color: rgba(255,255,255,0.08);
  background: #1a2e1a;
}

[data-theme="dark"] .chat-input {
  background: #253325;
  border-color: rgba(255,255,255,0.1);
  color: #e8e0d8;
}

[data-theme="dark"] .chat-input::placeholder {
  color: #7a8a7a;
}

[data-theme="dark"] .chat-quick-reply {
  background: rgba(129, 199, 132, 0.1);
  color: #81C784;
  border-color: rgba(129, 199, 132, 0.25);
}

[data-theme="dark"] .chat-quick-reply:hover {
  background: rgba(129, 199, 132, 0.18);
}

/* ── Mobile responsive ── */
@media (max-width: 480px) {
  .chat-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .chat-messages {
    max-height: calc(100dvh - 170px);
    min-height: 200px;
  }

  .chat-toggle {
    bottom: 16px;
    right: 16px;
  }
}

/* ── Powered by label ── */
.chat-powered-by {
  text-align: center;
  padding: 6px;
  font-size: 11px;
  color: #999;
  flex-shrink: 0;
}

.chat-powered-by a {
  color: #888;
  text-decoration: none;
}
