/* ===============================
   CHATBOT WIDGET - FIXED VERSION
   =============================== */

#cb-open {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: #0d6efd;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
}

/* Panel utama */
#cb-panel {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 360px;
  max-height: 80vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  isolation: isolate; /* KUNCI FIX */
}

/* Header */
.cb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: #0d6efd;
  color: #fff;
  position: relative;
  z-index: 1000;
}

.cb-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  color: #0d6efd;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cb-name {
  font-weight: bold;
}

.cb-status {
  font-size: 12px;
}

/* Tombol Close */
#cb-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10001;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  pointer-events: auto;
}

/* Chat area */
.cb-chat {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  background: #f5f5f5;
}

.cb-msg {
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  max-width: 85%;
  font-size: 14px;
}

.cb-user {
  background: #0d6efd;
  color: #fff;
  margin-left: auto;
}

.cb-bot {
  background: #e9e9e9;
  color: #000;
}

.cb-typing {
  font-size: 12px;
  color: #666;
  margin-bottom: 6px;
}

/* Input */
.cb-input {
  display: flex;
  border-top: 1px solid #ddd;
}

#cb-msg {
  flex: 1;
  border: none;
  padding: 10px;
  font-size: 14px;
}

#cb-send {
  border: none;
  background: #0d6efd;
  color: #fff;
  padding: 0 16px;
  cursor: pointer;
}

/* Quick buttons */
.cb-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
}

.cb-q {
  border: 1px solid #0d6efd;
  background: #fff;
  color: #0d6efd;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}

/* Footer */
.cb-footer {
  font-size: 11px;
  padding: 6px 10px;
  text-align: center;
  color: #555;
}

/* Hidden */
.cb-hidden {
  display: none;
}

/* Mobile */
@media(max-width: 480px){
  #cb-panel {
    width: calc(100% - 20px);
    right: 10px;
    bottom: 80px;
  }
}

/* === CLOSE BUTTON FIX TOTAL === */
.cb-close-fixed {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2147483647; /* MAX Z-INDEX */
  background: transparent;
  border: none;
  font-size: 22px;
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
}

/* pastikan header TIDAK menutup klik */
.cb-header,
.cb-header * {
  pointer-events: auto;
}

