/**
 * TerraVector AI Chat Widget Styles
 *
 * Matches TerraVector design system:
 * - Colors: earth, clay, chalk, stone, ink
 * - Fonts: Space Grotesk (headings), DM Sans (body)
 */

/* Floating Chat Button */
.chat-button {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--clay, #B8896A);
  border: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999;
}

.chat-button:hover {
  background: #a37959;
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.chat-button.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}

/* Chat Widget Panel */
.chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 48px);
  height: 600px;
  max-height: calc(100vh - 100px);
  background: var(--chalk, #F7F4EF);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95) translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  overflow: hidden;
}

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

/* Chat Header */
.chat-header {
  background: var(--earth, #2C3E2D);
  color: var(--chalk, #F7F4EF);
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.chat-header-content h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px 0;
}

.chat-header-content p {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--mist, #D4CFC7);
  margin: 0;
}

.chat-close {
  background: none;
  border: none;
  color: var(--mist, #D4CFC7);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.chat-close:hover {
  color: var(--chalk, #F7F4EF);
  background: rgba(255, 255, 255, 0.1);
}

/* Chat Messages Area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: white;
}

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

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

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--mist, #D4CFC7);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--stone, #6B7B6E);
}

/* Welcome Message */
.chat-welcome {
  text-align: center;
  padding: 24px 16px;
  color: var(--stone, #6B7B6E);
}

.chat-welcome-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.chat-welcome p {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  margin: 8px 0;
}

.chat-welcome strong {
  color: var(--ink, #1A1E1A);
  font-weight: 600;
}

/* Chat Messages */
.chat-message {
  display: flex;
  gap: 12px;
  animation: slideUp 0.3s ease;
}

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

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

.chat-message-assistant {
  justify-content: flex-start;
}

.chat-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--clay, #B8896A);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.chat-message-content {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 75%;
  word-wrap: break-word;
}

.chat-message-user .chat-message-content {
  background: var(--clay, #B8896A);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-message-assistant .chat-message-content {
  background: var(--sand, #E8DFD0);
  color: var(--ink, #1A1E1A);
  border-bottom-left-radius: 4px;
}

/* Loading Animation */
.chat-message.loading .chat-message-content {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* Chat Form */
.chat-form {
  display: flex;
  gap: 8px;
  padding: 16px;
  background: var(--chalk, #F7F4EF);
  border-top: 1px solid var(--sand, #E8DFD0);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--sand, #E8DFD0);
  border-radius: 24px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
  background: white;
  color: var(--ink, #1A1E1A);
}

.chat-input:focus {
  border-color: var(--clay, #B8896A);
  box-shadow: 0 0 0 3px rgba(184, 137, 106, 0.1);
}

.chat-input::placeholder {
  color: var(--stone, #6B7B6E);
}

.chat-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--clay, #B8896A);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-send:hover {
  background: #a37959;
  transform: scale(1.05);
}

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

/* Mobile Responsive */
@media (max-width: 768px) {
  .chat-widget {
    width: 100%;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }

  .chat-button {
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
  }
}
