/* AI Shopping Assistant Frontend Styles */

#ai-shopping-assistant-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
}

.ai-chat-toggle {
  min-width: 60px;
  height: 50px;
  border-radius: 30px;
  background: linear-gradient(
    135deg,
    var(--ai-gradient-1, #667eea) 0%,
    var(--ai-gradient-2, #764ba2) 100%
  );
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: white;
  padding: 0 20px;
  gap: 8px;
}

.ai-chat-icon,
.ai-chat-close {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-chat-toggle-label {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  display: block;
}

.ai-chat-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
  border-radius: 30px;
  min-width: auto;
  width: auto;
}

.ai-chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  height: 500px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s ease;
  max-width: calc(100vw - 40px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.ai-chat-window.closing {
  animation: slideDown 0.3s ease;
}

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

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

.ai-chat-header {
  background: linear-gradient(
    135deg,
    var(--ai-gradient-1, #667eea) 0%,
    var(--ai-gradient-2, #764ba2) 100%
  );
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.ai-chat-avatar {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-chat-title h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.ai-chat-status {
  font-size: 12px;
  opacity: 0.9;
}

.ai-chat-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ai-chat-action-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-chat-action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-message {
  display: flex;
  gap: 8px;
}

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

.ai-message-content {
  max-width: 75%;
}

.ai-message-text {
  background: #f3f4f6;
  padding: 12px 16px;
  border-radius: 18px 18px 18px 4px;
  color: #374151;
  line-height: 1.5;
  font-size: 14px;
}

.ai-message-text br {
  line-height: 1.8;
}

.ai-message-text strong {
  font-weight: 600;
  color: #1f2937;
}

.ai-message.user .ai-message-text strong {
  color: rgba(255, 255, 255, 0.95);
}

.ai-message.user .ai-message-text {
  background: linear-gradient(
    135deg,
    var(--ai-gradient-1, #667eea) 0%,
    var(--ai-gradient-2, #764ba2) 100%
  );
  color: white;
  border-radius: 18px 18px 4px 18px;
}

.ai-products-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.ai-product-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  gap: 12px;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
}

.ai-product-card:hover {
  border-color: var(--ai-gradient-1, #667eea);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  text-decoration: none;
  color: inherit;
}

.ai-product-image {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.ai-product-details {
  flex: 1;
  min-width: 0;
}

.ai-product-name {
  font-weight: 600;
  font-size: 13px;
  margin: 0 0 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-product-price {
  color: var(--ai-gradient-1, #667eea);
  font-weight: 600;
  font-size: 14px;
  margin: 0 0 4px 0;
}

.ai-product-category {
  color: #6b7280;
  font-size: 12px;
  margin: 0;
}

.ai-chat-input-container {
  border-top: 1px solid #e5e7eb;
  padding: 16px 20px;
  background: white;
}

.ai-chat-form {
  display: flex;
}

.ai-chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
}

.ai-chat-input {
  flex: 1;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  padding: 12px 16px;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  max-height: 50px;
  min-height: 32px;
  line-height: 1.4;
}

.ai-chat-input:focus {
  border-color: var(--ai-gradient-1, #667eea);
}

.ai-chat-send-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    var(--ai-gradient-1, #667eea) 0%,
    var(--ai-gradient-2, #764ba2) 100%
  );
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.ai-chat-send-btn:hover {
  transform: scale(1.05);
}

.ai-chat-send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.ai-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #6b7280;
  font-style: italic;
}

.ai-loading-dots {
  display: inline-flex;
  gap: 2px;
}

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

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

#ai-chat-input {
  min-height: 50px !important;
}

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

/* Responsive Design */
@media (max-width: 768px) {
  .ai-chat-window {
    width: calc(100vw - 30px);
    max-width: none;
  }
}

@media (max-width: 480px) {
  .ai-chat-window {
    width: calc(100vw);
    right: -10px;
    height: 70vh;
    bottom: 70px;
  }

  #ai-shopping-assistant-widget {
    right: 10px;
    bottom: 10px;
  }
}
