/* Enhanced AI Widget Styles */
#ai-widget {
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
}

/* Widget Container */
.ai-widget-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* Toggle Button */
.ai-widget-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--ai-color);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
  transition: all 0.3s ease;
  color: white;
}

.ai-widget-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

.ai-widget-toggle svg {
  transition: transform 0.3s ease;
  pointer-events: none;
}

.ai-widget-toggle:hover svg {
  transform: rotate(5deg);
}

/* Widget Card */
.ai-widget-card {
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: 80vh;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease-out;
}

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

/* Header */
.ai-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--ai-color);
  color: white;
}

.ai-widget-title {
  font-weight: 600;
  font-size: 16px;
}

.ai-widget-close {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.ai-widget-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Messages */
.ai-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  max-height: 400px;
  scroll-behavior: smooth;
}

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

.ai-widget-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.ai-widget-messages::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.ai-widget-messages::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Messages */
.ai-widget-message {
  margin-bottom: 16px;
  animation: fadeIn 0.3s ease-out;
}

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

.ai-widget-message-user {
  display: flex;
  justify-content: flex-end;
}

.ai-widget-message-bot {
  display: flex;
  justify-content: flex-start;
}

.ai-widget-message-content {
  max-width: 280px;
  padding: 12px 16px;
  border-radius: 18px;
  word-wrap: break-word;
  font-size: 14px;
  line-height: 1.4;
}

.ai-widget-message-user .ai-widget-message-content {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

.ai-widget-message-bot .ai-widget-message-content {
  background: #f3f4f6;
  color: #1f2937;
  border-bottom-left-radius: 4px;
}

.ai-widget-message-time {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 4px;
  text-align: center;
}

/* Typing Indicator */
.ai-widget-typing {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: #6b7280;
  font-size: 14px;
}

.ai-widget-typing-dots {
  display: flex;
  gap: 4px;
  margin-right: 8px;
}

.ai-widget-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6b7280;
  animation: typingDot 1.4s infinite ease-in-out;
}

.ai-widget-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.ai-widget-typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingDot {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Input Row */
.ai-widget-input-row {
  display: flex;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
}

.ai-widget-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
  resize: none;
}

.ai-widget-input:focus {
  border-color: #667eea;
}

.ai-widget-btn {
  padding: 12px 20px;
  border: none;
  border-radius: 24px;
  background: var(--ai-color);
  color: white;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.ai-widget-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.ai-widget-btn:active {
  transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 480px) {
  .ai-widget-card {
    width: calc(100vw - 32px);
    max-height: 70vh;
  }

  .ai-widget-message-content {
    max-width: 240px;
  }
}

/* Dark Theme Support */
[data-theme="dark"] .ai-widget-card,
.ai-widget-dark .ai-widget-card {
  background: #1f2937;
  color: #f9fafb;
}

.ai-widget-dark .ai-widget-message-bot .ai-widget-message-content {
  background: #374151;
  color: #f9fafb;
}

.ai-widget-dark .ai-widget-input-row {
  background: #1f2937;
  border-top-color: #374151;
}

.ai-widget-dark .ai-widget-input {
  background: #374151;
  border-color: #4b5563;
  color: #f9fafb;
}

/* Animations */
.ai-widget-bounce {
  animation: bounce 0.6s ease;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

/* Hidden class */
.ai-hidden {
  display: none !important;
}
