.chat-widget-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: 'Inter', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.chat-widget-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-orange), var(--accent-purple));
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(255, 107, 43, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 28px;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-widget-button:hover {
  transform: scale(1.1) rotate(5deg);
}

.chat-widget-window {
  width: 350px;
  max-height: 500px;
  height: 60vh;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  backdrop-filter: blur(10px);
}

.chat-widget-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.chat-widget-header {
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.chat-widget-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.chat-widget-title {
  color: #fff;
  font-weight: 600;
  font-size: 16px;
}

.chat-widget-subtitle {
  color: var(--text-muted);
  font-size: 12px;
}

.chat-widget-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 24px;
  transition: color 0.2s;
}

.chat-widget-close:hover {
  color: #fff;
}

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

/* Custom Webkit Scrollbar to force visibility */
.chat-widget-messages::-webkit-scrollbar {
  width: 6px;
}
.chat-widget-messages::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.02); 
}
.chat-widget-messages::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1); 
  border-radius: 10px;
}
.chat-widget-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.2); 
}

.chat-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap; /* Forces linebreaks to render properly */
  word-wrap: break-word;
  animation: messageSlideIn 0.3s ease forwards;
}

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

.chat-message.bot {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-color);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-message.user {
  background: var(--accent-orange);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-widget-input-area {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  gap: 8px;
}

.chat-widget-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 10px 16px;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.chat-widget-input::placeholder {
  color: var(--text-muted);
}

.chat-widget-input:focus {
  border-color: var(--accent-orange);
}

.chat-widget-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-orange);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.2s;
}

.chat-widget-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  max-width: max-content;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

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

@media (max-width: 480px) {
  .chat-widget-window {
    width: calc(100vw - 40px);
    right: 20px;
    bottom: 90px;
  }
}
