/*!
 * Conversational "Make An Enquiry" chat widget.
 * Scoped to .enquiry-chat-* classes only — does not touch shared site styles.
 */

/* Anchored bottom-right, 60px above the floating "Make An Enquiry" button
   (which sits at bottom:20px; right:20px; - see .floating-action in
   medical-guide.css), matching the site's existing popup convention. */
.enquiry-chat-overlay {
  display: none;
  position: fixed;
  z-index: 100000;
  bottom: 80px;
  right: 20px;
}

.enquiry-chat-overlay.show {
  display: block;
}

.enquiry-chat-modal {
  position: relative;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: min(640px, 80vh);
  background: #FFFFFF;
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(20, 30, 26, 0.28);
  border: 1px solid #DCEAE6;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Montserrat', Arial, sans-serif;
}

/* Mirrors .make-appointment-wrapper's own mobile breakpoint: full-width,
   anchored to the very bottom of the screen. */
@media (max-width: 768px) {
  .enquiry-chat-overlay {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
  }
  .enquiry-chat-modal {
    width: 100%;
    max-width: 100%;
    height: 85vh;
    border-radius: 16px 16px 0 0;
    border: none;
    box-shadow: 0 -4px 24px rgba(20, 30, 26, 0.2);
  }
}

.enquiry-chat-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  color: #454545;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}
.enquiry-chat-close:hover { background: rgba(0, 0, 0, 0.12); }

.enquiry-chat-header {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 44px 16px 18px;
  border-bottom: 1px solid #DCEAE6;
  background: #FFFFFF;
}

.enquiry-chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #EDF7F4;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  overflow: hidden;
  border: 1px solid #DCEAE6;
}
.enquiry-chat-avatar img { width: 26px; height: 26px; object-fit: contain; }

.enquiry-chat-header-text { flex: 1; min-width: 0; }

.enquiry-chat-name {
  font-weight: 800;
  font-size: 15px;
  line-height: 1.2;
  color: #1B2420;
}

.enquiry-chat-tagline {
  font-size: 12px;
  color: #6B7C74;
}

.enquiry-chat-thread {
  flex: 1;
  min-height: 0; /* without this, a flex child with overflow:auto won't
    shrink below its content's height in a fixed-height flex column - the
    thread would grow past the modal and get clipped or shove the composer
    out of its normal position instead of scrolling internally. */
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end; /* anchor messages to the bottom, right above
    the entry box - without this, a short conversation clusters at the top
    of this tall area instead, leaving a big empty gap between the current
    question and its answer box below. */
  gap: 10px;
  background: #F4FAF8;
}

.enquiry-chat-msg-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: 100%;
}
.enquiry-chat-msg-row.bot { justify-content: flex-start; }
.enquiry-chat-msg-row.user { justify-content: flex-end; }

.enquiry-chat-msg-row .enquiry-chat-avatar-sm {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #EDF7F4;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid #DCEAE6;
}
.enquiry-chat-msg-row .enquiry-chat-avatar-sm img { width: 15px; height: 15px; object-fit: contain; }

.enquiry-chat-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.45;
  max-width: 78%;
  box-shadow: 0 1px 1px rgba(20, 40, 33, 0.04);
}
.enquiry-chat-msg-row.bot .enquiry-chat-bubble {
  background: #EDF7F4;
  color: #1B2420;
  border-bottom-left-radius: 4px;
}
.enquiry-chat-msg-row.user .enquiry-chat-bubble {
  background: #21A78A;
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
  font-weight: 700;
}

.enquiry-chat-typing .enquiry-chat-bubble {
  background: #EDF7F4;
  border-bottom-left-radius: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 13px 16px;
}
.enquiry-chat-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6B7C74;
  opacity: 0.5;
}
@media (prefers-reduced-motion: no-preference) {
  .enquiry-chat-typing-dot { animation: enquiryChatBounce 1.1s infinite ease-in-out; }
  .enquiry-chat-typing-dot:nth-child(2) { animation-delay: 0.15s; }
  .enquiry-chat-typing-dot:nth-child(3) { animation-delay: 0.3s; }
  .enquiry-chat-msg-row { animation: enquiryChatRise 0.28s ease-out both; }
}
@keyframes enquiryChatBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}
@keyframes enquiryChatRise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.enquiry-chat-composer {
  flex: none;
  max-height: 46vh; /* safety net: the review step's card can get tall on a
    short viewport - this lets the composer scroll internally rather than
    letting its content (including the Send button) get clipped by the
    modal's overflow:hidden. */
  overflow-y: auto;
  border-top: 1px solid #DCEAE6;
  padding: 12px 14px;
  background: #FFFFFF;
}

.enquiry-chat-field-row { display: flex; gap: 8px; }
.enquiry-chat-field-row + .enquiry-chat-field-row { margin-top: 8px; }
.enquiry-chat-field-row > input,
.enquiry-chat-field-row > textarea {
  flex: 1;
  min-width: 0;
}

.enquiry-chat-composer input[type="text"],
.enquiry-chat-composer input[type="email"],
.enquiry-chat-composer input[type="tel"],
.enquiry-chat-composer input[type="date"],
.enquiry-chat-composer textarea {
  width: 100%;
  font-family: 'Montserrat', Arial, sans-serif;
  font-size: 14.5px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid #DCEAE6;
  background: #F4FAF8;
  color: #1B2420;
  outline: none;
}
/* css/dropmenu.css sets a global, unscoped `::-webkit-input-placeholder {
   color: #fff }` (site-wide, meant for a dark menu context) that otherwise
   makes every placeholder here render as near-invisible white-on-white.
   These scoped rules out-specificity it. */
.enquiry-chat-composer input::-webkit-input-placeholder,
.enquiry-chat-composer textarea::-webkit-input-placeholder {
  color: #6B7C74;
  opacity: 1;
}
.enquiry-chat-composer input::-moz-placeholder,
.enquiry-chat-composer textarea::-moz-placeholder {
  color: #6B7C74;
  opacity: 1;
}
.enquiry-chat-composer input:-ms-input-placeholder,
.enquiry-chat-composer textarea:-ms-input-placeholder {
  color: #6B7C74;
}
.enquiry-chat-composer input::placeholder,
.enquiry-chat-composer textarea::placeholder {
  color: #6B7C74;
  opacity: 1;
}
.enquiry-chat-composer input:focus,
.enquiry-chat-composer textarea:focus,
.enquiry-chat-composer button:focus-visible,
.enquiry-chat-chip:focus-visible {
  border-color: #21A78A;
  outline: 2px solid #21A78A;
  outline-offset: 1px;
}
.enquiry-chat-composer textarea { resize: none; min-height: 56px; }

.enquiry-chat-composer-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}

.enquiry-chat-send-btn {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: #21A78A;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.enquiry-chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.enquiry-chat-send-btn:not(:disabled):hover { background: #167A63; }

.enquiry-chat-skip-btn {
  background: none;
  border: none;
  color: #6B7C74;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 4px;
  text-decoration: underline;
}

.enquiry-chat-chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; }

.enquiry-chat-chip {
  font-family: 'Montserrat', Arial, sans-serif;
  font-weight: 700;
  font-size: 13.5px;
  padding: 9px 15px;
  border-radius: 999px;
  border: 1.5px solid #C9DFD9;
  background: #FFFFFF;
  color: #1B2420;
  cursor: pointer;
}
.enquiry-chat-chip:hover { border-color: #21A78A; }
.enquiry-chat-chip.selected {
  background: #21A78A;
  color: #FFFFFF;
  border-color: #21A78A;
}

.enquiry-chat-review-card {
  background: #F4FAF8;
  border: 1px solid #DCEAE6;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13.5px;
}
.enquiry-chat-review-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px dashed #DCEAE6;
}
.enquiry-chat-review-row:last-child { border-bottom: none; }
.enquiry-chat-review-row .k { color: #6B7C74; flex: none; }
.enquiry-chat-review-row .v { font-weight: 700; text-align: right; }
.enquiry-chat-review-row button {
  background: none;
  border: none;
  color: #167A63;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  margin-left: 6px;
}

.enquiry-chat-primary-btn {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: none;
  background: #D89701;
  color: #fff;
  font-family: 'Montserrat', Arial, sans-serif;
  font-weight: 800;
  font-size: 14.5px;
  cursor: pointer;
  margin-top: 10px;
}
.enquiry-chat-primary-btn:hover { opacity: 0.92; }

.enquiry-chat-whatsapp-btn {
  width: 100%;
  padding: 11px;
  border-radius: 12px;
  border: 1.5px solid #DCEAE6;
  background: transparent;
  color: #1B2420;
  font-family: 'Montserrat', Arial, sans-serif;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.enquiry-chat-whatsapp-btn:hover { border-color: #21A78A; }
.enquiry-chat-whatsapp-btn svg { flex: none; }

.enquiry-chat-consent-note {
  font-size: 12.5px;
  color: #6B7C74;
  margin-top: 10px;
}

.enquiry-chat-success-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #E8F5EC;
  color: #1E7A46;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin: 0 auto 8px;
}

.enquiry-chat-error-banner {
  background: #FDECEA;
  color: #A32C21;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 8px;
}

.enquiry-chat-thread::-webkit-scrollbar { width: 6px; }
.enquiry-chat-thread::-webkit-scrollbar-thumb { background: #DCEAE6; border-radius: 3px; }
