/* ── QualiRent Chatbot Widget ── */
#qr-chatbot {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: 'DM Sans', sans-serif;
}

#qr-chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--navy, #0B1829);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(11,24,41,0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#qr-chat-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 28px rgba(11,24,41,0.35);
}

#qr-chat-toggle svg {
  width: 28px;
  height: 28px;
  fill: #D4A843;
}

#qr-chat-window {
  display: none;
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 48px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(11,24,41,0.18);
  overflow: hidden;
  flex-direction: column;
  max-height: 560px;
}

#qr-chat-window.open {
  display: flex;
  flex-direction: column;
}

.qr-chat-header {
  background: #0B1829;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.qr-chat-header-info { flex: 1; }

.qr-chat-header-name {
  font-family: 'Fraunces', serif;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
}

.qr-chat-header-status {
  font-size: 0.75rem;
  color: #D4A843;
  margin-top: 2px;
}

.qr-chat-header-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: rgba(255,255,255,0.5);
  font-size: 1.25rem;
  line-height: 1;
  transition: color 0.2s;
}

.qr-chat-header-close:hover { color: #fff; }

.qr-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  background: #F5F0E8;
  min-height: 300px;
  max-height: 400px;
}

.qr-msg {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.9375rem;
  line-height: 1.5;
  animation: qr-fade-in 0.3s ease;
}

@keyframes qr-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.qr-msg.bot {
  background: #fff;
  color: #1A2533;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(11,24,41,0.08);
  align-self: flex-start;
}

.qr-msg.user {
  background: #0B1829;
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
  text-align: right;
}

.qr-msg.qualified {
  background: #0B1829;
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

.qr-msg.qualified .qr-booking-link {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.625rem 1.25rem;
  background: #D4A843;
  color: #0B1829;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  transition: opacity 0.2s;
}

.qr-msg.qualified .qr-booking-link:hover { opacity: 0.85; }

.qr-msg.rejected {
  background: #fff;
  color: #7A8899;
  border-bottom-left-radius: 4px;
  font-style: italic;
  align-self: flex-start;
}

.qr-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #fff;
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  box-shadow: 0 1px 4px rgba(11,24,41,0.08);
}

.qr-typing-dot {
  width: 6px;
  height: 6px;
  background: #7A8899;
  border-radius: 50%;
  animation: qr-bounce 1.2s infinite;
}

.qr-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.qr-typing-dot:nth-child(3) { animation-delay: 0.4s; }

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

.qr-chat-input-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.875rem 1.25rem;
  background: #fff;
  border-top: 1px solid rgba(11,24,41,0.08);
}

#qr-chat-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(11,24,41,0.12);
  border-radius: 10px;
  font-size: 0.9375rem;
  font-family: 'DM Sans', sans-serif;
  background: #F5F0E8;
  color: #1A2533;
  outline: none;
  transition: border-color 0.2s;
}

#qr-chat-input:focus { border-color: #D4A843; }

#qr-chat-send {
  width: 44px;
  height: 44px;
  background: #0B1829;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

#qr-chat-send:hover { background: #1a2f4a; }

#qr-chat-send svg { fill: #D4A843; }

@media (max-width: 480px) {
  #qr-chatbot { bottom: 16px; right: 16px; }
  #qr-chat-window { right: -8px; }
}