/* Виджет Sun-Travel Chat — палитра сайта: ночная база, латунный акцент. */

#suntravel-chat {
  --stc-ink: #060F16;
  --stc-ink-2: #0A1C28;
  --stc-paper: #E7E7E0;
  --stc-gold: #E8912F;
  --stc-gold-lt: #F6B25C;
  --stc-line: rgba(231, 231, 224, 0.16);
}

/* атрибут hidden обязан прятать элементы, что бы ни говорили display-правила ниже */
#suntravel-chat [hidden] {
  display: none !important;
}

#suntravel-chat {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99999;
  /* Тема может задавать body > * { width: … ; zoom: … } — фикс-контейнер
     тогда растягивается на ширину макета и кнопка уезжает влево. */
  width: auto !important;
  min-width: 0 !important;
  zoom: 1 !important;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: 'Raleway', system-ui, -apple-system, sans-serif;
}

#suntravel-chat .stc-toggle {
  position: relative;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(232, 145, 47, 0.55);
  border-radius: 50%;
  background: var(--stc-ink);
  color: var(--stc-gold);
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(6, 15, 22, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.35s cubic-bezier(.16, 1, .3, 1), background 0.35s ease, color 0.35s ease;
}

#suntravel-chat .stc-toggle:hover {
  transform: translateY(-3px);
  background: var(--stc-gold);
  color: var(--stc-ink);
}

#suntravel-chat .stc-toggle:focus-visible,
#suntravel-chat .stc-teaser:focus-visible {
  outline: 2px solid var(--stc-gold);
  outline-offset: 3px;
}

#suntravel-chat .stc-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: var(--stc-gold);
  color: var(--stc-ink);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

#suntravel-chat .stc-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: 372px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100dvh - 120px);
  background: var(--stc-ink);
  border: 1px solid var(--stc-line);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#suntravel-chat .stc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  background: var(--stc-ink-2);
  border-bottom: 1px solid var(--stc-line);
  color: var(--stc-paper);
}

#suntravel-chat .stc-head strong {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

#suntravel-chat .stc-status {
  display: block;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--stc-gold);
  margin-top: 6px;
}

#suntravel-chat .stc-channels {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

#suntravel-chat .stc-channels a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--stc-line);
  color: var(--stc-paper);
  transition: border-color 0.3s ease, color 0.3s ease, transform 0.3s ease;
}

#suntravel-chat .stc-channels a:hover {
  border-color: var(--stc-gold);
  color: var(--stc-gold);
  transform: translateY(-2px);
}

#suntravel-chat .stc-close {
  background: none;
  border: 0;
  color: rgba(231, 231, 224, 0.6);
  width: 28px;
  height: 28px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.3s ease;
}

#suntravel-chat .stc-close:hover {
  color: var(--stc-gold);
}

#suntravel-chat .stc-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--stc-ink);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#suntravel-chat .stc-msg {
  max-width: 84%;
  padding: 11px 14px;
  font-size: 14px;
  line-height: 1.6;
  font-weight: 300;
  word-wrap: break-word;
}

#suntravel-chat .stc-msg a {
  color: var(--stc-gold);
  text-decoration: underline;
  text-underline-offset: 3px;
}

#suntravel-chat .stc-user {
  align-self: flex-end;
  background: var(--stc-gold);
  color: var(--stc-ink);
  font-weight: 400;
}

#suntravel-chat .stc-assistant {
  align-self: flex-start;
  background: var(--stc-ink-2);
  color: var(--stc-paper);
  border-left: 1px solid rgba(232, 145, 47, 0.5);
}

#suntravel-chat .stc-operator {
  align-self: flex-start;
  background: var(--stc-ink-2);
  color: var(--stc-paper);
  border-left: 1px solid var(--stc-gold-lt);
}

#suntravel-chat .stc-operator::before {
  content: "Guide";
  display: block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--stc-gold-lt);
  margin-bottom: 5px;
}

#suntravel-chat .stc-system {
  align-self: center;
  background: transparent;
  color: rgba(231, 231, 224, 0.5);
  font-size: 12px;
  text-align: center;
}

#suntravel-chat .stc-typing {
  display: flex;
  gap: 5px;
  padding: 14px 16px;
}

#suntravel-chat .stc-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--stc-gold);
  animation: stcBlink 1.2s infinite;
}

#suntravel-chat .stc-typing span:nth-child(2) { animation-delay: 0.2s; }
#suntravel-chat .stc-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes stcBlink {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

#suntravel-chat .stc-form {
  display: flex;
  gap: 10px;
  padding: 12px;
  background: var(--stc-ink-2);
  border-top: 1px solid var(--stc-line);
}

#suntravel-chat .stc-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(231, 231, 224, 0.28);
  color: var(--stc-paper);
  font-family: inherit;
  font-size: 15px;
  font-weight: 300;
  padding: 8px 2px;
  outline: none;
  transition: border-color 0.3s ease;
}

#suntravel-chat .stc-input::placeholder {
  color: rgba(231, 231, 224, 0.35);
}

#suntravel-chat .stc-input:focus {
  border-bottom-color: var(--stc-gold);
}

#suntravel-chat .stc-send {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(232, 145, 47, 0.5);
  border-radius: 50%;
  background: transparent;
  color: var(--stc-gold);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.3s ease, color 0.3s ease;
}

#suntravel-chat .stc-send:hover {
  background: var(--stc-gold);
  color: var(--stc-ink);
}

/* ---- тизер-приглашение ---- */
#suntravel-chat .stc-teaser {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: 280px;
  padding: 16px 36px 16px 18px;
  background: var(--stc-ink-2);
  border: 1px solid rgba(232, 145, 47, 0.4);
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.55);
  font-size: 14px;
  line-height: 1.6;
  font-weight: 300;
  color: var(--stc-paper);
  cursor: pointer;
  animation: stcTeaserIn 0.5s cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes stcTeaserIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

#suntravel-chat .stc-teaser-close {
  position: absolute;
  top: 6px;
  right: 10px;
  border: 0;
  background: none;
  font-size: 18px;
  line-height: 1;
  color: rgba(231, 231, 224, 0.4);
  cursor: pointer;
}

#suntravel-chat .stc-teaser-close:hover {
  color: var(--stc-gold);
}

/* На странице маршрута внизу висит панель брони — поднимаем виджет над ней. */
@media (min-width: 761px) {
  body.single-st_tour #suntravel-chat {
    bottom: 92px;
  }
}

@media (max-width: 575.98px) {
  #suntravel-chat {
    right: 14px;
    bottom: 14px;
  }
  body.single-st_tour #suntravel-chat {
    bottom: 78px;
  }
  #suntravel-chat .stc-panel {
    width: calc(100vw - 28px);
    height: 72dvh;
  }
}

@media (prefers-reduced-motion: reduce) {
  #suntravel-chat .stc-teaser { animation: none; }
  #suntravel-chat .stc-typing span { animation: none; }
}
