.chat-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* background-color: rgba(0, 0, 0, 0.5); */
  z-index: 999;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.chat-popup-overlay.show {
  opacity: 1;
}

.chat-popup-container {
  position: absolute;
  bottom: 45px;
  right: 40px;
  width: 350px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.chat-popup-overlay.show .chat-popup-container {
  transform: translateY(0);
}

/* Chat Window Mode */
.chat-popup-container.chat-mode {
  height: 500px;
  display: flex;
  flex-direction: column;
}

.chat-popup-container.initial-mode {
  width: 350px;
}

.chat-header {
  background: #a8d8d8;
  color: #2d5a5a;
  padding: 16px;
  font-weight: 600;
  font-size: 16px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-back-btn {
  background: none;
  border: none;
  color: #2d5a5a;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: none;
}

.chat-back-btn:hover {
  background: rgba(45, 90, 90, 0.1);
}

.chat-back-btn.show {
  display: block;
}

.chat-close {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #2d5a5a;
  cursor: pointer;
  font-size: 18px;
  padding: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-close:hover {
  background: rgba(45, 90, 90, 0.1);
}

.chat-body {
  padding: 20px;
  background: white;
  transition: all 0.3s ease;
}

/* Chat Messages Mode */
.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: #f8f9fa;
  display: none;
}

.chat-messages.show {
  display: block;
}

.message-container {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
}

.message-container.incoming {
  align-items: flex-start;
}

.message-container.outgoing {
  align-items: flex-end;
}

.message-time {
  text-align: center;
  color: #666;
  font-size: 12px;
  margin-bottom: 12px;
}

.message-bubble {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.4;
  display: flex;
  padding: 8px 12px;
  flex-direction: column;
  border-radius: 19px;
  box-shadow: 0px 2px 4px 1px rgba(142, 144, 147, 0.25);
  width: fit-content;
  word-wrap: break-word;
}

.message-sender {
  font-weight: 600;
  margin-bottom: 4px;
  color: #108482;
}

.message-timestamp {
  font-size: 11px;
  color: #999;
  margin-top: 5px;
}

.message-incoming {
  background: var(--Primary-25, #e7f3f3);
  margin-right: auto;
}

.message-outgoing {
  background: #ffffff;
  margin-left: auto;
}

.chat-input-container {
  padding: 16px;
  background: white;
  border-top: 1px solid #e1e5e9;
  display: none;
  align-items: center;
  gap: 12px;
}

.chat-input-container.show {
  display: flex;
}

.chat-input {
  min-height: 48px;
  max-height: 120px;
  resize: none;
  overflow-y: auto;
  line-height: 1.4;
}

.chat-input:focus {
  outline: none;
  border-color: #108482;
}

.message-input .send-icon {
  position: absolute;
  transform: translate(50%, -50%);
  top: 50%;
  right: 6%;
  cursor: pointer;
}

/* Form Styles */
.chat-form-group {
  margin-bottom: 16px;
}

.chat-form-control {
  width: 100%;
  padding: 12px;
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  font-size: 14px;
}

.chat-form-control:focus {
  outline: none;
  border-color: #108482;
  box-shadow: 0 0 0 3px rgba(16, 132, 130, 0.1);
}

.chat-textarea {
  min-height: 80px;
  resize: vertical;
}

.chat-textarea.small {
  min-height: 110px;
  font-size: 13px;
  padding: 10px;
  resize: none;
}

.chat-textarea.chat-message {
  resize: none;
  padding-right: 40px;
  min-height: 45px;
  height: 45px;
  width: 100%;
  display: flex;
  padding: 10px 14px;
  align-items: center;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.chat-checkbox-container {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 16px 0;
}

.chat-checkbox {
  margin-top: 2px;
}

.chat-checkbox-label {
  font-size: 13px;
  color: #666;
  line-height: 1.4;
}

.chat-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.chat-send-small {
  background: #108482;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-send-small:hover {
  background: #0d6b69;
}

/* Content States */
.chat-content {
  display: none;
}

.chat-content.active {
  display: block;
}

.chat-close-icon {
  display: flex;
  width: 24px;
  height: 24px;
  padding: 10px 12px;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  background: var(--Primary-500, #108482);
}

/* Responsive */
@media (max-width: 576px) {
  .chat-popup-container {
    left: 10px;
    right: 10px;
    width: auto;
  }
}
