/* ============================================
   THE DADDY'S PAINTING LLC - AI CHATBOT STYLES
   ============================================ */

:root {
  --chat-primary: #039A02;
  --chat-primary-light: #A1F88B;
  --chat-primary-dark: #027a01;
  --chat-secondary: #2D2928;
  --chat-bg: #E1F8F2;
  --chat-surface: #1a1917;
  --chat-surface-light: #353331;
  --chat-text: #ffffff;
  --chat-text-muted: rgba(255, 255, 255, 0.6);
  --chat-border: rgba(255, 255, 255, 0.1);
  --chat-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  --chat-radius: 20px;
  --chat-font: "Inter", "Alexandria", system-ui, sans-serif;
}

/* ── Floating Button ─────────────────────── */
.chatbot-trigger {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 68px;
  height: 68px;
  border: none;
  cursor: pointer;
  z-index: 9998;
  background: transparent;
  padding: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 4px 20px rgba(3, 154, 2, 0.4));
}

.chatbot-trigger:hover {
  transform: scale(1.08) rotate(-3deg);
  filter: drop-shadow(0 6px 28px rgba(3, 154, 2, 0.55));
}

.chatbot-trigger:active {
  transform: scale(0.95);
}

.chatbot-trigger-icon {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Paint drip shape as button background */
.chatbot-trigger-icon .trigger-bg {
  position: absolute;
  inset: 0;
  transition: opacity 0.3s ease;
}

.chatbot-trigger-icon .trigger-icon {
  position: relative;
  z-index: 1;
  width: 30px;
  height: 30px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.chatbot-trigger.active .trigger-icon-open {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

.chatbot-trigger.active .trigger-icon-close {
  opacity: 1;
  transform: rotate(0) scale(1);
}

.chatbot-trigger:not(.active) .trigger-icon-close {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

.chatbot-trigger:not(.active) .trigger-icon-open {
  opacity: 1;
  transform: rotate(0) scale(1);
}

/* Pulse ring animation */
.chatbot-trigger::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: rgba(3, 154, 2, 0.2);
  animation: chatPulse 3s ease-in-out infinite;
  z-index: -1;
}

.chatbot-trigger.active::before {
  animation: none;
  opacity: 0;
}

@keyframes chatPulse {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.2); opacity: 0; }
}

/* Notification Badge */
.chatbot-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  background: #ef4444;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  border: 2px solid #fff;
  z-index: 2;
  animation: badgePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

@keyframes badgePop {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

/* ── Chat Container ──────────────────────── */
.chatbot-container {
  position: fixed;
  bottom: 110px;
  right: 28px;
  width: 380px;
  height: 540px;
  background: var(--chat-secondary);
  border-radius: var(--chat-radius);
  box-shadow: var(--chat-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  opacity: 0;
  transform: scale(0.85) translateY(20px);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: var(--chat-font);
}

.chatbot-container.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

/* ── Header ──────────────────────────────── */
.chatbot-header {
  background: linear-gradient(135deg, var(--chat-primary-dark) 0%, var(--chat-primary) 100%);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.chatbot-header-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.chatbot-header-avatar img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.chatbot-header-info {
  flex: 1;
  min-width: 0;
}

.chatbot-header-name {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.chatbot-header-status {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.chatbot-header-status .dot {
  width: 7px;
  height: 7px;
  background: var(--chat-primary-light);
  border-radius: 50%;
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.chatbot-header-status span {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
}

.chatbot-close-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.chatbot-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.chatbot-close-btn svg {
  width: 16px;
  height: 16px;
  color: #fff;
}

/* ── Messages Area ───────────────────────── */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  background: var(--chat-secondary);
}

.chatbot-messages::-webkit-scrollbar {
  width: 4px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

/* Message Bubbles */
.chat-message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.5;
  animation: messageIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  word-wrap: break-word;
}

.chat-message a {
  color: var(--chat-primary-light);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chat-message a:hover {
  color: #fff;
}

.chat-message ul, .chat-message ol {
  margin: 6px 0;
  padding-left: 18px;
}

.chat-message li {
  margin-bottom: 3px;
}

@keyframes messageIn {
  0% { opacity: 0; transform: translateY(10px) scale(0.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-message.bot {
  align-self: flex-start;
  background: var(--chat-surface-light);
  color: var(--chat-text);
  border-bottom-left-radius: 4px;
}

.chat-message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-primary-dark) 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.typing-indicator {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 18px;
  background: var(--chat-surface-light);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  animation: messageIn 0.3s ease;
}

.typing-indicator .dot {
  width: 7px;
  height: 7px;
  background: var(--chat-text-muted);
  border-radius: 50%;
  animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-indicator .dot:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* ── Quick Buttons ───────────────────────── */
.chatbot-quick-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px;
  background: var(--chat-secondary);
  border-top: 1px solid var(--chat-border);
}

.chatbot-quick-btn {
  background: transparent;
  border: 1px solid rgba(161, 248, 139, 0.3);
  color: var(--chat-primary-light);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-family: var(--chat-font);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.chatbot-quick-btn:hover {
  background: var(--chat-primary);
  border-color: var(--chat-primary);
  color: #fff;
  transform: translateY(-1px);
}

/* ── Input Area ──────────────────────────── */
.chatbot-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  background: var(--chat-surface);
  border-top: 1px solid var(--chat-border);
}

.chatbot-textarea {
  flex: 1;
  background: var(--chat-surface-light);
  border: 1px solid var(--chat-border);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--chat-text);
  font-size: 13px;
  font-family: var(--chat-font);
  line-height: 1.4;
  resize: none;
  min-height: 40px;
  max-height: 100px;
  overflow-y: auto;
  outline: none;
  transition: border-color 0.2s;
}

.chatbot-textarea::placeholder {
  color: var(--chat-text-muted);
}

.chatbot-textarea:focus {
  border-color: var(--chat-primary);
}

.chatbot-send-btn {
  width: 40px;
  height: 40px;
  background: var(--chat-primary);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chatbot-send-btn:hover {
  background: var(--chat-primary-dark);
  transform: scale(1.05);
}

.chatbot-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.chatbot-send-btn svg {
  width: 18px;
  height: 18px;
  color: #fff;
}

/* ── Powered By ──────────────────────────── */
.chatbot-powered {
  text-align: center;
  padding: 6px;
  font-size: 9px;
  color: var(--chat-text-muted);
  background: var(--chat-surface);
}

/* ── Mobile Responsive ───────────────────── */
@media (max-width: 480px) {
  .chatbot-container {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    transform-origin: bottom center;
  }

  .chatbot-container.open {
    border-radius: 0;
  }

  .chatbot-trigger {
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
  }
}
