#custom-chat-btn {
  position: fixed !important;
  bottom: 25px !important;
  right: 25px !important;
  width: 60px !important;
  height: 60px !important;
  background: #e3007b !important;
  color: white !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  box-shadow: 0 4px 15px rgba(227, 0, 123, 0.4) !important;
  z-index: 2147483646 !important;
  transition: transform 0.3s ease !important;
  opacity: 1 !important;
  visibility: visible !important;
}
#custom-chat-btn:hover {
  transform: scale(1.08);
}
#custom-chat-btn svg {
  width: 28px !important;
  height: 28px !important;
}
#custom-chat-window {
  position: fixed !important;
  bottom: 100px !important;
  right: 25px !important;
  width: 350px !important;
  max-width: calc(100vw - 40px) !important;
  background: #fff !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 30px rgba(227, 0, 123, 0.15) !important; /* Легкая розовая тень */
  display: none;
  flex-direction: column !important;
  z-index: 2147483647 !important;
  overflow: hidden !important;
  font-family: Arial, sans-serif !important;
  border: 1px solid #e3007b !important; /* Тонкая розовая обводка */
}
.chat-header {
  background: #e3007b;
  color: white;
  padding: 12px 15px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chat-avatar {
  width: 48px;
  height: 48px;
  background: url('/nik/images/anastasia.jpg') center/cover;
  border-radius: 50%;
  background-color: white;
}
.chat-close {
  font-size: 16px;
  padding: 5px;
}
.chat-body {
  padding: 15px;
  height: 380px;
  max-height: 55vh; /* Защита от вылезания за экран на телефонах */
  overflow-y: auto;
  background: #f4f6f9;
  display: flex;
  flex-direction: column;
}
.chat-message {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
}
.chat-message.bot {
  align-items: flex-start;
}
.chat-message.user {
  align-items: flex-end;
}
.msg-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
}
.bot .msg-bubble {
  background: #fff;
  color: #333;
  border: 1px solid #e1e1e1;
  border-bottom-left-radius: 2px;
}
.user .msg-bubble {
  background: #e3007b;
  color: white;
  border-bottom-right-radius: 2px;
}
.msg-time {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
  margin-bottom: 2px;
}

/* Форма сбора контактов внутри чата */
.chat-form-card {
  background: #fff;
  border: 1px solid #e1e1e1;
  border-radius: 12px;
  padding: 15px;
  margin-top: 5px;
  width: 90%;
  box-sizing: border-box;
}
.chat-form-card input.chat-f-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
}
.chat-form-card input.chat-f-input:focus {
  border-color: #e3007b;
}
.chat-form-card button.chat-f-submit {
  width: 100%;
  padding: 10px;
  background: #e3007b;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  font-weight: bold;
  margin-top: 5px;
}
.chat-form-card button.chat-f-submit:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* Чекбоксы в форме */
#chat-consent {
  font-size: 11px;
  color: #555;
  margin-bottom: 10px;
}
.custom-checkbox {
  display: block;
  position: relative;
  padding-left: 24px;
  margin-bottom: 8px;
  cursor: pointer;
  user-select: none;
  line-height: 1.3;
}
.custom-checkbox input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}
.checkmark {
  position: absolute;
  top: 0;
  left: 0;
  height: 16px;
  width: 16px;
  background-color: #f1f1f1;
  border-radius: 4px;
  border: 1px solid #ccc;
  transition: 0.2s;
}
.custom-checkbox:hover input ~ .checkmark {
  background-color: #e9e9e9;
}
.custom-checkbox input:checked ~ .checkmark {
  background-color: #e3007b;
  border-color: #e3007b;
}
.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}
.custom-checkbox input:checked ~ .checkmark:after {
  display: block;
}
.custom-checkbox .checkmark:after {
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.lbl-text a {
  color: #e3007b;
  text-decoration: underline;
}

/* Поле ввода футера */
.chat-footer-wrapper {
  background: #fff;
  border-top: 1px solid #eee;
  display: flex;
  flex-direction: column;
}
.chat-footer {
  padding: 12px;
  display: flex;
  align-items: center;
}
.chat-input-wrapper {
  flex-grow: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  display: flex;
  background: #fff;
  transition: 0.2s;
}
.chat-input-wrapper:focus-within {
  border-color: #e3007b;
}
#chat-input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 10px 15px;
  outline: none;
  font-size: 14px;
}
#chat-send-btn {
  background: #e3007b;
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  margin-left: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
}
#chat-send-btn:hover {
  background: #c20067;
}

/* Анимация "Печатает..." */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 2px 4px;
}
.typing-indicator span {
  width: 6px;
  height: 6px;
  background: #999;
  border-radius: 50%;
  animation: typing 1.2s infinite ease-in-out;
}
.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* Оптимизация под мобильные устройства */
@media (max-width: 480px) {
  #custom-chat-btn {
    right: 15px !important;
    bottom: 15px !important;
  }
  #custom-chat-window {
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    border: none !important;
  }
  .chat-body {
    height: auto !important;
    max-height: none !important;
    flex-grow: 1 !important;
  }
}