/* ========== CHAT DRAWER STYLES ========== */

.chat-icon-btn {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #2A9B8E;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(42, 155, 142, 0.3);
  z-index: 999;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-size: 24px;
}

.chat-icon-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(42, 155, 142, 0.4);
}

.chat-icon-btn.hidden {
  display: none;
}

.chat-drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  max-width: 420px;
  height: 100dvh;
  background: white;
  box-shadow: -2px 0 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
  safe-area-inset-bottom: env(safe-area-inset-bottom);
}

.chat-drawer.open {
  right: 0;
}

.chat-header {
  padding: 12px 16px;
  background: #2A9B8E;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #ddd;
  flex-shrink: 0;
}

.chat-header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.chat-close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.chat-message {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

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

.chat-message-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-message.assistant .chat-message-bubble {
  background: #f0f0f0;
  color: #333;
}

.chat-message.user .chat-message-bubble {
  background: #2A9B8E;
  color: white;
}

.chat-input-area {
  padding: 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid #ddd;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 12px;
  font-size: 0.95rem;
  font-family: inherit;
  resize: none;
  max-height: 100px;
}

.chat-input:focus {
  outline: none;
  border-color: #2A9B8E;
  box-shadow: 0 0 0 3px rgba(42, 155, 142, 0.1);
}

.chat-send-btn {
  background: #2A9B8E;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s ease;
}

.chat-send-btn:hover:not(:disabled) {
  background: #238074;
}

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

.chat-loading {
  display: flex;
  gap: 4px;
  align-items: flex-end;
}

.chat-loading span {
  width: 8px;
  height: 8px;
  background: #666;
  border-radius: 50%;
  animation: bounce 1.4s infinite;
}

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

.chat-loading span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-8px); }
}

.chat-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.chat-overlay.open {
  opacity: 1;
  visibility: visible;
}

@media (max-width: 480px) {
  .chat-drawer {
    max-width: 100%;
  }

  .chat-message-bubble {
    max-width: 90%;
  }
}
