.chat-btn {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.chat-btn.show {
  opacity: 1;
  pointer-events: auto;
}

.link_message{
  color: #055ca9;
}

.link_message:hover{
  opacity: 0.7;
}

.chat-btn {
  position: fixed;
  bottom: 3rem;
  right: 3rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: rgb(215, 155, 37);
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
   border: 2px solid rgb(215, 155, 37);
  z-index: 3;
}
.chat-btn.active {
  background-color: transparent;
}
.chat-btn.active .chat-btn__open {
  display: none;
}
.chat-btn.active .chat-btn__close {
  display: flex;
}
.chat-btn:hover {
  opacity: 1;
}
.chat-btn__close {
  color: rgb(215, 155, 37);
  display: none;
}
.chat-btn__counter {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #eb5757;
  position: absolute;
  bottom: calc(100% - 15px);
  right: calc(100% - 15px);
  font-size: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.chat-btn__counter.disable {
  display: none;
}

.chat {
  position: fixed;
  /* bottom кнопки + высота кнопки + отступ от кнопки */
  bottom: calc(3rem + 48px + 16px);
  right: 3rem;
  width: 100%;
  max-width: 360px;
  height: 500px;
  /* высота экрана - bottom кнопки - высота кнопки - отступ от кнопки - отступ сверху */
  max-height: calc(100vh - 3rem - 48px - 16px - 16px);
  min-height: 120px;
  display: flex;
  flex-direction: column;
  z-index: 51;
  opacity: 0;
  visibility: hidden;
  transition: 0.3s;
}

.chat__time {
  font-size: 12px;
  color: #999;
  display: flex;
  align-items: center;
  gap: 6px;
}

.msg-status {
  font-size: 14px;
  margin-left: 4px;
  color: gray;
}

.msg-status::after {
  content: '✓'; /* первая галочка по умолчанию */
  color: gray;
}

/* доставлено */
.msg-status.double:after {
  content: '✓✓';
  color: #999;
}

/* прочитано */
.msg-status.read:after {
  content: '✓✓';
  color: #40b3ff; /* голубые */
}

@media (max-width: 576px) {
  .chat {
    bottom: 0;
    left: 0;
    max-width: unset;
    height: 100%;
    max-height: unset;
  }
}
.chat.active {
  opacity: 1;
  visibility: visible;
}
.chat__head {
  background-color: rgb(215, 155, 37);
  color: #fff;
  border-radius: 12px 12px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
}
@media (max-width: 576px) {
  .chat__head {
    border-radius: 0;
  }
}
.chat__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  border: 2px solid #fff;
}
.chat__avatar img {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
     object-fit: cover;
}
.chat__user {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chat__name {
  font-weight: 600;
}
.chat__status {
  font-size: 14px;
  opacity: 0.75;
  margin-top: auto;
}
.chat__status.typing {
  animation: typingAnimation 1s infinite;
}
.chat__close {
  display: none;
  margin-left: auto;
}
@media (max-width: 576px) {
  .chat__close {
    display: flex;
    background: none;
    border: none;
  }
}
.chat__body {
  border-radius: 0 0 12px 12px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-top: 0;
  position: relative;
  background-color: #ededed;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-grow: 1;
  overflow: hidden;
  padding: 0 12px 12px 12px;
  background-image: url("../chat/img/bg.png");
  background-repeat: repeat;
}
@media (max-width: 576px) {
  .chat__body {
    border-radius: 0;
  }
}
.chat__bg {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}
.chat__messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  flex-grow: 1;
}
.chat__messages::-webkit-scrollbar {
  display: none;
}
.chat__message {
  padding: 8px 12px;
  border-radius: 12px;
  background-color: #f4f6ff;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chat__message:first-child {
  margin-top: 12px;
}
.chat__message_own {
  background-color: #ffffff;
  color: #000000;
  align-self: end;
}
.chat__time {
  font-size: 12px;
  align-self: end;
  opacity: 0.75;
}
.chat__input-wrapper {
  display: flex;
  position: relative;
  color: #0d1036;
}

.chat__input-wrapper {
  overflow: visible;
}

.chat__input {
  border: 1px solid rgba(0, 0, 0, 0.1);
  min-height: 40px;
  width: 100%;
  border-radius: 20px;
  resize: none;
  overflow-y: auto;
  line-height: 1.4;
  max-height: 120px;
  white-space: pre-wrap;
  word-break: break-word;
  height: 45px;
  /* Заменили padding: 0 12px и padding-right: 35px на один: */
  padding: 10px 48px 10px 12px; /* top, right (кнопка), bottom, left */
}


.chat__input::-moz-placeholder {
  opacity: 0.5;
}
.chat__input::placeholder {
  opacity: 0.5;
}
.chat__btns {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  justify-content: center;
  align-items: center;
}
.chat__btn {
  opacity: 0.5;
  min-width: 30px;
  min-height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: none;
  border: none;
  z-index: 999;
}
.chat__send-message {
  opacity: 0.25;
  pointer-events: none;
}

.chat__send-message.active {
   opacity: 0.5;
   pointer-events: all;
 }

.chat__send-message {
  opacity: 1 !important;
  pointer-events: all !important;
}

.chat__open-emoji-picker {
  opacity: 1 !important;
  pointer-events: all !important;
}

.chat__btn:hover {
  opacity: 0.75;
}
.chat__emoji-picker {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  width: 100%;
  max-width: 182px;
  background-color: #fff;
  display: flex;
  flex-wrap: wrap;
  overflow-y: auto;
  max-height: 195px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
}
@media (max-width: 576px) {
  .chat__emoji-picker {
    max-width: 242px;
    max-height: 260px;
  }

  .chat__input {
    padding: 10px 65px 10px 12px; /* Чуть больше справа */
  }
}
.chat__emoji-picker.active {
  opacity: 1;
  visibility: visible;
}
.chat__emoji-picker::-webkit-scrollbar {
  display: none;
}
.chat__emoji-btn {
  width: 30px;
  height: 30px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 8px;
  font-size: 18px;
}
@media (max-width: 576px) {
  .chat__emoji-btn {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
}
@media (any-hover: hover) {
  .chat__emoji-btn:hover {
    opacity: 1;
    background-color: #b8c3cc;
  }
}

@keyframes typingAnimation {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}