/* ==========================================================================
   Royal Bliz Chat Widget - Production Clean Theme & Smooth Interactivity
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');

#rb-chat-widget-root {
  --rb-gold: #D4AF37;
  --rb-gold-dark: #AA8010;
  --rb-black: #0A0A0A;
  --rb-dark-grey: #131313;
  --rb-border: rgba(212, 175, 55, 0.2);
  --rb-border-hover: rgba(212, 175, 55, 0.5);
  --rb-text-light: #e5e2e1;
  --rb-text-muted: #d0c5af;
  --rb-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  --rb-font: 'Montserrat', sans-serif;
  
  box-sizing: border-box;
  font-family: var(--rb-font);
}

#rb-chat-widget-root *, 
#rb-chat-widget-root *::before, 
#rb-chat-widget-root *::after {
  box-sizing: inherit;
}

/* --- Floating Action Toggle Container --- */
.rb-widget__toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--rb-black);
  border: 1px solid var(--rb-gold);
  padding: 0;
  cursor: pointer;
  z-index: 99999;
  box-shadow: 0 4px 20px rgba(212, 175, 55, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.rb-widget__toggle:hover {
  transform: scale(1.08);
}

.rb-widget__toggle-frame {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rb-widget__img-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background-color: var(--rb-black);
}

.rb-widget__toggle-pulse {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 8px;
  height: 8px;
  background-color: #25D366;
  border-radius: 50%;
  border: 1.5px solid var(--rb-black);
  box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.4);
  animation: rb-pulse 2s infinite;
}

@keyframes rb-pulse {
  0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(37, 211, 102, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

/* --- Panel Mechanics --- */
.rb-chat {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 400px;
  height: 600px;
  max-height: calc(100vh - 120px);
  background: rgba(19, 19, 19, 0.75);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid var(--rb-border);
  border-radius: 16px;
  box-shadow: var(--rb-shadow);
  display: flex;
  flex-direction: column;
  z-index: 99999;
  overflow: hidden;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.rb-chat[hidden] {
  display: none !important;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
}

@media (max-width: 480px) {
  .rb-chat {
    width: 100%;
    height: 100%;
    max-height: 100%;
    bottom: 0;
    right: 0;
    border-radius: 0;
    border: none;
  }
}

/* --- Header Section --- */
.rb-chat__header {
  padding: 20px;
  background: rgba(19, 19, 19, 0.85);
  border-bottom: 1px solid rgba(212, 175, 55, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rb-chat__header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rb-chat__avatar-frame {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--rb-border);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--rb-black);
}

.rb-chat__avatar-initials {
  color: var(--rb-gold);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.05em;
}

.rb-chat__eyebrow {
  margin: 0;
  font-size: 9px;
  text-transform: uppercase;
  color: var(--rb-gold);
  letter-spacing: 0.15em;
  font-weight: 600;
}

.rb-chat__title {
  margin: 2px 0 0 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--rb-text-light);
}

/* --- Smooth Close Icon Animation --- */
.rb-chat__close {
  background: transparent;
  border: none;
  color: var(--rb-text-muted);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rb-chat__close-icon {
  transition: transform 0.45s cubic-bezier(0.19, 1, 0.22, 1), color 0.2s ease;
}

.rb-chat__close:hover .rb-chat__close-icon {
  color: var(--rb-gold);
  transform: rotate(90deg);
}

/* --- Body Scroll Container --- */
.rb-chat__body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 175, 55, 0.2) transparent;
}

.rb-chat__body::-webkit-scrollbar {
  width: 4px;
}

.rb-chat__body::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.2);
  border-radius: 10px;
}

.rb-chat__messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* --- Elegant Bubble Typography --- */
.rb-chat__message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  word-wrap: break-word;
}

.rb-chat__message--assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--rb-text-light);
  border-top-left-radius: 0px;
}

.rb-chat__message--user {
  align-self: flex-end;
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid var(--rb-border);
  color: var(--rb-gold);
  border-top-right-radius: 0px;
}

/* Clean Inline Links within text cards */
.rb-chat__inline-link {
  color: var(--rb-gold);
  text-decoration: underline;
  font-weight: 500;
  transition: color 0.2s ease;
}

.rb-chat__inline-link:hover {
  color: var(--rb-text-light);
}

/* --- Sandboxed Suggestion Product Cards (Protected from Theme Styles) --- */
.rb-wb-product-card {
  margin: 12px 0 !important;
  width: 100% !important;
}

.rb-wb-product-card__wrapper {
  background: var(--rb-dark-grey) !important;
  border: 1px solid var(--rb-border) !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  transition: border-color 0.4s ease, box-shadow 0.4s ease !important;
}

.rb-wb-product-card__wrapper:hover {
  border-color: var(--rb-border-hover) !important;
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.15) !important;
}

/* Sandboxed Image Box Container with Warm Cream Base */
.rb-wb-product-card__image-box {
  background: #F4F1EA !important; /* Neutralizes off-white background shades */
  aspect-ratio: 1 / 1 !important;
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  padding: 16px !important; 
  position: relative !important;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05) !important;
}

/* Forceful constraints to block theme's global image sizing & transitions */
.rb-wb-product-card__img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  border-radius: 8px !important;
  
  /* --- ULTIMATE BACKGROUND REMOVAL OVERRIDE --- */
  background-color: transparent !important;
  mix-blend-mode: multiply !important; 
  
  /* This filter combo isolates the watch details and burns the off-white background away entirely */
  filter: contrast(1.1) brightness(1.05) saturate(1.05) !important;
  
  /* Reset and force our own smooth transform transition */
  transform: scale(1) !important; 
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* Controlled hover scale (Will not conflict with theme) */
.rb-wb-product-card__wrapper:hover .rb-wb-product-card__img {
  transform: scale(1.06) !important;
}

.rb-wb-product-card__details {
  padding: 16px !important;
  background: var(--rb-dark-grey) !important;
  border-top: 1px solid rgba(212, 175, 55, 0.1) !important;
}

.rb-wb-product-card__row {
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  margin-bottom: 16px !important;
}

.rb-wb-product-card__name {
  margin: 0 !important;
  color: var(--rb-text-light) !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  letter-spacing: 0.02em !important;
  text-transform: none !important;
}

.rb-wb-product-card__sub {
  margin: 4px 0 0 0 !important;
  color: rgba(255, 255, 255, 0.45) !important;
  font-size: 11px !important;
  font-weight: 400 !important;
  text-transform: none !important;
}

.rb-wb-product-card__price {
  color: var(--rb-gold) !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
}

.rb-wb-product-card__btn-inquire {
  display: block !important;
  width: 100% !important;
  background: transparent !important;
  border: 1px solid rgba(212, 175, 55, 0.3) !important;
  color: var(--rb-gold) !important;
  text-align: center !important;
  text-transform: uppercase !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  letter-spacing: 0.2em !important;
  padding: 10px 16px !important;
  text-decoration: none !important;
  border-radius: 6px !important;
  transition: background 0.3s, color 0.3s, border-color 0.3s !important;
}

.rb-wb-product-card__btn-inquire:hover {
  background: var(--rb-gold) !important;
  color: var(--rb-black) !important;
  border-color: var(--rb-gold) !important;
}

/* --- Typing Indicator --- */
.rb-chat__typing-indicator {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.rb-chat__typing-indicator span {
  width: 6px;
  height: 6px;
  background-color: var(--rb-text-muted);
  border-radius: 50%;
  animation: rb-typing 1.4s infinite ease-in-out both;
}

.rb-chat__typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.rb-chat__typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes rb-typing {
  0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

/* --- Dynamic Interaction Actions --- */
.rb-chat__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}

.rb-chat__action {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--rb-text-muted);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background-color 0.2s;
}

.rb-chat__action:hover {
  border-color: var(--rb-gold);
  color: var(--rb-gold);
  background: rgba(212, 175, 55, 0.05);
}

/* --- WhatsApp Portal link --- */
.rb-chat__support {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 12px;
}

.rb-chat__whatsapp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: transparent;
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: #fff;
  text-decoration: none;
  padding: 14px;
  border-radius: 12px;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.2em;
  transition: border-color 0.3s ease, background-color 0.3s ease;
}

.rb-chat__whatsapp:hover {
  border-color: #25d366;
}

.rb-chat__wa-icon {
  fill: #25D366;
}

/* --- Input Bar Area --- */
.rb-chat__composer {
  background: rgba(19, 19, 19, 0.85);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding: 16px;
}

.rb-chat__composer-row {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 30px;
  overflow: hidden;
  transition: border-color 0.3s ease;
  align-items: center;
}

.rb-chat__composer-row:focus-within {
  border-color: rgba(212, 175, 55, 0.5);
}

.rb-chat__input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--rb-text-light);
  padding: 12px 18px;
  font-size: 13px;
}

.rb-chat__input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.rb-chat__send {
  background: transparent;
  border: none;
  color: var(--rb-text-muted);
  cursor: pointer;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.rb-chat__send:hover {
  color: var(--rb-gold);
}
