/* Чат поддержки: плавающий виджет + панель переписки. Палитра сайта. */
.support-widget {
  position: fixed;
  right: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  font-family: inherit;
  color: #FFF;
}
.support-widget [hidden] {
  display: none !important;
}

/* --- кнопка-лончер --- */
.support-widget__launcher {
  position: relative;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  color: #FFF;
  background: linear-gradient(135deg, #E270BB, #c255a0);
  box-shadow: 0 16px 34px -14px rgba(226, 112, 187, 0.95);
  transition: transform 0.18s ease, box-shadow 0.2s ease;
}
.support-widget__launcher:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 20px 40px -14px rgba(226, 112, 187, 1);
}
.support-widget__launcher:active {
  transform: translateY(0) scale(0.98);
}
.support-widget__launcher-icon {
  width: 24px;
  height: 24px;
}
.support-widget__badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 2px solid #1E1E1E;
  background-color: #FF5B7F;
  color: #FFF;
  font-size: 0.68em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.support-widget--unread .support-widget__launcher::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(226, 112, 187, 0.5);
  animation: support-pulse 1.8s ease-out infinite;
}
@keyframes support-pulse {
  0% {
    transform: scale(0.92);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.25);
    opacity: 0;
  }
}

/* --- панель --- */
.support-widget__panel {
  position: fixed;
  right: 24px;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  z-index: 70;
  display: flex;
  flex-direction: column;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: min(560px, calc(100vh - 140px));
  overflow: hidden;
  border: 1px solid #2d2d2d;
  border-radius: 18px;
  background-color: #1b1b1b;
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.95);
  animation: support-in 0.18s ease;
}
@keyframes support-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
}
.support-widget__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background-color: #252525;
  border-bottom: 1px solid #2d2d2d;
}
.support-widget__avatar {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: rgba(226, 112, 187, 0.12);
  border: 1px solid rgba(226, 112, 187, 0.35);
}
.support-widget__avatar img {
  width: 22px;
  height: 22px;
}
.support-widget__presence {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #252525;
  background-color: #3ddc84;
}
.support-widget__heading {
  min-width: 0;
  flex: 1 1 auto;
}
.support-widget__title {
  font-size: 0.9em;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.support-widget__status {
  margin-top: 1px;
  color: #848282;
  font-size: 0.72em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.support-widget__status--unread {
  color: #E270BB;
  font-weight: 600;
}
.support-widget__close {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #9B9C9F;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.support-widget__close:hover {
  color: #FFF;
  background-color: rgba(255, 255, 255, 0.08);
}

.support-widget__messages {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.support-widget__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  gap: 6px;
  padding: 20px;
  text-align: center;
}
.support-widget__empty-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 4px;
  border-radius: 50%;
  background-color: rgba(226, 112, 187, 0.1);
  color: #E270BB;
}
.support-widget__empty-title {
  font-size: 0.95em;
  font-weight: 700;
}
.support-widget__empty-text {
  max-width: 260px;
  color: #848282;
  font-size: 0.8em;
  line-height: 1.5;
}

.support-widget__day {
  display: flex;
  justify-content: center;
  margin: 6px 0 2px;
}
.support-widget__day-label {
  padding: 3px 10px;
  border-radius: 999px;
  background-color: #252525;
  color: #848282;
  font-size: 0.68em;
  font-weight: 600;
}
.support-widget__message {
  display: flex;
  flex-direction: column;
  max-width: 100%;
}
.support-widget__message--user {
  align-items: flex-end;
}
.support-widget__message--staff {
  align-items: flex-start;
}
.support-widget__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 84%;
}
.support-widget__bubble {
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 0.86em;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}
.support-widget__message--user .support-widget__bubble {
  border-bottom-right-radius: 4px;
  background: linear-gradient(135deg, #E270BB, #c255a0);
  color: #FFF;
}
.support-widget__message--staff .support-widget__bubble {
  border-bottom-left-radius: 4px;
  background-color: #2d2d2d;
  color: #EDEAEA;
}
.support-widget__meta {
  color: #7c7c7c;
  font-size: 0.68em;
  font-variant-numeric: tabular-nums;
}
.support-widget__message--user .support-widget__meta {
  text-align: right;
}
.support-widget__attachment-image,
.support-widget__attachment-video {
  display: block;
  max-width: 220px;
  max-height: 220px;
  border-radius: 12px;
  border: 1px solid #2d2d2d;
  background-color: #111;
}
.support-widget__attachment-link {
  display: block;
}

/* --- поле ввода --- */
.support-widget__composer {
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #2d2d2d;
  background-color: #1b1b1b;
}
.support-widget__composer-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.support-widget__attach {
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: #9B9C9F;
  background-color: #252525;
  border: 1px solid #2d2d2d;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.support-widget__attach:hover {
  color: #E270BB;
  border-color: rgba(226, 112, 187, 0.45);
}
.support-widget__input {
  flex: 1 1 auto;
  min-height: 36px;
  max-height: 120px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #2d2d2d;
  background-color: #252525;
  color: #FFF;
  font-size: 0.86em;
  line-height: 1.4;
  resize: none;
  outline: none;
  transition: border-color 0.2s ease;
}
.support-widget__input:focus {
  border-color: rgba(226, 112, 187, 0.55);
}
.support-widget__input::placeholder {
  color: #7c7c7c;
}
.support-widget__send {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #FFF;
  background: linear-gradient(135deg, #E270BB, #c255a0);
  transition: transform 0.15s ease, opacity 0.2s ease;
}
.support-widget__send:hover:not(:disabled) {
  transform: scale(1.05);
}
.support-widget__send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.support-widget__hint {
  margin-top: 6px;
  color: #6f6f6f;
  font-size: 0.68em;
  line-height: 1.4;
}
.support-widget__error {
  margin-top: 6px;
  color: #FF6B6B;
  font-size: 0.75em;
  font-weight: 600;
}
.support-widget__attachment {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px dashed rgba(226, 112, 187, 0.4);
  background-color: rgba(226, 112, 187, 0.07);
  font-size: 0.75em;
}
.support-widget__attachment-name {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #EDEAEA;
}
.support-widget__attachment-remove {
  flex: 0 0 auto;
  color: #E270BB;
  font-size: 1.2em;
  line-height: 1;
}

/* --- тизер --- */
.support-widget__teaser {
  position: fixed;
  right: 24px;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  z-index: 61;
  max-width: 270px;
  padding: 12px 30px 12px 14px;
  border: 1px solid rgba(226, 112, 187, 0.35);
  border-radius: 14px 14px 4px 14px;
  background-color: #252525;
  box-shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.95);
  cursor: pointer;
  animation: support-teaser-in 0.25s ease;
}
.support-widget__teaser-text {
  color: #EDEAEA;
  font-size: 0.8em;
  line-height: 1.5;
}
.support-widget__teaser-close {
  position: absolute;
  top: 6px;
  right: 8px;
  color: #848282;
  font-size: 1.1em;
  line-height: 1;
}
.support-widget__teaser-close:hover {
  color: #FFF;
}
@keyframes support-teaser-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* --- мобильная версия --- */
@media (max-width: 768px) {
  .support-widget {
    right: 16px;
    bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  }
  .support-widget__launcher {
    width: 50px;
    height: 50px;
    box-shadow: 0 12px 26px -12px rgba(226, 112, 187, 0.9);
  }
  .support-widget__panel {
    inset: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border: none;
    border-radius: 0;
  }
  .support-widget__header {
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
  }
  .support-widget__teaser {
    right: 16px;
    bottom: calc(150px + env(safe-area-inset-bottom, 0px));
    max-width: 240px;
  }
  body.support-chat-open {
    overflow: hidden;
  }
  body.support-chat-open .footer__navigation {
    display: none;
  }
  body.support-chat-open .support-widget__launcher {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .support-widget__launcher,
  .support-widget__panel,
  .support-widget__teaser,
  .support-widget--unread .support-widget__launcher::after {
    animation: none !important;
    transition: none !important;
  }
}
