/* ═══════════════════════════════════════════════════════════
   RELANTERN AI SUPPORT WIDGET — Floating Chat
   ═══════════════════════════════════════════════════════════ */

/* ── Floating Trigger Button ── */
.rw-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #d4a843 0%, #b8922e 100%);
  box-shadow: 0 4px 24px rgba(212, 168, 67, 0.4), 0 0 0 0 rgba(212, 168, 67, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  animation: rw-pulse 3s ease-in-out infinite;
}
.rw-trigger:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 32px rgba(212, 168, 67, 0.5);
}
.rw-trigger.rw-active {
  animation: none;
  transform: rotate(0deg);
  background: linear-gradient(135deg, #64748b, #475569);
}
.rw-trigger svg {
  width: 28px;
  height: 28px;
  fill: #0a0f1a;
  transition: transform 0.3s ease;
}
.rw-trigger.rw-active svg {
  fill: #fff;
}

@keyframes rw-pulse {
  0%, 100% { box-shadow: 0 4px 24px rgba(212, 168, 67, 0.4), 0 0 0 0 rgba(212, 168, 67, 0.3); }
  50% { box-shadow: 0 4px 24px rgba(212, 168, 67, 0.4), 0 0 0 12px rgba(212, 168, 67, 0); }
}

/* ── Notification Badge ── */
.rw-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0a0f1a;
}

/* ── Chat Panel ── */
.rw-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 9999;
  width: 400px;
  max-height: 620px;
  border-radius: 20px;
  background: rgba(10, 15, 26, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0s linear 0.3s;
  font-family: 'Inter', 'Outfit', -apple-system, sans-serif;
}
.rw-panel.rw-open {
  visibility: visible;
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0s linear 0s;
}

/* ── Panel Header ── */
.rw-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.rw-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d4a843 0%, #b8922e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.rw-header-info {
  flex: 1;
  min-width: 0;
}
.rw-header-title {
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0;
}
.rw-header-status {
  font-size: 11px;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 4px;
}
.rw-header-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
}
.rw-header-close {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}
.rw-header-close:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.06);
}

/* ── Messages Container ── */
.rw-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
  max-height: 420px;
  scroll-behavior: smooth;
}
.rw-messages::-webkit-scrollbar {
  width: 4px;
}
.rw-messages::-webkit-scrollbar-track {
  background: transparent;
}
.rw-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

/* ── Message Bubbles ── */
.rw-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
  animation: rw-fadeIn 0.3s ease;
}
.rw-msg-ai {
  align-self: flex-start;
  background: rgba(30, 41, 59, 0.8);
  color: #e2e8f0;
  border-bottom-left-radius: 4px;
}
.rw-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #d4a843, #b8922e);
  color: #0a0f1a;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

@keyframes rw-fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Typing Indicator ── */
.rw-typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  align-self: flex-start;
}
.rw-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #64748b;
  animation: rw-bounce 1.4s infinite;
}
.rw-typing span:nth-child(2) { animation-delay: 0.16s; }
.rw-typing span:nth-child(3) { animation-delay: 0.32s; }

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

/* ── Quick-Start Buttons ── */
.rw-quickstart {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0;
}
.rw-quickstart-btn {
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid rgba(212, 168, 67, 0.3);
  background: rgba(212, 168, 67, 0.08);
  color: #d4a843;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.rw-quickstart-btn:hover {
  background: rgba(212, 168, 67, 0.18);
  border-color: rgba(212, 168, 67, 0.5);
  transform: translateY(-1px);
}

/* ── Input Bar ── */
.rw-input-bar {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.rw-input-bar input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.6);
  color: #f1f5f9;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
.rw-input-bar input::placeholder { color: #475569; }
.rw-input-bar input:focus { border-color: rgba(212, 168, 67, 0.4); }
.rw-input-bar button {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #d4a843, #b8922e);
  color: #0a0f1a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, transform 0.2s;
  flex-shrink: 0;
}
.rw-input-bar button:hover { opacity: 0.85; transform: scale(1.04); }
.rw-input-bar button:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.rw-input-bar button svg { width: 18px; height: 18px; fill: #0a0f1a; }

/* ── Mobile Responsive ── */
@media (max-width: 480px) {
  .rw-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
  }
  .rw-trigger {
    bottom: 16px;
    right: 16px;
    width: 54px;
    height: 54px;
  }
  .rw-messages {
    max-height: calc(100vh - 180px);
    max-height: calc(100dvh - 180px);
  }
}
