/* Watermark Styles */
#vessail-watermark {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  pointer-events: auto;
  transition: all 0.3s ease;
}

#vessail-watermark .text {
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 10px 14px;
  border-radius: 20px;
  font-size: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0.95;
  margin-top: 10px;
  cursor: pointer;
  font-weight: 500;
}

#vessail-watermark .text:hover {
  opacity: 1;
  transform: translateY(-1px);
}

/* Chat Icon */
/* Chat Text - Styled like bot message */
#chat-text {
  background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
  color: white;
  padding: 14px 18px;
  border-radius: 22px;
  border-bottom-left-radius: 6px;
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  margin-bottom: 10px;
  cursor: pointer;
  opacity: 0.95;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  box-shadow: 0 4px 16px rgba(33, 150, 243, 0.25), 0 2px 8px rgba(0, 0, 0, 0.1);
  max-width: 160px;
  word-wrap: break-word;
  position: relative;
  animation: slideInFromBottom 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  left: -80px;
  top: 0;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#chat-text:hover {
  opacity: 1;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 20px rgba(33, 150, 243, 0.35), 0 4px 12px rgba(0, 0, 0, 0.15);
}

#chat-text.chat-text-hidden {
  opacity: 0;
  transform: translateY(10px) scale(0.9);
  pointer-events: none;
}

#chat-text::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 25px;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 12px solid #1976D2;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

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

#chat-toggle {
  position: relative;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(33, 150, 243, 0.4), 0 0 0 0 rgba(33, 150, 243, 0.7);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  margin-bottom: 12px;
  animation: gentlePulse 2s infinite;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#chat-toggle:hover {
  transform: scale(1.12) rotate(8deg);
  box-shadow: 0 10px 30px rgba(33, 150, 243, 0.6), 0 0 20px rgba(33, 150, 243, 0.4);
  animation-play-state: paused;
}

#chat-toggle::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  transition: all 0.3s ease;
}

#chat-toggle:hover::before {
  transform: translate(-50%, -50%) scale(1.1);
}

@keyframes gentlePulse {
  0%, 100% {
    box-shadow: 0 6px 24px rgba(33, 150, 243, 0.4), 0 0 0 0 rgba(33, 150, 243, 0.7);
  }
  50% {
    box-shadow: 0 6px 24px rgba(33, 150, 243, 0.4), 0 0 0 8px rgba(33, 150, 243, 0);
  }
}

/* Zenith Chat Box */
#zenith-chat {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 360px;
  height: 520px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 999998;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(20px);
  opacity: 0;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

#zenith-chat.active {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

/* Header */
#zenith-chat-header {
  background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
  color: white;
  padding: 18px 20px;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#close-chat {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

#close-chat:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* Messages Area */
#chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: linear-gradient(to bottom, #f0f8ff 0%, #e6f3ff 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(33, 150, 243, 0.3) transparent;
}

#chat-messages::-webkit-scrollbar {
  width: 4px;
}

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

#chat-messages::-webkit-scrollbar-thumb {
  background: rgba(33, 150, 243, 0.3);
  border-radius: 2px;
}

.message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 20px;
  word-wrap: break-word;
  animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  position: relative;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.4;
}

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

.bot-message {
  background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
  color: white;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  margin-left: 0;
}

.user-message {
  background: linear-gradient(135deg, #E1F5FE 0%, #B3E5FC 100%);
  color: #0277BD;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  margin-right: 0;
  text-align: left;
}

/* Loading Animation - Centered in bubble */
.streaming-message {
  background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
  color: white;
  align-self: flex-start;
  border-radius: 20px;
  border-bottom-left-radius: 4px;
  padding: 16px;
  max-width: 85%;
  word-wrap: break-word;
  white-space: pre-wrap;
  transition: all 0.3s ease;
  position: relative;
  line-height: 1.4;
  font-size: 15px;
  display: block;
  min-height: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: visible;
}

.streaming-message.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
}

.loading-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.loading-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  animation: loadingBounce 1.4s infinite ease-in-out both;
}

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

@keyframes loadingBounce {
  0%, 80%, 100% {
    transform: scale(0.6) translateY(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1) translateY(-4px);
    opacity: 1;
  }
}

.streaming-message::after {
  content: '';
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 12px;
  height: 12px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  animation: typingPulse 1.5s infinite;
}

@keyframes typingPulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.2); }
}

/* Input Area */
#chat-input-area {
  padding: 16px 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  gap: 12px;
  background: white;
  align-items: center;
}

#chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 25px;
  outline: none;
  font-size: 15px;
  transition: all 0.2s ease;
  background: #f8f9fa;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#chat-input:focus {
  border-color: #2196F3;
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
  background: white;
}

#send-message {
  background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.2s ease;
  min-width: 60px;
}

#send-message:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

#send-message:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Responsive */
@media (max-width: 768px) {
  #zenith-chat {
    width: 95vw;
    height: 80vh;
    bottom: 80px;
    right: 2.5vw;
    left: 2.5vw;
    margin: 0 auto;
  }

  #chat-toggle {
    width: 50px;
    height: 50px;
  }

  #chat-toggle::before {
    width: 26px;
    height: 26px;
  }

  .message,
  .streaming-message {
    max-width: 90%;
    font-size: 14px;
  }

  #chat-input-area {
    padding: 12px 16px;
  }
}