/* ============================================
   AI Components - Unified Design System
   Consistent styles for all AI-powered features
   ============================================ */

/* AI Gradient - Brand Purple */
:root {
  --ai-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --ai-color-start: #667eea;
  --ai-color-end: #764ba2;
  --ai-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
  --ai-shadow-hover: 0 6px 25px rgba(102, 126, 234, 0.5);
}

/* ============================================
   AI Buttons
   ============================================ */

.btn-ai,
.btn-gradient,
.ai-button {
  background: var(--ai-gradient);
  color: white;
  border: none;
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--ai-shadow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.btn-ai:hover,
.btn-gradient:hover,
.ai-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--ai-shadow-hover);
}

.btn-ai:active,
.btn-gradient:active,
.ai-button:active {
  transform: translateY(0);
}

.btn-ai:disabled,
.btn-gradient:disabled,
.ai-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* AI Button Sizes */
.btn-ai.btn-sm {
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--font-size-sm);
}

.btn-ai.btn-lg {
  padding: var(--space-lg) var(--space-2xl);
  font-size: var(--font-size-lg);
}

/* ============================================
   AI Quick Action Buttons
   ============================================ */

.quick-action-btn,
.ai-quick-btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg-elevated);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.quick-action-btn:hover,
.ai-quick-btn:hover {
  border-color: var(--ai-color-start);
  background: var(--ai-gradient);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.quick-action-btn svg,
.ai-quick-btn svg {
  flex-shrink: 0;
  stroke: currentColor;
}

/* ============================================
   AI Chat Interface
   ============================================ */

.ai-chat-container,
.ai-search-container {
  background: var(--color-bg-elevated);
  border: 2px solid var(--ai-color-start);
  border-radius: var(--radius-xl);
  box-shadow: 0 8px 32px rgba(102, 126, 234, 0.15);
  overflow: hidden;
}

.ai-chat-messages,
.chat-messages-ai {
  height: 300px;
  max-height: 400px;
  overflow-y: auto;
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  scroll-behavior: smooth;
  background: var(--color-bg);
}

.chat-message {
  display: flex;
  gap: var(--space-sm);
  animation: slideIn 0.3s ease;
}

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

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ai-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  flex-shrink: 0;
}

.chat-message.user .message-avatar {
  background: var(--color-text);
}

.message-content {
  flex: 1;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  max-width: 70%;
  color: var(--color-text);
}

.chat-message.user .message-content {
  background: var(--ai-gradient);
  color: white;
  border-color: var(--ai-color-start);
}

.message-content p {
  margin: 0;
  line-height: var(--line-height-relaxed);
}

.message-content p:not(:last-child) {
  margin-bottom: var(--space-sm);
}

.message-content strong {
  font-weight: var(--font-weight-bold);
  display: block;
  margin-bottom: var(--space-xs);
}

/* ============================================
   AI Input Forms
   ============================================ */

.ai-chat-form,
.ai-search-form,
.ai-input-form {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--color-bg-elevated);
  border-top: 1px solid var(--color-border);
}

.ai-chat-input,
.ai-search-input {
  flex: 1;
  padding: var(--space-md) var(--space-lg);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--font-size-base);
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-bg);
  transition: all 0.3s ease;
}

.ai-chat-input:focus,
.ai-search-input:focus {
  outline: none;
  border-color: var(--ai-color-start);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.ai-chat-input::placeholder,
.ai-search-input::placeholder {
  color: var(--color-text-secondary);
}

.ai-submit-btn,
.ai-chat-submit,
.ai-search-submit {
  width: 48px;
  height: 48px;
  background: var(--ai-gradient);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-submit-btn:hover,
.ai-chat-submit:hover,
.ai-search-submit:hover {
  transform: scale(1.1) rotate(15deg);
  box-shadow: var(--ai-shadow);
}

.ai-submit-btn:active,
.ai-chat-submit:active,
.ai-search-submit:active {
  transform: scale(0.95) rotate(15deg);
}

/* ============================================
   AI Modals
   ============================================ */

.ai-modal-header,
.modal-header.ai-header {
  background: var(--ai-gradient);
  color: white;
  padding: var(--space-xl);
  border-bottom: none;
}

.ai-modal-header h2,
.ai-modal-header h3 {
  color: white;
  margin: 0;
}

.ai-modal-header .modal-close {
  color: white;
}

/* ============================================
   AI Cards & Containers
   ============================================ */

.ai-card,
.card-ai {
  background: var(--color-bg-elevated);
  border: 2px solid var(--ai-color-start);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: 0 8px 32px rgba(102, 126, 234, 0.15);
}

.ai-header,
.ai-banner {
  background: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0.05) 0%,
    rgba(118, 75, 162, 0.05) 100%
  );
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-md);
}

/* ============================================
   AI Indicators & Badges
   ============================================ */

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: var(--ai-gradient);
  color: white;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: var(--space-sm);
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--ai-color-start);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
  0%,
  60%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-10px);
  }
}

/* ============================================
   AI Animations
   ============================================ */

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

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

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ============================================
   Dark Mode Support
   ============================================ */

[data-theme="dark"] .quick-action-btn,
[data-theme="dark"] .ai-quick-btn {
  background: var(--color-bg);
  color: var(--color-text);
  border-color: var(--color-border);
}

[data-theme="dark"] .quick-action-btn:hover,
[data-theme="dark"] .ai-quick-btn:hover {
  background: var(--ai-gradient);
  color: white;
  border-color: var(--ai-color-start);
}

[data-theme="dark"] .ai-chat-messages,
[data-theme="dark"] .chat-messages-ai {
  background: var(--color-bg);
}

[data-theme="dark"] .message-content {
  background: var(--color-bg-elevated);
  color: var(--color-text);
}

[data-theme="dark"] .chat-message.user .message-content {
  background: var(--ai-gradient);
  color: white;
}

[data-theme="dark"] .ai-chat-input,
[data-theme="dark"] .ai-search-input {
  background: var(--color-bg);
  color: var(--color-text);
  border-color: var(--color-border);
}

[data-theme="dark"] .ai-chat-input::placeholder,
[data-theme="dark"] .ai-search-input::placeholder {
  color: var(--color-text-secondary);
}

[data-theme="dark"] .ai-header,
[data-theme="dark"] .ai-banner {
  background: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0.1) 0%,
    rgba(118, 75, 162, 0.1) 100%
  );
}

/* ============================================
   Responsive Adjustments
   ============================================ */

@media (max-width: 768px) {
  .ai-chat-messages,
  .chat-messages-ai {
    height: 250px;
    padding: var(--space-md);
  }

  .message-content {
    max-width: 80%;
  }

  .btn-ai.btn-lg {
    padding: var(--space-md) var(--space-xl);
    font-size: var(--font-size-base);
  }

  .quick-action-btn,
  .ai-quick-btn {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-xs);
  }
}

@media (max-width: 480px) {
  .ai-chat-messages,
  .chat-messages-ai {
    height: 200px;
  }

  .message-avatar {
    width: 28px;
    height: 28px;
    font-size: var(--font-size-xs);
  }

  .ai-submit-btn,
  .ai-chat-submit,
  .ai-search-submit {
    width: 40px;
    height: 40px;
  }
}
