.ks-chat-widget {
  --ks-primary: #16a34a;
  --ks-bg: #d9e8f3;
  --ks-user: #ffffff;
  --ks-bot: rgba(255, 255, 255, 0.75);
  --ks-font: "Avenir Next", "Nunito Sans", "Segoe UI", sans-serif;
  --ks-font-size: 16px;
  --ks-radius: 38px;

  width: 100%;
  max-width: 560px;
  height: clamp(560px, 84vh, 760px);
  min-height: 560px;
  max-height: 760px;
  margin: 12px auto;
  padding: 24px 24px 18px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: max(var(--ks-radius), 32px) !important;
  background:
    radial-gradient(130% 130% at 82% 68%, rgba(156, 221, 246, 0.55) 0%, rgba(156, 221, 246, 0) 52%),
    radial-gradient(120% 120% at 18% 95%, rgba(233, 193, 233, 0.55) 0%, rgba(233, 193, 233, 0) 46%),
    linear-gradient(180deg, #f4f5f5 0%, #d4e2ef 54%, #dbd4eb 100%) !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-family: var(--ks-font);
  font-size: var(--ks-font-size);
}

.ks-chat-widget,
.ks-chat-widget * {
  box-sizing: border-box;
}

.ks-chat-shadow {
  box-shadow: 0 16px 34px rgba(20, 28, 44, 0.18);
}

.ks-chat-header {
  display: block !important;
  text-align: center;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 600;
  color: #171717;
  margin: 48px auto 8px;
  max-width: 300px;
  letter-spacing: -0.02em;
}

.ks-chat-messages {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

.ks-chat-messages::-webkit-scrollbar {
  width: 5px;
}

.ks-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.ks-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 999px;
}

.ks-chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.28);
}

.ks-chat-empty {
  display: none !important;
  margin: 48px auto auto;
  max-width: 280px;
  text-align: center;
  font-size: 20px;
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 600;
  color: #151515;
}

.ks-chat-message {
  display: flex;
  width: 100%;
}

.ks-chat-user {
  justify-content: flex-end;
}

.ks-chat-bot {
  justify-content: flex-start;
}

.ks-chat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 18px;
  line-height: 1.42;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px) saturate(125%);
  -webkit-backdrop-filter: blur(10px) saturate(125%);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.ks-chat-user .ks-chat-bubble {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.62) 0%, rgba(255, 205, 237, 0.6) 100%);
  color: #202020;
  border-bottom-right-radius: 6px;
}

.ks-chat-bot .ks-chat-bubble {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.7) 0%, rgba(232, 239, 247, 0.55) 100%);
  color: #212121;
  border-bottom-left-radius: 6px;
}

.ks-chat-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 14px 18px;
  min-height: 42px;
}

.ks-chat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
  animation: ks-dot-bounce 1.4s ease-in-out infinite;
}

.ks-chat-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.ks-chat-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes ks-dot-bounce {

  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }

  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

.ks-chat-suggestions {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  margin: 0 4px;
}

.ks-chat-suggestion {
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.4);
  color: #252525;
  border-radius: 999px;
  padding: 10px 18px;
  max-width: 190px;
  font: inherit;
  font-size: 14px;
  text-transform: none !important;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  backdrop-filter: blur(6px);
  touch-action: manipulation;
}

.ks-chat-suggestion:hover {
  background: rgba(255, 255, 255, 0.62);
}

.ks-chat-input-wrap {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.ks-chat-input-shell {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.52);
  border-radius: 999px;
  padding: 5px 18px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ks-chat-widget .ks-chat-input,
.ks-chat-widget input.ks-chat-input,
.ks-chat-widget input[type="text"].ks-chat-input,
.ks-chat-widget .ks-chat-input-wrap input[type="text"],
.ks-chat-widget .ks-chat-input-shell input[type="text"] {
  flex: 1;
  border: 0 !important;
  box-shadow: none !important;
  outline: none !important;
  background: transparent !important;
  padding: 8px 0;
  color: #4a4a4a;
  font: inherit;
  font-size: 16px;
  line-height: 1.2;
  text-transform: none !important;
  border-radius: 999px !important;
  margin: 0 !important;
  width: 100%;
  min-width: 0;
  appearance: none;
}

.ks-chat-input::placeholder {
  color: rgba(62, 62, 62, 0.66);
}

.ks-chat-send {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: #2563eb;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 2px;
  touch-action: manipulation;
  transition: background 0.18s ease;
}

.ks-chat-send-text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.ks-chat-send-icon {
  width: 20px;
  height: 20px;
  fill: #ffffff;
  stroke: none;
  transform: translateX(1px);
}

.ks-chat-send:hover {
  background: #1d4ed8;
}

.ks-chat-send:disabled,
.ks-chat-input:disabled,
.ks-chat-suggestion:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ks-chat-error {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
  border-radius: 14px;
  padding: 12px 14px;
}

@media (max-width: 680px) {
  .ks-chat-widget {
    max-width: 100%;
    width: 100%;
    height: min(80vh, 660px);
    height: min(80dvh, 660px);
    min-height: 500px;
    max-height: 660px;
    border-radius: 24px;
    padding: 14px 12px 10px;
    gap: 8px;
  }

  .ks-chat-header {
    margin-top: 10px;
    margin-bottom: 2px;
    font-size: 16px;
    max-width: 220px;
  }

  .ks-chat-messages {
    padding: 8px 2px;
    gap: 8px;
  }

  .ks-chat-bubble {
    max-width: 92%;
    padding: 9px 11px;
    font-size: 13px;
    line-height: 1.35;
  }

  .ks-chat-suggestions {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
    margin: 0 0 2px;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .ks-chat-suggestions::-webkit-scrollbar {
    display: none;
  }

  .ks-chat-suggestion {
    flex: 0 0 auto;
    max-width: 82%;
    font-size: 12px;
    padding: 7px 12px;
  }

  .ks-chat-input-wrap {
    gap: 8px;
  }

  .ks-chat-input-shell {
    padding: 3px 12px;
  }

  .ks-chat-widget .ks-chat-input,
  .ks-chat-widget input.ks-chat-input,
  .ks-chat-widget input[type="text"].ks-chat-input,
  .ks-chat-widget .ks-chat-input-wrap input[type="text"],
  .ks-chat-widget .ks-chat-input-shell input[type="text"] {
    font-size: 16px;
    padding: 9px 0;
  }

  .ks-chat-send {
    width: 40px;
    height: 40px;
    margin-right: 0;
  }

  .ks-chat-send-icon {
    width: 17px;
    height: 17px;
  }
}