.site-chat-widget-root {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1600;
  font-family: "Roboto", sans-serif;
}

.site-chat-widget {
  position: relative;
}

.site-chat-toggle {
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #0b6b5e, #12a37f);
  color: #fff;
  box-shadow: 0 18px 36px rgba(11, 107, 94, 0.28);
  cursor: pointer;
  font-size: 28px;
}

.site-chat-panel {
  position: absolute;
  right: 0;
  bottom: 84px;
  width: min(380px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 120px));
  max-height: min(640px, calc(100vh - 120px));
  display: none;
  flex-direction: column;
  overflow: hidden;
  border-radius: 24px;
  background: #fffdf9;
  box-shadow: 0 26px 60px rgba(26, 42, 43, 0.22);
  border: 1px solid rgba(12, 78, 67, 0.12);
  touch-action: pan-y;
  overscroll-behavior: contain;
}

.site-chat-widget.is-open .site-chat-panel {
  display: flex;
}

.site-chat-widget.is-open .site-chat-toggle {
  display: none;
}

.site-chat-header {
  padding: 12px 16px 10px;
  background: linear-gradient(135deg, #133b37, #0b6b5e);
  color: #fff;
}

.site-chat-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.site-chat-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ffcc6d;
}

.site-chat-status.is-online::before {
  background: #7ff0c2;
}

.site-chat-connection {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px 10px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  font-weight: 700;
}

.site-chat-connection.is-connected {
  background: rgba(127, 240, 194, 0.18);
  color: #d8ffef;
}

.site-chat-connection.is-reconnecting {
  background: rgba(255, 204, 109, 0.18);
  color: #ffe6b7;
}

.site-chat-connection.is-fallback {
  background: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.82);
}

.site-chat-widget.is-compact .site-chat-header {
  display: none;
}

.site-chat-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background:
    radial-gradient(circle at top right, rgba(18, 163, 127, 0.1), transparent 38%),
    linear-gradient(180deg, #fffdf9 0%, #f4f8f6 100%);
}

.site-chat-messages {
  flex: 1;
  min-height: 0;
  padding: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.site-chat-empty,
.site-chat-note {
  margin: 0;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  color: #34514a;
  font-size: 14px;
  line-height: 1.45;
}

.site-chat-note {
  margin: 0 16px 14px;
  border: 1px dashed rgba(11, 107, 94, 0.22);
}


.site-chat-message {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.site-chat-message.is-client {
  align-items: flex-end;
}

.site-chat-message__meta {
  font-size: 12px;
  color: #68827a;
}

.site-chat-message__bubble {
  max-width: 84%;
  padding: 11px 14px;
  border-radius: 18px;
  background: #ffffff;
  color: #1f302e;
  line-height: 1.45;
  box-shadow: 0 8px 18px rgba(28, 45, 42, 0.08);
  white-space: pre-wrap;
}

.site-chat-message.is-client .site-chat-message__bubble {
  background: linear-gradient(135deg, #0b6b5e, #159978);
  color: #fff;
}

.site-chat-typing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  color: #47635b;
  box-shadow: 0 8px 18px rgba(28, 45, 42, 0.08);
}

.site-chat-typing__dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #0b6b5e;
  animation: site-chat-bounce 1.2s infinite ease-in-out;
}

.site-chat-typing__dot:nth-child(2) {
  animation-delay: 0.15s;
}

.site-chat-typing__dot:nth-child(3) {
  animation-delay: 0.3s;
}

.site-chat-typing__label {
  margin-left: 6px;
  font-size: 13px;
}

.site-chat-form {
  position: sticky;
  bottom: 0;
  padding: 14px 16px 16px;
  border-top: 1px solid rgba(12, 78, 67, 0.08);
  background: rgba(255, 255, 255, 0.92);
  touch-action: pan-y;
  display: grid;
  gap: 12px;
}

.site-chat-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.site-chat-identity[hidden] {
  display: none !important;
}

.site-chat-form input,
.site-chat-form textarea {
  width: 100%;
  border: 1px solid rgba(12, 78, 67, 0.14);
  border-radius: 14px;
  padding: 12px 13px;
  font: inherit;
  box-sizing: border-box;
  background: #fff;
}

.site-chat-form textarea {
  resize: vertical;
  min-height: 94px;
  max-height: 180px;
  margin: 0;
}

.site-chat-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 4px;
}

.site-chat-submit,
.site-chat-minimize {
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  font: inherit;
  cursor: pointer;
}

.site-chat-submit {
  background: #0b6b5e;
  color: #fff;
  font-weight: 700;
}

.site-chat-minimize {
  background: rgba(11, 107, 94, 0.1);
  color: #0b6b5e;
}

.site-chat-error {
  margin: 0;
  color: #b43d3d;
  font-size: 13px;
}

@media (max-width: 640px) {
  html.site-chat-page-locked,
  body.site-chat-page-locked {
    overflow: hidden;
    overscroll-behavior: none;
  }

  .site-chat-widget-root {
    right: 12px;
    left: 12px;
    bottom: 12px;
  }

  .site-chat-toggle {
    margin-left: auto;
    display: block;
  }

  .site-chat-panel {
    width: 100%;
    right: 0;
    bottom: 78px;
    height: min(72vh, calc(var(--site-chat-vh, 100vh) - 96px));
    max-height: min(72vh, calc(var(--site-chat-vh, 100vh) - 96px));
  }

  .site-chat-form input,
  .site-chat-form textarea {
    font-size: 16px;
  }

  .site-chat-widget.is-keyboard .site-chat-panel {
    bottom: 8px;
    height: min(68vh, calc(var(--site-chat-vh, 100vh) - 12px));
    max-height: min(68vh, calc(var(--site-chat-vh, 100vh) - 12px));
    border-radius: 16px;
  }

  .site-chat-widget.is-keyboard .site-chat-messages {
    padding: 8px 10px;
  }

  .site-chat-widget.is-keyboard .site-chat-message {
    margin-bottom: 8px;
  }

  .site-chat-widget.is-keyboard .site-chat-form {
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    gap: 10px;
  }

  .site-chat-widget.is-keyboard .site-chat-form textarea {
    min-height: 44px;
    max-height: 92px;
    padding: 9px 11px;
  }

  .site-chat-widget.is-keyboard .site-chat-actions {
    padding-top: 2px;
  }

}

@keyframes site-chat-bounce {
  0%, 80%, 100% {
    transform: scale(0.7);
    opacity: 0.55;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}
