/* Основний контейнер чат-боту */
#custom-chat-bot {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  width: 100%;
  max-width: 416px;
  height: 85dvh;
  max-height: 721px;
  overflow: hidden;
  font-family: Satoshi-Regular, sans-serif;
  color: var(--e-global-color-text);
  background: #070B12;
  border-bottom: 1px solid rgb(240 243 250 / 8%);
  border-radius: 16px;
  box-shadow: 0 0 0.438px 0 rgb(0 0 0 / 70%), 0 8.767px 13.15px 0 rgb(0 0 0 / 30%), 0 4.383px 21.916px 0 rgb(0 0 0 / 20%);
  transition: all 0.3s ease;
}

/* Контейнер чату */
.chat-bot-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

/* Шапка чату */
.chat-bot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  color: var(--e-global-color-text);
  background: #070B12;
  border-bottom: 1px solid rgb(240 243 250 / 8%);
}

.chat-bot-header img {
  width: 67px;
  height: 25px;
  object-fit: contain;
}

.chat-bot-header button {
  padding: 12px 20px;
  font-size: 20px;
  color: var(--e-global-color-text);
  cursor: pointer;
  background: transparent;
  border: none;
  transition-duration: 0.5s;
}

.chat-bot-header button:hover {
  color: red;
}

/* Область повідомлень */
.chat-bot-messages {
  flex-grow: 1;
  padding: 12px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--e-global-color-text);
  background: rgb(240 243 250 / 4%);
}

/* Повідомлення */
.chat-message {
  max-width: 90%;
  padding: 10px 15px;
  word-wrap: break-word;
  border-radius: 15px;
}

.chat-message:has(.chat-bot-contact-form) {
  width: 100%;
  max-width: initial;
  padding: initial;
}

.chat-message:has(.chat-bot-contact-form) .bot-icon {
  display: none;
}

.chat-message:has(.chat-bot-contact-form) .message-content {
  width: 100%;
  max-width: initial;
}

.bot-message .bot-content-wrapper {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 15px;
}

.bot-message .bot-icon {
  display: inline-block;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
}

.bot-message .bot-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.bot-message .message-content {
  display: inline-block;
  align-self: flex-start;
  padding: 12px 16px;
  overflow: hidden;
  color: var(--e-global-color-text);
  background: rgb(240 243 250 / 4%);
  border-radius: 16px;
}

.user-message {
  align-self: flex-end;
  margin-left: auto;
  color: var(--e-global-color-text);
  background-color: var(--e-global-color-brand);
  border-top-right-radius: 5px;
}

/* Кнопки варіантів */
.message-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
}

.chat-bot-button {
  padding: 12px 16px;
  color: var(--e-global-color-text);
  cursor: pointer;
  background-color: transparent;
  border: 1px solid var(--e-global-color-brand);
  border-radius: 12px;
  transition: all 0.2s;
}

.chat-bot-button:hover {
  background-color: var(--e-global-color-brand);
  border: 1px solid var(--e-global-color-brand);
}

/* Форма для введення */
.chat-bot-input-area {
  position: relative;
  flex: 0 0 84px;
  height: 84px;
  padding: 16px;
  overflow: hidden;
  background: rgb(240 243 250 / 4%);
}

#chat-bot-input {
  height: 100%;
  padding: 12px 86px 12px 16px;
  overflow: hidden;
  color: var(--e-global-color-text);
  resize: none;
  background-color: rgb(12 15 21 / 88%);
  border: 1px solid rgb(240 243 250 / 16%);
  border-radius: 16px;
  outline: none;
}

#chat-bot-name:-webkit-autofill,
#chat-bot-name:-webkit-autofill:hover,
#chat-bot-name:-webkit-autofill:focus,
#chat-bot-email:-webkit-autofill,
#chat-bot-email:-webkit-autofill:hover,
#chat-bot-email:-webkit-autofill:focus,
#chat-bot-phone:-webkit-autofill,
#chat-bot-phone:-webkit-autofill:hover,
#chat-bot-message:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--e-global-color-text);
  box-shadow: 0 0 0 1000px rgb(12 15 21 / 88%) inset;
  transition: background-color 5000s ease-in-out 0s;
}

#chat-bot-name,
#chat-bot-name:hover,
#chat-bot-name:focus,
#chat-bot-email,
#chat-bot-email:hover,
#chat-bot-email:focus,
#chat-bot-phone,
#chat-bot-phone:hover,
#chat-bot-message:focus {
  color: var(--e-global-color-text) !important;
  background-color: rgb(12 15 21 / 88%) !important;
  border: 1px solid rgb(240 243 250 / 16%) !important;

}

#chat-bot-input div,
#chat-bot-input p,
#chat-bot-input span {
  padding: 0;
  margin: 0;
}

.chat-bot-input-buttons {
  position: absolute;
  top: 50%;
  right: 32px;
  display: flex;
  align-items: center;
  transform: translateY(-50%);
}

#chat-bot-send {
  width: 24px;
  height: 24px;
  padding: 0;
  color: var(--e-global-color-text);
  cursor: pointer;
  background-color: transparent;
  border: none;
  border-radius: 50%;
  transition-duration: 0.5s;
}

#chat-bot-send:hover {
  color: var(--e-global-color-brand);
}

/* Форма контактів */
.chat-bot-contact-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.chat-bot-contact-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--e-global-color-text);
}

.chat-bot-field {
  flex: 1 1 auto;
  color: var(--e-global-color-text);
  background-color: rgb(12 15 21 / 88%);
  border: 1px solid rgb(240 243 250 / 16%);
  border-radius: 16px;
  outline: none;
}

.chat-contact-form label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}

#chat-bot-message {
  min-height: 80px;
  resize: none;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-bot-submit-btn {
  padding: 12px 16px;
  margin-top: 10px;
  font-weight: bold;
  color: var(--e-global-color-text);
  cursor: pointer;
  background-color: transparent;
  border: 1px solid var(--e-global-color-brand);
  border-radius: 5px;
  transition: all 0.5s;
}

.chat-bot-submit-btn:hover {
  background-color: var(--e-global-color-brand);
  border: 1px solid var(--e-global-color-brand);
}

/* Стани чат-боту */
.chat-bot-open {
  display: block;
}

.chat-bot-closed {
  display: none;
}

/* Додайте ці стилі до існуючого файлу chat-bot.css */

/* Стилі для секції прикріплення файлів */
.chat-bot-attachments {
  display: flex;
  align-items: center;
}

.chat-bot-attach-btn {
  padding: 5px;
  color: var(--e-global-color-brand);
  cursor: pointer;
  background-color: transparent;
  border: none;
  transition: color 0.2s;
}

.chat-bot-attach-btn:hover {
  color: var(--e-global-color-text);
}

.chat-bot-file-preview {
  flex-grow: 1;
  margin-left: 10px;
  font-size: 12px;
}

/* Стилі для списку файлів */
.file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.file-item {
  display: flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 12px;
  background-color: #f0f0f0;
  border-radius: 15px;
}

.file-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-file {
  margin-left: 5px;
  font-size: 14px;
  line-height: 1;
  color: #666;
  cursor: pointer;
  background: transparent;
  border: none;
}

.remove-file:hover {
  color: #ff5252;
}

.file-uploading {
  font-style: italic;
  color: #666;
}

/* Стилі для відображення файлів у формі */
.chat-file-attachments {
  margin: 10px 0;
}

.chat-file-list {
  padding: 0;
  margin: 5px 0;
  list-style: none;
}

.chat-file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  margin-bottom: 5px;
  font-size: 12px;
  background-color: #f0f0f0;
  border-radius: 15px;
}

.remove-file-btn {
  font-size: 14px;
  color: #666;
  cursor: pointer;
  background: transparent;
  border: none;
}

.remove-file-btn:hover {
  color: #ff5252;
}

.form-group a {
  position: relative;
  color: var(--e-global-color-brand) !important;
  text-decoration: none;
  transition-duration: 0.5s;
}

.form-group a::after {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  content: '';
  background-color: var(--e-global-color-brand);
  transition-duration: 0.5s;
}

.form-group a:hover::after {
  width: 100%;
}

/* Typing indicator animation */
.chat-bot-typing-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
}

.chat-bot-typing-indicator span {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 2px;
  background-color: var(--e-global-color-text);
  border-radius: 50%;
  opacity: 0.4;
  animation: typing-animation 1.4s infinite ease-in-out both;
}

.chat-bot-typing-indicator span:nth-child(1) {
  animation-delay: 0s;
}

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

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

@keyframes typing-animation {
  0%, 80%, 100% {
    opacity: 0.4;
    transform: scale(0.6);
  }

  40% {
    opacity: 1;
    transform: scale(1);
  }
}


@media screen and (max-width: 540px) {
  #custom-chat-bot {
    width: 85vw;
    max-width: 416px;
    height: 85dvh;
    max-height: 721px;
  }

  .bot-message {
    width: 100%;
    max-width: initial;
    padding: 0;
  }
}