:root {
    --header-color: #0077BE;
    --bot-message-color: #E6F3FF;
    --user-message-color: #0077BE;
    --font-family: Arial;
    --font-size: 14px;
    --footer-bg-color: #0077BE;
    --footer-font-color: #ffffff;
    --footer-font-family: Arial;
    --footer-font-size: 12px;
    --input-bg-color: #ffffff;
    --user-font-color: #ffffff;
    --user-font-family: Arial;
    --user-font-size: 14px;
    --send-button-color: #0077BE;
    --chat-area-bg-color: #F0F8FF;
    --widget-color: #0077BE;
    --bot-font-color: #1a1a1a;
    --bot-font-family: Arial;
    --bot-font-size: 14px;
    --loading-dots-color: #0077BE;
    --header-svg-filter: brightness(0) invert(1);
    --bot-icon-filter: var(--custom-bot-icon-filter);
    --widget-icon-filter: var(--custom-widget-icon-filter);
}

.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    height: 600px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: none;  /* Start hidden */
    flex-direction: column;
    z-index: 1000;
    transition: all 0.3s ease;
    font-family: var(--font-family);
    font-size: var(--font-size);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

/* Show state */
.chatbot-container.show {
    display: flex !important;  /* Override any other display settings */
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.chatbot-header {
  display: flex;
  align-items: center;
  padding: 15px;
  background: var(--header-color);
  border-radius: 10px 10px 0 0;
  color: white;
}

.chatbot-header img {
  width: 30px;
  height: 30px;
  margin-right: 10px;
  border-radius: 50%;
}

.chatbot-header-title {
  flex-grow: 1;
  font-weight: 600;
}

.chatbot-controls {
  display: flex;
  gap: 10px;
}

.control-button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 5px;
}

.maximize-button i {
  font-size: 16px;
}

.close-button i {
  font-size: 18px;
}

.chat-messages {
  flex-grow: 1;
  overflow-y: auto;
  padding: 15px;
  background: var(--chat-area-bg-color);
}

.message {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
    width: 100%;
}

.message.bot {
    justify-content: flex-start;
}

.message.user {
    justify-content: flex-end;
}

.message-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  margin: 0 10px;
}

.message-content {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 15px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message.bot .bot-message-container {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.bot-icon {
  width: 24px;
  height: 24px;
  margin-top: 4px;
  border-radius: 50%;
  flex-shrink: 0;
}

.message.bot .message-content {
    background: var(--bot-message-color);
    color: var(--bot-font-color) !important;
    font-family: var(--bot-font-family);
    font-size: var(--bot-font-size);
    padding: 10px 15px;
    border-radius: 15px;
    max-width: 80%;
    margin: 5px 0;
    word-wrap: break-word;
}

.chatbot-container .chat-messages .message.bot .message-content,
.chatbot-container .message.bot .message-content p,
.chatbot-container .message.bot .message-content span,
.chatbot-container .message.bot .message-content div {
    color: var(--bot-font-color) !important;
}


.message.bot:first-child .message-content {
    color: var(--bot-font-color) !important;
}

.message.bot {
    opacity: 1 !important;
}

.message.bot .message-content {
    opacity: 1 !important;
}

.message.user .message-content {
    background: var(--user-message-color);
    color: var(--user-font-color);
    margin-right: 8px;
    font-family: var(--user-font-family);
    font-size: var(--user-font-size);
}

.chat-input-container {
  padding: 15px;
  border-top: 1px solid #eee;
}

.chat-form {
  display: flex;
  gap: 10px;
}

.chat-input {
  flex-grow: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 10px 15px;
  max-height: 60px;
  min-height: 40px;
  resize: none;
  background: var(--input-bg-color);
}

.attachment-button {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 5px;
}

.send-button {
  background: var(--send-button-color);
  border: none;
  color: white;
  padding: 8px 15px;
  border-radius: 20px;
  cursor: pointer;
}

.chatbot-footer {
  padding: 10px;
  text-align: center;
  color: var(--footer-font-color);
  font-size: var(--footer-font-size);
  border-top: 1px solid #eee;
  background: var(--footer-bg-color);
  font-family: var(--footer-font-family);
}

/* Maximized state */
.chatbot-container.maximized {
  width: 80vw;
  height: 80vh;
}

/* Chat toggle styles */
.chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    z-index: 999;
    transition: all 0.3s ease;
}

.toggle-message {
    background-color: var(--widget-color);
    color: #ffffff;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    margin-right: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.chat-toggle img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.chat-toggle:hover .toggle-message {
    opacity: 0.9;
}

.chat-toggle:hover img {
    transform: scale(1.1);
}

.chat-toggle.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

#chat-toggle {
  display: inline-block;
  cursor: pointer;
  margin-right: 10px;
  position: fixed;
  bottom: 10px;
  right: 10px;
  color: #333;
  font-size: 14px;
  z-index: 10000;
}

#close-btn {
  position: absolute;
  right: 10px;
  top: 10px;
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

.processing-message {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 0;
}

.processing-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 70px;
  height: 20px;
  position: relative;
}

/* First dot */
.processing-dots::before {
  content: "";
  width: 14px;
  height: 14px;
  background-color: var(--loading-dots-color, #0077BE);
  border-radius: 50%;
  animation: wave 1.4s ease-in-out infinite;
  animation-delay: 0s;
}

/* Middle dot using box-shadow trick on the ::before element */
.processing-dots::before {
  box-shadow: 22px 0 0 0 var(--loading-dots-color, #0077BE),
              44px 0 0 0 var(--loading-dots-color, #0077BE);
  animation: wave-with-shadows 1.4s ease-in-out infinite;
}

.chat-toggle-message {
  background: #00a5c6;
  color: #fff;
  padding: 10px;
  border-radius: 20px;
  margin-right: 10px;
}

.toggle-animation {
  animation: bounce 1s infinite;
}

@keyframes wave-with-shadows {
  0% {
    transform: translateY(0) scale(1);
    opacity: 0.8;
    box-shadow: 22px 0 0 0 var(--loading-dots-color, #0077BE),
                44px 0 0 0 var(--loading-dots-color, #0077BE);
  }
  16.67% {
    transform: translateY(-12px) scale(1.3);
    opacity: 1;
    box-shadow: 22px 0 0 0 var(--loading-dots-color, #0077BE),
                44px 0 0 0 var(--loading-dots-color, #0077BE);
  }
  33.34% {
    transform: translateY(0) scale(1);
    opacity: 0.8;
    box-shadow: 22px -12px 0 0 var(--loading-dots-color, #0077BE),
                44px 0 0 0 var(--loading-dots-color, #0077BE);
  }
  50% {
    transform: translateY(0) scale(1);
    opacity: 0.8;
    box-shadow: 22px 0 0 0 var(--loading-dots-color, #0077BE),
                44px 0 0 0 var(--loading-dots-color, #0077BE);
  }
  66.67% {
    transform: translateY(0) scale(1);
    opacity: 0.8;
    box-shadow: 22px 0 0 0 var(--loading-dots-color, #0077BE),
                44px -12px 0 0 var(--loading-dots-color, #0077BE);
  }
  83.34% {
    transform: translateY(0) scale(1);
    opacity: 0.8;
    box-shadow: 22px 0 0 0 var(--loading-dots-color, #0077BE),
                44px 0 0 0 var(--loading-dots-color, #0077BE);
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 0.8;
    box-shadow: 22px 0 0 0 var(--loading-dots-color, #0077BE),
                44px 0 0 0 var(--loading-dots-color, #0077BE);
  }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@media screen and (max-width: 768px) {
  #chatbot-container {
    width: 90%;
    height: 80vh;
    right: 5%;
    bottom: 10%;
  }
  
  #chat-messages {
    height: 70%;
  }
}

/* Dark theme styles */
.chatbot-container.dark-theme {
  background: #2d2d2d;
  color: #fff;
}

.dark-theme .chat-messages {
  background: #1f1f1f;
}

.dark-theme .message.bot .message-content {
  background: #3d3d3d;
  color: #fff;
}

.dark-theme .chat-input {
  background: #3d3d3d;
  color: #fff;
  border-color: #4d4d4d;
}

/* Preview specific styles */
.preview-container {
    margin: 20px 0;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 10px;
    display: block !important;
}

#preview-chatbot {
    position: relative;
    width: 350px;
    height: 500px;
    margin: 0 auto;
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
}

/* Update SVG-specific styles */
.chatbot-header img[src$=".svg"] {
    filter: var(--header-svg-filter) !important;
}

.message.bot .bot-icon[src$=".svg"] {
    filter: var(--bot-icon-filter) !important;
}

.chat-toggle img[src$=".svg"] {
    filter: var(--widget-icon-filter) !important;
}

/* Ensure bot icon in messages is visible and properly sized */
.message.bot .bot-icon {
    width: 24px;
    height: 24px;
    margin-top: 4px;
    display: inline-block;
    vertical-align: top;
} 