/* Общий контейнер чата */

#chat-container {
  position: relative; 
  font-family: 'Pretendard'!important;
  border-radius: 10px;
  width:300px;
  margin:20px auto;
  display: flex;
  justify-content: center;
  overflow: hidden;
  user-select: text;
  border: 1px solid #e7e5e6;
}

#chat-container .this_h3 {
    position: relative;
    user-select: text;
    display: block;
    width: 100px;
    border: solid 1px #f1f1f1;
    background-color: #fff;
    font-size: 12px;
    font-weight: bold;
    line-height: 10px;
    padding: 15px 10px 10px 10px;
    color: #cec4cf;
    text-transform: lowercase;
    border-radius: 10px;
    box-sizing: border-box;
    top: -8px;
    margin: 0px auto;
    text-align: center;
}

#chat-container #main-page {
  position: relative;
  width: 300px;
  height: 500px;
  background: #fff;
  overflow: hidden;
}

/* сам чат */
#chat-container #chat-main {
  width: 300px;
  display: flex;
  flex-direction: column;
  height: 500px;
  background: #fff;
  z-index: 1;
}

/* список тем для анимации*/
#chat-container #topics {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%; /* чтобы не вылезало за 300px */
  height: 100%;
  background: #fff;
  padding: 0px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  opacity: 0;
  transform: translateY(0px);
  pointer-events: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
  z-index: 2;
}


/* при показе */
#chat-container #topics.visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

/* При активации тем */
#chat-container #chat-main.faded {
  filter: blur(0px);
  pointer-events: none;
}


#chat-container #chat-topics { 
  height: 350px;
  overflow-y: auto;
  padding: 0px 15px 15px 15px;
  user-select: none;
  margin-top: 15px;
}
#chat-container #close-topics {
    all: unset;
    position: absolute;
    display: block;
    top: 15px;
    left: 20px; 
    cursor: pointer; 
    transition: all 0.3s ease; 
}

#chat-container #close-topics .ph-bold.ph-caret-left {
  font-size: 20px!important;
}

#chat-container #close-topics:hover {
transform: translateY(-1px);
}

/*превью чатов в списке*/
#chat-container .chat-topic {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  background-color: #f7f7f7;
  transition: all 0.2s ease;
  cursor: pointer;
  margin-bottom: 10px;
  border:1px solid #f7f7f7;
}

#chat-container .chat-topic:hover {
  background-color: #f0f0f0;
}

#chat-container .chat-topic.active {
  background: #fff;
  border:1px solid #e1bcc7;
}
#chat-container .chat-topic-avatar { width: 42px;
  height: 42px;}
  
#chat-container .chat-topic-avatar img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 50%;
  transition: all 0.25s ease;
  filter: grayscale(100%) contrast(120%) brightness(1.1);
}

#chat-container .chat-topic-content {
  flex: 1;
  flex-direction: column;
  justify-content: center;
  margin-left:12px;
}

#chat-container .chat-topic-title {
  font-size: 15px;
  font-weight: 600;
  color: #747474;
  font-family: 'Noto Sans', sans-serif;
}

#chat-container .chat-topic-preview {
  font-size: 12px;
  color: #777;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#chat-container .chat-topic.active .chat-topic-avatar img {
  background-color: #fafafa;
  filter: grayscale(0%) contrast(110%) brightness(1);
  
}
#chat-container .chat-topic.active .chat-topic-title {
  color: #222222;  
}

#chat-container .chat-topic.active .chat-topic-preview {
  color: #e1bcc7;  
}

/* заголовок и профиль*/
#chat-container #chat-header {
  display: flex;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid #ddd;
  background: #f5f5f5;
  gap: 20px;
  position: relative;
  user-select: none;
}

#chat-container #chat-title {cursor: pointer;
  flex-grow: 1;
  position: relative;
  padding-left: 8px;
  font-family: 'Pretendard', sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: #333;
}


#chat-container #chat-title::after {
  content: '';
  position: absolute;
  top: 10%;
  left: 0;
  width: 25px;
  height: 25px;
  transform: translateY(-50%) rotate(15deg);
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='682.667' height='682.667' version='1.0' viewBox='0 0 512 512'%3e%3cpath d='M489.5 8.7c-33.6 22.4-57.2 35.6-123 68.6-65.3 32.8-86 45.1-111.5 66.5-12.4 10.4-32.3 30.9-43.3 44.7-10.7 13.4-25 34.7-34.6 51.5-3.9 6.9-7.4 13.1-7.9 13.9-.5.9-1.9-2.3-4-9.4-3.6-12.3-5.1-14.5-9.9-14.5-4.1 0-9.1 4.3-20.1 17.5-31.1 37-47.2 83.8-48.9 142.1-.6 20.1.4 38.7 3.1 56.7l1.3 8.7-12 6.5c-6.6 3.6-12.2 6.3-12.4 6.2-.1-.2.6-4 1.8-8.5 2.7-10.9 2.3-17.8-1.3-20.5-4.7-3.5-10.3-.5-11.3 6.1-2.3 16.3-6 24.9-14.2 33-4.3 4.3-8 6.6-19.1 11.8-20.5 9.6-20.6 9.6-21.6 12.7-1.3 3.6.8 7.8 4.7 9.1 3.1 1.1 7.5-.6 36.7-14.6 17.9-8.6 18.8-8.9 28.8-10 12.7-1.4 24-.1 33.8 3.8 7.7 3.1 10.9 2.6 13.3-1.8 3.6-6.4-3.5-12.1-19-15.5l-7.9-1.6 4.1-2.4 4.2-2.3 14.1 4.6c53.8 17.6 108.5 19.8 159.1 6.5 15.2-4 20.5-6.2 22.8-9.3 2.9-3.8 1.8-6.1-7.8-16.7-4.7-5.1-8.5-9.6-8.5-10 0-.3 5.3-2 11.8-3.7 31.6-8.5 60.8-23.3 86.7-44.1 11.7-9.3 30.2-28.2 39.6-40.3 44.3-56.9 73.3-139.7 86.8-247.5C507.3 80 512 22.1 512 8c0-3.7-3.9-8-7.2-8-1.3 0-8.2 3.9-15.3 8.7zm6.5 19c0 8.2-2.9 42.8-5.6 66.3-13.8 122.6-47.9 213.1-101.1 269-30.9 32.6-70.5 54.5-116.7 64.7-11.1 2.4-13.2 3.2-14.9 5.5-1.3 1.7-1.8 3.5-1.4 5 .4 1.3 4.9 7.1 10.1 12.8 5.9 6.6 9 10.7 8.3 11.1-2.8 1.5-24.2 6-35.2 7.3-27.8 3.4-52.1 2.8-80.3-1.9-13.6-2.3-33.1-7-39.8-9.6l-2.9-1 6-3.7c13-7.9 44.8-29.6 60-40.9 54-40.3 103-87.2 149.9-143.8 21.8-26.2 66.6-88 69.5-95.6 2-5.6-4-11.5-9.3-9.1-1.3.6-8.1 9.4-15.2 19.9-65.2 95.2-137.7 170.4-221.4 229.5-16 11.3-49.5 32.8-51 32.8-2 0-4.4-35.3-3.7-55.5 1.1-29 4.9-51.8 12.8-75 7.1-21 18.8-42.4 31.2-57 2.8-3.3 5.4-6.4 5.7-6.8.4-.4 2.2 4.3 4 10.5 4.7 16.1 5.7 18.4 8.9 19.8 4.8 1.9 7.6 0 11.7-8.2 26-51.8 56.3-91.9 90.7-120.2 24.5-20.1 47.8-33.8 107.2-63.2 56.2-27.8 87-44.8 113.5-62.3 4.1-2.8 7.8-5 8.3-5.1.4 0 .7 2.1.7 4.7z' fill='%23ee77a1'/%3e%3c/svg%3e");
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.9;
  animation: featherDrift 4s ease-in-out infinite;
}

@keyframes featherDrift {
  0%, 100% {
    transform: translateY(-50%) rotate(15deg) translateX(0);
  }
  50% {
    transform: translateY(-50%) rotate(15deg) translateX(3px);
  }
}

/* текущий профиль в чате you */
#chat-container #chat-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  font-size: 12px;
  color: #222;
}

#chat-container #chat-profile > div:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: default;
}

#chat-container #chat-avatar-preview {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #ffffff;
  transition: transform 1.8s ease, box-shadow 1.4s ease, filter 1.3s ease;
  filter: grayscale(100%) brightness(1.2);
  cursor: pointer;
}

#chat-container#chat-avatar-preview:hover {
  transform: scale(1.1);
  filter: grayscale(0%) brightness(1.1);
  transition: transform 1.8s ease, box-shadow 1.4s ease, filter 1.3s ease;
}

#chat-container #chat-username-preview {
  user-select: text;
  max-width: 120px;
  border: solid 1px #f1f1f1;
    background-color: #fff;
    font-size: 10px;
    line-height: 10px;
    padding: 8px 8px 8px 20px;
    color: #cec4cf;
    text-transform: lowercase;
    border-radius: 10px;
    box-sizing: border-box;
    margin-left:-26px;
}

#profile-menu {
  position: relative;
  display: flex;
  align-items: center;
}


#profile-settings input[type="text"] {
  all: unset;
  width: 100%;
  padding: 3px 10px;
  margin-bottom: 5px;
  box-shadow: rgba(0, 0, 0, 0.05) 0px 1px 2px;
  border-radius: 8px;
  background: #fff;
  box-sizing: border-box;
  font-size: 10px;
  transition: border 0.2s;
  text-align: center;
}

#profile-settings input[type="text"]:focus {
  border: none;
  outline: none;
}

#profile-settings input:placeholder-shown {
  background-color: #fff; /* светлый фон если пусто */
}

#profile-settings input:not(:placeholder-shown) {
  border: 1px solid #e1bcc780;
}

#save-profile-btn {
    all: unset;
    width: 100%;
    height: 15px;
    font-family: "Pretendard", sans-serif;
    font-size: 10px;
    padding: 3px;
    background-color: #fff;
    color: #444;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    text-align: center;
}

#save-profile-btn:hover {
  background: #e1bcc7;
  font-weight: bold;
  color: #fff;
}


#profile-settings {
  position: absolute;
  top: 25px;
  right: 0;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  z-index: 1000;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  width: 200px;
  background: #f8f8f8;
  padding: 20px;
  font-size: 12px;
  color: #333;
  display: none;
}

#profile-settings.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#profile-settings label {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  user-select: none;
  font-size: 11px;
  justify-content: center;
}

/* Чекбокс с сердцем */
.minimal-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 15px;
  font-size: 15px;
  cursor: pointer;
}

.minimal-checkbox input[type="checkbox"] {
  display: none;
}

.checkbox-custom {
  width: 16px;
  height: 16px;
  display: inline-block;
  border-radius: 50%;
  position: relative;
  transition: all 0.3s;
}

.checkbox-custom::after {
  content: '\2764';
  font-size: 15px;
  color: #aaa;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  text-align: center;
  line-height: 16px;
  transition: color 0.3s;
}

.minimal-checkbox input[type="checkbox"]:checked + .checkbox-custom::after {
  content: '\2764';
  color: #e1bcc7;
}

#profile-selector {
  position: relative;
  padding: 10px 5px; 
    margin-top: 10px;
    display:flex; 
    gap:5px;
    width: auto;
    height: 30px;
    overflow-x: auto;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
  transition: all 0.3s ease;
  cursor: grab;
}


/* Скрываем дефолтный скролл */
#profile-selector::-webkit-scrollbar {
  display: none;
}

#profile-selector {
  -ms-overflow-style: none; /* IE/Edge */
  scrollbar-width: none; /* Firefox */
 user-select: none;
  -webkit-user-select: none; /* для Safari */
  -ms-user-select: none;     /* для IE/Edge */
  }


#chat-container .profile-delete-btn {
  user-select: none; 
  -webkit-user-select: none; /* для Safari */
  -ms-user-select: none;     /* для IE/Edge */
  position: absolute;
  top: -5px;
  right: -5px;
  background: #c9c9c9;
  color: white;
  font-size: 8px;
  width: 13px;
  height: 13px;
  text-align: center;
  line-height: 14px;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  transition: opacity 0.2s ease;
  z-index: 10;
}

#chat-container .profile-save {
  position: relative;
  display: inline-block;
  margin-right: 3px;
}

#chat-container .profile-save:hover .profile-delete-btn {
  display: block;
  background: #e1bcc7;
}

#chat-container .profile-save-avatar-img {
        user-select: none; 
-webkit-user-select: none; /* для Safari */
  -ms-user-select: none;     /* для IE/Edge */
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.2s ease;
}

#chat-container .profile-save-avatar-img:hover {
    user-select: none;
  transform: scale(1.1);
}

#profile-selector img {
  pointer-events: auto;
  user-drag: none;          /* Safari */
  -webkit-user-drag: none;  /* Safari */
}

/* Основная панель сообщений */
#chat-messages {
  flex: 1;
  padding: 12px 18px;
  overflow-y: auto;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 12px;
  line-height: 1;
}


#chat-messages::-webkit-scrollbar {
  width: 8px;
}

#chat-messages::-webkit-scrollbar-thumb {
  background: #bbb;
  border-radius: 4px;
}

#chat-messages::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

#chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

#chat-messages::-webkit-scrollbar-thumb {
  background-color: rgba(100, 100, 100, 0.3);
  border-radius: 10px;
  transition: background-color 0.3s ease;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
  background-color: rgba(100, 100, 100, 0.6);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 100, 100, 0.3) transparent;
}



/* Контейнер одного сообщения */
.chat-message {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 12px;
  max-width: 100%;
}

/* Аватарка */
.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* Баббл текста */
.chat-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  background-color: #f0f0f0;
  color: #333;
  font-size: 12px;
  line-height: 1;
  max-width: 70%;
  word-wrap: break-word;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Свои сообщения (разворачиваем, цвет другой) */
.chat-message.own-msg {
  flex-direction: row-reverse;
}

.chat-message.own-msg .chat-bubble {
  background-color: #f7f7f7;
  color: #111;
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 18px;
}

/* Чужие сообщения — стандарт */
.chat-message:not(.own-msg) .chat-bubble {
  border: 1px solid #ededed;
  background-color: #fff;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 18px;
}


/* Панель с кнопками форматирования и смайлами */
#chat-controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  user-select: none;
}

#chat-form {
  background: #f5f5f5;
  padding: 8px;
  border-top: 0px solid #ddd;
}

#chat-container .format-btn {
  all: unset;
  font-family: "Pretendard", sans-serif;
  font-size: 12px;
  background-color: #f6f6f6;
  color: #444;
  width: 25px;
  height: 25px;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  cursor: pointer;
  position: relative;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

#chat-container.format-btn:hover {
  background-color: #eee;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}

/* Сердечко-прыгун */
#chat-container .format-btn::after {
  content: '\2764';
  font-size: 10px;
  position: absolute;
  top: -4px;
  right: -4px;
  opacity: 0;
  color:#ee77a1;
  transform: scale(0.5) rotate(10deg);
  pointer-events: none;
}

#chat-container .format-btn:hover::after {
  animation: heart-bounce 0.4s forwards;
}

@keyframes heart-bounce {
  0% {
    transform: scale(0.5) translateY(0) rotate(10deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.2) translateY(-4px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: scale(1) translateY(0) rotate(0deg);
    opacity: 1;
  }
}


#emoji-picker {
  position: absolute;
  top: 35%;
  left: 0;
  z-index: 1000;
  background-color: white;
  border: 1px solid #ccc;
  padding: 5px;
  width: 220px;
  border-radius: 8px;
  box-shadow: 0px 1px 50px 150px rgba(0, 0, 0, 0.15);
  transition: all 0.5s ease;
  max-height: 70px;
  overflow-y: auto;
  margin: 0px 35px;
}

#sticker-picker {
  position: absolute;
  top: 20%;
  left: 0;
  z-index: 1000;
  background-color: white;
  border: 1px solid #ccc;
  padding: 5px;
  width: 260px;
  border-radius: 8px;
  box-shadow: 0px 1px 50px 150px rgba(0, 0, 0, 0.15);
  transition: all 0.5s ease;
  max-height: 120px;
  overflow-y: auto;
  margin: 0px 15px;
}

.emoji-row, .sticker-row{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.emoji-btn, .sticker-btn  {
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  transition: transform 0.2s;
}

.emoji-btn:hover, .sticker-btn:hover {
  transform: scale(1.2);
}

.sticker-img {
  width: 60px;
  height: 60px;
  border-radius:2px;
  object-fit: cover;
  cursor: pointer;
}

/* Редактируемое поле ввода */
#chat-input {
  flex-grow: 1;
  min-height: 30px;
  max-height: 80px; 
  font-size: 12px;
  line-height: 1.2em;
  padding: 6px;
  border-radius: 8px;
  overflow-y: auto;
  outline: none;
  background-color: #fff;
  color: #222;
  white-space: pre-wrap;
  word-wrap: break-word;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Placeholder для contenteditable через data-placeholder */
#chat-input:empty::before {
  content: attr(placeholder);
  color: #aaa;
  pointer-events: none;
  user-select: none;
  position: absolute;
  left: 8px;
  top: 6px;
  font-size: 11px;
}


/* Кнопка отправки */
#chat-send {
  all: unset;
  width: 25px;
  height: 25px;
  font-family: "Pretendard", sans-serif;
  font-size: 15px;
  padding: 3px;
  background-color: #f6f6f6;
  color: #444;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

#chat-send:hover {
  background-color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}

#chat-send::after {
  content: "\2764";
  font-size: 12px;
  position: absolute;
  top: -6px;
  right: -4px;
  opacity: 0;
  color:#ee77a1;
  transform: scale(0.5) rotate(10deg);
  pointer-events: none;
}

#chat-send:hover::after {
  animation: flower-bounce 0.4s forwards;
}

@keyframes flower-bounce {
  0% {
    transform: scale(0.5) translateY(0) rotate(10deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.2) translateY(-4px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: scale(1) translateY(0) rotate(0deg);
    opacity: 1;
  }
}

#chat-send .flower-effect {
  content: "\2764";
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.5);
  animation: none;
}

#chat-send .loading {all: unset;
  width: 25px;
  height: 25px;
  font-family: "Pretendard", sans-serif;
  font-size: 15px;
  padding: 3px;
  background-color: #e5e5e5;
  color: #444;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;   
}


#image-url { all: unset;
  flex-grow: 1;
  padding: 6px 10px;
  font-size: 10px;
  line-height: 1.2em;
  padding: 6px 8px;
  border-radius: 8px;
  overflow-y: auto;
  outline: none;
  background-color: #fff;
  color: #222;
  white-space: pre-wrap;
  word-wrap: break-word;
  position: relative;
}
#image-preview {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  overflow: hidden;
  border: 0px solid #ddd;
  background-color: #f9f9f9;
}

#preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}


/* Скрытый iframe */
#chat-iframe {
  display: none;
}

/* Адаптив для маленьких экранов */
@media (max-width: 350px) {
  #chat-container {
    width: 100%;
    border-radius: 0;
  }
  
  #chat-messages {
    padding: 8px 12px;
  }
  
  #chat-input, #image-url, #chat-send {
    margin: 0 12px 10px 12px;
    width: calc(100% - 24px);
  }
}


/* Голосовое */
#voice-delete-btn {
  background: none;
  border: none;
  color: #c44;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.2s ease, color 0.2s ease;
  line-height: 1;
}

#voice-delete-btn:hover {
  background: rgba(255, 0, 0, 0.1);
  color: #a00;
}

.voice-msg {width: 120px;
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 11px;
  color: #555;
  cursor: pointer;
}

.voice-msg summary {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.voice-msg summary::-webkit-details-marker {
  display: none;
}

#voice-preview i {
    color: #c5c5c5;
    font-size: 10px;
    cursor: default;
}

.voice-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.voice-title {
  font-weight: bold;
  color: #333;
}

.voice-msg-duration {
  font-size: 11px;
  color: #777;
}

.voice-animation {
  display: flex;
  gap: 2px;
}

.voice-msg-text {
  margin-top: 6px;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 11px;
  white-space: pre-wrap;
  line-height: 1.4;
  cursor: default;
}

.voice-toggle {
  background: none;
  border: none;
  color: #888;
  font-size: 10px;
  cursor: pointer;
  padding: 2px 4px;
}

.hidden {
  display: none;
}

.voice-play {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  color: #666;
  padding: 2px;
}

.voice-title {
  font-weight: bold;
  font-size: 9px;
  color: #666;
}

.voice-animation {
  display: flex;
  gap: 2px;
  align-items: center;
  height: 10px;
  margin-left: 4px;
}

.voice-wave {
  width: 2px;
  height: 8px;
  background: #bbb;
  animation: waveAnim 0.6s infinite ease-in-out;
}

.voice-wave:nth-child(2) {
  animation-delay: 0.1s;
}
.voice-wave:nth-child(3) {
  animation-delay: 0.2s;
}

@keyframes waveAnim {
  0%, 100% {
    height: 6px;
  }
  50% {
    height: 12px;
  }
}

.voice-msg-duration {
  margin-left: auto;
  font-size: 9px;
  color: #999;
}

.voice-msg-text {
  margin-top: 6px;
  font-size: 9px;
  color: #999;
  line-height: 1.4;
  white-space: normal;
  word-break: break-word;
  padding: 0;
  white-space: pre-wrap; /* <- сохраняет переносы строк */
}

details.voice-transcript > div {
  margin: 0 !important;
  padding: 0 !important;
}

.remove-voice-btn {
  position: relative;
  font-weight: 700;
  font-size: 10px;
  user-select: none;
  margin-left: 6px;
  cursor: pointer;
  line-height: 1;
  cursor: pointer;
  left: 5px;
}

.remove-voice-btn:hover {
  color: #800;
}

#voice-modal {
  display: none;
  position: absolute;
  background: #f9f9f9;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 10px;
  margin-top: 100px;
  font-size: 10px;
  color: #555;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  max-width: 100%;
  z-index: 1;
}

#voice-modal h3 {
  margin: 0 0 6px 0;
  font-size: 11px;
  font-weight: 600;
  color: #333;
}

#voice-modal label {
  font-size: 9px;
  color: #777;
  display: block;
  margin: 6px 0 2px;
}

#voice-modal textarea,
#voice-modal input[type="text"] {
  width: 100%;
  padding: 4px;
  font-size: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  box-sizing: border-box;
  resize: vertical;
}

#voice-modal button {
  margin-top: 8px;
  margin-right: 6px;
  padding: 3px 8px;
  font-size: 10px;
  border: none;
  border-radius: 4px;
  background-color: #ddd;
  color: #333;
  cursor: pointer;
  transition: background 0.2s;
}

#voice-modal button:hover {
  background-color: #ccc;
}

#voice-text, #voice-duration {
  width: 100%;
  padding: 8px;
  font-size: 12px;
  font-family: 'Pretendard';
  color: #444;
  background-color: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 6px;
  outline: none;
  resize: vertical;
  transition: border-color 0.2s ease;
}

#voice-text:focus, #voice-duration:focus {
  border-color: #bbb;
  background-color: #fdfdfd;
  box-shadow: none;
  color: #444;
}


/*Уведомления*/
.chat-toast {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translate(-50%, 0px) !important;
  background: #222;
  color: #fff;
  padding: 10px 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
  z-index: 9999;
  opacity: 0;
  font-size: 12px;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.chat-toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Добавим анимацию выхода */
.chat-toast.fade-out {
  opacity: 0;
  transform: translateX(100px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.chat-toast img.toast-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}


.toast-text {
  max-width: 150px;
  word-wrap: break-word;
}
.notification-label {
  color: #111; 
  background: #f6f6f6;
  padding: 2px 6px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  user-select: none;
}
.notification-label .icon {
  font-size: 14px;
}

.toast-close {
  margin-left: auto;
  font-size: 18px;
  color: #fff;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease;
}

.toast-close:hover {
  color: #e74c3c;
}

.chat-toast {
  transition: transform 0.3s ease, opacity 0.3s ease;
  user-select: none;
  cursor:pointer;
}

/*выделение никнейма после собаки*/
.mention {
  background-color: #e1bcc7;
  color: white;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: bold;
  font-size: 0.9em;
  margin-right: 6px;
  display: inline-block;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s;
}

.mention:hover {
  background-color: #e9b6ce;
}

/*цитата с ником*/

.quote-block {
  border-left: 3px solid #999;
  padding-left: 8px;
  padding-bottom: 3px;
  margin: 6px 0;
  color: #444;
  background: #f3f3f3;
  border-radius: 4px;
  font-size: 10px;
}
.quote-block b {
  color: #e1bcc7;
}
.context-menu {
  position: absolute;
  background: #1e1e1e;
  color: #fff;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 4px 0;
  font-size: 14px;
  z-index: 9999;
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
  display: none;
}

.context-menu__item {
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
}

.context-menu__item:hover {
  background: #333;
}
.quote-wrapper {
  position: relative;
  padding: 0px;
  margin-bottom: 3px;
  opacity: 0.9;
  pointer-events: none; /* блокирует всё внутри */
}

.quote-wrapper * {
  user-select: none;
}

.remove-quote-btn {
  pointer-events: all; /* чтобы кнопка работала несмотря на блок */
  position: absolute;
  top: 2px;
  right: 2px;
  background: none;
  border: none;
  font-size: 10px;
  cursor: pointer;
  opacity: 0.6;
}

.remove-quote-btn:hover {
  opacity: 1;
  color: red;
}

/*настройки*/
#settings-toggle {  all: unset;
  position: absolute;
  top: 13px;
  right: 20px;
  padding: 4px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

#settings-toggle:hover {
  transform: translateY(-1px);
}

/* Анимация вращения шестерёнки при клике */
#settings-toggle.clicked i {
  animation: gear-spin 0.8s ease-in-out;
}

@keyframes gear-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.chat-settings.hidden {
  display: none;
}

.chat-settings {
  position: absolute;
  right: 10px;
  top: 40px;
  width: 240px;
  background: var(--bg-settings, #f9f9f9);
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 10px;
  z-index: 9;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* колокольчик в настройках*/
#notify-toggle {    display: none;}
