/* ClubProperty chatbot widget */
:root {
  --cpcb-bg: #ffffff;
  --cpcb-fg: #1a1a1a;
  --cpcb-muted: #6b7280;
  --cpcb-brand: #0a2540;          /* deep navy (luxury real estate) */
  --cpcb-brand-fg: #ffffff;
  --cpcb-bubble-user: #0a2540;
  --cpcb-bubble-assistant: #f1f3f5;
  --cpcb-border: #e5e7eb;
  --cpcb-shadow: 0 10px 30px rgba(10, 37, 64, 0.18);
}

#cpcb-root { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

/* Pill-shaped chat bubble with icon + label */
.cpcb-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: inline-flex !important;
  align-items: center;
  gap: 10px;
  padding: 14px 22px 14px 18px;
  height: auto;
  min-height: 56px;
  border-radius: 999px;
  background: var(--cpcb-brand);
  color: var(--cpcb-brand-fg);
  border: 3px solid #ffffff;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(10, 37, 64, 0.35), 0 0 0 1px rgba(10, 37, 64, 0.15);
  z-index: 2147483000; /* very high to sit above WhatsApp/livechat/etc. */
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.2s ease, padding 0.2s ease;
  visibility: visible !important;
  opacity: 1 !important;
}
.cpcb-bubble:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(10, 37, 64, 0.45), 0 0 0 4px rgba(10, 37, 64, 0.08);
}
.cpcb-bubble:active { transform: translateY(0); }

.cpcb-bubble-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.cpcb-bubble-label {
  display: inline-block;
}

/* "New" badge on top-right corner - bulletproof against translator DOM changes */
.cpcb-bubble {
  position: fixed; /* anchor for absolute badge */
}
.cpcb-bubble-badge {
  position: absolute !important;
  top: -8px !important;
  right: -8px !important;
  background: #dc2626 !important;
  color: #ffffff !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  letter-spacing: 0.5px !important;
  text-transform: uppercase !important;
  padding: 3px 7px !important;
  border-radius: 999px !important;
  border: 2px solid #ffffff !important;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.4) !important;
  line-height: 1 !important;
  pointer-events: none !important;
  white-space: nowrap !important;
  display: inline-block !important;
  vertical-align: baseline !important;
  z-index: 1 !important;
}
.cpcb-bubble.cpcb-clicked .cpcb-bubble-badge {
  display: none !important;
}

/* Bounce animation - gentle hop every 2.5 seconds to draw attention.
   Stopped permanently after first user click (saved in localStorage). */
@keyframes cpcb-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  10% { transform: translateY(-12px); }
  20% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
  40% { transform: translateY(0); }
}
.cpcb-bubble.cpcb-bounce {
  animation: cpcb-bounce 2.5s ease-in-out infinite;
}
.cpcb-bubble.cpcb-bounce:hover {
  animation: none;
}
@media (prefers-reduced-motion: reduce) {
  .cpcb-bubble.cpcb-bounce { animation: none; }
}

/* Mobile: WhatsApp is on the left, chatbot on the right - no stacking needed. */
@media (max-width: 480px) {
  .cpcb-bubble {
    bottom: 16px;
    right: 16px;
    padding: 12px 18px 12px 14px;
    font-size: 14px;
    min-height: 52px;
    max-width: calc(100vw - 32px);
  }
  .cpcb-bubble-icon { width: 24px; height: 24px; }
  .cpcb-bubble-icon svg { width: 20px; height: 20px; }
}

.cpcb-panel {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: var(--cpcb-bg);
  border: 1px solid var(--cpcb-border);
  border-radius: 12px;
  box-shadow: var(--cpcb-shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 2147483001;
}
.cpcb-panel.cpcb-open { display: flex; }

.cpcb-panel-inline {
  position: relative;
  bottom: auto;
  right: auto;
  width: 100%;
  max-width: 100%;
  height: 600px;
}

.cpcb-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--cpcb-brand);
  color: var(--cpcb-brand-fg);
}
.cpcb-title { font-weight: 600; font-size: 15px; }
.cpcb-close {
  background: transparent;
  border: none;
  color: var(--cpcb-brand-fg);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.cpcb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fafafa;
}

.cpcb-msg { display: flex; flex-direction: column; max-width: 100%; }
.cpcb-msg-user { align-items: flex-end; }
.cpcb-msg-assistant { align-items: flex-start; }

.cpcb-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  max-width: 85%;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.cpcb-msg-user .cpcb-msg-bubble {
  background: var(--cpcb-bubble-user);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.cpcb-msg-assistant .cpcb-msg-bubble {
  background: var(--cpcb-bubble-assistant);
  color: var(--cpcb-fg);
  border-bottom-left-radius: 4px;
}
.cpcb-typing .cpcb-msg-bubble { font-style: italic; color: var(--cpcb-muted); }

.cpcb-props {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  width: 100%;
}

.cpcb-prop {
  display: flex;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--cpcb-border);
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.cpcb-prop:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border-color: var(--cpcb-brand);
}

.cpcb-prop-img {
  width: 90px;
  min-width: 90px;
  background: #eee center/cover no-repeat;
}
.cpcb-prop-img-empty { background: linear-gradient(135deg, #e5e7eb, #d1d5db); }

.cpcb-prop-body {
  flex: 1;
  padding: 10px 12px 10px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.cpcb-prop-title {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cpcb-prop-city { font-size: 12px; color: var(--cpcb-muted); }
.cpcb-prop-meta { font-size: 12px; color: var(--cpcb-muted); }
.cpcb-prop-price { font-weight: 600; font-size: 14px; color: var(--cpcb-brand); margin-top: 2px; }
.cpcb-prop-link {
  font-size: 12px;
  color: var(--cpcb-brand);
  margin-top: 4px;
  align-self: flex-start;
}

.cpcb-input-bar {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--cpcb-border);
  background: #fff;
}
.cpcb-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--cpcb-border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}
.cpcb-input:focus { border-color: var(--cpcb-brand); }
.cpcb-send {
  background: var(--cpcb-brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.cpcb-send:disabled { opacity: 0.6; cursor: not-allowed; }

@media (max-width: 480px) {
  .cpcb-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
}
