/* Chat Widget Styles */
.chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--brand);
  border: none;
  color: var(--foreground);
  cursor: pointer;
  box-shadow: var(--shadow-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.3s, box-shadow 0.3s;
}

.chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-glow);
}

.chat-toggle:focus {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.chat-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--accent);
  color: var(--background);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  border: 2px solid var(--background);
}

.chat-window {
  width: 380px;
  height: 600px;
  background: var(--surface-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s ease-out;
  border: 1px solid var(--border);
}

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

.chat-header {
  background: var(--brand);
  color: var(--foreground);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.chat-avatar {
  width: 40px;
  height: 40px;
  background: rgba(15, 23, 42, 0.35);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.chat-title {
  font-weight: 600;
  font-size: 16px;
}

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

.chat-close {
  background: rgba(15, 23, 42, 0.35);
  border: none;
  color: var(--foreground);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.chat-close:hover {
  background: rgba(15, 23, 42, 0.5);
}

.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.5);
  border-radius: 3px;
}

.chat-message {
  display: flex;
  gap: 10px;
  animation: fadeIn 0.3s ease-out;
}

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

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.message-content {
  background: var(--surface);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  max-width: 70%;
  line-height: 1.5;
  font-size: 14px;
  box-shadow: 0 1px 2px rgba(2, 6, 23, 0.4);
  white-space: pre-line;
  color: var(--foreground);
  border: 1px solid var(--border);
}

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

.user-message .message-content {
  background: var(--brand);
  color: var(--foreground);
  border-color: transparent;
}

.user-message .message-avatar {
  background: rgba(15, 23, 42, 0.7);
}

.typing-indicator .message-content {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}

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

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

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

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

.chat-input-container {
  padding: 16px;
  background: var(--surface-strong);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  background: var(--surface);
  color: var(--foreground);
}

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

.chat-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--brand);
  border: none;
  color: var(--foreground);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
  flex-shrink: 0;
}

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

.chat-send-btn:active {
  transform: scale(0.95);
}

.chat-quick-actions {
  padding: 12px 16px;
  background: var(--surface-strong);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
}

.quick-action-btn {
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  color: var(--foreground);
}

.quick-action-btn:hover {
  background: var(--brand);
  color: var(--foreground);
  border-color: var(--brand);
}

/* Mobile responsive */
@media (max-width: 480px) {
  .chat-window {
    width: calc(100vw - 20px);
    height: calc(100vh - 100px);
    bottom: 10px;
    right: 10px;
  }
  
  .chat-toggle {
    width: 56px;
    height: 56px;
  }
}

/* Link styles in messages */
.message-content a {
  color: inherit;
  text-decoration: underline;
  font-weight: 600;
}

.bot-message .message-content a:hover {
  opacity: 0.8;
}
