/* ==========================================================================
   THE ROYAL CRIMSON™ — LUXURY AI ALLOTMENT CHATBOT WIDGET
   ========================================================================== */

/* Floating Launcher Button */
#crimson-chatbot-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99990;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-family: var(--font-sans, system-ui, -apple-system, sans-serif);
}

.chatbot-launcher-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #b71c24 0%, #7b0017 100%);
  color: #fff;
  border: 2px solid #e5b74b;
  box-shadow: 0 8px 25px rgba(123, 0, 23, 0.38), 0 0 0 0 rgba(229, 183, 75, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  position: relative;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  animation: pulse-ring 2.8s infinite;
}

@keyframes pulse-ring {
  0% {
    box-shadow: 0 8px 25px rgba(123, 0, 23, 0.38), 0 0 0 0 rgba(229, 183, 75, 0.4);
  }
  70% {
    box-shadow: 0 8px 25px rgba(123, 0, 23, 0.38), 0 0 0 14px rgba(229, 183, 75, 0);
  }
  100% {
    box-shadow: 0 8px 25px rgba(123, 0, 23, 0.38), 0 0 0 0 rgba(229, 183, 75, 0);
  }
}

.chatbot-launcher-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 30px rgba(123, 0, 23, 0.5);
}

.chatbot-launcher-btn .bi-chat-dots-fill {
  transition: opacity 0.2s, transform 0.2s;
}

.chatbot-launcher-btn .bi-x-lg {
  display: none;
  font-size: 22px;
}

#crimson-chatbot-launcher.is-active .chatbot-launcher-btn {
  background: #180507;
  border-color: #e5b74b;
  animation: none;
}

#crimson-chatbot-launcher.is-active .bi-chat-dots-fill {
  display: none;
}

#crimson-chatbot-launcher.is-active .bi-x-lg {
  display: inline-block;
}

/* Greeting Callout Bubble next to button */
.chatbot-greeting-pill {
  background: #ffffff;
  color: #1b0f10;
  padding: 8px 14px;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  border: 1px solid #ebdcd7;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  animation: slideInPill 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.3s, transform 0.3s;
}

.chatbot-greeting-pill .gold-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #198754;
  box-shadow: 0 0 6px #198754;
}

.chatbot-greeting-pill .close-pill {
  color: #999;
  cursor: pointer;
  margin-left: 4px;
  font-size: 12px;
}

.chatbot-greeting-pill .close-pill:hover {
  color: #b71c24;
}

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

/* Chat Window */
#crimson-chatbot-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 390px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 120px);
  background: #fffdfa;
  border-radius: 20px;
  box-shadow: 0 15px 45px rgba(24, 5, 7, 0.22), 0 2px 10px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(197, 153, 51, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99995;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--font-sans, system-ui, -apple-system, sans-serif);
}

#crimson-chatbot-window.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Chat Window Header */
.chatbot-header {
  background: linear-gradient(135deg, #7b0017 0%, #50000f 100%);
  color: #ffffff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #c59933;
}

.chatbot-header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #ffffff;
  border: 1.5px solid #e5b74b;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7b0017;
  font-size: 20px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  position: relative;
}

.chatbot-online-indicator {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #28a745;
  border: 2px solid #7b0017;
}

.chatbot-header-text h6 {
  margin: 0;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.3px;
  color: #ffffff;
}

.chatbot-header-text span {
  font-size: 11px;
  color: #e5b74b;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chatbot-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chatbot-tool-btn {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #ffffff;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
}

.chatbot-tool-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #e5b74b;
}

/* Quick Chips Container (Sticky Top) */
.chatbot-chips-bar {
  background: #fdf8f3;
  padding: 8px 12px;
  border-bottom: 1px solid #ebdcd7;
  overflow-x: auto;
  white-space: nowrap;
  display: flex;
  gap: 6px;
  scrollbar-width: none;
}

.chatbot-chips-bar::-webkit-scrollbar {
  display: none;
}

.chat-chip {
  background: #ffffff;
  border: 1px solid #e2cb9b;
  color: #631018;
  padding: 5px 11px;
  border-radius: 14px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.chat-chip:hover {
  background: #7b0017;
  color: #ffffff;
  border-color: #7b0017;
  transform: translateY(-1px);
}

/* Chat Messages Stream */
.chatbot-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: #faf6f0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.chat-bubble {
  max-width: 86%;
  font-size: 13px;
  line-height: 1.5;
  border-radius: 16px;
  padding: 12px 15px;
  position: relative;
  word-wrap: break-word;
  animation: messageIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.chat-bubble-bot {
  align-self: flex-start;
  background: #ffffff;
  color: #2b1719;
  border: 1px solid #ebdcd7;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.chat-bubble-bot a {
  color: #7b0017;
  font-weight: 700;
  text-decoration: underline;
}

.chat-bubble-bot p:last-child {
  margin-bottom: 0;
}

.chat-bubble-bot ul, .chat-bubble-bot ol {
  padding-left: 18px;
  margin-bottom: 6px;
}

.chat-bubble-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #991321 0%, #7b0017 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(123, 0, 23, 0.25);
}

.chat-time-tag {
  font-size: 10px;
  opacity: 0.65;
  margin-top: 4px;
  display: block;
  text-align: right;
}

/* Typing Indicator */
.chat-typing-indicator {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid #ebdcd7;
  border-radius: 14px;
  padding: 8px 14px;
  display: none;
  align-items: center;
  gap: 4px;
}

.chat-typing-indicator.is-typing {
  display: flex;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c59933;
  animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Interactive Action Cards inside chat */
.chat-action-card {
  background: #fffdfa;
  border: 1px solid #ebdcd7;
  border-radius: 12px;
  padding: 12px;
  margin-top: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.chat-action-card .btn-card-action {
  background: #7b0017;
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
}

.chat-action-card .btn-card-action:hover {
  background: #991321;
}

/* Chat Input Bar */
.chatbot-footer {
  background: #ffffff;
  padding: 10px 14px 12px;
  border-top: 1px solid #ebdcd7;
}

.chatbot-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fcf8f3;
  border: 1.5px solid #ebdcd7;
  border-radius: 25px;
  padding: 4px 6px 4px 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chatbot-input-row:focus-within {
  border-color: #c59933;
  box-shadow: 0 0 0 3px rgba(197, 153, 51, 0.15);
  background: #ffffff;
}

#chatUserInput {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13.5px;
  color: #1b0f10;
  padding: 6px 0;
}

#chatUserInput::placeholder {
  color: #8c787a;
}

#chatSendBtn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #7b0017;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: transform 0.15s, background 0.2s;
}

#chatSendBtn:hover {
  background: #991321;
  transform: scale(1.05);
}

.chatbot-footer-subtext {
  text-align: center;
  font-size: 10px;
  color: #8c787a;
  margin-top: 6px;
  letter-spacing: 0.2px;
}

/* Mobile Screen Adaptations */
@media (max-width: 576px) {
  #crimson-chatbot-window {
    right: 12px;
    bottom: 84px;
    width: calc(100vw - 24px);
    height: calc(100vh - 100px);
    border-radius: 16px;
  }

  .chatbot-launcher-btn {
    width: 54px;
    height: 54px;
    font-size: 22px;
  }

  #crimson-chatbot-launcher {
    bottom: 16px;
    right: 16px;
  }

  .chatbot-greeting-pill {
    display: none;
  }
}
