/* =========================================================
   RekaLOKA FAQ Chatbot Widget
   Warna mengikuti tema website (ink / blue / green)
   ========================================================= */

#rk-chat-root {
  --rk-ink: #10131A;
  --rk-charcoal: #1B1F27;
  --rk-paper: #FFFFFF;
  --rk-mist: #EDEFF0;
  --rk-line: #DBDEE0;
  --rk-text: #10131A;
  --rk-muted: #565D67;
  --rk-on-dark: #F3F4F5;
  --rk-on-dark-muted: #9CA3AD;
  --rk-blue: #3E7CB1;
  --rk-green: #2E9E6E;
  --rk-font: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  --rk-display: 'Space Grotesk', 'Helvetica Neue', Arial, sans-serif;
  font-family: var(--rk-font);
  z-index: 9999;
}

/* ----- Floating button ----- */
#rk-chat-toggle {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--rk-blue), var(--rk-green));
  color: #0A0C10;
  box-shadow: 0 8px 24px rgba(16, 19, 26, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 10000;
}

#rk-chat-toggle:hover {
  transform: scale(1.06);
  box-shadow: 0 10px 28px rgba(16, 19, 26, 0.35);
}

#rk-chat-toggle svg {
  width: 26px;
  height: 26px;
}

#rk-chat-toggle .rk-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  background: #e74c3c;
  border-radius: 50%;
  border: 2px solid var(--rk-paper);
  display: none;
}

#rk-chat-toggle.open {
  background: var(--rk-ink);
  color: var(--rk-on-dark);
}

/* ----- Panel ----- */
#rk-chat-panel {
  position: fixed;
  right: 22px;
  bottom: 92px;
  width: 370px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: var(--rk-paper);
  border: 1px solid var(--rk-line);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(16, 19, 26, 0.18);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 10000;
  animation: rkSlideUp 0.25s ease;
}

#rk-chat-panel.open {
  display: flex;
}

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

/* Header */
.rk-chat-header {
  background: var(--rk-ink);
  color: var(--rk-on-dark);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.rk-chat-header .rk-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #10131A;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  border: none;
}
.rk-chat-header .rk-avatar svg {
  width: 38px;
  height: 38px;
  display: block;
}

.rk-chat-header .rk-title {
  flex: 1;
  min-width: 0;
}

.rk-chat-header .rk-title h3 {
  margin: 0;
  font-family: var(--rk-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--rk-on-dark);
}

.rk-chat-header .rk-title p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--rk-on-dark-muted);
}

.rk-chat-header .rk-close {
  background: none;
  border: none;
  color: var(--rk-on-dark-muted);
  cursor: pointer;
  padding: 4px;
  line-height: 0;
  border-radius: 4px;
}

.rk-chat-header .rk-close:hover {
  color: var(--rk-on-dark);
  background: rgba(255,255,255,0.08);
}

/* Messages area */
.rk-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--rk-mist);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rk-msg {
  max-width: 88%;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.rk-msg.bot {
  align-self: flex-start;
  background: var(--rk-paper);
  color: var(--rk-text);
  border: 1px solid var(--rk-line);
  border-bottom-left-radius: 4px;
}

.rk-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--rk-blue), var(--rk-green));
  color: #0A0C10;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

.rk-msg .rk-time {
  display: block;
  font-size: 10.5px;
  margin-top: 6px;
  opacity: 0.55;
}

/* Quick replies */
.rk-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 10px;
  background: var(--rk-mist);
  flex-shrink: 0;
}

.rk-quick button {
  font-family: var(--rk-font);
  font-size: 12.5px;
  padding: 7px 12px;
  border-radius: 20px;
  border: 1px solid var(--rk-line);
  background: var(--rk-paper);
  color: var(--rk-text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.rk-quick button:hover {
  border-color: var(--rk-blue);
  background: #f0f6fb;
}

/* Input area */
.rk-chat-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--rk-line);
  background: var(--rk-paper);
  flex-shrink: 0;
}

.rk-chat-input input {
  flex: 1;
  border: 1px solid var(--rk-line);
  border-radius: 22px;
  padding: 11px 16px;
  font-family: var(--rk-font);
  font-size: 14px;
  color: var(--rk-text);
  outline: none;
  background: var(--rk-mist);
  transition: border-color 0.2s;
}

.rk-chat-input input:focus {
  border-color: var(--rk-blue);
  background: var(--rk-paper);
}

.rk-chat-input button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--rk-blue), var(--rk-green));
  color: #0A0C10;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s;
}

.rk-chat-input button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.rk-chat-input button svg {
  width: 18px;
  height: 18px;
}

/* Typing indicator */
.rk-typing {
  align-self: flex-start;
  background: var(--rk-paper);
  border: 1px solid var(--rk-line);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  padding: 12px 16px;
  display: flex;
  gap: 5px;
}

.rk-typing span {
  width: 7px;
  height: 7px;
  background: var(--rk-muted);
  border-radius: 50%;
  animation: rkBounce 1.2s infinite ease-in-out;
}

.rk-typing span:nth-child(2) { animation-delay: 0.15s; }
.rk-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes rkBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Mobile */
@media (max-width: 480px) {
  #rk-chat-panel {
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: none;
  }
  #rk-chat-toggle {
    right: 16px;
    bottom: 16px;
  }
}
