/* =============================================================
   Chat Bot Widget - "Priya" lead capture chat
   Uses the site's existing brand colours:
   - Green  #22a447  (used already on your download-brochure hover)
   - Orange #f96c00  (used already on your call icon)
   ============================================================= */

:root {
  --cb-green: #22a447;
  --cb-green-dark: #1c8a3c;
  --cb-orange: #f96c00;
  --cb-bg: #f4f6f5;
  --cb-white: #ffffff;
  --cb-text: #1f2a24;
  --cb-muted: #8a938d;
  --cb-radius: 16px;
  --cb-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  --cb-font: 'Mulish', sans-serif;
  --cb-z: 2147483001; /* always above any other overlay/popup on the page */
}

/* ---------- Launcher button ---------- */
.chatbot-launcher {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: var(--cb-z);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--cb-green);
  color: var(--cb-white);
  padding: 10px 18px 10px 10px;
  border-radius: 50px;
  box-shadow: var(--cb-shadow);
  cursor: pointer;
  font-family: var(--cb-font);
  transition: transform .2s ease, opacity .2s ease;
}

.chatbot-launcher:hover {
  transform: translateY(-2px);
}

.chatbot-launcher.cb-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}

.chatbot-launcher img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255, 255, 255, .25);
}

.chatbot-launcher-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.chatbot-launcher-text strong {
  font-size: 14px;
  font-weight: 800;
}

.chatbot-launcher-text span {
  font-size: 11.5px;
  opacity: .92;
}

/* ---------- Chat panel ---------- */
.chatbot-panel {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: calc(var(--cb-z) + 1);
  width: 360px;
  max-width: calc(100vw - 40px);
  height: 560px;
  max-height: calc(100vh - 40px);
  background: var(--cb-white);
  border-radius: var(--cb-radius);
  box-shadow: var(--cb-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--cb-font);

  opacity: 0;
  transform: translateY(24px) scale(.98);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}

.chatbot-panel.cb-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ---------- Header ---------- */
.chatbot-header {
  background: var(--cb-green);
  color: var(--cb-white);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  position: relative;
}

.chatbot-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255, 255, 255, .25);
  flex: 0 0 auto;
}

.chatbot-header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

.chatbot-header-user h5 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--cb-white);
}

.chatbot-header-user p {
  margin: 0;
  font-size: 11.5px;
  opacity: .92;
  display: flex;
  align-items: center;
  gap: 5px;
}

.dot-online {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #bdf5c9;
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .25);
}

.chatbot-close {
  border: none;
  background: rgba(255, 255, 255, .18);
  color: var(--cb-white);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-close:hover {
  background: rgba(255, 255, 255, .3);
}

/* ---------- Body / message thread ---------- */
.chatbot-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 12px;
  background: var(--cb-bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chatbot-body::-webkit-scrollbar {
  width: 6px;
}

.chatbot-body::-webkit-scrollbar-thumb {
  background: #d3d9d6;
  border-radius: 10px;
}

.cb-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 88%;
}

.cb-msg-bot {
  align-self: flex-start;
}

.cb-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.cb-msg-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  background: #dfe6e1;
}

.cb-msg-col {
  display: flex;
  flex-direction: column;
}

.cb-msg-user .cb-msg-col {
  align-items: flex-end;
}

.cb-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--cb-text);
  background: var(--cb-white);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
  word-break: break-word;
}

.cb-msg-bot .cb-bubble {
  border-bottom-left-radius: 4px;
}

.cb-msg-user .cb-bubble {
  background: var(--cb-green);
  color: var(--cb-white);
  border-bottom-right-radius: 4px;
}

.cb-time {
  font-size: 10px;
  color: var(--cb-muted);
  margin-top: 3px;
  padding: 0 4px;
}

/* ---------- Quick reply / BHK option buttons ---------- */
.cb-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 4px 34px;
  max-width: 88%;
}

.cb-option-btn {
  border: 1.5px solid var(--cb-green);
  background: var(--cb-white);
  color: var(--cb-green-dark);
  font-weight: 700;
  font-size: 12.5px;
  padding: 8px 14px;
  border-radius: 24px;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
  white-space: nowrap;
}

.cb-option-btn:hover {
  background: var(--cb-green);
  color: var(--cb-white);
}

/* ---------- Typing indicator ---------- */
.cb-typing-wrap {
  align-items: flex-end;
}

.cb-typing {
  background: var(--cb-white);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 12px 14px;
  display: flex;
  gap: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.cb-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #b7bfba;
  display: inline-block;
  animation: cbTypingBounce 1.2s infinite ease-in-out;
}

.cb-typing span:nth-child(2) { animation-delay: .15s; }
.cb-typing span:nth-child(3) { animation-delay: .3s; }

@keyframes cbTypingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ---------- System note (post-submit) ---------- */
.cb-system-note {
  align-self: center;
  font-size: 11.5px;
  color: var(--cb-muted);
  background: #e9ece9;
  padding: 6px 12px;
  border-radius: 20px;
  margin-top: 4px;
  text-align: center;
}

/* ---------- Lead capture form (name + phone) ---------- */
.chatbot-lead-form {
  flex: 0 0 auto;
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid #eaeeec;
  background: var(--cb-white);
}

.chatbot-lead-form input {
  width: 100%;
  border: 1.5px solid #dfe4e1;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 13.5px;
  font-family: var(--cb-font);
  color: var(--cb-text);
  outline: none;
  transition: border-color .2s ease;
}

.chatbot-lead-form input:focus {
  border-color: var(--cb-green);
}

.chatbot-phone-row {
  display: flex;
  align-items: center;
  border: 1.5px solid #dfe4e1;
  border-radius: 10px;
  overflow: hidden;
}

.chatbot-phone-row:focus-within {
  border-color: var(--cb-green);
}

.chatbot-phone-prefix {
  padding: 11px 10px;
  background: #f1f4f2;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--cb-text);
  flex: 0 0 auto;
}

.chatbot-phone-row input {
  border: none;
  border-radius: 0;
}

.cb-error-text {
  color: #e0433c;
  font-size: 11.5px;
  font-weight: 700;
  margin-top: -4px;
}

.chatbot-lead-form input.cb-input-invalid {
  border-color: #e0433c;
}

.chatbot-submit-btn {
  background: var(--cb-green);
  color: var(--cb-white);
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-weight: 800;
  font-size: 13.5px;
  letter-spacing: .4px;
  cursor: pointer;
  transition: background .2s ease, opacity .2s ease;
}

.chatbot-submit-btn:hover {
  background: var(--cb-green-dark);
}

.chatbot-submit-btn:disabled {
  opacity: .7;
  cursor: not-allowed;
}

/* ---------- Free text input row ---------- */
.chatbot-input-row {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #eaeeec;
  background: var(--cb-white);
}

.chatbot-input-row input {
  flex: 1 1 auto;
  border: 1.5px solid #dfe4e1;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 13.5px;
  font-family: var(--cb-font);
  outline: none;
}

.chatbot-input-row input:focus {
  border-color: var(--cb-green);
}

.chatbot-input-row button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--cb-green);
  color: var(--cb-white);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
}

.chatbot-input-row button:hover {
  background: var(--cb-green-dark);
}

/* =============================================================
   Responsive
   ============================================================= */
@media (max-width: 576px) {
  .chatbot-launcher {
    left: 9px;
    bottom: 70px;
    padding: 8px 14px 8px 8px;
  }

  .chatbot-launcher-text strong {
    font-size: 12.5px;
  }

  .chatbot-launcher-text span {
    font-size: 10.5px;
  }

  .chatbot-panel {
    left: 0;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .cb-options {
    margin-left: 0;
    max-width: 100%;
  }
}

@media (min-width: 577px) and (max-width: 768px) {
  .chatbot-panel {
    width: 340px;
    height: 520px;
  }
}