/* =============================================================
   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: square avatar + green online dot ---------- */
.chatbot-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: var(--cb-z);
  width: 60px;
  height: 60px;
  background: #fff;
  border-radius: 7px;
  box-shadow: 0 0 8px 4px rgba(0, 0, 0, .16);
  cursor: pointer;
  transition: transform .2s ease, opacity .2s ease;
}

.chatbot-launcher:hover {
  transform: translateY(-2px) scale(1.05);
}

.chatbot-launcher.cb-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}

.chatbot-launcher img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 7px;
  object-fit: cover;
  object-position: center top;
}

.chatbot-online-dot {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #fff;
  animation: cbOnlinePulse 1.8s ease-out infinite;
}

@keyframes cbOnlinePulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); }
  70%, 100% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
}

/* ---------- Chat panel ---------- */
.chatbot-panel {
  position: fixed;
  right: 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);
  transform-origin: bottom right;
  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: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  background: #fff;
  border: 2px solid rgba(255, 255, 255, .85);
  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: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
  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: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  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%;
  min-width: 0;
  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);
}

/* Page behind is locked while the chat is full-screen on phones */
html.cb-no-scroll,
html.cb-no-scroll body {
  overflow: hidden !important;
}

/* =============================================================
   Responsive
   ============================================================= */
@media (min-width: 577px) and (max-width: 768px) {
  .chatbot-panel {
    width: 340px;
    height: 520px;
  }
}

/* Phones: compact launcher bottom-right (above the site's bottom call bar),
   full-screen chat with a big close button and safe-area padding. */
@media (max-width: 576px) {
  .chatbot-launcher {
    right: 12px;
    bottom: 70px; /* above the site's bottom call bar */
    width: 54px;
    height: 54px;
  }

  .chatbot-panel {
    right: 0;
    bottom: 0;
    left: 0;
    top: 0;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    transform: translateY(100%);
    transform-origin: bottom center;
  }

  .chatbot-panel.cb-open {
    transform: translateY(0);
  }

  .chatbot-header {
    padding: 12px 14px;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
  }

  .chatbot-close {
    width: 42px;
    height: 42px;
    font-size: 28px;
    background: rgba(255, 255, 255, .28);
  }

  .chatbot-body {
    padding: 14px 12px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .cb-msg {
    max-width: 92%;
  }

  .cb-bubble {
    font-size: 14.5px;
  }

  .cb-options {
    margin-left: 36px;
    max-width: calc(100% - 36px);
  }

  .cb-option-btn {
    font-size: 13.5px;
    padding: 10px 16px;
    min-height: 40px;
  }

  /* 16px inputs stop iOS Safari from zooming the page on focus */
  .chatbot-lead-form,
  .chatbot-input-row {
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .chatbot-lead-form input,
  .chatbot-input-row input {
    font-size: 16px;
  }

  .chatbot-phone-prefix {
    font-size: 16px;
    padding: 12px 10px;
  }

  .chatbot-submit-btn {
    font-size: 15px;
    padding: 14px;
  }

  .chatbot-input-row button {
    width: 42px;
    height: 42px;
  }
}


/* =============================================================
   Floating animated "Download Brochure" (same idea as Nambiar's):
   - desktop: pill just left of the chat avatar
   - mobile : replaces the "Brochure" cell in the bottom bar
   The .webp files are animated (PDF icon flips, loops forever).
   ============================================================= */
.brochure-sticky {
  position: fixed;
  z-index: 1000; /* above the site nav, below the chat widget */
  display: block;
  line-height: 0;
  transition: transform .3s ease;
}

.brochure-sticky:hover {
  transform: scale(1.08);
}

.brochure-sticky img {
  display: block;
  height: auto;
}

.brochure-desk {
  right: 100px;
  bottom: 22px;
}

.brochure-desk img {
  width: 144px;
}

@media (max-width: 991px) {
  .brochure-desk { display: none; }
}

/* Mobile bottom bar: the "Brochure" cell shows a small red PDF symbol
   (bounces + soft pulse, same rhythm as the other cell icons) */
.bottomfix .brochure-cell .pdf-symbol {
  display: block;
  margin: 0 auto 1px;
  animation: pdfBounce 1.2s ease-in-out infinite;
}

@keyframes pdfBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(4px) scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  .bottomfix .brochure-cell .pdf-symbol { animation: none; }
}




/* =============================================================
   Project theme (Mana Skanda): use the site's primary colour
   ============================================================= */
:root {
  --cb-green: var(--primary-color, #16336d);
  --cb-green-dark: color-mix(in srgb, var(--primary-color, #16336d) 78%, #000);
}




/* Bottom-bar "Brochure" cell: same icon height as the other cells' 20px arrows,
   so the three labels sit on one line */
.bottomfix .brochure-cell .pdf-symbol {
  width: 20px;
  height: 20px;
  margin: 0 auto;
}


/* =============================================================
   Floating column (right edge) - ONE layout for every screen size.
   From the bottom up:   chat avatar -> call button -> WhatsApp
   Each icon is centred on the avatar's centre line, 10-16px apart.
   ============================================================= */

/* WhatsApp: give the icon a real 44x44 box (it was a 60px-tall text line) */
.fix_icons {
  top: auto;
  display: block;
  line-height: 0;
}

.fix_icons .whts {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  font-size: 40px;
  line-height: 1;
  margin: 0;
}

/* Desktop / large screens (no bottom bar): avatar is 60px at bottom:24 / right:24 -> centre 54px from right */
.fix_call  { right: 36px; bottom: 100px; }
.fix_icons { right: 32px; bottom: 146px; }

/* Phones + tablets (<1200px): the 55px orange bottom bar is visible,
   so the avatar sits at bottom:70px and everything shifts up with it. */
@media (max-width: 1199px) {
  .chatbot-launcher { bottom: 70px; }
  .brochure-desk    { bottom: 68px; }
  .fix_call         { bottom: 140px; }
  .fix_icons        { bottom: 186px; }
}

/* Phones: avatar is 54px at right:12 -> centre 39px from right */
@media (max-width: 576px) {
  .fix_call  { right: 21px; }
  .fix_icons { right: 17px; }
}
