/* WK Bot — match We Kongsi landing (navy / teal / Poppins) */
html { overflow-x: hidden; }

.wk-fab {
  position: fixed;
  right: max(14px, env(safe-area-inset-right, 0px));
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  cursor: pointer;
  color: #fff;
  font-family: Poppins, system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 12px 18px 12px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #3d8f82 0%, #5fb0a0 52%, #7bc9b8 100%);
  background-size: 160% 160%;
  box-shadow: 0 18px 36px -14px rgba(74, 157, 142, 0.75);
  transition: box-shadow 0.2s ease;
  animation: wkfab-idle 3.4s ease-in-out infinite;
  max-width: calc(100% - 28px);
  box-sizing: border-box;
}
.wk-fab:hover {
  animation: none;
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 22px 40px -12px rgba(74, 157, 142, 0.9);
}
.wk-fab-ring,
.wk-fab-ring-2 {
  position: absolute;
  inset: -5px;
  border-radius: inherit;
  border: 2px solid rgba(127, 210, 194, 0.7);
  pointer-events: none;
  animation: wkfab-ping 2.6s ease-out infinite;
}
.wk-fab-ring-2 {
  animation-delay: 1.3s;
}
.wk-fab-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #7dffb3;
  border: 2px solid #2f7a6e;
  box-sizing: border-box;
  animation: wkfab-live 1.6s ease-in-out infinite;
}
@keyframes wkfab-idle {
  0%, 100% { transform: translateY(0); background-position: 0% 50%; }
  50% { transform: translateY(-4px); background-position: 100% 50%; }
}
@keyframes wkfab-ping {
  0% { transform: scale(1); opacity: 0.55; }
  70%, 100% { transform: scale(1.16); opacity: 0; }
}
@keyframes wkfab-live {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.82); opacity: 0.7; }
}
.wk-fab::after,
.wk-fab::before {
  position: absolute;
  right: 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.wk-fab::after {
  content: attr(data-tip);
  bottom: calc(100% + 12px);
  padding: 7px 12px;
  border-radius: 10px;
  background: #13233b;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  box-shadow: 0 10px 22px -14px rgba(19, 35, 59, 0.7);
  transform: translateY(4px);
}
.wk-fab::before {
  content: "";
  bottom: calc(100% + 6px);
  width: 8px;
  height: 8px;
  background: #13233b;
  transform: translateY(4px) rotate(45deg);
}
.wk-fab:hover::after,
.wk-fab:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}
.wk-fab:hover::before,
.wk-fab:focus-visible::before {
  opacity: 1;
  transform: translateY(0) rotate(45deg);
}
@media (hover: none) {
  .wk-fab::after,
  .wk-fab::before { display: none; }
}
.wk-fab-ico {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: visible;
  flex: none;
}
.wk-fab-ico img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  border-radius: 50%;
}
.wk-fab.is-open { display: none; }
@media (prefers-reduced-motion: reduce) {
  .wk-fab,
  .wk-fab-ring,
  .wk-fab-ring-2,
  .wk-fab-dot { animation: none; }
}

.wk-panel {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 10000;
  width: min(380px, calc(100% - 24px));
  height: min(560px, calc(100dvh - 24px));
  max-width: calc(100% - 24px);
  box-sizing: border-box;
  display: none;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e7edf0;
  border-radius: 24px;
  box-shadow: 0 30px 70px -32px rgba(22, 36, 58, 0.45);
  overflow: hidden;
  font-family: Poppins, system-ui, sans-serif;
  color: #22303f;
}
.wk-panel.open { display: flex; }

.wk-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(118deg, #13233b 0%, #1f4a45 58%, #356f64 100%);
  color: #fff;
}
.wk-head img {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #fff;
  padding: 3px;
  object-fit: contain;
}
.wk-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.wk-head p {
  margin: 2px 0 0;
  font-size: 0.75rem;
  color: #bfe6dd;
}
.wk-head-txt { flex: 1; min-width: 0; }
.wk-x {
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

.wk-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  background: #f7faf9;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.wk-msg {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-wrap;
}
.wk-msg a {
  color: #2d7a6d;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.wk-msg a:hover { color: #4a9d8e; }
.wk-bot-msg {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e7edf0;
  color: #22303f;
  border-bottom-left-radius: 6px;
}
.wk-user-msg {
  align-self: flex-end;
  background: linear-gradient(135deg, #4a9d8e, #5fb0a0);
  color: #fff;
  border-bottom-right-radius: 6px;
}
.wk-dots { display: inline-flex; gap: 4px; padding: 2px 2px 0; }
.wk-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5fb0a0;
  animation: wkdot 1s infinite ease-in-out;
}
.wk-dots i:nth-child(2) { animation-delay: 0.15s; }
.wk-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes wkdot {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}
.wk-caret {
  display: inline-block;
  width: 2px;
  height: 0.95em;
  margin-left: 1px;
  background: #4a9d8e;
  vertical-align: -2px;
  animation: wkcaret 0.7s step-end infinite;
}
@keyframes wkcaret { 50% { opacity: 0; } }
.wk-cert {
  display: block;
  width: 100%;
  max-width: 260px;
  margin-top: 10px;
  border-radius: 12px;
  border: 1px solid #e7edf0;
  box-shadow: 0 10px 24px -16px rgba(22, 36, 58, 0.4);
}

.wk-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.wk-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #eaf4f1;
  color: #3c8a7c;
  border: 1px solid #d5e9e3;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
}
.wk-cta:hover { background: #4a9d8e; color: #fff; border-color: transparent; }

.wk-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 10px 16px 8px 12px;
  background: #fff;
  border-top: 1px solid #e7edf0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: #b7d4cd transparent;
  cursor: grab;
}
.wk-chips:active { cursor: grabbing; }
.wk-chips::-webkit-scrollbar { height: 4px; }
.wk-chips::-webkit-scrollbar-thumb {
  background: #b7d4cd;
  border-radius: 99px;
}
.wk-chip {
  flex: 0 0 auto;
  white-space: nowrap;
  scroll-snap-align: start;
  border: 1px solid #e7edf0;
  background: #f3f9f7;
  color: #16243a;
  border-radius: 999px;
  padding: 7px 14px;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}
.wk-chip:hover { border-color: #5fb0a0; color: #3c8a7c; }

.wk-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 12px;
  background: #fff;
  border-top: 1px solid #e7edf0;
  flex-shrink: 0;
}
.wk-form input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1.5px solid #e7edf0;
  border-radius: 999px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.86rem;
  outline: none;
  color: #22303f;
}
.wk-form input:focus { border-color: #5fb0a0; }
.wk-send {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  height: 42px;
  padding: 0 16px;
  background: linear-gradient(135deg, #4a9d8e, #5fb0a0);
  color: #fff;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.84rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.wk-send-ico { display: none; }
.wk-send:disabled { opacity: 0.5; cursor: default; }

@media (max-width: 820px) {
  .wk-fab {
    right: 12px;
    bottom: calc(68px + env(safe-area-inset-bottom, 0px));
    padding: 8px;
    gap: 0;
  }
  .wk-fab-label { display: none; }
  .wk-fab-ico {
    width: 42px;
    height: 42px;
  }
  .wk-fab-ico img {
    width: 30px;
    height: 30px;
  }
  .wk-fab-ring,
  .wk-fab-ring-2 {
    inset: -3px;
    animation: none;
    opacity: 0.35;
  }
  .wk-panel {
    inset: 0;
    right: 0;
    left: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 100svh;
    max-height: 100svh;
    border-radius: 0;
    border: 0;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .wk-form {
    padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .wk-send {
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
  }
  .wk-send-txt { display: none; }
  .wk-send-ico { display: block; }
}
