/* ============================================================
   ESR AI CHATBOT V2.0 — Premium Widget Styles
   Eco Space Realtors | esrs.in
   ============================================================ */

:root {
  --esr-red: #D32F2F;
  --esr-red-dark: #7A0A0A;
  --esr-gold: #c8a96e;
  --esr-charcoal: #333333;
  --esr-bg: #FFF5F5;
  --esr-border: #F0E0E0;
  --esr-text: #333333;
  --esr-text-light: #777777;
  --esr-font: 'Outfit', 'Segoe UI', sans-serif;
  --esr-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}

/* ── FAB (Floating Action Button) ── */
#esr-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  height: 64px;
  padding: 8px 22px 8px 8px;
  background: linear-gradient(135deg, var(--esr-red-dark) 0%, #E51A1A 100%);
  border-radius: 40px;
  display: flex;
  align-items: center;
  cursor: pointer;
  z-index: 99999;
  box-shadow: 0 12px 40px rgba(229, 26, 26, 0.4), 0 0 0 4px rgba(229, 26, 26, 0.1);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  user-select: none;
  font-family: var(--esr-font);
}

#esr-fab:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 16px 50px rgba(229, 26, 26, 0.5), 0 0 0 6px rgba(229, 26, 26, 0.15);
}

#esr-fab:active {
  transform: scale(0.97);
}

.esr-fab-icon-box {
  background: rgba(255, 255, 255, 0.16);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.esr-fab-icon-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.esr-fab-texts {
  margin-left: 14px;
  display: flex;
  flex-direction: column;
}

.esr-fab-top {
  color: white;
  display: flex;
  align-items: baseline;
}

.esr-fab-top strong {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.esr-fab-top span {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.85;
  margin-left: 8px;
  letter-spacing: 0.5px;
}

.esr-fab-bot {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 1px;
}

#esr-fab-notif {
  position: absolute;
  top: -2px;
  right: 0;
  width: 24px;
  height: 24px;
  background: #E51A1A;
  border-radius: 50%;
  font-size: 12px;
  color: white;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  animation: esrPulse 2s infinite;
}

@keyframes esrPulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.15);
  }
}

/* ── Close Button ── */
#esr-close-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 60px;
  height: 60px;
  background: #CC0000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 99999;
  color: white;
  font-size: 22px;
  font-weight: 300;
  box-shadow: 0 10px 30px rgba(204, 0, 0, 0.4);
  transition: transform 0.25s, background 0.25s;
}

#esr-close-btn:hover {
  transform: scale(1.08) rotate(90deg);
  background: var(--esr-red-dark);
}

/* ── Chat Panel ── */
#esr-chat {
  position: fixed;
  bottom: 110px;
  right: 28px;
  width: 420px;
  max-height: calc(100vh - 130px);
  background: #FFF;
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(24, 24, 27, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99998;
  opacity: 0;
  transform: translateY(30px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.19, 1, 0.22, 1),
    transform 0.35s cubic-bezier(0.19, 1, 0.22, 1);
}

#esr-chat.esr-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Header ── */
#esr-header {
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.16), transparent 24%),
    linear-gradient(135deg, var(--esr-red-dark) 0%, var(--esr-red) 100%);
  padding: 20px;
  color: white;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

.esr-hlogo {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2) inset;
  padding: 8px;
}

.esr-hlogo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.esr-hinfo {
  flex: 1;
  line-height: 1.25;
}

.esr-h-sub {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 3px;
  font-family: var(--esr-font);
}

.esr-hname {
  font-weight: 800;
  font-size: 17px;
  font-family: var(--esr-font);
  letter-spacing: 0.3px;
}

.esr-htag {
  font-size: 11px;
  opacity: 0.82;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  font-family: var(--esr-font);
}

.esr-hdot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
  display: inline-block;
}

.esr-hactions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.esr-ai-badge {
  background: rgba(255, 255, 255, 0.15);
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 800;
  font-family: var(--esr-font);
  letter-spacing: 0.5px;
}

.esr-wa-btn {
  width: 38px;
  height: 38px;
  background: #25D366;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
  transition: transform 0.2s;
}

.esr-wa-btn:hover {
  transform: scale(1.1);
}

.esr-wa-btn svg {
  width: 20px;
  height: 20px;
}

/* ── Progress Bar ── */
#esr-progress {
  height: 3px;
  background: rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

#esr-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--esr-red), var(--esr-gold));
  width: 0%;
  transition: width 0.5s ease;
}

/* ── Messages Area ── */
#esr-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background:
    linear-gradient(180deg, #fff7f7 0%, #fffdfd 45%, #fffafa 100%);
  scroll-behavior: smooth;
}

#esr-messages::-webkit-scrollbar {
  width: 5px;
}

#esr-messages::-webkit-scrollbar-thumb {
  background: #E0C0C0;
  border-radius: 4px;
}

/* ── Message Rows ── */
.esr-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  max-width: 100%;
}

.esr-row.esr-user {
  flex-direction: row-reverse;
}

.esr-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  background: #2a2a2a;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.esr-row.esr-user .esr-avatar {
  background: white;
  border: 1px solid #ddd;
  color: #555;
}

.esr-bubble {
  max-width: 100%;
  background: #FFFFFF;
  border: 1px solid rgba(0, 0, 0, 0.04);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
  border-radius: 20px;
  border-bottom-left-radius: 4px;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--esr-text);
  font-family: var(--esr-font);
  word-break: break-word;
  width: fit-content;
}

.esr-row.esr-user .esr-bubble {
  background: var(--esr-charcoal);
  color: white;
  border: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
  /* allow long words to wrap properly */
}

.esr-time {
  font-size: 10px;
  color: #999;
  margin-top: 6px;
  padding: 0 4px;
  font-family: var(--esr-font);
  width: 100%;
}

.esr-row.esr-user .esr-time {
  text-align: right;
}

/* ── Option Chips ── */
.esr-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.esr-opt {
  padding: 10px 18px;
  background: white;
  border: 1px solid rgba(204, 0, 0, 0.3);
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.4, 1);
  color: var(--esr-red);
  font-family: var(--esr-font);
  box-shadow: 0 2px 6px rgba(204, 0, 0, 0.05);
}

.esr-opt:hover {
  border-color: var(--esr-red);
  background: #FFF0F0;
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(204, 0, 0, 0.1);
}

.esr-opt.esr-sel {
  background: var(--esr-charcoal);
  color: white;
  border-color: transparent;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.esr-smartchips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  margin-bottom: 10px;
}

.esr-smartchip {
  border: 1px solid rgba(17, 24, 39, 0.14);
  background: linear-gradient(180deg, #ffffff, #f8f8f8);
  color: #111827;
  border-radius: 999px;
  padding: 9px 13px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--esr-font);
}

.esr-smartchip:hover {
  border-color: var(--esr-red);
  color: var(--esr-red);
  background: #fff0f0;
  transform: translateY(-1px);
}

.esr-smartchip:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* ── Typing Indicator ── */
.esr-typing {
  display: flex;
  gap: 5px;
  padding: 6px 2px;
  align-items: center;
}

.esr-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ccc;
  animation: esrBounce 1.2s infinite;
}

.esr-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.esr-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes esrBounce {

  0%,
  60%,
  100% {
    transform: translateY(0);
  }

  30% {
    transform: translateY(-8px);
  }
}

/* ── Requirements Summary Card ── */
.esr-reqcard {
  background: linear-gradient(135deg, rgba(255, 249, 240, 0.95), rgba(255, 255, 255, 0.95));
  border: 1.5px solid rgba(200, 169, 110, 0.4);
  box-shadow: 0 8px 20px rgba(200, 169, 110, 0.1);
  border-radius: 16px;
  padding: 16px 18px;
  margin-top: 8px;
}

.esr-reqcard-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--esr-red);
  margin-bottom: 8px;
}

.esr-reqrow {
  font-size: 12.5px;
  color: var(--esr-text);
  margin: 4px 0;
}

.esr-reqrow span {
  font-weight: 600;
}

/* ── Premium Property Card ── */
.esr-card-premium {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.05);
  font-family: var(--esr-font);
  transition: transform 0.25s, box-shadow 0.25s;
  margin-top: 10px;
}

.esr-card-premium:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(204, 0, 0, 0.1);
}

.esr-cp-head {
  padding: 16px 16px 12px;
  background: linear-gradient(180deg, #FFF9F9, #FFFFFF);
  border-bottom: 1px solid #F0E0E0;
  position: relative;
}

.esr-cp-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--esr-red);
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 8px;
  letter-spacing: 0.5px;
}

.esr-cp-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--esr-charcoal);
  margin-bottom: 2px;
  padding-right: 60px;
  line-height: 1.3;
}

.esr-cp-builder {
  font-size: 12px;
  color: #888;
  font-weight: 600;
  display: block;
  margin-top: 2px;
}

.esr-cp-loc {
  font-size: 12px;
  color: #666;
  font-weight: 600;
  margin-top: 8px;
}

.esr-cp-body {
  padding: 14px 16px;
}

.esr-cp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.esr-cp-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #FAFAFA;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #F0F0F0;
}

.esr-cp-icon {
  font-size: 14px;
}

.esr-cp-val {
  font-size: 12px;
  font-weight: 700;
  color: var(--esr-charcoal);
}

.esr-cp-foot {
  padding: 14px 16px;
  background: #FFF9F9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #F0E0E0;
}

.esr-cp-poss {
  font-size: 12px;
  font-weight: 800;
  color: #555;
}

.esr-cp-btn {
  background: var(--esr-red);
  color: white;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 18px;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s;
  box-shadow: 0 4px 10px rgba(204, 0, 0, 0.2);
}

.esr-cp-btn:hover {
  background: var(--esr-red-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(204, 0, 0, 0.3);
}

/* ── Service Card ── */
.esr-svccard {
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  padding: 16px;
  margin-top: 10px;
  font-family: var(--esr-font);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
}

.esr-svccard-cat {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  margin-bottom: 6px;
}

.esr-svccard-title {
  font-weight: 800;
  font-size: 15px;
  color: var(--esr-charcoal);
  margin-bottom: 8px;
}

.esr-svccard-desc {
  font-size: 13px;
  color: #555;
  line-height: 1.6;
  margin-bottom: 14px;
}

.esr-svccard-btn {
  display: inline-block;
  padding: 10px 18px;
  background: var(--esr-red);
  color: white;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: opacity 0.2s;
  box-shadow: 0 4px 12px rgba(204, 0, 0, 0.2);
}

/* ── Blog Card ── */
.esr-blogcard {
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-left: 4px solid var(--esr-red);
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 10px;
  font-family: var(--esr-font);
}

.esr-blogcard-title {
  font-weight: 800;
  font-size: 14px;
  color: var(--esr-charcoal);
  margin-bottom: 6px;
}

.esr-blogcard-excerpt {
  font-size: 13px;
  color: #555;
  line-height: 1.5;
}

/* ── Lead Capture Form ── */
.esr-leadform {
  background: linear-gradient(135deg, #FFF0F0, #FFF);
  border: 1.5px solid #FFD4D4;
  border-radius: 16px;
  padding: 18px;
  margin-top: 10px;
  font-family: var(--esr-font);
  box-shadow: 0 8px 24px rgba(204, 0, 0, 0.05);
}

.esr-leadform-title {
  font-weight: 800;
  font-size: 15px;
  color: var(--esr-red);
  margin-bottom: 6px;
}

.esr-leadform-sub {
  font-size: 13px;
  color: #666;
  margin-bottom: 14px;
  line-height: 1.5;
}

.esr-leadform input {
  width: 100%;
  border: 1.5px solid #E0E0E0;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: var(--esr-font);
  color: var(--esr-charcoal);
  margin-bottom: 10px;
  outline: none;
  transition: border-color 0.2s;
  background: white;
}

.esr-leadform input:focus {
  border-color: var(--esr-red);
  box-shadow: 0 0 0 4px rgba(204, 0, 0, 0.1);
}

.esr-leadform-btn {
  width: 100%;
  padding: 14px;
  background: var(--esr-red);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 800;
  font-family: var(--esr-font);
  cursor: pointer;
  transition: all 0.2s;
}

.esr-leadform-btn:hover {
  background: var(--esr-red-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(204, 0, 0, 0.2);
}

.esr-lead-book {
  background: #1f2937 !important;
}

.esr-lead-book:hover {
  background: #111827 !important;
}

/* ── Quick Action Buttons (Above Input) ── */
#esr-quickactions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  padding: 12px 14px;
  background: white;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
  overflow-x: auto;
  scroll-behavior: smooth;
}

#esr-quickactions::-webkit-scrollbar {
  display: none;
}

.esr-qa {
  padding: 9px 14px;
  background: linear-gradient(180deg, #FFFFFF, #FFF6F6);
  border: 1px solid rgba(192, 10, 39, 0.12);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: var(--esr-charcoal);
  font-family: var(--esr-font);
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.4, 1);
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.esr-qa:hover {
  border-color: var(--esr-red);
  color: var(--esr-red);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(204, 0, 0, 0.08);
  background: #FFF0F0;
}

/* ── Input Area ── */
#esr-input-area {
  padding: 0 18px 16px;
  background: white;
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-shrink: 0;
}

#esr-input {
  flex: 1;
  border: 1.5px solid rgba(0, 0, 0, 0.12);
  border-radius: 20px;
  padding: 14px 18px;
  font-size: 14px;
  font-family: var(--esr-font);
  color: var(--esr-charcoal);
  resize: none;
  outline: none;
  min-height: 50px;
  max-height: 100px;
  line-height: 1.45;
  transition: all 0.2s;
  background: #FFF;
}

#esr-input:focus {
  border-color: var(--esr-red);
  box-shadow: 0 0 0 4px rgba(204, 0, 0, 0.08);
}

#esr-input::placeholder {
  color: #888;
  font-weight: 500;
}

#esr-send {
  width: 50px;
  height: 50px;
  background: var(--esr-charcoal);
  border: none;
  border-radius: 16px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  flex-shrink: 0;
}

#esr-send:hover {
  background: #111;
  transform: scale(1.05);
}

#esr-send svg {
  fill: white;
  width: 22px;
  height: 22px;
}

/* ── Footer ── */
#esr-footer {
  text-align: center;
  font-size: 11px;
  color: #888;
  padding: 0 0 14px;
  background: white;
  font-family: var(--esr-font);
  flex-shrink: 0;
}

/* ── Responsive ── */
@media (max-width: 500px) {
  #esr-chat {
    width: calc(100vw - 20px);
    right: 10px;
    bottom: 100px;
    max-height: 80vh;
    border-radius: 20px;
  }

  #esr-fab {
    right: 16px;
    bottom: 16px;
    height: 56px;
    padding: 6px 16px 6px 6px;
  }

  .esr-fab-icon-box {
    width: 40px;
    height: 40px;
    padding: 7px;
  }

  .esr-fab-top strong {
    font-size: 16px;
  }

  #esr-close-btn {
    right: 16px;
    bottom: 16px;
    width: 48px;
    height: 48px;
    font-size: 18px;
  }
}
