.thecore-tchat-trigger__wrapper {
  text-align: left;
}

.thecore-tchat-trigger {
  text-decoration: none;
  cursor: pointer;
}

.thecore-tchat-trigger .elementor-button-content-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
}

.thecore-tchat-trigger .elementor-button-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.thecore-tchat-trigger .elementor-button-icon svg {
  width: 1em;
  height: 1em;
}

.thecore-tchat-module {
  --thecore-tchat-panel-width: min(360px, calc(100vw - 32px));
  --thecore-tchat-panel-height: min(520px, calc(100vh - 32px));
  --thecore-tchat-viewport-gap-top: 16px;
  --thecore-tchat-viewport-gap-bottom: 16px;
  --thecore-tchat-surface: #ffffff;
  --thecore-tchat-text: #0f172a;
  --thecore-tchat-text-muted: #64748b;
  --thecore-tchat-border: #e2e8f0;
  --thecore-tchat-accent: #ffca00;
  --thecore-tchat-accent-contrast: #111827;
}

.thecore-tchat-module__trigger-wrap {
  position: fixed;
  inset-inline: 16px;
  bottom: 16px;
  text-align: right;
  z-index: 9998;
  pointer-events: none;
}

.thecore-tchat-module__trigger-wrap .thecore-tchat-trigger {
  pointer-events: auto;
}

.thecore-tchat-module__backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: rgb(15 23 42 / 0.28);
  transition: opacity 180ms ease, visibility 180ms ease;
}

.thecore-tchat-module__dialog {
  position: fixed;
  z-index: 9999;
  width: var(--thecore-tchat-panel-width);
  max-width: calc(100vw - 32px);
  height: var(--thecore-tchat-panel-height);
  max-height: calc(100vh - var(--thecore-tchat-viewport-gap-top) - var(--thecore-tchat-viewport-gap-bottom));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--thecore-tchat-border);
  border-radius: 24px;
  background: var(--thecore-tchat-surface);
  color: var(--thecore-tchat-text);
  box-shadow: 0 30px 70px rgb(15 23 42 / 0.22);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
}

.thecore-tchat-module--align-right .thecore-tchat-module__dialog {
  inset-inline-end: 16px;
}

.thecore-tchat-module--align-left .thecore-tchat-module__dialog {
  inset-inline-start: 16px;
}

.thecore-tchat-module--position-bottom .thecore-tchat-module__dialog {
  bottom: var(--thecore-tchat-viewport-gap-bottom);
  transform: translateY(12px) scale(0.96);
}

.thecore-tchat-module--position-top .thecore-tchat-module__dialog {
  top: var(--thecore-tchat-viewport-gap-top);
  transform: translateY(-12px) scale(0.96);
}

.thecore-tchat-module--position-center .thecore-tchat-module__dialog {
  top: 50%;
  transform: translateY(calc(-50% + 12px)) scale(0.96);
}

.thecore-tchat-module.is-open .thecore-tchat-module__backdrop,
.thecore-tchat-module.is-open .thecore-tchat-module__dialog {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.thecore-tchat-module.is-open.thecore-tchat-module--position-bottom .thecore-tchat-module__dialog,
.thecore-tchat-module.is-open.thecore-tchat-module--position-top .thecore-tchat-module__dialog {
  transform: translateY(0) scale(1);
}

.thecore-tchat-module.is-open.thecore-tchat-module--position-center .thecore-tchat-module__dialog {
  transform: translateY(-50%) scale(1);
}

.thecore-tchat-module__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 16px;
  background: linear-gradient(180deg, rgb(255 202 0 / 0.16), rgb(255 202 0 / 0.04));
  border-bottom: 1px solid rgb(226 232 240 / 0.8);
}

.thecore-tchat-module__header-copy {
  min-width: 0;
}

.thecore-tchat-module__title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--thecore-tchat-text);
}

.thecore-tchat-module__subtitle {
  margin: 8px 0 0;
  color: var(--thecore-tchat-text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.thecore-tchat-module__close {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgb(148 163 184 / 0.18);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.72);
  color: var(--thecore-tchat-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 180ms ease, transform 180ms ease;
}

.thecore-tchat-module__close:hover,
.thecore-tchat-module__close:focus-visible {
  background: rgb(255 255 255 / 0.96);
  transform: rotate(90deg);
}

.thecore-tchat-module__close svg {
  width: 18px;
  height: 18px;
}

.thecore-tchat-module__log {
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f8fafc;
}

.thecore-tchat-module__message {
  margin: 0;
  padding: 10px 12px;
  max-width: 84%;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.thecore-tchat-module__message.is-in {
  align-self: flex-start;
  background: #e2e8f0;
  color: #0f172a;
}

.thecore-tchat-module__message.is-out {
  align-self: flex-end;
  background: var(--thecore-tchat-accent);
  color: var(--thecore-tchat-accent-contrast);
}

.thecore-tchat-module__footer {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--thecore-tchat-border);
  background: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.thecore-tchat-module__input {
  flex: 1 1 auto;
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border: 1px solid var(--thecore-tchat-border);
  border-radius: 14px;
  background: #ffffff;
  color: var(--thecore-tchat-text);
  outline: 0;
  box-shadow: none;
}

.thecore-tchat-module__input::placeholder {
  color: var(--thecore-tchat-text-muted);
}

.thecore-tchat-module__input:focus {
  border-color: color-mix(in srgb, var(--thecore-tchat-accent) 55%, var(--thecore-tchat-border));
}

.thecore-tchat-module__send {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: var(--thecore-tchat-accent);
  color: var(--thecore-tchat-accent-contrast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.thecore-tchat-module__send svg {
  width: 18px;
  height: 18px;
}

@supports (height: 100dvh) {
  .thecore-tchat-module__dialog {
    max-height: calc(100dvh - var(--thecore-tchat-viewport-gap-top) - var(--thecore-tchat-viewport-gap-bottom));
  }
}
