/* Чат с Игорем — в палитре сайта */

.float-chat {
  position: fixed;
  right: 24px; bottom: 24px;
  width: 58px; height: 58px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: linear-gradient(135deg, rgba(201,169,97,.22), rgba(201,169,97,.08)), #1A1410;
  color: var(--gold-light);
  display: flex; align-items: center; justify-content: center;
  z-index: 160;
  cursor: pointer;
  box-shadow: 0 10px 30px -12px rgba(0,0,0,.8);
  transition: transform .25s var(--ease-even), box-shadow .25s, bottom .3s var(--ease-even);
}

/* пока висит баннер cookie — поднимаем кнопку над ним */
body:has(.cookie-banner:not([hidden]):not(.is-hide)) .float-chat { bottom: 112px; }
@media (max-width: 720px) {
  body:has(.cookie-banner:not([hidden]):not(.is-hide)) .float-chat { bottom: 232px; }
}
.float-chat:hover { transform: translateY(-2px); box-shadow: 0 16px 36px -12px rgba(201,169,97,.5); }
.float-chat svg { width: 24px; height: 24px; }
.float-chat::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 1px solid rgba(201,169,97,.35);
  animation: chatPulse 2.6s ease-out infinite;
}
@keyframes chatPulse {
  0% { transform: scale(.9); opacity: .8; }
  100% { transform: scale(1.35); opacity: 0; }
}
.float-chat.is-hidden { display: none; }

.chat {
  position: fixed;
  right: 24px; bottom: 96px;
  width: 400px; height: min(620px, calc(100vh - 130px));
  display: flex; flex-direction: column;
  background: #14100D;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.95);
  z-index: 170;
  overflow: hidden;
}
.chat[hidden] { display: none; }

.chat__head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(160deg, rgba(201,169,97,.10), transparent 70%);
}
.chat__ava {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: linear-gradient(135deg, rgba(201,169,97,.25), rgba(201,169,97,.05));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 19px; color: var(--gold-light);
  flex-shrink: 0;
}
.chat__who { flex: 1; min-width: 0; line-height: 1.25; }
.chat__who b { display: block; font-family: var(--font-display); font-size: 17px; font-weight: 600; color: var(--text); }
.chat__who span { font-size: 11.5px; color: var(--text-muted); letter-spacing: .02em; }
.chat__close {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent; color: var(--text-muted);
  font-size: 18px; line-height: 1; cursor: pointer;
  transition: .2s;
}
.chat__close:hover { color: var(--gold-light); border-color: var(--border-strong); }

.chat__body {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  scrollbar-width: thin;
}
.chat__body::-webkit-scrollbar { width: 6px; }
.chat__body::-webkit-scrollbar-thumb { background: rgba(201,169,97,.25); border-radius: 3px; }

.chat__note {
  font-size: 11.5px; line-height: 1.45;
  color: var(--text-dim, #6A645C);
  border-left: 2px solid var(--gold-dim);
  padding-left: 10px;
  margin-bottom: 4px;
}

.chat__msg {
  max-width: 88%;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 14.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.chat__msg--bot {
  align-self: flex-start;
  background: rgba(201,169,97,.07);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.chat__msg--user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #1A1410;
  border-bottom-right-radius: 4px;
}
.chat__msg--err { border-color: rgba(229,115,115,.4); color: #E8B4B2; background: rgba(229,115,115,.08); }

.chat__typing { display: inline-flex; gap: 4px; align-items: center; height: 18px; }
.chat__typing i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold); opacity: .35;
  animation: chatDot 1.2s infinite;
}
.chat__typing i:nth-child(2) { animation-delay: .15s; }
.chat__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes chatDot { 0%,60%,100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.chat__form {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: rgba(13,11,9,.6);
}
.chat__form textarea {
  flex: 1;
  resize: none;
  max-height: 110px;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0F0C0A;
  color: var(--text);
  font: inherit; font-size: 14.5px;
  line-height: 1.45;
}
.chat__form textarea:focus { outline: none; border-color: var(--gold); }
.chat__form textarea::placeholder { color: #6A645C; }
.chat__send {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 10px; border: 0;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #1A1410; font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: .2s;
}
.chat__send:hover { filter: brightness(1.06); }
.chat__send[disabled] { opacity: .45; cursor: not-allowed; }

/* форма заявки при исчерпании лимита */
.chat__lead {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: rgba(201,169,97,.06);
}
.chat__lead[hidden] { display: none; }
.chat__lead p { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; line-height: 1.45; }
.chat__lead input {
  width: 100%; margin-bottom: 8px;
  padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: #0F0C0A; color: var(--text);
  font: inherit; font-size: 14px;
}
.chat__lead input:focus { outline: none; border-color: var(--gold); }
.chat__lead button {
  width: 100%; padding: 11px;
  border-radius: 8px; border: 0;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #1A1410; font: inherit; font-weight: 600; cursor: pointer;
}
.chat__lead .ok { font-size: 13px; color: var(--gold-light); }

.chat__tools {
  display: flex; justify-content: center; align-items: center; gap: 8px;
  padding: 8px 14px 10px;
  border-top: 1px solid rgba(201, 169, 97, 0.10);
}
.chat__summary {
  background: transparent; border: 1px solid var(--border); border-radius: 999px;
  cursor: pointer; font: inherit; font-size: 12px; color: var(--text-muted);
  padding: 6px 12px; transition: .2s;
}
.chat__summary:hover { color: var(--gold-light); border-color: var(--border-strong); }
.chat__tools[hidden] { display: none; }

@media (max-width: 720px) {
  .float-chat { right: 16px; bottom: 76px; width: 54px; height: 54px; }
  .chat {
    right: 0; left: 0; bottom: 0;
    width: auto; height: 100dvh;
    max-height: none;
    border-radius: 0;
    border-left: 0; border-right: 0; border-bottom: 0;
  }
  .chat__body { padding: 14px; }
  .chat__msg { max-width: 92%; font-size: 15px; }
  .chat__form textarea { font-size: 16px; } /* чтобы iOS не зумил */
}

.chat__hint { font-size: 12.5px; color: var(--text-muted); }

/* прикрепление документов */
.chat__attach {
  width: 40px; height: 44px; flex-shrink: 0;
  border-radius: 10px; border: 1px solid var(--border);
  background: transparent; color: var(--text-muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: .2s;
}
.chat__attach:hover { color: var(--gold-light); border-color: var(--border-strong); }
.chat__attach svg { width: 18px; height: 18px; }

.chat__chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 14px 0; }
.chat__chips[hidden] { display: none; }
.chat__chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--gold-light);
  background: rgba(201,169,97,.10); border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 4px 10px;
}
.chat__chip button { background: none; border: 0; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; padding: 0; }
.chat__sep { display: none; }

.chat__docmenu { display: flex; flex-direction: column; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--border); }
.chat__docmenu[hidden] { display: none; }
.chat__docmenu button {
  text-align: left; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: #0F0C0A; color: var(--text);
  font: inherit; font-size: 13.5px; cursor: pointer;
}
.chat__docmenu button:hover { border-color: var(--gold); color: var(--gold-light); }

.chat__files { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

a.chat__file {
  display: inline-block; margin-top: 0;
  padding: 9px 16px; border-radius: 8px;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #1A1410; font-weight: 600; text-decoration: none;
}


/* кнопка «начать заново» */
.chat__reset {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent; color: var(--text-muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  margin-right: 6px; transition: .2s;
}
.chat__reset:hover { color: var(--gold-light); border-color: var(--border-strong); }

a.chat__file--word {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--gold-light);
}

/* кнопка «всё равно подготовить» */
.chat__force {
  display: block; margin-top: 12px;
  padding: 9px 16px; border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: transparent; color: var(--gold-light);
  font: inherit; font-size: 13px; cursor: pointer;
  transition: .2s;
}
.chat__force:hover { background: rgba(201, 169, 97, 0.10); }

.chat__tip {
  display: block; margin-top: 10px;
  font-size: 12px; line-height: 1.5; color: var(--text-muted);
}
