:root {
  --navy: #12124f;
  --navy-deep: #12124f;
  --teal: #3ea8a6;
  --lime: #b6ff29;
  --lime-soft: #d7ff7a;
  --paper: #f4f7fc;
  --ink: #09162f;
  --muted: #61708f;
  --line: rgba(7, 26, 77, 0.12);
  --shadow: 0 20px 60px rgba(4, 17, 51, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: transparent;
  font-family: "Segoe UI", Arial, sans-serif;
}

.chat-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  display: inline-grid;
  place-items: center;
  width: 66px;
  height: 66px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy) 0%, #0d2f80 100%);
  color: white;
  cursor: pointer;
  box-shadow: var(--shadow);
  animation: launcherPulse 2.4s ease-in-out infinite;
}

.chat-launcher::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px solid rgba(182, 255, 41, 0.22);
  opacity: 0.75;
  animation: launcherRing 2.4s ease-out infinite;
}

.chat-launcher-icon {
  position: relative;
  width: 28px;
  height: 22px;
  border-radius: 10px;
  background: white;
}

.chat-launcher-icon::before {
  content: "";
  position: absolute;
  left: 4px;
  bottom: -5px;
  width: 10px;
  height: 10px;
  background: white;
  clip-path: polygon(0 0, 100% 0, 0 100%);
}

.chat-launcher-icon::after {
  content: "";
  position: absolute;
  inset: 6px 5px auto;
  height: 2px;
  background: var(--navy);
  box-shadow:
    0 5px 0 var(--navy),
    0 10px 0 var(--navy);
}

.chat-widget {
  position: fixed;
  right: 20px;
  bottom: 90px;
  z-index: 25;
  width: min(420px, calc(100vw - 24px));
  height: min(690px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(7, 26, 77, 0.08);
  border-radius: 24px;
  background: white;
  box-shadow: var(--shadow);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform-origin: calc(100% - 33px) calc(100% + 56px);
  transform: translate3d(0, 14px, 0) scale(0.18);
  border-radius: 24px;
  will-change: transform, opacity;
  backface-visibility: hidden;
  transition:
    transform 280ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 220ms ease;
}

body[data-chat-state="open"] .chat-widget {
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) scale(1);
}

body[data-chat-state="opening"] .chat-widget {
  opacity: 1;
  pointer-events: none;
  transform: translate3d(0, 0, 0) scale(1);
}

body[data-chat-state="closing"] .chat-widget {
  opacity: 0;
  pointer-events: none;
  transform: translate3d(0, 14px, 0) scale(0.18);
}

.chat-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  color: white;
  background: #12124f;
}

.chat-widget-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-widget-header h1 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.1;
}

.chat-widget-avatar {
  flex: 0 0 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  padding: 3px;
  border-radius: 50%;
  background: white;
  border: 1px solid rgba(255, 255, 255, 0.22);
  overflow: hidden;
}

.chat-widget-avatar-image {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: cover !important;
  object-position: center !important;
  flex: 0 0 100% !important;
}

.chat-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.chat-frame {
  flex: 1;
  position: relative;
  min-height: 0;
  padding: 0;
  background: white;
}

#chatkit {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 520px;
  border-radius: 0;
  overflow: hidden;
  background: white;
}

.chat-disclaimer {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 16px;
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
  color: #5f6783;
  text-align: center;
  pointer-events: none;
  z-index: 2;
}

body[data-responding="true"] .chat-widget {
  box-shadow:
    var(--shadow),
    0 0 0 1px rgba(182, 255, 41, 0.18),
    0 0 34px rgba(182, 255, 41, 0.12);
}

@media (max-width: 640px) {
  .chat-launcher {
    right: 14px;
    bottom: 14px;
  }

  .chat-widget {
    right: 12px;
    bottom: 78px;
    width: calc(100vw - 24px);
    height: min(78vh, 700px);
  }
}

@keyframes launcherPulse {
  0%,
  100% {
    transform: translateY(0) scale(1);
    box-shadow: var(--shadow);
  }
  50% {
    transform: translateY(-2px) scale(1.03);
    box-shadow:
      var(--shadow),
      0 0 0 8px rgba(182, 255, 41, 0.08);
  }
}

@keyframes launcherRing {
  0% {
    transform: scale(0.92);
    opacity: 0.55;
  }
  70% {
    transform: scale(1.12);
    opacity: 0;
  }
  100% {
    transform: scale(1.12);
    opacity: 0;
  }
}
