
/* Bubble Chat Widget */
#kpChatBubbleIcon,
#kpChatBubbleIcon * {
  box-sizing: border-box;
}

#kpChatBubbleIcon {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 58px;
  height: 58px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #111111 0%, #2a2a2a 100%);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(17, 17, 17, 0.18);
  z-index: 12000;
  transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease;
  font-size: 26px;
  animation: kpBubblePulse 2.8s ease-in-out infinite;
}

#kpChatBubbleIcon::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 999px;
  border: 2px solid rgba(17, 17, 17, 0.22);
  opacity: 0;
  animation: kpBubbleRipple 2.8s ease-out infinite;
}

#kpChatBubbleIcon:hover {
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 16px 32px rgba(17, 17, 17, 0.22);
  filter: brightness(1.02);
}

#kpChatWidget {
  position: fixed;
  right: 20px;
  bottom: 90px;
  width: min(334px, calc(100vw - 24px));
  height: min(500px, calc(100vh - 112px));
  background: rgba(255,255,255,0.97);
  border: 1px solid rgba(17,17,17,0.07);
  border-radius: 18px;
  box-shadow: 0 18px 42px rgba(17,17,17,0.14);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 12000;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-family: 'Montserrat', sans-serif;
  transform-origin: bottom right;
}

#kpChatWidget.is-open {
  display: flex;
  animation: kpChatEnter 0.28s ease forwards;
}

@keyframes kpChatEnter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes kpFadeInSoft {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#kpChatHeader {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(17,17,17,0.97);
  color: #ffffff;
}

#kpChatHeader img {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  object-fit: cover;
  flex: 0 0 auto;
}

#kpChatHeaderText {
  min-width: 0;
  flex: 1 1 auto;
}

#kpChatHeaderTitle {
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1.15;
}

#kpChatHeaderSubtitle {
  font-size: 0.72rem;
  opacity: 0.82;
  margin-top: 2px;
  line-height: 1.35;
}

#kpChatClose {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255,255,255,0.10);
  color: #ffffff;
  border-radius: 999px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

#kpChatClose:hover {
  background: rgba(255,255,255,0.16);
  transform: scale(1.04);
}

.kp-chat-panel {
  display: none;
  min-height: 0;
  flex: 1 1 auto;
}

.kp-chat-panel.is-active {
  display: flex;
  flex-direction: column;
  animation: kpFadeInSoft 0.24s ease;
}

#kpChatMenu {
  padding: 12px;
  gap: 12px;
}

.kp-chat-message {
  display: flex;
  margin-bottom: 9px;
}

.kp-chat-message.kim {
  justify-content: flex-start;
}

.kp-chat-message.visitor {
  justify-content: flex-end;
}

.kp-chat-message .bubble {
  max-width: 82%;
  padding: 9px 12px;
  border-radius: 16px;
  font-size: 0.87rem;
  line-height: 1.42;
  word-break: break-word;
}

.kp-chat-message.kim .bubble {
  background: #f5f2ef;
  color: #111111;
  border-top-left-radius: 6px;
}

.kp-chat-message.visitor .bubble {
  background: #111111;
  color: #ffffff;
  border-top-right-radius: 6px;
}

.kp-chat-actions {
  display: grid;
  gap: 9px;
}

.kp-chat-action-btn {
  width: 100%;
  border: none;
  border-radius: 11px;
  padding: 11px 13px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.22s ease, filter 0.22s ease, box-shadow 0.22s ease;
}

.kp-chat-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(17,17,17,0.10);
}

.kp-chat-action-btn.primary {
  background: #111111;
  color: #ffffff;
}

.kp-chat-action-btn.secondary {
  background: #ebe4de;
  color: #111111;
}

.kp-chat-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  border-bottom: 1px solid rgba(17,17,17,0.08);
}

.kp-chat-topbar-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #111111;
}

.kp-chat-back-btn {
  border: none;
  background: transparent;
  font-size: 0.82rem;
  font-weight: 600;
  color: #111111;
  cursor: pointer;
  padding: 0;
}

#kpChatMessagesWrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  background: #ffffff;
}

#kpChatMessages {
  display: flex;
  flex-direction: column;
}

#kpChatComposer {
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(17,17,17,0.08);
  background: #ffffff;
}

#kpUserMessage {
  flex: 1 1 auto;
  border: 1px solid rgba(17,17,17,0.14);
  border-radius: 10px;
  padding: 10px 11px;
  font-size: 0.9rem;
  font-family: 'Montserrat', sans-serif;
}

#kpSendMessageBtn {
  flex: 0 0 auto;
  border: none;
  border-radius: 10px;
  background: #111111;
  color: #ffffff;
  min-width: 48px;
  padding: 0 12px;
  cursor: pointer;
  font-size: 1rem;
  transition: transform 0.2s ease, filter 0.2s ease;
}

#kpSendMessageBtn:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

#kpBubbleFormArea {
  padding: 12px;
  overflow-y: auto;
}

#kpBubbleContactForm {
  display: grid;
  gap: 8px;
}

#kpBubbleContactForm input,
#kpBubbleContactForm select,
#kpBubbleContactForm textarea {
  width: 100%;
  border: 1px solid rgba(17,17,17,0.14);
  border-radius: 10px;
  padding: 10px 11px;
  font-size: 0.88rem;
  font-family: 'Montserrat', sans-serif;
  background: #ffffff;
  color: #111111;
}

#kpBubbleContactForm textarea {
  min-height: 104px;
  resize: vertical;
}

#kpBubbleContactForm button {
  border: none;
  border-radius: 10px;
  background: #111111;
  color: #ffffff;
  padding: 11px 13px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}

#kpBubbleContactForm button:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

#kpBubbleOtherSupportRow {
  display: none;
}

#kpBubbleOtherSupportRow.is-visible {
  display: block;
}

#kpBubbleFormStatus,
#kpChatStatus {
  font-size: 0.78rem;
  color: #444444;
  min-height: 1.2em;
  margin-top: 2px;
}

#kpBubbleFormFrame {
  display: none;
}

#kpBubbleFormSuccess {
  display: none;
  padding: 34px 16px;
  text-align: center;
  align-items: center;
  justify-content: center;
  min-height: 190px;
  animation: kpFadeInSoft 0.24s ease;
}

#kpBubbleFormSuccess.is-visible {
  display: flex;
}

#kpBubbleFormSuccessCard {
  width: 100%;
  border: 1px solid rgba(17,17,17,0.08);
  border-radius: 14px;
  background: #f8f5f2;
  padding: 22px 16px;
  box-shadow: 0 10px 24px rgba(17,17,17,0.06);
}

#kpBubbleFormSuccessIcon {
  width: 42px;
  height: 42px;
  margin: 0 auto 12px;
  border-radius: 999px;
  background: #111111;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
}

#kpBubbleFormSuccessText {
  font-size: 0.92rem;
  line-height: 1.5;
  color: #111111;
  font-weight: 600;
}

@media (max-width: 640px) {
  #kpChatBubbleIcon {
    right: 16px;
    bottom: 16px;
    width: 56px;
    height: 56px;
  }

  #kpChatBubbleIcon::after {
    inset: -6px;
  }

  #kpChatWidget {
    right: 14px;
    left: 14px;
    width: auto;
    bottom: 84px;
    height: min(500px, calc(100vh - 110px));
  }
}



#kpChatNudge {
  position: fixed;
  right: 92px;
  bottom: 28px;
  z-index: 11999;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.24s ease, transform 0.24s ease;
  animation: kpNudgeFloat 2.6s ease-in-out infinite;
}

#kpChatNudge.is-hidden {
  opacity: 0;
  transform: translateY(6px) scale(0.96);
}

#kpChatNudgeDot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #111111;
  box-shadow: 0 0 0 rgba(17,17,17,0.28);
  animation: kpNudgePulse 1.8s ease-out infinite;
}

#kpChatNudgeCard {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.97);
  border: 1px solid rgba(17,17,17,0.08);
  box-shadow: 0 10px 24px rgba(17,17,17,0.10);
  color: #111111;
  font-size: 0.82rem;
  line-height: 1.2;
  font-weight: 600;
  white-space: nowrap;
  transform-origin: right center;
}

@keyframes kpNudgeFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes kpNudgePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(17,17,17,0.24);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(17,17,17,0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(17,17,17,0);
  }
}

@media (max-width: 640px) {
  #kpChatNudge {
    right: 82px;
    bottom: 24px;
  }

  #kpChatNudgeCard {
    min-height: 34px;
    padding: 7px 11px;
    font-size: 0.78rem;
    max-width: 160px;
    white-space: normal;
    text-align: left;
  }
}


@keyframes kpBubblePulse {
  0%, 100% { transform: scale(1); }
  8% { transform: scale(1.08); }
  14% { transform: scale(1); }
  22% { transform: scale(1.06); }
  28% { transform: scale(1); }
}

@keyframes kpBubbleRipple {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  8% {
    opacity: 0.26;
  }
  38% {
    opacity: 0;
    transform: scale(1.28);
  }
  100% {
    opacity: 0;
    transform: scale(1.28);
  }
}

@keyframes kpNudgePop {
  0% {
    opacity: 0.55;
    transform: scale(0.96);
  }
  55% {
    opacity: 1;
    transform: scale(1.06);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}


#kpChatNamePanel {
  padding: 14px;
  justify-content: center;
}

#kpChatNameForm {
  display: grid;
  gap: 10px;
}

#kpChatNameIntro {
  font-size: 0.88rem;
  line-height: 1.5;
  color: #333333;
  margin: 0;
}

#kpChatNameForm input {
  width: 100%;
  border: 1px solid rgba(17,17,17,0.14);
  border-radius: 10px;
  padding: 10px 11px;
  font-size: 0.88rem;
  font-family: 'Montserrat', sans-serif;
  background: #ffffff;
  color: #111111;
}

#kpChatNameForm button {
  border: none;
  border-radius: 10px;
  background: #111111;
  color: #ffffff;
  padding: 11px 13px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}

#kpChatNameForm button:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

#kpChatNameStatus {
  font-size: 0.78rem;
  color: #444444;
  min-height: 1.2em;
}

#kpChatVisitorBadge {
  display: none;
  font-size: 0.76rem;
  color: #555555;
  padding: 0 12px 10px;
  background: #ffffff;
}

#kpChatVisitorBadge.is-visible {
  display: block;
}




/* Final live-chat name step layout */
#kpChatNamePanel {
  padding: 0;
}

#kpChatNamePanel #kpBubbleFormArea {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 16px 20px;
}

#kpChatNameForm {
  width: 100%;
  max-width: 248px;
  display: grid;
  gap: 10px;
  justify-items: stretch;
}

#kpChatNameIntro {
  margin: 0 0 2px;
  text-align: center;
  max-width: none;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #333333;
}

#kpChatNameForm input,
#kpChatNameForm button,
#kpChatNameStatus {
  width: 100%;
  max-width: none;
}

#kpChatNameStatus {
  text-align: center;
}


.kp-chat-admin-presence {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
  font-size: 0.7rem;
  line-height: 1;
  font-weight: 600;
  white-space: nowrap;
}

.kp-chat-admin-presence::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  flex: 0 0 auto;
  background: currentColor;
}

.kp-chat-admin-presence.is-active {
  color: #8df0b6;
}

.kp-chat-admin-presence.is-away {
  color: rgba(255,255,255,0.72);
}


.kp-chat-end-btn {
  border: none;
  background: rgba(17,17,17,0.08);
  color: #111111;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}
.kp-chat-end-btn:hover {
  background: rgba(17,17,17,0.12);
  transform: translateY(-1px);
}

.kp-chat-message.has-avatar {
  align-items: flex-end;
  gap: 8px;
}
.kp-chat-message.is-system {
  justify-content: flex-start;
}
.kp-chat-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  object-fit: cover;
  flex: 0 0 auto;
  background: #e9e4e0;
}
.kp-chat-message.is-system .bubble {
  background: #f5f2ef;
  color: #111111;
}


.kp-chat-system-message {
  display: flex;
  justify-content: center;
  margin: 10px 0;
}

.kp-chat-system-card {
  max-width: 90%;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 14px;
  background: #f3efec;
  color: #5a534d;
  text-align: left;
}

.kp-chat-system-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  object-fit: cover;
  flex: 0 0 auto;
}

.kp-chat-system-copy {
  display: grid;
  gap: 2px;
}

.kp-chat-system-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #111111;
}

.kp-chat-system-text {
  font-size: 0.8rem;
  line-height: 1.4;
}


#kpChatVisitorBadge {
  text-align: center;
}

.kp-chat-system-card {
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.kp-chat-system-copy,
.kp-chat-system-text {
  text-align: center;
}

.kp-chat-message.kim {
  align-items: flex-end;
  gap: 8px;
}

.kp-chat-avatar--fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #111111;
}


.kp-chat-system-meta {
  margin-top: 4px;
  font-size: 0.66rem;
  line-height: 1.2;
  color: #7a736c;
  text-align: center;
}


/* grouped visitor chat overrides */
.kp-chat-message.kim,
.kp-chat-message.visitor {
  align-items: flex-start;
  gap: 8px;
}
.kp-chat-message.kim { justify-content: flex-start; }
.kp-chat-message.visitor { justify-content: flex-end; }
.kp-chat-message-stack { display: grid; gap: 4px; max-width: 82%; }
.kp-chat-message-name { font-size: 0.72rem; font-weight: 700; line-height: 1.2; color: #555555; }
.kp-chat-message-bubble { padding: 9px 12px; border-radius: 16px; font-size: 0.87rem; line-height: 1.42; word-break: break-word; }
.kp-chat-message.kim .kp-chat-message-bubble { background: #f5f2ef; color: #111111; border-top-left-radius: 6px; }
.kp-chat-message.visitor .kp-chat-message-bubble { background: #111111; color: #ffffff; border-top-right-radius: 6px; }
.kp-chat-message-meta { font-size: 0.68rem; line-height: 1.2; color: #7a736c; }
.kp-chat-message-bubble + .kp-chat-message-bubble { margin-top: -1px; }
.kp-chat-system-card { flex-direction: column; align-items: center; text-align: center; }
.kp-chat-system-copy, .kp-chat-system-text { text-align: center; }
.kp-chat-system-meta { margin-top: 2px; font-size: 0.6rem; line-height: 1.15; color: #8a837c; text-align: center; }
