.chat-widget-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    sans-serif;
}

@media (max-width: 640px) {
  .chat-widget-container {
    bottom: 16px;
    right: 16px;
  }
}

.chat-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  border: none;
  color: white;
}

@media (max-width: 640px) {
  .chat-button {
    width: 52px;
    height: 52px;
  }
}

.chat-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}

.chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  height: 550px;
  max-height: calc(100vh - 120px);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
}

@media (max-width: 1024px) {
  .chat-window {
    width: 360px;
    max-height: calc(100vh - 100px);
  }
}

@media (max-width: 640px) {
  .chat-window {
    width: calc(100vw - 32px);
    height: 70vh;
    max-height: calc(100vh - 90px);
    bottom: 70px;
    right: -8px;
    border-radius: 16px;
  }
}

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

.chat-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  color: white;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 640px) {
  .chat-header {
    padding: 16px;
  }
}

.chat-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  position: relative;
  top: 4px;
}

.chat-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
}

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

@media (max-width: 640px) {
  .chat-messages {
    padding: 16px;
    gap: 12px;
  }
}

.message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 15px;
  font-size: 0.95rem;
  line-height: 1.4;
}

@media (max-width: 640px) {
  .message {
    max-width: 90%;
    padding: 10px 14px;
    font-size: 0.9rem;
  }
}

.message.user {
  align-self: flex-end;
  background: #3b82f6;
  color: white;
  border-bottom-right-radius: 4px;
}

.message.ai {
  align-self: flex-start;
  background: #f1f5f9;
  color: #1e293b;
  border-bottom-left-radius: 4px;
}

.message.ai .model-link {
  color: #0072ce;
  text-decoration: underline;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.message.ai .model-link:hover {
  opacity: 0.7;
}

/* Product Card Styles */
.product-card-container {
  margin: 12px 0;
  width: 100%;
}

.product-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.product-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.2s ease;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.product-card:hover {
  border-color: #0072ce;
  box-shadow: 0 4px 12px rgba(0, 114, 206, 0.15);
  transform: translateY(-2px);
}

.card-image {
  width: 100%;
  height: 140px;
  background: #f8f9fa;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-content {
  padding: 12px;
}

.card-model {
  font-size: 0.75rem;
  color: #0072ce;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.card-title {
  margin: 0 0 6px 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.3;
}

.card-description {
  margin: 0 0 8px 0;
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-categories {
  font-size: 0.75rem;
  color: #0072ce;
  margin-bottom: 8px;
  font-weight: 500;
}

.card-cta {
  font-size: 0.85rem;
  color: #0072ce;
  font-weight: 600;
  transition: all 0.2s ease;
}

.product-card:hover .card-cta {
  color: #005ba3;
}

/* Loading Skeleton */
.product-card.loading {
  pointer-events: none;
}

.card-image-skeleton {
  width: 100%;
  height: 140px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

.card-title-skeleton,
.card-desc-skeleton {
  height: 8px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 4px;
  margin: 8px 0;
}

.card-title-skeleton {
  height: 12px;
  width: 70%;
}

.card-desc-skeleton {
  width: 100%;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.chat-input-area {
  padding: 20px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 10px;
}

@media (max-width: 640px) {
  .chat-input-area {
    padding: 16px;
    gap: 8px;
  }
}

.chat-input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 25px;
  padding: 10px 20px;
  outline: none;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

@media (max-width: 640px) {
  .chat-input {
    padding: 8px 16px;
    font-size: 0.9rem;
  }
}

.chat-input:focus {
  border-color: #3b82f6;
}

.send-button {
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

@media (max-width: 640px) {
  .send-button {
    width: 36px;
    height: 36px;
  }
}

.send-button:hover {
  background: #2563eb;
}

.typing-indicator {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: #f1f5f9;
  border-radius: 15px;
  width: fit-content;
  margin-bottom: 20px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: #94a3b8;
  border-radius: 50%;
  animation: typing 1s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}
.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}
