@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap');

#chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  font-family: 'Inter', sans-serif;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

#chat-widget-toggle {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #28a745, #20c997);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 28px;
  color: #fff;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  transition: transform 0.2s, box-shadow 0.2s;
}

#chat-widget-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 25px rgba(0,0,0,0.35);
}

#chat-widget-box {
  width: 380px;
  max-height: 500px;
  background: #ffffff;
  border-radius: 20px;
  overflow: hidden;
  display: none;
  flex-direction: column;
  box-shadow: 0 12px 35px rgba(0,0,0,0.25);
  margin-bottom: 15px;
}

#chat-widget-header {
  background: linear-gradient(135deg, #28a745, #20c997);
  color: #fff;
  padding: 12px 15px;
  font-weight: 600;
  font-size: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.3);
}

#chat-widget-header .chat-widget-status {
  font-weight: 400;
  font-size: 13px;
  color: #e0f7e9;
}

#chat-widget-messages {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  background: #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-widget-message {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  max-width: 80%;
  opacity: 0;
  transform: translateY(15px);
  animation: chat-widget-msg-appear 0.3s forwards;
}

@keyframes chat-widget-msg-appear {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-widget-message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-widget-message .chat-widget-avatar {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  object-fit: cover;
}

.chat-widget-message .chat-widget-text {
  padding: 12px 18px;
  border-radius: 20px;
  font-size: 14px;
  line-height: 1.5;
  background: #d4edda;
  color: #155724;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chat-widget-message.server .chat-widget-text {
  background: #e9ecef;
  color: #495057;
}

#chat-widget-input {
  display: flex;
  gap: 10px;
  padding: 12px 15px;
  border-top: 1px solid #e0e0e0;
  background: #fff;
  align-items: center;
}

#chat-widget-input textarea {
  flex: 1;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 25px;
  outline: none;
  font-size: 14px;
  resize: none;
  height: 50px;
  line-height: 1.5;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#chat-widget-input textarea:focus {
  border-color: #28a745;
  box-shadow: 0 0 8px rgba(40,167,69,0.3);
}

#chat-widget-send-btn {
  padding: 0 20px;
  border: none;
  background: linear-gradient(135deg, #28a745, #20c997);
  color: #fff;
  border-radius: 25px;
  cursor: pointer;
  font-weight: 600;
  font-size: 16px;
  height: 50px;
  transition: transform 0.2s, box-shadow 0.2s;
}

#chat-widget-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Индикатор "печатает..." */
.chat-widget-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #495057;
  font-style: italic;
  opacity: 0.8;
  animation: chat-widget-msg-appear 0.3s forwards;
}
