/* css/chat.css */
/* Premium AI Chatbot Widget Styling */

:root {
  --chat-primary: #ef4444;
  --chat-primary-hover: #dc2626;
  --chat-bg: rgba(15, 15, 25, 0.95);
  --chat-card-bg: rgba(30, 30, 45, 0.65);
  --chat-border: rgba(255, 255, 255, 0.08);
  --chat-text: #f3f4f6;
  --chat-text-muted: #9ca3af;
  --chat-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Floating Chat Button */
.ai-chat-bubble {
  display: none !important;
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 60px;
  height: 60px;
  background: var(--chat-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.4), inset 0 2px 4px rgba(255,255,255,0.2);
  z-index: 9999;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: none;
}

.ai-chat-bubble:hover {
  transform: scale(1.1) rotate(5deg);
  background: var(--chat-primary-hover);
  box-shadow: 0 12px 35px rgba(239, 68, 68, 0.5);
}

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

.ai-chat-bubble .notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #3b82f6;
  color: #fff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 0.75rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--chat-bg);
  animation: pulseBadge 2s infinite;
}

@keyframes pulseBadge {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); box-shadow: 0 0 8px rgba(59, 130, 246, 0.6); }
  100% { transform: scale(1); }
}

/* Chat Widget Panel */
.ai-chat-window {
  position: fixed;
  bottom: 95px;
  right: 25px;
  width: 400px;
  height: 600px;
  max-height: calc(100vh - 120px);
  background: var(--chat-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--chat-border);
  border-radius: 24px;
  box-shadow: var(--chat-shadow);
  display: flex;
  flex-direction: column;
  z-index: 9998;
  overflow: hidden;
  transform: translateY(30px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* Chat Header */
.ai-chat-header {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(0, 0, 0, 0) 100%);
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--chat-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-chat-header-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ai-chat-avatar {
  width: 40px;
  height: 40px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--chat-primary);
  font-size: 1.1rem;
}

.ai-chat-meta h4 {
  font-family: 'Oswald', sans-serif;
  margin: 0;
  font-size: 1.05rem;
  color: #fff;
  letter-spacing: 0.5px;
}

.ai-chat-status {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: #10b981;
  margin-top: 2px;
}

.ai-chat-status-dot {
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
  animation: blinkStatus 1.5s infinite;
}

@keyframes blinkStatus {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

.ai-chat-close {
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: var(--chat-text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.ai-chat-close:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--chat-primary);
}

/* Chat Messages Area */
.ai-chat-body {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-behavior: smooth;
}

.ai-chat-message {
  max-width: 80%;
  padding: 0.85rem 1.1rem;
  border-radius: 18px;
  font-size: 0.92rem;
  line-height: 1.5;
  word-break: break-word;
}

/* AI Message Bubble */
.ai-chat-message.ai {
  align-self: flex-start;
  background: var(--chat-card-bg);
  border: 1px solid var(--chat-border);
  color: var(--chat-text);
  border-top-left-radius: 4px;
}

/* User Message Bubble */
.ai-chat-message.user {
  align-self: flex-end;
  background: var(--chat-primary);
  color: #fff;
  border-top-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2);
}

/* System or Valuation Message Bubble */
.ai-chat-message.system {
  align-self: center;
  max-width: 95%;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  font-size: 0.88rem;
  border-radius: 14px;
  white-space: pre-line;
}

/* Chat Image Message */
.ai-chat-msg-image {
  max-width: 100%;
  border-radius: 12px;
  margin-bottom: 0.5rem;
  display: block;
}

/* Typing Indicator Animation */
.ai-chat-typing {
  align-self: flex-start;
  background: var(--chat-card-bg);
  border: 1px solid var(--chat-border);
  padding: 0.8rem 1.2rem;
  border-radius: 18px;
  border-top-left-radius: 4px;
  display: flex;
  gap: 4px;
  align-items: center;
}

.ai-chat-typing-dot {
  width: 6px;
  height: 6px;
  background: var(--chat-text-muted);
  border-radius: 50%;
  animation: bounceDot 1.4s infinite ease-in-out both;
}

.ai-chat-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.ai-chat-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounceDot {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Chat Controls/Input Footer */
.ai-chat-footer {
  padding: 1rem 1.5rem 1.5rem;
  border-top: 1px solid var(--chat-border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Preview of uploaded image before sending */
.ai-chat-upload-preview {
  display: flex;
  gap: 0.5rem;
  padding: 0.25rem 0;
  overflow-x: auto;
}

.ai-chat-preview-box {
  position: relative;
  width: 55px;
  height: 55px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--chat-primary);
}

.ai-chat-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ai-chat-preview-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 0.65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Chat Input Row */
.ai-chat-input-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--chat-border);
  border-radius: 14px;
  padding: 0.35rem 0.5rem 0.35rem 0.85rem;
}

.ai-chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
  padding: 0.4rem 0;
  resize: none;
  max-height: 80px;
}

.ai-chat-input::placeholder {
  color: var(--chat-text-muted);
}

.ai-chat-action-btn {
  background: transparent;
  border: none;
  color: var(--chat-text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.ai-chat-action-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.ai-chat-send-btn {
  background: var(--chat-primary);
  color: #fff;
}

.ai-chat-send-btn:hover {
  background: var(--chat-primary-hover);
  color: #fff;
}

/* Interactive Quick Buttons inside Chat */
.ai-chat-quick-replies {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scrollbar-width: none;
}

.ai-chat-quick-replies::-webkit-scrollbar {
  display: none;
}

.ai-chat-btn-reply {
  background: var(--chat-card-bg);
  border: 1px solid var(--chat-border);
  color: var(--chat-text);
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.ai-chat-btn-reply:hover {
  background: var(--chat-primary);
  border-color: var(--chat-primary);
  color: #fff;
}

/* Mobile Responsiveness for Chat Widget */
@media (max-width: 480px) {
  .ai-chat-window {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }
  
  .ai-chat-window.active {
    transform: translateY(0) scale(1);
  }
  
  .ai-chat-bubble {
    bottom: 20px;
    right: 20px;
  }
}
