/* ── RemoteKaki Chatbot Widget ── */
:root {
  --rk-bot-color: #00AAFF;
  --rk-bot-navy:  #0D1B3E;
  --rk-bot-dark:  #060E20;
  --rk-bot-card:  #0F2248;
  --rk-bot-grey:  #7A8AA0;
  --rk-bot-white: #FFFFFF;
  --rk-bot-r:     16px;
}

/* Toggle button */
#rk-chat-toggle {
  position: fixed;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0A4DA6, var(--rk-bot-color));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 4px 24px rgba(0,170,255,.45), 0 2px 8px rgba(0,0,0,.4);
  transition: transform .2s, box-shadow .2s;
  z-index: 99998;
  bottom: 28px;
}
#rk-chat-toggle.rk-right { right: 28px; }
#rk-chat-toggle.rk-left  { left:  28px; }
#rk-chat-toggle:hover { transform: scale(1.1); box-shadow: 0 6px 32px rgba(0,170,255,.6); }
#rk-chat-toggle.open  { background: linear-gradient(135deg, #0A4DA6, #FF4466); }

/* Notification dot */
.rk-notif-dot {
  position: absolute;
  top: 2px; right: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #FF4466;
  border: 2px solid #060E20;
  display: none;
  animation: rk-bounce .6s ease infinite alternate;
}
.rk-notif-dot.show { display: block; }
@keyframes rk-bounce { from { transform: scale(1); } to { transform: scale(1.25); } }

/* Chat window */
#rk-chat-window {
  position: fixed;
  width: 380px;
  height: 540px;
  background: var(--rk-bot-dark);
  border: 1px solid rgba(0,170,255,.25);
  border-radius: 20px;
  box-shadow: 0 16px 64px rgba(0,0,0,.6), 0 0 40px rgba(0,170,255,.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99999;
  bottom: 100px;
  transition: opacity .2s, transform .25s;
  opacity: 0;
  transform: translateY(20px) scale(.96);
  pointer-events: none;
}
#rk-chat-window.rk-right { right: 28px; }
#rk-chat-window.rk-left  { left:  28px; }
#rk-chat-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
.rk-chat-header {
  background: linear-gradient(135deg, #0A1A38, #0A4DA6);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(0,170,255,.2);
  flex-shrink: 0;
}
.rk-bot-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(0,170,255,.2);
  border: 2px solid rgba(0,170,255,.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
}
.rk-bot-info { flex: 1; }
.rk-bot-name { font-size: .95rem; font-weight: 700; color: #fff; line-height: 1.2; }
.rk-bot-status {
  display: flex; align-items: center; gap: 5px;
  font-size: .72rem; color: rgba(255,255,255,.6);
}
.rk-status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #00CC70;
  animation: rk-pulse-g 2s ease-in-out infinite;
}
@keyframes rk-pulse-g {
  0%,100% { box-shadow: 0 0 0 0 rgba(0,204,112,.5); }
  50%      { box-shadow: 0 0 0 5px rgba(0,204,112,0); }
}
.rk-chat-close {
  background: none; border: none; color: rgba(255,255,255,.6);
  cursor: pointer; font-size: 1.2rem; padding: 4px;
  border-radius: 6px; transition: color .2s, background .2s;
  line-height: 1;
}
.rk-chat-close:hover { color: #fff; background: rgba(255,255,255,.1); }

/* Messages area */
.rk-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.rk-chat-messages::-webkit-scrollbar { width: 4px; }
.rk-chat-messages::-webkit-scrollbar-track { background: transparent; }
.rk-chat-messages::-webkit-scrollbar-thumb { background: rgba(0,170,255,.2); border-radius: 2px; }

/* Message bubbles */
.rk-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: 88%;
  animation: rk-msg-in .25s ease;
}
@keyframes rk-msg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.rk-msg.rk-bot  { align-self: flex-start; }
.rk-msg.rk-user { align-self: flex-end; flex-direction: row-reverse; }

.rk-msg-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,170,255,.15); border: 1px solid rgba(0,170,255,.25);
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; flex-shrink: 0;
}

.rk-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: .88rem;
  line-height: 1.65;
  max-width: 100%;
  word-break: break-word;
}
.rk-bot .rk-msg-bubble {
  background: #0F2248;
  border: 1px solid rgba(0,170,255,.15);
  color: #D0E4F8;
  border-bottom-left-radius: 4px;
}
.rk-user .rk-msg-bubble {
  background: linear-gradient(135deg, #0A4DA6, #00AAFF);
  color: #fff;
  border-bottom-right-radius: 4px;
}
/* Markdown-like formatting */
.rk-msg-bubble strong { color: #fff; font-weight: 700; }
.rk-msg-bubble .rk-bullet { display: block; padding-left: 12px; position: relative; }
.rk-msg-bubble .rk-bullet::before { content:'•'; position: absolute; left: 0; color: #00AAFF; }

/* Typing indicator */
.rk-typing {
  display: flex; align-items: center; gap: 5px;
  padding: 10px 14px;
  background: #0F2248;
  border: 1px solid rgba(0,170,255,.15);
  border-radius: 14px; border-bottom-left-radius: 4px;
  width: fit-content;
}
.rk-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--rk-bot-grey);
  animation: rk-type .9s ease-in-out infinite;
}
.rk-typing span:nth-child(2) { animation-delay: .15s; }
.rk-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes rk-type { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }

/* Quick replies */
.rk-quick-replies {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 16px 0;
}
.rk-quick-btn {
  background: rgba(0,170,255,.1);
  border: 1px solid rgba(0,170,255,.25);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: .78rem;
  color: #00AAFF;
  cursor: pointer;
  font-family: inherit;
  transition: all .18s;
  white-space: nowrap;
}
.rk-quick-btn:hover {
  background: rgba(0,170,255,.2);
  border-color: rgba(0,170,255,.5);
  transform: translateY(-1px);
}

/* Input area */
.rk-chat-input-area {
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: rgba(255,255,255,.02);
  flex-shrink: 0;
}
#rk-chat-input {
  flex: 1;
  background: rgba(255,255,255,.06);
  border: 1.5px solid rgba(255,255,255,.1);
  border-radius: 10px;
  padding: 10px 13px;
  color: #fff;
  font-family: inherit;
  font-size: .88rem;
  resize: none;
  max-height: 100px;
  line-height: 1.5;
  outline: none;
  transition: border-color .2s;
}
#rk-chat-input::placeholder { color: rgba(255,255,255,.25); }
#rk-chat-input:focus { border-color: rgba(0,170,255,.45); }
#rk-chat-send {
  width: 38px; height: 38px; flex-shrink: 0;
  background: linear-gradient(135deg, #0A4DA6, #00AAFF);
  border: none; border-radius: 10px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all .18s;
}
#rk-chat-send:hover { transform: scale(1.08); box-shadow: 0 4px 12px rgba(0,170,255,.4); }
#rk-chat-send svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2.5; }
#rk-chat-send:disabled { opacity: .5; cursor: not-allowed; }

/* Footer */
.rk-chat-footer {
  text-align: center;
  padding: 6px 0 8px;
  font-size: .68rem;
  color: rgba(255,255,255,.25);
  flex-shrink: 0;
}

/* Mobile */
@media (max-width: 480px) {
  #rk-chat-window { width: calc(100vw - 24px); right: 12px !important; left: 12px !important; bottom: 88px; }
  #rk-chat-toggle { bottom: 20px; }
  #rk-chat-toggle.rk-right { right: 16px; }
  #rk-chat-toggle.rk-left  { left:  16px; }
}
