/* Chat Interface Styles */

.chat-wrapper {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 380px;
  max-height: calc(100vh - 120px);
  background: #2a2a2a;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  display: none;
  flex-direction: column;
  overflow: hidden;
  transition: background 0.3s;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.3s, transform 0.3s;
  z-index: 1001;
}

.chat-wrapper.open {
  display: flex;
  opacity: 1;
  transform: scale(1);
}

.chat-toggle-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #cfb991;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  color: #1e1e1e;
  font-size: 28px;
  transition: all 0.3s;
  z-index: 1000;
  padding: 0;
}

.chat-toggle-btn:hover {
  background: #dcc9a8;
  /* transform: scale(1.1); */
}

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

.chat-header {
  padding: 16px 20px;
  border-bottom: 1px solid #3a3a3a;
  background: #2a2a2a;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-title {
  font-size: 16px;
  font-weight: 700;
  color: #cfb991;
  letter-spacing: 0.5px;
}

.chat-close-btn {
  background: none;
  border: none;
  color: #cfb991;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
}

.chat-close-btn:hover {
  background: #3a3a3a;
  color: #ff6b6b;
}

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

.chat-message {
  display: flex;
  gap: 12px;
  animation: fadeIn 0.2s ease;
}

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

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.chat-message.user .chat-avatar {
  background: #cfb991;
  color: #1e1e1e;
}

.chat-message.assistant .chat-avatar {
  background: #cfb991;
  color: #1e1e1e;
}

.chat-content {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  max-width: 85%;
  /* text-align: justify; */
}

.chat-message.user .chat-content {
  background: #cfb991;
  color: #1e1e1e;
  border-top-right-radius: 2px;
}

.chat-message.assistant .chat-content {
  background: #3a3a3a;
  color: #eee;
  border-top-left-radius: 2px;
}

.chat-input-area {
  padding: 16px;
  background: #2a2a2a;
  border-top: 1px solid #3a3a3a;
  display: flex;
  gap: 12px;
  align-items: center;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 15px;
  border: 1px solid #444;
  background: #1e1e1e;
  color: #eee;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

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

.chat-send {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #999;
  color: #1e1e1e;
  cursor: not-allowed;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, opacity 0.2s;
  opacity: 0.5;
  flex-shrink: 0;
}

.chat-send.active {
  background: #cfb991;
  cursor: pointer;
  opacity: 1;
}

.chat-send.active:hover {
  background: #dcc9a8;
}

.chat-send:hover {
  background: #dcc9a8;
}

.chat-suggestions {
  padding: 0 20px 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.suggestion-chip {
  padding: 8px 14px;
  border-radius: 18px;
  background: #3a3a3a;
  border: 1px solid #444;
  color: #bbb;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.suggestion-chip:hover {
  background: #444;
  color: #fff;
  border-color: #cfb991;
}

.loading-dots {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: #3a3a3a;
  border-radius: 12px;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  background: #cfb991;
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out;
}

.loading-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

/* Light mode overrides */
body.light .chat-wrapper {
  background: #e5e5e5;
}

body.light .chat-header {
  border-bottom-color: #ddd;
  background: #e5e5e5;
}

body.light .chat-close-btn {
  color: #8e6f3e;
}

body.light .chat-close-btn:hover {
  background: #ddd;
  color: #d94545;
}

body.light .chat-message.assistant .chat-content {
  background: #f0f0f0;
  color: #232323;
}

body.light .chat-input {
  background: #f4f4f7;
  border-color: #ddd;
  color: #232323;
}

body.light .chat-send {
  background: #8e6f3e;
  color: #fff;
}

body.light .chat-send:hover {
  background: #a8845f;
}

body.light .chat-message.user .chat-avatar {
  background: #cfb991;
  color: #1e1e1e;
}

body.light .chat-message.user .chat-content {
  background: #e8dcc8;
  color: #232323;
  border-bottom-right-radius: 2px;
}

body.light .chat-input:focus {
  border-color: #8e6f3e;
}

body.light .suggestion-chip:hover {
  border-color: #8e6f3e;
  color: #232323;
}

body.light .suggestion-chip {
  background: #f0f0f0;
  border-color: #ddd;
  color: #555;
}

body.light .suggestion-chip:hover {
  background: #e0e0e0;
}

body.light .chat-title {
  color: #232323;
}

body.light .chat-input-area {
  background: #e5e5e5;
  border-top-color: #ddd;
}

body.light .loading-dots {
  background: #f0f0f0;
}

body.light .chat-message.user .chat-content {
  background: #7a5a1a;
  color: #fff;
}

body.light .chat-toggle-btn {
  background: #cfb991;
  color: #232323;
}

body.light .chat-toggle-btn:hover {
  background: #a88551;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* Hide chat on small screens */
/* @media (max-width: 1400px) {
  .chat-toggle-btn {
    display: none;
  }
} */
