/* ─────────────────────────────────────────────────────────────
   BIDAKARA — Floating chat widget (WhatsApp + chatbot)
   ───────────────────────────────────────────────────────────── */
.chat-widget {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}

.chat-widget [hidden],
.chat-widget [hidden] * {
  display: none !important;
}

/* ── Floating action button ── */
.cw-fab {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
}

.cw-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
}

.cw-fab--bot {
  background: #0b4c8a;
  position: relative;
}

.cw-fab--bot:hover {
  background: #0b5ba3;
}

.cw-fab__icon--close {
  display: none;
}

.chat-widget.is-open .cw-fab__icon--chat {
  display: none;
}

.chat-widget.is-open .cw-fab__icon--close {
  display: block;
}

/* ── Chat panel ── */
.cw-panel {
  width: 350px;
  max-width: calc(100vw - 30px);
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(12, 32, 60, 0.28);
  border: 1px solid rgba(12, 76, 138, 0.12);
  display: flex;
  flex-direction: column;
  animation: cw-pop 0.22s ease;
}

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

.cw-panel__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(120deg, #0b4c8a, #0a5d96);
  color: #fff;
}

.cw-panel__avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
  background: #ffc10e;
  color: #003c71;
  font-weight: 800;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cw-panel__who {
  flex: 1;
  min-width: 0;
}

.cw-panel__name {
  font-weight: 700;
  font-size: 15px;
  display: block;
}

.cw-panel__status {
  font-size: 12px;
  opacity: 0.92;
  display: flex;
  align-items: center;
  gap: 5px;
}

.cw-panel__status i {
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  display: inline-block;
}

.cw-panel__close {
  background: rgba(255, 255, 255, 0.18);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 30px;
}

.cw-panel__close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.cw-body {
  padding: 14px 14px 6px;
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cw-msg {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-line;
  word-break: break-word;
  animation: cw-msg-in 0.18s ease;
}

@keyframes cw-msg-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cw-msg--bot {
  background: #f0f4f9;
  color: #1c2a3a;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.cw-msg--user {
  background: #0b4c8a;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.cw-typing {
  align-self: flex-start;
  font-size: 12.5px;
  color: #5b6b7c;
  padding: 0 2px;
  animation: cw-blink 1s ease infinite;
}

@keyframes cw-blink {
  50% { opacity: 0.45; }
}

.cw-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px;
  border-top: 1px solid #edf1f5;
}

.cw-chip {
  background: #eef3f9;
  border: 1px solid #d7e0ea;
  color: #0b4c8a;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
  font-family: inherit;
}

.cw-chip:hover {
  background: #dce8f5;
}

.cw-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #edf1f5;
}

.cw-input {
  flex: 1;
  border: 1px solid #d7e0ea;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  background: #f7fafc;
}

.cw-input:focus {
  border-color: #0b4c8a;
  background: #fff;
}

.cw-send {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
  background: #0b4c8a;
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.cw-send:hover {
  background: #0a5d96;
}

.cw-panel__wa {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 12px;
  background: #eafaf0;
  color: #128c4b;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border-top: 1px solid #d4f0df;
}

.cw-panel__wa:hover {
  background: #d8f4e5;
}

/* ── Responsive ── */
@media (max-width: 520px) {
  .chat-widget {
    right: 14px;
    bottom: 14px;
  }

  .cw-panel {
    width: min(350px, calc(100vw - 28px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .cw-panel, .cw-msg {
    animation: none;
  }
}