/* Стильная кнопка чата */
.chat-button {
  background: linear-gradient(135deg, #007bff, #0056b3);
  color: white;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 123, 255, 0.4);
  position: relative;
  transition: all 0.3s ease;
  animation: pulse 2s infinite;
  cursor: pointer;
}

.chat-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(0, 123, 255, 0.6);
}

.chat-button svg {
  width: 28px;
  height: 28px;
}

/* Анимация пульсации */
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(0, 123, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 123, 255, 0); }
}

/* Бейдж уведомлений */
.chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ff4444;
  color: white;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center; /* Центрирование по вертикали */
  justify-content: center; /* Центрирование по горизонтали */
  font-size: 11px;
  font-weight: bold;
  line-height: normal; /* Отключаем принудительное изменение высоты строки */
  border: 2px solid white;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  text-align: center; /* Не обязательно, но полезно для дополнительной страховки */
  padding: 0;
  margin: 0;
}


/* Окно чата */
.chat-container {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 360px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  height: 480px;
  overflow: hidden;
  z-index: 9998;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Шапка чата */
.chat-header {
  background: linear-gradient(135deg, #007bff, #0056b3);
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-info h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.chat-status {
  font-size: 13px;
  opacity: 0.9;
  margin-top: 2px;
}

.chat-close-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.chat-close-btn:hover {
  background: rgba(255,255,255,0.3);
}

.chat-close-btn svg {
  width: 18px;
  height: 18px;
}

/* Сообщения */
.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-welcome {
  text-align: center;
  color: #6c757d;
  padding: 20px;
  margin: auto;
}

.chat-welcome p {
  font-size: 16px;
  line-height: 1.5;
}

.chat-message {
  max-width: 85%;
  display: flex;
}

.chat-message.user {
  margin-left: auto;
}

.chat-message.support {
  margin-right: auto;
}

.message-bubble {
  background: white;
  border-radius: 18px;
  padding: 14px 18px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  position: relative;
  max-width: 100%;
}

.chat-message.user .message-bubble {
  background: linear-gradient(135deg, #007bff, #0056b3);
  color: white;
  border-bottom-right-radius: 5px;
}

.chat-message.support .message-bubble {
  border-bottom-left-radius: 5px;
}

.message-text {
  word-wrap: break-word;
  line-height: 1.5;
}

.message-time {
  font-size: 11px;
  opacity: 0.8;
  margin-top: 4px;
  text-align: right;
}

.chat-message.user .message-time {
  color: rgba(255,255,255,0.8);
}

/* Поле ввода */
.chat-input {
  padding: 16px;
  background: white;
  border-top: 1px solid #e9ecef;
  display: flex;
  gap: 10px;
}

.chat-input textarea {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #ced4da;
  border-radius: 24px;
  resize: none;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  transition: border-color 0.2s;
}

.chat-input textarea:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

.chat-input button {
  background: linear-gradient(135deg, #007bff, #0056b3);
  color: white;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-input button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-input button:hover:not(:disabled) {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
}

.chat-input button svg {
  width: 20px;
  height: 20px;
}