/* кнопка */
.fixed-chat .fixed-chat-button {
  right: 20px;
  bottom: 20px;
  z-index: 1030;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .14);
  cursor: pointer;
  user-select: none;
  position: fixed;
}

/* скрытие FAB */
.fixed-chat .fixed-chat-button.is-hidden {
  display: none !important;
}

/* общий badge на FAB */
.fixed-chat-fab-unread {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .18);
}

/* карточка */
.fixed-chat-card {
  position: fixed;
  right: 20px;
  bottom: 78px;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 560px;
  max-height: calc(100vh - 140px);
  z-index: 1030;
  border-radius: 18px;
  overflow: hidden;

  display: flex;
  flex-direction: column;

  opacity: 0;
  transform: translateY(10px) scale(.98);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.fixed-chat-card.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* body занимает остаток */
.fixed-chat-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* сообщения */
.fixed-chat-messages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px 14px 10px;
  background: linear-gradient(180deg, rgba(244, 246, 248, .9), rgba(255, 255, 255, 1));
}

/* typing */
.fixed-chat-typing {
  padding: 0 14px 10px;
  display: flex;
  align-items: center;
  background: transparent;
}

/* футер всегда снизу */
.fixed-chat-footer {
  padding: 12px 14px 14px;
  background: #fff;
  border-top: 1px solid rgba(0, 0, 0, .06);
}

/* ряд сообщения */
.fixed-chat-msg {
  display: flex;
  margin: 10px 0;
}

.fixed-chat-msg--bot {
  justify-content: flex-start;
}

.fixed-chat-msg--me {
  justify-content: flex-end;
}

/* пузырь */
.fixed-chat-bubble {
  max-width: 78%;
  padding: 10px 12px 8px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
  position: relative;
  cursor: default;
}

.fixed-chat-bubble.can-moderate {
  cursor: context-menu;
}

.fixed-chat-msg--bot .fixed-chat-bubble {
  background: #fff;
  color: #111827;
  border: 1px solid rgba(0, 0, 0, .06);
  border-top-left-radius: 10px;
}

.fixed-chat-msg--me .fixed-chat-bubble {
  background: linear-gradient(180deg, rgba(203, 12, 159, 1) 0%, rgba(121, 40, 202, 1) 100%);
  color: #fff;
  border-top-right-radius: 10px;
}

.fixed-chat-author {
  font-size: 12px;
  font-weight: 600;
  opacity: .85;
  margin-bottom: 4px;
}

.fixed-chat-msg--me .fixed-chat-author {
  text-align: right;
  opacity: .9;
}

.fixed-chat-text {
  font-size: 14px;
  line-height: 1.25rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.fixed-chat-time {
  margin-top: 6px;
  font-size: 11px;
  opacity: .75;
}

.fixed-chat-msg--me .fixed-chat-time {
  text-align: right;
}

/* инпут */
.fixed-chat-form .input-group {
  align-items: stretch;
}

.fixed-chat-input {
  border-radius: 14px 0 0 14px !important;
  height: 44px;
  padding: 10px 12px;
}

.fixed-chat-send {
  width: 52px;
  border-radius: 0 14px 14px 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fixed-chat-send .material-symbols-rounded {
  font-size: 20px;
  line-height: 1;
}

/* аккуратный скролл */
.fixed-chat-messages::-webkit-scrollbar {
  width: 10px;
}

.fixed-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, .15);
  border-radius: 999px;
  border: 3px solid rgba(255, 255, 255, .7);
}

/* dots */
.fixed-chat-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #6b7280;
  margin-right: 4px;
  animation: fixedChatBlink 1.1s infinite ease-in-out;
}

.fixed-chat-dot:nth-child(2) { animation-delay: .15s; }
.fixed-chat-dot:nth-child(3) { animation-delay: .3s; }

@keyframes fixedChatBlink {
  0%, 80%, 100% { transform: translateY(0); opacity: .35; }
  40% { transform: translateY(-2px); opacity: 1; }
}

/* Tabs / Rooms */
.fixed-chat-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.fixed-chat-tab {
  border: 1px solid rgba(0, 0, 0, .08);
  background: #fff;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  color: #111827;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform .08s ease, background .12s ease, border-color .12s ease;
}

.fixed-chat-tab:hover { transform: translateY(-1px); }

.fixed-chat-tab.is-active {
  background: rgba(203, 12, 159, .08);
  border-color: rgba(203, 12, 159, .28);
}

.fixed-chat-unread {
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* notify toggle */
#chatNotifyToggle .material-symbols-rounded {
  font-size: 22px;
  line-height: 1;
  vertical-align: middle;
}

#chatNotifyToggle.is-off { opacity: .55; }

@media (max-width: 420px) {
  .fixed-chat-card {
    width: calc(100vw - 40px);
    height: 520px;
  }
}
