/* =============================================
   RESOURCEBOT FLOATING CHAT WIDGET
   Professional blue palette preview
   ============================================= */

#rm-widget {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  font-family: 'Outfit', sans-serif;
}

/* ── Toggle button ──────────────────────────────────────── */
#rm-toggle {
  height: 54px;
  padding: 0 22px 0 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #6b86a6 0%, #8fa4bf 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #0f172a;
  box-shadow: 0 14px 30px rgba(7, 16, 34, 0.34);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#rm-toggle-label {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  letter-spacing: 0.1px;
}

#rm-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(107, 134, 166, 0.24);
}

/* ── Panel ──────────────────────────────────────────────── */
#rm-panel[hidden] {
  display: none;
}

#rm-panel {
  position: fixed;
  top: 72px;
  right: 28px;
  width: min(760px, calc(100vw - 56px));
  height: calc(100vh - 112px);
  background: #111827;
  border: 1px solid #2b3b5d;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 28px 72px rgba(7, 16, 34, 0.5);
  animation: rm-slide-up 0.2s ease;
}

@keyframes rm-slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Header ─────────────────────────────────────────────── */
#rm-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #1c2740;
  font-size: 16px;
  color: #d7e2f2;
  border-bottom: 1px solid #2b3b5d;
  flex-shrink: 0;
}

#rm-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;   /* green = online */
  transition: background 0.3s;
}

#rm-status-dot.rm-status--thinking {
  background: #4f8cff;
  animation: rm-pulse 1s infinite;
}

@keyframes rm-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

#rm-close {
  background: none;
  border: none;
  color: #8a8a8c;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s;
}
#rm-close:hover { color: #d7e2f2; }

/* ── Message area ───────────────────────────────────────── */
#rm-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

#rm-messages::-webkit-scrollbar { width: 4px; }
#rm-messages::-webkit-scrollbar-thumb { background: #2b3b5d; border-radius: 2px; }

/* ── Messages ───────────────────────────────────────────── */
.rm-msg {
  max-width: 88%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.65;
  word-wrap: break-word;
}

.rm-msg--bot {
  background: #1c2740;
  color: #d7e2f2;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.rm-msg--user {
  background: #4f8cff;
  color: #0f172a;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

/* Typing indicator */
.rm-msg--thinking {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 14px 16px;
  background: #1c2740;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.rm-msg--thinking span {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8a8a8c;
  animation: rm-bounce 1.2s infinite;
}

.rm-msg--thinking span:nth-child(2) { animation-delay: 0.2s; }
.rm-msg--thinking span:nth-child(3) { animation-delay: 0.4s; }

@keyframes rm-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40%           { transform: translateY(-5px); opacity: 1; }
}

/* ── Input row ──────────────────────────────────────────── */
#rm-input-row {
  display: flex;
  gap: 10px;
  padding: 16px 18px;
  border-top: 1px solid #2b3b5d;
  background: #111827;
  flex-shrink: 0;
}

#rm-input {
  flex: 1;
  background: #1a2336;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px 16px;
  color: #d7e2f2;
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
}

#rm-input::placeholder { color: #8a8a8c; }

#rm-input:focus {
  border-color: #6b86a6;
  box-shadow: 0 0 0 3px rgba(107, 134, 166, 0.18);
}

#rm-send {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  background: #6b86a6;
  color: #0f172a;
  border: none;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

#rm-send:hover  { background: #3e79e6; }
#rm-send:active { transform: scale(0.95); }
#rm-send:disabled { background: #3d3c41; color: #8a8a8c; cursor: not-allowed; }

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 440px) {
  #rm-panel {
    width: calc(100vw - 24px);
    right: 16px;
    top: 72px;
    height: min(78vh, 720px);
  }
  #rm-widget {
    right: 16px;
    bottom: 20px;
  }
}
