/**
 * TIHEST Chatbot Frontend Styles
 */

/* Base container styles */
.tihest-chatbot-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 350px;
  max-width: calc(100vw - 40px);
  height: 500px;
  max-height: calc(100vh - 100px);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: #fff;
  z-index: 999999;
  transition: all 0.3s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

/* Chat trigger button */
.tihest-chatbot-trigger {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #0bc3b7; /* TIHEST teal */
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 999999;
  transition: all 0.3s ease;
  overflow: hidden;
}

.tihest-chatbot-trigger:hover {
  background-color: #0a9b91;
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.tihest-chatbot-trigger-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Chat header */
.tihest-chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #0bc3b7; /* TIHEST teal */
  color: white;
  padding: 12px 16px;
}

.tihest-chatbot-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tihest-chatbot-logo {
  font-weight: 700;
  font-size: 16px;
}

.tihest-chatbot-title-text {
  font-weight: 500;
  font-size: 14px;
}

.tihest-chatbot-close-button {
  background: transparent;
  border: none;
  cursor: pointer;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.tihest-chatbot-close-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Messages container */
.tihest-chatbot-messages-container {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background-color: #f8f9fa;
}

/* Message styling */
.tihest-chatbot-message-container {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 100%;
  animation: fadeIn 0.3s ease-out forwards;
}

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

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

.tihest-chatbot-message-bot {
  justify-content: flex-start;
}

.tihest-chatbot-message {
  padding: 10px 14px;
  border-radius: 18px;
  max-width: 85%;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.tihest-chatbot-user-bubble {
  background-color: #0bc3b7; /* TIHEST teal */
  color: white;
  border-bottom-right-radius: 4px;
}

.tihest-chatbot-bot-bubble {
  background-color: #e9e9eb; /* Light gray */
  color: #1c1c1e;
  border-bottom-left-radius: 4px;
}

.tihest-chatbot-error-message {
  background-color: #ffecee;
  color: #e53935;
}

.tihest-chatbot-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: #0bc3b7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: white;
  font-size: 12px;
  flex-shrink: 0;
}

/* Typing indicator */
.tihest-chatbot-typing-indicator-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.tihest-chatbot-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  background-color: #e9e9eb;
  padding: 8px 12px;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
}

.tihest-chatbot-typing-dot {
  width: 8px;
  height: 8px;
  background-color: #999;
  border-radius: 50%;
  animation: typingAnimation 1.4s infinite ease-in-out both;
}

.tihest-chatbot-typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.tihest-chatbot-typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

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

/* Input area */
.tihest-chatbot-input-container {
  display: flex;
  padding: 12px;
  border-top: 1px solid #e1e1e1;
  background-color: #fff;
}

.tihest-chatbot-input {
  flex: 1;
  border: 1px solid #e1e1e1;
  border-radius: 18px;
  padding: 10px 14px;
  resize: none;
  outline: none;
  font-size: 14px;
  line-height: 1.5;
  font-family: inherit;
}

.tihest-chatbot-input:focus {
  border-color: #0bc3b7;
  box-shadow: 0 0 0 2px rgba(11, 195, 183, 0.1);
}

.tihest-chatbot-send-button {
  background-color: #0bc3b7;
  color: white;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  margin-left: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tihest-chatbot-send-button:hover {
  background-color: #0a9b91;
}

.tihest-chatbot-send-button.disabled {
  background-color: #ccc;
  cursor: not-allowed;
  opacity: 0.7;
}

/* Responsive adjustments */
@media (max-width: 576px) {
  .tihest-chatbot-widget {
    width: 100%;
    height: 100%;
    max-height: 100%;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }
  
  .tihest-chatbot-trigger {
    bottom: 10px;
    right: 10px;
  }
}
