/* Chat Widget Styles */
.chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* On desktop, position chat widget to the left of contact button */
@media (min-width: 769px) {
  .chat-widget {
    bottom: 24px;
    right: 88px; /* Position to the left of contact button (56px width + 16px gap + 16px margin) */
  }
}

/* Chat Toggle Button */
.chat-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-500, #a78bfa) 0%, var(--primary-600, #8b5cf6) 100%);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(167, 139, 250, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(167, 139, 250, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3);
}

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

.chat-icon {
  width: 24px;
  height: 24px;
  transition: transform 0.3s ease;
  stroke: white;
  fill: none;
  stroke-width: 2.5;
}

.chat-widget.active .chat-icon {
  transform: rotate(180deg);
}

.chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: white;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* AI Chat Bot Floater Tooltip */
.chat-ai-floater {
  position: absolute;
  bottom: 70px;
  right: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4), 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateY(10px) scale(0.9);
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10001;
  animation: chatFloaterPulse 2s ease-in-out infinite;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.chat-ai-floater::before {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 20px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #667eea;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

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

.chat-ai-floater.hide {
  opacity: 0;
  transform: translateY(10px) scale(0.9);
  pointer-events: none;
}

.chat-ai-floater-icon {
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
  animation: chatSparkle 1.5s ease-in-out infinite;
}

@keyframes chatFloaterPulse {
  0%, 100% {
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4), 0 4px 12px rgba(0, 0, 0, 0.15);
  }
  50% {
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.6), 0 6px 16px rgba(0, 0, 0, 0.2), 0 0 0 4px rgba(102, 126, 234, 0.1);
  }
}

@keyframes chatSparkle {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.1);
  }
}

.chat-ai-floater-close {
  display: inline-block;
  margin-left: 8px;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
  vertical-align: middle;
  line-height: 1;
  font-size: 16px;
  font-weight: bold;
}

.chat-ai-floater-close:hover {
  opacity: 1;
}

/* Mobile adjustments for floater */
@media (max-width: 768px) {
  .chat-ai-floater {
    bottom: 70px;
    right: 0;
    font-size: 12px;
    padding: 10px 14px;
    max-width: 200px;
    white-space: normal;
  }
  
  .chat-ai-floater::before {
    right: 16px;
  }
}

/* Desktop positioning */
@media (min-width: 769px) {
  .chat-ai-floater {
    bottom: 70px;
    right: 0;
  }
}

/* Chat Window */
.chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 600px;
  max-height: calc(100vh - 100px);
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

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

/* Chat Header */
.chat-header {
  background: linear-gradient(135deg, var(--primary-500, #a78bfa) 0%, var(--primary-600, #8b5cf6) 100%);
  color: white;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chat-header-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  overflow: visible;
  box-shadow: none;
}

.chat-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  max-width: 100%;
  max-height: 100%;
  background: transparent;
}

/* Remove white background from SVG logo in chat */
.chat-logo svg rect[fill="#ffffff"],
.chat-logo svg rect[fill="#fff"],
.chat-message-logo svg rect[fill="#ffffff"],
.chat-message-logo svg rect[fill="#fff"] {
  fill: transparent !important;
  fill-opacity: 0 !important;
}

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

.chat-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-subtitle {
  font-size: 13px;
  margin: 0;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* AI Disclaimer Footer */
.chat-disclaimer {
  padding: 12px 16px;
  background: rgba(99, 102, 241, 0.05);
  border-top: 1px solid rgba(99, 102, 241, 0.1);
  font-size: 11px;
  line-height: 1.5;
  color: #6b7280;
  text-align: center;
}

.chat-disclaimer strong {
  color: #4b5563;
  font-weight: 600;
}

.chat-disclaimer a {
  color: #6366f1;
  text-decoration: none;
}

.chat-disclaimer a:hover {
  text-decoration: underline;
}

/* Quick Action Buttons */
.chat-quick-actions-container {
  padding: 8px 20px 12px 20px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
}

.chat-quick-action-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  white-space: nowrap;
  font-size: 12px;
}

.chat-quick-action-item:hover {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
  border-color: rgba(167, 139, 250, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(167, 139, 250, 0.2);
}

.chat-quick-action-item:active {
  transform: translateY(0);
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
}

.chat-quick-action-icon {
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

.chat-quick-action-text {
  font-size: 12px;
  font-weight: 500;
  color: #6366f1;
  line-height: 1;
}

.chat-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.chat-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

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

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #f9fafb;
}

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

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

.chat-messages::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Chat Message */
.chat-message {
  display: flex;
  gap: 12px;
  animation: messageSlideIn 0.3s ease-out;
}

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

.chat-message-user {
  flex-direction: row-reverse;
}

.chat-message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
  padding: 0;
  overflow: visible;
  box-shadow: none;
}

.chat-message-user .chat-message-avatar {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
}

.chat-message-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  max-width: 100%;
  max-height: 100%;
  background: transparent;
}

.chat-message-avatar svg {
  width: 20px;
  height: 20px;
}

.chat-message-content {
  flex: 1;
  min-width: 0;
  max-width: 75%;
}

.chat-message-user .chat-message-content {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.chat-message-text {
  background: white;
  padding: 12px 16px;
  border-radius: 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  word-wrap: break-word;
}

.chat-message-user .chat-message-text {
  background: linear-gradient(135deg, var(--primary-500, #a78bfa) 0%, var(--primary-600, #8b5cf6) 100%);
  color: white;
}

.chat-message-text p {
  margin: 0 0 8px 0;
  line-height: 1.5;
  font-size: 14px;
}

.chat-message-text p:last-child {
  margin-bottom: 0;
}

.chat-message-text ul {
  margin: 8px 0;
  padding-left: 20px;
}

.chat-message-text li {
  margin: 4px 0;
  font-size: 13px;
  line-height: 1.5;
}

.chat-message-time {
  font-size: 11px;
  color: #6b7280;
  margin-top: 4px;
  padding: 0 4px;
}

.chat-message-user .chat-message-time {
  color: rgba(255, 255, 255, 0.7);
}

.chat-quick-actions {
  list-style: none;
  padding: 0;
  margin: 12px 0 0 0;
}

.chat-quick-actions li {
  padding: 8px 12px;
  margin: 6px 0;
  background: rgba(167, 139, 250, 0.1);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
  font-size: 13px;
}

.chat-quick-actions li:hover {
  background: rgba(167, 139, 250, 0.2);
}

/* Chat Input Area */
.chat-input-area {
  padding: 16px;
  background: white;
  border-top: 1px solid #e5e7eb;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.chat-upload-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: white;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chat-upload-btn:hover {
  background: #f9fafb;
  border-color: var(--primary-300, #ddd6fe);
  color: var(--primary-600, #8b5cf6);
}

.chat-upload-btn svg {
  width: 20px;
  height: 20px;
}

.chat-input-wrapper {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: #f9fafb;
  border-radius: 12px;
  padding: 8px;
  border: 1px solid #e5e7eb;
}

.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  resize: none;
  font-size: 14px;
  font-family: inherit;
  color: #111827;
  padding: 4px 8px;
  max-height: 120px;
  overflow-y: auto;
  outline: none;
}

.chat-input::placeholder {
  color: #9ca3af;
}

.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, var(--primary-500, #a78bfa) 0%, var(--primary-600, #8b5cf6) 100%);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(167, 139, 250, 0.4);
}

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

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

/* Typing Indicator */
.chat-typing {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
  border-top: 1px solid #e5e7eb;
}

.chat-typing-dots {
  display: flex;
  gap: 4px;
}

.chat-typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
  animation: typingDot 1.4s infinite ease-in-out;
}

.chat-typing-dots span:nth-child(1) {
  animation-delay: 0s;
}

.chat-typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.chat-typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

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

.chat-typing-text {
  font-size: 13px;
  color: #6b7280;
}

/* Responsive Design */
@media (max-width: 768px) {
  .chat-widget {
    bottom: 88px; /* Position above contact button (56px + 16px gap + 16px margin) */
    right: 16px;
  }

  .chat-window {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
    bottom: 10px;
    right: 10px;
    border-radius: 16px;
  }

  .chat-toggle {
    width: 56px;
    height: 56px;
  }
}

/* File Upload Progress */
.chat-file-upload {
  padding: 12px 16px;
  margin: 8px 20px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-file-upload-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #0ea5e9;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-file-upload-icon svg {
  width: 20px;
  height: 20px;
}

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

.chat-file-upload-name {
  font-size: 13px;
  font-weight: 500;
  color: #0c4a6e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-file-upload-progress {
  font-size: 11px;
  color: #0369a1;
  margin-top: 2px;
}

.chat-file-upload-progress-bar {
  width: 100%;
  height: 4px;
  background: #e0f2fe;
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.chat-file-upload-progress-fill {
  height: 100%;
  background: #0ea5e9;
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* Deletion Warning Modal */
.chat-deletion-warning {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.chat-deletion-warning-content {
  background: white;
  border-radius: 12px;
  padding: 32px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
  text-align: center;
}

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

.chat-deletion-warning-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.chat-deletion-warning-content h3 {
  margin: 0 0 12px 0;
  font-size: 20px;
  font-weight: 600;
  color: #1f2937;
}

.chat-deletion-warning-content p {
  margin: 0 0 16px 0;
  font-size: 14px;
  color: #6b7280;
  line-height: 1.5;
}

.chat-deletion-warning-content ul {
  text-align: left;
  margin: 16px auto;
  padding-left: 24px;
  color: #6b7280;
  font-size: 14px;
  max-width: 300px;
}

.chat-deletion-warning-content li {
  margin: 8px 0;
}

.chat-deletion-warning-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.chat-deletion-cancel,
.chat-deletion-confirm {
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.chat-deletion-cancel {
  background: #f3f4f6;
  color: #374151;
}

.chat-deletion-cancel:hover {
  background: #e5e7eb;
}

.chat-deletion-confirm {
  background: #ef4444;
  color: white;
}

.chat-deletion-confirm:hover {
  background: #dc2626;
}

