/* KasihKata — Chat Admin. Warna mengikuti variabel site.css (dengan cadangan). */
.kkc {
  --kkc-accent: var(--accent, #b3556b);
  --kkc-accent-hover: var(--accent-hover, #9c4459);
  --kkc-soft: var(--accent-soft, #f7e6ea);
  --kkc-ink: var(--ink, #2a231f);
  --kkc-muted: var(--muted, #8a7d76);
  --kkc-line: var(--line, #f0e3da);
  --kkc-bg: var(--bg, #fff9f6);
  --kkc-wa: #25d366;
  font-family: var(--font-body, ui-sans-serif, system-ui, sans-serif);
  line-height: 1.5;
  color: var(--kkc-ink);
}
.kkc *, .kkc *::before, .kkc *::after { box-sizing: border-box; }
html.kkc-lock { overflow: hidden; }

/* ---------- dok kanan bawah: bubble ajakan + tombol bulat ---------- */
.kkc-dock {
  position: fixed; right: 18px; bottom: 18px; z-index: var(--z-chat, 9000);
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
}
.kkc-fab {
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--kkc-accent); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 8px 22px rgba(131, 24, 67, .28);
  transition: transform .2s ease, background .2s ease;
}
.kkc-fab:hover { background: var(--kkc-accent-hover); transform: translateY(-2px); }
.kkc-fab:focus-visible, .kkc-btn:focus-visible, .kkc-q:focus-visible { outline: 3px solid #f2b8c6; outline-offset: 2px; }
.kkc-shake { animation: kkc-shake .9s ease-in-out; }
@keyframes kkc-shake {
  0%, 100% { transform: rotate(0); } 15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); }
  45% { transform: rotate(9deg); } 60% { transform: rotate(-6deg); } 75% { transform: rotate(3deg); }
}

.kkc-teaser { position: relative; max-width: 270px; animation: kkc-up .35s ease both; }
.kkc-teaser[hidden] { display: none; }
.kkc-teaser-card {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface, #fff); border: 1px solid var(--kkc-line); border-radius: 16px 16px 4px 16px;
  padding: 11px 30px 11px 14px; font: inherit; color: inherit;
  box-shadow: 0 10px 28px rgba(42, 35, 31, .14);
}
.kkc-teaser-name { display: block; font-weight: 700; font-size: 12.5px; color: var(--accent-text, var(--kkc-accent)); }
.kkc-teaser-text { display: block; font-size: 13.5px; margin-top: 2px; }
.kkc-teaser-x {
  position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%;
  border: 0; background: #574b45; color: #fff; font-size: 16px; line-height: 1; cursor: pointer;
}
.kkc-teaser-x[hidden] { display: none; }

/* ---------------------------- jendela chat ---------------------------- */
.kkc-wrap { position: fixed; inset: 0; z-index: calc(var(--z-chat, 9000) + 5); pointer-events: none; }
.kkc-overlay { position: absolute; inset: 0; background: rgba(42, 35, 31, .35); opacity: 0; transition: opacity .25s; }
.kkc-panel {
  position: absolute; right: 18px; bottom: 18px; width: 370px; max-width: calc(100vw - 24px);
  height: min(620px, calc(100vh - 36px)); display: flex; flex-direction: column;
  background: var(--kkc-bg); border-radius: 20px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(42, 35, 31, .28);
  transform: translateY(24px) scale(.98); opacity: 0; transition: transform .25s ease, opacity .25s ease;
}
.kkc-wrap.is-open { pointer-events: auto; }
.kkc-wrap.is-open .kkc-overlay { opacity: 1; }
.kkc-wrap.is-open .kkc-panel { transform: none; opacity: 1; }

.kkc-head {
  display: flex; align-items: center; gap: 11px; padding: 13px 14px;
  background: var(--kkc-accent); color: #fff;
}
.kkc-ava {
  width: 40px; height: 40px; border-radius: 50%; flex: none; overflow: hidden;
  background: #fff; color: var(--kkc-accent); display: grid; place-items: center;
  font-weight: 700; font-family: var(--font-head, Georgia, serif); font-size: 18px;
}
.kkc-ava img { width: 100%; height: 100%; object-fit: cover; }
.kkc-who { flex: 1; min-width: 0; }
.kkc-name { font-weight: 700; font-size: 15px; }
.kkc-status { font-size: 12px; opacity: .9; display: flex; align-items: center; gap: 6px; }
.kkc-close {
  width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .18); color: #fff; font-size: 22px; line-height: 1;
}
.kkc-close:hover { background: rgba(255, 255, 255, .3); }

.kkc-body { flex: 1; overflow-y: auto; padding: 14px 12px 6px; overscroll-behavior: contain; }
.kkc-line { display: flex; margin: 6px 0; }
.kkc-line.kkc-me { justify-content: flex-end; }
.kkc-bubble {
  max-width: 84%; padding: 9px 12px; font-size: 14px; white-space: pre-line; word-wrap: break-word;
  border-radius: 14px; box-shadow: 0 1px 1px rgba(42, 35, 31, .06);
}
/* latar mengikuti mode terang/gelap (dulu #fff: di mode gelap tulisan terang di atas putih tak terbaca) */
.kkc-bot .kkc-bubble { background: var(--surface, #fff); border: 1px solid var(--kkc-line); border-top-left-radius: 4px; }
.kkc-me .kkc-bubble { background: var(--kkc-soft); border-top-right-radius: 4px; }
.kkc-pop { animation: kkc-up .22s ease both; }
@keyframes kkc-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.kkc-link {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 6px;
  font-weight: 600; color: var(--kkc-accent); text-decoration: none;
}
.kkc-link:hover { text-decoration: underline; }
.kkc-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.kkc-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--kkc-muted); animation: kkc-dot 1.1s infinite; }
.kkc-typing span:nth-child(2) { animation-delay: .15s; }
.kkc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes kkc-dot { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* --------------------------- tombol & pilihan --------------------------- */
.kkc-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; margin: 10px 0 8px; animation: kkc-up .25s ease both; }
.kkc-q-line { display: flex; justify-content: flex-end; width: 100%; }
.kkc-q {
  max-width: 88%; text-align: right; cursor: pointer; font: inherit; font-size: 13.5px;
  background: var(--surface, #fff); color: var(--accent-text, var(--kkc-accent)); border: 1.5px solid var(--kkc-accent);
  border-radius: 14px; padding: 7px 12px; transition: background .15s;
}
.kkc-q:hover { background: var(--kkc-soft); }
.kkc-btn {
  width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 999px; padding: 10px 14px; font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer; border: 0; transition: filter .15s, background .15s;
}
.kkc-btn-wa { background: var(--kkc-wa); color: #fff; }
.kkc-btn-wa:hover { filter: brightness(.95); }
.kkc-btn-primary { background: var(--kkc-accent); color: #fff; }
.kkc-btn-primary:hover { background: var(--kkc-accent-hover); }
.kkc-btn-outline { background: var(--surface, #fff); color: var(--accent-text, var(--kkc-accent)); border: 1.5px solid var(--kkc-accent); }
.kkc-toggle {
  display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; cursor: pointer;
  color: var(--kkc-accent); font: inherit; font-size: 13px; font-weight: 600; padding: 2px 4px;
}
.kkc-toggle svg { transition: transform .2s; }
.kkc-toggle.is-open svg { transform: rotate(180deg); }
.kkc-divider { width: 100%; height: 1px; background: var(--kkc-line); margin: 4px 0; }

.kkc-more { width: 100%; background: var(--surface, #fff); border: 1px solid var(--kkc-line); border-radius: 14px; padding: 8px; }
.kkc-search {
  display: flex; align-items: center; gap: 7px; padding: 7px 10px; margin-bottom: 6px;
  border: 1px solid var(--kkc-line); border-radius: 10px; color: var(--kkc-muted);
}
.kkc-search input { flex: 1; border: 0; outline: 0; font: inherit; font-size: 13.5px; background: none; color: var(--kkc-ink); min-width: 0; }
.kkc-more-list { display: flex; flex-direction: column; gap: 6px; max-height: 210px; overflow-y: auto; }
.kkc-empty { text-align: center; color: var(--kkc-muted); font-size: 13px; padding: 14px 6px; }

.kkc-foot { padding: 9px 12px 12px; border-top: 1px solid var(--kkc-line); background: var(--surface, #fff); }
.kkc-hint {
  border-radius: 999px; background: var(--kkc-bg); color: var(--kkc-muted);
  font-size: 13px; padding: 9px 14px; user-select: none;
}

/* ------------------------------- HP ------------------------------- */
@media (max-width: 767px) {
  .kkc-dock { right: 14px; bottom: 14px; }
  .kkc-panel {
    right: 0; left: 0; bottom: 0; width: 100%; max-width: none;
    height: 88vh; height: 88dvh; border-radius: 20px 20px 0 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .kkc *, .kkc-panel { animation: none !important; transition: none !important; }
}
