/* Значок ассистента */
.assistant-icon {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 80px;
  height: 80px;
  /* background: #0052a6; */
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;                 /* изначально скрыт */
  transform: scale(0.5);      /* уменьшен для плавного появления */
  transition: all 0.3s ease-in-out;
  z-index: 10;               /* подложка и чат будут выше */
  color: #fff;
  font-size: 2rem;
  font-weight: bold;
}
/* Ободок вокруг значка */
.assistant-icon::before {
  content: "";
  position: absolute;
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  z-index: -1;
  transform: scale(0);
  transition: transform 0.5s ease;
}
/* Когда иконка «проявляется» */
.assistant-icon.visible {
  opacity: 1;
  transform: scale(1);
}
.assistant-icon.visible::before {
  transform: scale(1);
}
/* А вот теперь эффекты ховера и нажатия — именно у "visible" */
.assistant-icon.visible:hover {
  transform: scale(1.2);
  /* box-shadow: 0 0 20px rgba(0, 0, 0, 0.5); */ 
}
.assistant-icon.visible:active {
  transform: scale(0.9);
  /* box-shadow: 0 0 25px rgba(0, 0, 0, 0.7); */
}

 /* Значок ИИ */
.scaled-svg-ai {
  width: 100%;
  height: 100%;
  transform: scale(0.9) translateY(6px); /* Уменьшаем на 80% и сдвигаем вниз на 10px */
  transform-origin: center center;
}

/* Тёмная полупрозрачная подложка на весь экран */
.assistant-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 11;
}
.assistant-overlay.active {
  display: block;
}

/* Стиль диалогового окна (чат) */
.assistant-chat {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 0;
  height: 0;
  overflow: hidden;
  background: #DDEEE6;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transition: width 0.5s ease, height 0.5s ease;
  z-index: 12;
  display: flex;
  flex-direction: column;
  max-width: 90vw;
  max-height: 90vh;
  max-height: 90dvh;
}
.assistant-chat.open {
  width: 500px;
  height: 600px;
}

/* Заголовок чата */
.assistant-chat-header {
  background: #0052a6;
  padding: 10px;
  color: #fff;
  font-weight: bold;
  text-align: center;
  border-radius: 8px 8px 0 0;
}

/* Основная часть чата */
.assistant-chat-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;   
  overflow-x: hidden;
  padding: 10px;
  gap: 6px;
}
.assistant-chat-messages {
  position: relative; /* добавляем относительное позиционирование */
  flex: 1;
  overflow-y: auto;
  margin-bottom: 0;
  border: 1px solid #eee;
  background: white;
  padding: 8px;
  border-radius: 4px;
}
/* Стили для элемента-подсказки */
.assistant-chat-messages .placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;   
  color: #888;       /* приятный оттенок серого */
  text-align: center;
  pointer-events: none;  /* чтобы не мешал взаимодействию с чатом */
}
.assistant-chat-messages .top-notice {
  position: absolute;
  top: 10px;    
  left: 50%;
  width: 90%;
  transform: translateX(-50%);
  font-size: 14px;    
  color: #777;       /* немного светлее серого */
  text-align: center;
  pointer-events: none;
}
    
.assistant-chat-input {
  display: flex;
  align-items: center;
  padding: 2px 0;
}
#assistantInput {
  flex: 1;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  min-width: 50px; /* критично: позволяет инпуту ужаться */
  font-size: 16px;
}
.send-btn {
  margin-left: 8px;
  padding: 0;
  border: none;
  background: #0052a6;
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}
.send-btn svg {
  width: 24px;
  height: 24px;
  display: block;
  fill: currentColor;
  transition: transform 0.2s ease;
}
.send-btn:hover {
  opacity: 0.9;
}
.send-btn.disabled {
  background: silver;
  color: #fff;        /* Можно оставить цвет текста, либо изменить */
  cursor: not-allowed;
}
.assistant-action-btn.is-call-ready {
  background: #0b4d32;
}
.assistant-action-btn.is-text-ready {
  background: #0052a6;
}
.assistant-action-btn.is-call-active {
  background: #c62828;
}
.assistant-action-btn.is-call-active svg {
  transform: rotate(135deg);
}
.assistant-action-btn.is-starting {
  background: #0b4d32;
  opacity: 0.8;
}
.assistant-call-status {
  min-height: 18px;
  padding: 0 2px;
  color: #52606d;
  font-size: 13px;
  text-align: center;
}
.assistant-call-status:empty {
  display: none;
  min-height: 0;
  padding: 0;
}
.assistant-call-status.is-error {
  color: #b42318;
}
.assistant-call-status.is-active {
  color: #067647;
  font-weight: 600;
}
.assistant-call-status.is-ringing {
  color: #0b4d32;
  font-weight: 600;
}
   
/* Стили для сообщений в чате */
.chat-message {
  margin: 4px 0;
  padding: 6px 10px;
  border-radius: 4px;
}
.chat-message.user {
  background-color: #d0eaff;
  text-align: right;
  background-image: url('user.png');
  background-repeat: no-repeat;
  background-size: 40px 40px;
  background-position: 10px center;
  padding-left: 60px;
}
.chat-message.assistant {
  background-color: #F0F0EB;
  text-align: left;
}
.chat-message img {
  max-width: calc(100% - 10px);
  height: auto;
  object-fit: contain; /* Сохраняет пропорции */
}


/* размеры заголовков в чате от ассистента */
.chat-message.assistant h6 {
  font-size: 1em; /* базовый размер — равен текущему шрифту */
  margin-bottom: -0.4em;
}
.chat-message.assistant h5 {
  font-size: 1.14em; 
  margin-bottom: -0.4em;
}
.chat-message.assistant h4 {
  font-size: 1.27em;
  margin-bottom: -0.4em;
}
.chat-message.assistant h3 {
  font-size: 1.4em;
  margin-bottom: -0.4em;
}
.chat-message.assistant h2 {
  font-size: 1.6em;
  margin-bottom: -0.1em;
  text-align: center;
}
.chat-message.assistant h1 {
  font-size: 1.8em;
  margin-bottom: -0.1em;
  text-align: center;
}


/* Стилизация таблиц для чата */
.chat-message table {
  width: 80%;
  margin: 20px auto;
  border-collapse: collapse; /* Объединяем границы ячеек */
  border: 1px solid #6a0dad; /* Граница таблицы */
}
.chat-message th, .chat-message td {
  padding: 6px;
  border: 1px solid #B2B3B3;
}
.chat-message th {
  text-align: center;
  background-color: #D9DADA;
  color: black;
}
.chat-message tbody tr {
  background-color: #FEFEFE; /* Однотонный цвет для всех строк */
}
.chat-message tbody tr:hover {
  background-color: #F7F7F7;
}
/* Стилизация блока code */
.chat-message pre {
    position: relative; /* Добавлено позиционирование относительно */
    padding: 6px;
    background-color: #F7F7F7; /* Светлый фон для кода */
    border: 1px solid #B2B3B3; /* Граница вокруг блока кода */
    border-radius: 5px;
    overflow: auto; /* Чтобы длинные строки не выходили за пределы блока */
}
.ChatAI pre::-webkit-scrollbar-track {
    background: #F0F0F0; /* Цвет дорожки полосы прокрутки */
}
.ChatAI pre::-webkit-scrollbar-thumb {
    background: #DCDCDC; /* Цвет самой полосы прокрутки */
}
.table-scroll-wrapper {
  overflow-x: auto;
  overflow-y: hidden;
  width: 100%;
  display: block;
}


/* техподдержка */
/* Уникальные стили для виджета отправки */
.send-widget-box {
  background: #f0f8ff;
  border: 1px solid #90caf9;
  border-radius: 8px;
  padding: 12px;
  max-width: 600px;
  margin: 10px 0;
}
.send-widget-label {
  font-weight: bold;
  color: #006064;
  margin-bottom: 6px;
}
.send-widget-content {
  margin-bottom: 8px;
  color: #004d40;
}
.send-widget-btn {
  padding: 6px 12px;
  background: #e0f7fa;
  color: #006064;
  border: 1px solid #006064;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
  display: inline-block;
  width: auto;
  margin-top: 4px;
}
#send-widget-menu {
  position: absolute;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  padding: 6px 0;
  z-index: 1000;
}
#send-widget-menu button {
  display: block;
  width: 100%;
  padding: 6px 12px;
  background: none;
  border: none;
  text-align: left;
  font-size: 0.9em;
  cursor: pointer;
}
#send-widget-menu button:hover {
  background: #f5f5f5;
}

@media (max-width: 600px) {
  .assistant-icon {
    right: 12px;
    bottom: 12px;
    width: 68px;
    height: 68px;
  }

  .assistant-icon::before {
    width: 84px;
    height: 84px;
  }

  .assistant-chat {
    right: 10px;
    bottom: 10px;
    max-width: calc(100vw - 20px);
    max-height: 84vh;
    max-height: 84dvh;
  }

  .assistant-chat.open {
    width: calc(100vw - 20px);
    height: 84vh;
    height: 84dvh;
  }

  .assistant-chat-body {
    padding: 8px;
  }

  .assistant-chat-messages .placeholder {
    width: 90%;
    font-size: 20px;
  }

  .chat-message table {
    width: 100%;
  }
}

.assistant-overlay.voice-call-mode {
  background: #000;
}

.assistant-chat.voice-call-mode {
  top: 14vh;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 86vh;
  height: 86dvh;
  max-width: 100vw;
  max-height: 86vh;
  max-height: 86dvh;
  border-radius: 18px 18px 0 0;
  background: #000;
  box-shadow: none;
}

.assistant-chat.voice-call-mode.is-browser-fullscreen,
.assistant-chat.voice-call-mode:fullscreen,
.assistant-chat.voice-call-mode:-webkit-full-screen {
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  border-radius: 0;
}

.assistant-chat.voice-call-mode .assistant-chat-header {
  display: none;
}

.assistant-chat.voice-call-mode .assistant-chat-body {
  align-items: center;
  justify-content: flex-end;
  padding: 24px;
  gap: 22px;
  background: #000;
}

.assistant-chat.voice-call-mode .assistant-chat-messages {
  display: none;
}

.assistant-chat.voice-call-mode .assistant-call-status {
  display: block;
  margin: auto 0 30px;
  color: #fff;
  font-size: 20px;
  line-height: 1.35;
  min-height: 30px;
  padding: 0 16px;
  text-align: center;
}

.assistant-chat.voice-call-mode .assistant-call-status.is-error {
  color: #ffb4ab;
}

.assistant-chat.voice-call-mode .assistant-call-status.is-active,
.assistant-chat.voice-call-mode .assistant-call-status.is-ringing {
  color: #fff;
}

.assistant-chat.voice-call-mode .assistant-chat-input {
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  padding: 4px 0 calc(34px + env(safe-area-inset-bottom));
}

.assistant-chat.voice-call-mode .assistant-chat-input::before {
  content: "Можете спрашивать";
  color: rgba(255, 255, 255, 0.82);
  font-size: 17px;
  line-height: 1.3;
}

.assistant-chat.voice-call-mode #assistantInput {
  display: none;
}

.assistant-chat.voice-call-mode .send-btn {
  width: 64px;
  height: 64px;
  flex-basis: 64px;
  margin-left: 0;
  background: #c62828;
}

.assistant-chat.voice-call-mode .send-btn svg {
  width: 30px;
  height: 30px;
  transform: rotate(135deg);
}

