/* Плаваючий віджет зв'язку EuroMobile — світла палітра, компактний хедер */

.site-chat-widget {
  --sc-bg: #ffffff;
  --sc-surface: #eef5ff;
  --sc-border: rgba(30, 58, 95, 0.12);
  --sc-accent: #f28c18;
  --sc-accent-soft: rgba(242, 140, 24, 0.12);
  --sc-blue: #1976d2;
  --sc-blue-soft: #e8f2ff;
  --sc-head-bg: linear-gradient(135deg, #eef4fc 0%, #e3ecf8 100%);
  --sc-head-text: #163454;
  --sc-text: #1a2d44;
  --sc-muted: #5a6b82;
  --sc-radius: 12px;
  --sc-shadow: 0 18px 42px rgba(22, 52, 84, 0.18);
  position: fixed;
  z-index: 2147483000;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: 0.01em;
  color: var(--sc-text);
  box-sizing: border-box;
}

.site-chat-widget *,
.site-chat-widget *::before,
.site-chat-widget *::after {
  box-sizing: border-box;
}

.site-chat-widget button {
  margin: 0;
}

.site-chat-widget:not([data-ready="1"]) {
  visibility: hidden;
  pointer-events: none;
}

.site-chat-widget[data-ready="1"] {
  visibility: visible;
}

.site-chat-widget .site-chat-panel[hidden] {
  display: none !important;
}

.site-chat-widget .site-chat-greeting[hidden] {
  display: none !important;
}

/* Панель вище за FAB — клік по хрестику не перехоплюється круглою кнопкою */
.site-chat-widget .site-chat-panel {
  z-index: 100;
}

.site-chat-widget .site-chat-greeting {
  z-index: 80;
}

.site-chat-widget .site-chat-fab {
  position: relative;
  z-index: 50;
}

@keyframes sc-pop-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* FAB */
.site-chat-fab {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #2f86ea 0%, #1565c0 100%);
  color: #fff;
  box-shadow: 0 10px 26px rgba(30, 107, 190, 0.32);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.site-chat-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(30, 107, 190, 0.34);
}

.site-chat-fab:active {
  transform: translateY(0);
}

.site-chat-fab svg {
  width: 24px;
  height: 24px;
}

.site-chat-fab {
  position: relative;
}

/* Компактне привітання для першого візиту */
.site-chat-greeting {
  position: absolute;
  right: 0;
  bottom: 70px;
  width: min(300px, calc(100vw - 24px));
  padding: 14px 38px 14px 16px;
  border: 1px solid rgba(30, 58, 95, 0.12);
  border-radius: 12px;
  background: #fff;
  color: #5f7086;
  box-shadow: 0 14px 34px rgba(22, 52, 84, 0.16);
  animation: sc-pop-in 0.25s ease;
}

.site-chat-greeting::after {
  content: "";
  position: absolute;
  right: 22px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-right: 1px solid rgba(30, 58, 95, 0.12);
  border-bottom: 1px solid rgba(30, 58, 95, 0.12);
  transform: rotate(45deg);
}

.site-chat-greeting__text {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 14px;
  line-height: 1.55;
  text-align: left;
  cursor: pointer;
}

.site-chat-greeting__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #eef5ff;
  color: #6a7b91;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.site-chat-greeting__close span {
  font-size: 18px;
  line-height: 1;
  transform: translateY(-1px);
}

/* Панель */
.site-chat-panel {
  position: absolute;
  right: 0;
  bottom: 70px;
  width: min(330px, calc(100vw - 24px));
  height: min(610px, calc(100vh - 88px));
  min-height: min(500px, calc(100vh - 88px));
  max-height: min(680px, calc(100vh - 88px));
  background: var(--sc-bg);
  border-radius: var(--sc-radius);
  box-shadow: var(--sc-shadow);
  border: 1px solid var(--sc-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: sc-pop-in 0.25s ease;
}

.site-chat-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 8px 10px 8px 16px;
  background: linear-gradient(135deg, #2f86ea 0%, #1976d2 52%, #1565c0 100%);
  color: #fff;
  border-bottom: none;
  flex-shrink: 0;
}

.site-chat-panel__head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.site-chat-panel__head-text {
  display: flex;
  align-items: center;
  min-height: 28px;
}

.site-chat-panel__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.site-chat-panel-close {
  width: 28px;
  height: 28px;
  min-width: 28px;
  margin: 0 !important;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  cursor: pointer;
  font-size: 0;
  line-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.site-chat-panel-close:hover {
  background: rgba(255, 255, 255, 0.32);
}

.site-chat-panel-close span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 22px;
  font-weight: 300;
  line-height: 16px;
  transform: translateY(-1px);
}

.site-chat-panel__body {
  padding: 16px;
  background: linear-gradient(180deg, #eaf3ff 0%, #f6f9fe 100%);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.site-chat-panel__body--scroll {
  flex: 1 1 auto;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
}

.site-chat-panel [data-sc-home] {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
}

.site-chat-panel [data-sc-home][hidden],
.site-chat-panel .sc-lead-screen[hidden],
.site-chat-panel .sc-lead-form[hidden],
.site-chat-panel .sc-lead-success[hidden] {
  display: none !important;
}

.sc-intro {
  margin-bottom: 4px;
}

.sc-welcome {
  margin: 0 0 14px;
  padding: 18px 14px 12px;
  font-size: 15px;
  line-height: 1.72;
  color: #657386;
  background: transparent;
  border-radius: 0;
  border: none;
  text-align: center;
}

/* Великі кнопки месенджерів (як у типового віджета) */
.sc-channel-full {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.sc-channel-full-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 9px;
  border: 1px solid rgba(30, 58, 95, 0.08);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  color: #3f4b5a;
  background: #fff;
  box-shadow: 0 6px 16px rgba(22, 52, 84, 0.06);
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.sc-channel-full-btn:hover {
  border-color: rgba(30, 107, 190, 0.22);
  box-shadow: 0 8px 20px rgba(22, 52, 84, 0.1);
  transform: translateY(-1px);
}

.sc-channel-full-btn--tg {
  background: #fff;
  color: #3f4b5a;
}

.sc-channel-full-btn--vb {
  background: #fff;
  color: #3f4b5a;
}

.sc-channel-full-btn--tg .sc-brand-ico,
.sc-channel-full-btn--vb .sc-brand-ico {
  opacity: 0.95;
}

.sc-channel-full-btn--tg .sc-brand-ico {
  color: #229ed9;
}

.sc-channel-full-btn--vb .sc-brand-ico {
  color: #665cac;
}

.sc-open-lead-btn {
  width: 100%;
  margin-top: 4px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid rgba(242, 140, 24, 0.55);
  background: linear-gradient(180deg, #fff8ef 0%, #fff3e0 100%);
  color: #c66900;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sc-open-lead-btn:hover {
  border-color: rgba(242, 140, 24, 0.85);
  box-shadow: 0 2px 10px rgba(242, 140, 24, 0.2);
}

.sc-open-lead-hint {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--sc-muted);
  text-align: center;
}

.site-chat-panel[data-sc-thread="1"] .sc-divider--home {
  display: none;
}

.sc-channel-full-btn__label {
  text-align: left;
  flex: 1;
  color: #3f4b5a;
}

.sc-channel-full-btn:hover .sc-channel-full-btn__label {
  color: #1a2d44;
}

.sc-channel-full-btn__ico {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sc-channel-full-btn--tg .sc-channel-ico {
  color: #fff;
}

.sc-channel-full-btn--vb .sc-channel-ico {
  color: #fff;
}

.sc-chat-alt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 7px 8px 7px 10px;
  border: 1px solid rgba(30, 58, 95, 0.09);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 1px 2px rgba(22, 52, 84, 0.04);
}

.site-chat-widget .sc-chat-alt[hidden] {
  display: none !important;
}

.sc-chat-alt__label {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  color: #6a7b91;
  white-space: nowrap;
}

.sc-chat-alt__inner {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.sc-chip-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
  border: 1px solid rgba(30, 58, 95, 0.1);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.sc-chip-brand:hover {
  border-color: rgba(30, 107, 190, 0.24);
}

.sc-chip-brand--tg {
  background: #f5fbff;
  color: #1686bf;
}

.sc-chip-brand--vb {
  background: #f8f5ff;
  color: #665cac;
}

.sc-chip-brand--ask {
  background: #fff8ef;
  color: #b76300;
  border-color: rgba(242, 140, 24, 0.22);
}

.sc-brand-ico--sm {
  flex-shrink: 0;
}

.sc-chat-alt__inner .sc-chip-brand--tg .sc-brand-ico,
.sc-chat-alt__inner .sc-chip-brand--vb .sc-brand-ico {
  color: currentColor;
}

.sc-quick-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sc-muted);
  margin: 0 0 8px;
}

.sc-quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.sc-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.sc-chip:hover {
  transform: translateY(-1px);
}

.sc-chip--tg {
  background: var(--sc-blue-soft);
  color: #0c63a8;
  border: 1px solid rgba(30, 107, 190, 0.18);
}

.sc-chip--vb {
  background: #f3edff;
  color: #5b4acb;
  border: 1px solid rgba(115, 96, 242, 0.2);
}

.sc-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 12px;
  color: var(--sc-muted);
  font-size: 12px;
}

.sc-divider::before,
.sc-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(30, 58, 95, 0.15), transparent);
}

.sc-divider span {
  white-space: nowrap;
}

/* Онлайн-чат */
.site-chat-online {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.site-chat-panel:not([data-sc-thread="1"]) .site-chat-online {
  flex: 0 0 auto;
  margin-top: auto;
}

.site-chat-panel[data-sc-thread="1"] .site-chat-online {
  flex: 1 1 auto;
}

/* Доки немає повідомлень у переписці — не показуємо порожню «стрічку» */
.site-chat-panel:not([data-sc-thread="1"]) .site-chat-online__log:empty {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  border: none !important;
  overflow: hidden !important;
}

.site-chat-online__log {
  overflow-y: auto;
  padding: 12px 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border-radius: 12px;
  min-height: 120px;
  max-height: 220px;
  font-size: 14px;
  line-height: 1.55;
  border: 1px solid rgba(30, 58, 95, 0.08);
}

.site-chat-panel[data-sc-thread="1"] .site-chat-online__log {
  flex: 1 1 auto;
  max-height: none;
  min-height: 0;
}

.site-chat-online__log .sc-msg {
  display: flex;
  margin-bottom: 10px;
}

.site-chat-online__log .sc-msg:last-child {
  margin-bottom: 0;
}

.site-chat-online__log .sc-msg--in {
  justify-content: flex-start;
}

.site-chat-online__log .sc-msg--out {
  justify-content: flex-end;
}

.site-chat-online__log .sc-msg-bubble {
  max-width: 88%;
  min-width: 112px;
  padding: 8px 10px 9px;
  border-radius: 13px;
  border: 1px solid transparent;
  box-shadow: 0 2px 7px rgba(22, 52, 84, 0.06);
}

.site-chat-online__log .sc-msg--in .sc-msg-bubble {
  border-bottom-left-radius: 5px;
  background: #eef6ff;
  border-color: rgba(30, 118, 210, 0.1);
  color: #165d9d;
}

.site-chat-online__log .sc-msg--out .sc-msg-bubble {
  border-bottom-right-radius: 5px;
  background: #fff7ea;
  border-color: rgba(242, 140, 24, 0.17);
  color: #5b3f12;
}

.site-chat-online__log .sc-msg-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: rgba(90, 107, 130, 0.82);
  margin-bottom: 4px;
  white-space: nowrap;
}

.site-chat-online__log .sc-msg-author {
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-chat-online__log .sc-msg-time {
  flex: 0 0 auto;
  color: rgba(90, 107, 130, 0.72);
}

.site-chat-online__log .sc-msg-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: inherit;
}

.site-chat-online__log .sc-msg--typing .sc-msg-bubble {
  min-width: 138px;
  max-width: 92%;
  background: #fff7ea;
  border-color: rgba(242, 140, 24, 0.17);
  color: #7a5314;
}

.site-chat-online__log .sc-msg--typing .sc-msg-body {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  font-size: 13px;
}

.site-chat-online__log .sc-msg--typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
  animation: scTypingDot 1.2s infinite ease-in-out;
}

.site-chat-online__log .sc-msg--typing[data-sc-dots="0"] i {
  display: none;
}

.site-chat-online__log .sc-msg--typing i:nth-child(3) {
  animation-delay: 0.16s;
}

.site-chat-online__log .sc-msg--typing i:nth-child(4) {
  animation-delay: 0.32s;
}

@keyframes scTypingDot {
  0%, 80%, 100% {
    opacity: 0.28;
    transform: translateY(0);
  }
  40% {
    opacity: 0.85;
    transform: translateY(-2px);
  }
}

/* Композер як у SendPulse: одне поле з кнопкою всередині рамки */
.site-chat-composer {
  position: relative;
  display: block;
  border: 1px solid rgba(30, 58, 95, 0.14);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  padding: 4px 50px 4px 4px;
}

.site-chat-composer__field {
  display: block;
  width: 100%;
  border: none;
  height: 38px;
  min-height: 38px;
  max-height: 86px;
  padding: 9px 10px 7px;
  resize: none;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  background: transparent;
  overflow-y: hidden;
  scrollbar-width: none;
}

.site-chat-composer__field::-webkit-scrollbar {
  width: 0;
  display: none;
}

.site-chat-composer__field:focus {
  outline: none;
}

.site-chat-composer__send {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 42px;
  min-width: 42px;
  height: 38px;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: #e8f4fc;
  color: #1976d2;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.site-chat-composer__send:hover {
  background: #d4eafc;
}

.site-chat-composer__send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.site-chat-online__err {
  color: #b71c1c;
  font-size: 13px;
  margin: 0;
  line-height: 1.45;
}

.sc-lead-screen {
  padding-bottom: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.sc-lead-screen.is-success {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0;
}

.sc-lead-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px;
  padding: 6px 0;
  border: none;
  background: none;
  color: #1565c0;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.sc-lead-back:hover {
  text-decoration: underline;
}

.sc-lead-form--solo {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}

.sc-lead-row {
  display: block;
  margin-bottom: 12px;
}

.sc-lead-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--sc-text);
}

.sc-req-star {
  color: #e53935;
  font-weight: 700;
}

.sc-opt {
  font-weight: 500;
  color: var(--sc-muted);
  font-size: 11px;
}

.sc-lead-required-foot {
  margin: 4px 0 14px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--sc-muted);
}

.sc-lead-submit--wide {
  width: 100%;
  margin-top: 4px;
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  background: var(--sc-accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

.sc-lead-submit--wide:hover:not(:disabled) {
  filter: brightness(1.05);
}

.sc-lead-submit--wide:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.sc-lead-form--solo input,
.sc-lead-form--solo textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(30, 58, 95, 0.14);
  font-family: inherit;
  font-size: 14px;
  background: #fff;
}

.sc-lead-form--solo input:focus,
.sc-lead-form--solo textarea:focus {
  outline: none;
  border-color: var(--sc-blue);
  box-shadow: 0 0 0 3px rgba(30, 107, 190, 0.12);
}

.sc-lead-form--solo textarea {
  resize: vertical;
  min-height: 96px;
}

.sc-lead-status {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.45;
}

.sc-lead-status--ok {
  color: #1b5e20;
}

.sc-lead-status--err {
  color: #b71c1c;
}

.sc-lead-success {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 10px 56px;
  text-align: center;
  color: var(--sc-text);
}

.sc-lead-success__icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #e8f6ee;
  color: #23834f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 25px;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(35, 131, 79, 0.12);
}

.sc-lead-success h3 {
  margin: 0 0 10px;
  font-size: 17px;
  line-height: 1.3;
  color: #163454;
}

.sc-lead-success p {
  max-width: 250px;
  margin: 0 auto;
  font-size: 14px;
  line-height: 1.55;
  color: #5a6b82;
}

.sc-lead-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.sc-lead-submit {
  flex: 1;
  min-width: 140px;
  padding: 10px 14px;
  border: none;
  border-radius: 12px;
  background: var(--sc-accent);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.sc-lead-submit:hover:not(:disabled) {
  filter: brightness(1.05);
}

.sc-lead-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.sc-lead-cancel {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--sc-border);
  background: #fff;
  color: var(--sc-muted);
  font-size: 13px;
  cursor: pointer;
}

.sc-lead-cancel:hover {
  border-color: rgba(30, 58, 95, 0.25);
  color: var(--sc-text);
}

@media (max-width: 480px) {
  .site-chat-panel {
    width: calc(100vw - 16px);
    height: calc(100vh - 96px);
    min-height: 0;
    max-height: calc(100vh - 96px);
    bottom: 66px;
  }

  .sc-welcome {
    padding-top: 14px;
  }
}
