/* AI Chat Widget Styles */
.ai-chat-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 229, 160, 0.4);
  transition: all 0.3s ease;
  z-index: 999;
  animation: pulse-glow 2s infinite;
}

.ai-chat-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(0, 229, 160, 0.6);
}

.ai-chat-btn svg {
  width: 28px;
  height: 28px;
  stroke: var(--dark);
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 4px 20px rgba(0, 229, 160, 0.4);
  }
  50% {
    box-shadow: 0 4px 30px rgba(0, 229, 160, 0.7);
  }
}

.ai-chat-window {
  position: fixed;
  bottom: 6rem;
  right: 2rem;
  width: 380px;
  max-width: calc(100vw - 4rem);
  height: 500px;
  max-height: calc(100vh - 12rem);
  background: var(--dark);
  border: 1px solid var(--gray);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  display: none;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
  animation: slideIn 0.3s ease;
}

.ai-chat-window.active {
  display: flex;
}

/* Hide chat button when chat is open */
.ai-chat-window.active ~ .ai-chat-btn,
body.chat-open .ai-chat-btn {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}

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

.ai-chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: var(--gray);
  border-bottom: 1px solid var(--gray-light);
}

.ai-chat-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1rem;
  color: var(--light);
}

.ai-chat-title svg {
  width: 24px;
  height: 24px;
}

.ai-chat-close {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--gray-light);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.ai-chat-close:hover {
  background: var(--primary);
}

.ai-chat-close svg {
  width: 16px;
  height: 16px;
  stroke: var(--light);
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ai-message {
  display: flex;
  animation: messageIn 0.3s ease;
}

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

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

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

.ai-message-content {
  max-width: 85%;
  padding: 0.875rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.ai-message-bot .ai-message-content {
  background: var(--gray);
  border: 1px solid var(--gray-light);
  color: var(--light);
  border-bottom-left-radius: 4px;
}

.ai-message-user .ai-message-content {
  background: var(--primary);
  color: var(--dark);
  border-bottom-right-radius: 4px;
}

.ai-message-content p {
  margin: 0;
}

.ai-message-content p + p {
  margin-top: 0.5rem;
}

.ai-status {
  font-family: 'Space Mono', monospace;
  font-size: 0.8rem;
  color: #888 !important;
  padding-top: 0.5rem;
  border-top: 1px solid var(--gray-light);
  margin-top: 0.75rem !important;
}

.ai-chat-input {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--gray);
  border-top: 1px solid var(--gray-light);
}

.ai-chat-input input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--gray-light);
  border: 1px solid var(--gray);
  border-radius: 8px;
  color: var(--light);
  font-family: 'Syne', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.3s ease;
}

.ai-chat-input input:focus {
  border-color: var(--primary);
}

.ai-chat-input input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ai-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.ai-send-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.ai-send-btn svg {
  width: 18px;
  height: 18px;
  stroke: var(--dark);
}

/* Scrollbar Styling */
.ai-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-track {
  background: var(--gray-light);
  border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
  background: var(--gray);
  border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
  .ai-chat-btn {
    bottom: 1.5rem;
    right: 1.5rem;
    width: 54px;
    height: 54px;
  }
  
  .ai-chat-btn svg {
    width: 24px;
    height: 24px;
  }
  
  .ai-chat-window {
    bottom: 5.5rem;
    right: 1.5rem;
    left: 1.5rem;
    width: auto;
    max-width: none;
    height: calc(100vh - 14rem);
  }
}
