/*!
 * Чат-ассистент nadomu.sumy.ua — стили виджета.
 * Всё под префиксом .nchat-, чтобы ничего не столкнулось со стилями сайта.
 */

.nchat-btn {
  position: fixed;
  right: 20px;
  bottom: 88px;   /* поднято: внизу справа у сайта свои красные кнопки в потоке */
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: 0;
  border-radius: 3px;
  background: #e75440;
  color: #fff;
  font: 600 15px/1.2 inherit;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .22);
}
.nchat-btn:hover { background: #cf4430; }
.nchat-btn:focus-visible { outline: 3px solid #1b4f77; outline-offset: 2px; }
.nchat-btn-i { font-size: 17px; line-height: 1; }
.nchat-hidden { display: none; }

.nchat-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  width: 370px;
  max-width: calc(100vw - 32px);
  max-height: min(620px, calc(100vh - 40px));
  display: none;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 10px 44px rgba(0, 0, 0, .26);
  font: 400 15px/1.5 inherit;
  font-family: inherit;
  color: #2b2f33;
}
.nchat-panel.nchat-open { display: flex; }

.nchat-head {
  display: flex;
  align-items: center;
  padding: 13px 16px;
  background: #3f9ad4;
  color: #fff;
}
.nchat-head b { font-size: 15px; font-weight: 600; }
.nchat-x {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.nchat-x:hover { background: rgba(255, 255, 255, .16); }
.nchat-x:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }

.nchat-log {
  flex: 1;
  min-height: 220px;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f4f5f6;
}

.nchat-msg {
  max-width: 86%;
  padding: 9px 13px;
  border-radius: 13px;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 14.5px;
}
.nchat-bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e2e4e7;
  border-bottom-left-radius: 4px;
}
.nchat-me {
  align-self: flex-end;
  background: #3f9ad4;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.nchat-note {
  align-self: center;
  max-width: 100%;
  padding: 3px 0;
  background: none;
  color: #2f7d4f;
  font-size: 13px;
  font-weight: 600;
}

.nchat-typing { display: flex; gap: 4px; padding: 13px; }
.nchat-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a3a8ad;
  animation: nchat-blink 1.2s infinite;
}
.nchat-typing i:nth-child(2) { animation-delay: .18s; }
.nchat-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes nchat-blink { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }

.nchat-form {
  display: flex;
  gap: 8px;
  padding: 11px 14px;
  border-top: 1px solid #e2e4e7;
  background: #fff;
}
.nchat-form input {
  flex: 1;
  min-width: 0;
  padding: 10px 13px;
  border: 1px solid #d5d8dc;
  border-radius: 3px;
  background: #f4f5f6;
  color: #2b2f33;
  font: inherit;
  font-size: 15px;
}
.nchat-form input:focus-visible { outline: 2px solid #3f9ad4; outline-offset: 1px; border-color: #3f9ad4; }
.nchat-form input:disabled { opacity: .6; }

.nchat-send {
  flex: none;
  width: 44px;
  border: 0;
  border-radius: 3px;
  background: #e75440;
  color: #fff;
  font-size: 19px;
  cursor: pointer;
}
.nchat-send:hover { background: #cf4430; }
.nchat-send:disabled { opacity: .45; cursor: default; }
.nchat-send:focus-visible { outline: 2px solid #1b4f77; outline-offset: 2px; }

.nchat-foot {
  padding: 0 14px 12px;
  background: #fff;
  color: #6b7075;
  font-size: 11.5px;
  line-height: 1.45;
}
.nchat-foot a { color: #2684c0; font-weight: 600; }

@media (max-width: 520px) {
  .nchat-panel {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-height: calc(100vh - 16px);
  }
  .nchat-btn { right: 14px; bottom: 76px; padding: 11px 16px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .nchat-typing i { animation: none; opacity: .55; }
}
