/* NVISION in-house chatbot — loaded inside Shadow DOM */
:host,
.nvision-chat-root {
  all: initial;
  font-family: Montserrat, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.nv-chat-launcher-wrap {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 99998;
}

.nvision-chat-launcher {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: #0069be;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.2s;
  padding: 0;
  overflow: hidden;
}

.nvision-chat-launcher .nv-chat-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.nvision-chat-launcher:hover {
  transform: scale(1.05);
}

.nv-chat-launcher-dot {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 10px;
  height: 10px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #fff;
}

.nv-chat-panel {
  position: fixed;
  right: 16px;
  bottom: 84px;
  width: min(380px, calc(100vw - 32px));
  height: min(520px, calc(100vh - 120px));
  max-height: 90vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.nv-chat-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.nv-chat-header-title {
  font-weight: 600;
  color: #0069be;
  font-size: 14px;
}

.nv-chat-header-actions {
  display: flex;
  gap: 4px;
}

.nv-chat-btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 4px;
}

.nv-chat-btn-icon:hover {
  background: #f3f4f6;
}

.nv-chat-messages {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f9fafb;
  min-width: 0;
}

.nv-chat-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  min-width: 0;
  max-width: 100%;
}

.nv-chat-row.user {
  justify-content: flex-end;
}

.nv-chat-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
}

.nv-chat-avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.nv-chat-loading {
  text-align: center;
  color: #6b7280;
  font-size: 14px;
  padding: 24px;
}

.nv-chat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  color: #1f2937;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
  box-sizing: border-box;
}

.nv-chat-bubble.bot {
  background: #fff;
  border: 1px solid #e5e7eb;
}

.nv-chat-bubble.user {
  background: #0069be;
  color: #fff;
  white-space: pre-wrap;
}

.nv-chat-bubble p {
  margin: 0;
}

.nv-chat-typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 52px;
  min-height: 20px;
  padding: 12px 16px;
}

.nv-chat-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9ca3af;
  animation: nv-chat-typing-bounce 1.2s ease-in-out infinite;
}

.nv-chat-typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.nv-chat-typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes nv-chat-typing-bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }

  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.nv-chat-image {
  max-width: 100%;
  border-radius: 8px;
  margin-top: 8px;
  display: block;
}

.nv-chat-html {
  font-size: 13px;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.nv-chat-html .LocationCard,
.nv-chat-html a {
  font-size: inherit;
}

.nv-chat-composer {
  border-top: 1px solid #e5e7eb;
  padding: 8px 12px 12px;
  flex-shrink: 0;
  background: #fff;
}

.nv-chat-options:empty {
  display: none;
  margin: 0;
}

.nv-chat-row-options {
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.nv-chat-options-inline {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
  max-width: 85%;
  box-sizing: border-box;
}

.nv-chat-options-inline--compact {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nv-chat-options-inline--compact .nv-chat-option {
  white-space: normal;
  max-width: 100%;
}

.nv-chat-option {
  width: fit-content;
  max-width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: 1px solid #0069be;
  border-radius: 12px;
  background: #d6ebf9;
  color: #0069be;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 105, 190, 0.12);
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.nv-chat-option:hover {
  background: #0069be;
  color: #fff;
  box-shadow: 0 2px 4px rgba(0, 105, 190, 0.2);
}

.nv-chat-option--enter {
  opacity: 0;
  transform: translateY(8px);
  animation: nv-chat-option-fade-in 0.35s ease forwards;
}

@keyframes nv-chat-option-fade-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .nv-chat-option--enter {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

.nv-chat-composer .nv-chat-option {
  border: 1px solid #0069be;
  border-radius: 24px;
  background: #fff;
  color: #0069be;
}

.nv-chat-composer .nv-chat-option:hover {
  background: #eff6ff;
}

.nv-chat-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  min-width: 0;
}

.nv-chat-composer--hide-input .nv-chat-input-row {
  display: none !important;
}

.nv-chat-input {
  flex: 1;
  min-width: 0;
  border: 1px solid #d1d5db;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  line-height: 1.45;
  font-family: inherit;
  outline: none;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  overflow-y: hidden;
  box-sizing: border-box;
}

.nv-chat-input:focus {
  border-color: #0069be;
}

.nv-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #0069be;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.nv-chat-inline-form,
.nv-chat-zip-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nv-chat-inline-form label {
  font-size: 12px;
  color: #4b5563;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nv-chat-inline-form input,
.nv-chat-zip-form input {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
}

.nv-chat-form-submit,
.nv-chat-zip-form button[type='submit'] {
  background: #0069be;
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

@media (max-width: 599px) {
  .nv-chat-panel {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 90vh;
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
  }

  .nv-chat-launcher-wrap {
    right: 12px;
    bottom: 12px;
  }
}

body.Body--showFooterAction .nv-chat-launcher-wrap {
  bottom: 72px;
}

body.Body--showFooterAction .nv-chat-panel {
  bottom: 140px;
}

/* AI answers (Ask NVISION) inside chat */
.nv-chat-ai p {
  margin: 0 0 0.5em;
}

.nv-chat-ai p:last-child {
  margin-bottom: 0;
}

.nv-chat-ai-links {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nv-chat-suggested-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nv-chat-suggested-link {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  color: #0069be;
  text-decoration: none;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.nv-chat-suggested-link:hover {
  text-decoration: underline;
}

.nv-chat-ai-links .link-card {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.nv-chat-ai-links .link-card-link {
  display: flex;
  align-items: stretch;
  text-decoration: none;
  color: inherit;
  gap: 0;
}

.nv-chat-ai-links .link-card-image {
  flex: 0 0 72px;
  min-height: 72px;
  background: #f3f4f6;
}

.nv-chat-ai-links .link-card-image img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  display: block;
}

.nv-chat-ai-links .link-card-content {
  padding: 10px 12px;
  display: flex;
  align-items: center;
}

.nv-chat-ai-links .link-card-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: #0069be;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.nv-chat-ai-links .link-card-fallback {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  color: #0069be;
}

.nv-chat-ai-links .nvision-logo-svg {
  width: 48px;
  height: auto;
}

/* Consultation nearest-location card */
.nv-chat-location-card {
  display: flex;
  flex-direction: column;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  margin-top: 4px;
}

.nv-chat-location-card-image {
  width: 100%;
  background: #f3f4f6;
  line-height: 0;
}

.nv-chat-location-card-image img {
  width: 100%;
  height: auto;
  max-height: 180px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center;
  display: block;
}

.nv-chat-location-card-body {
  padding: 12px;
  min-width: 0;
}

.nv-chat-location-card-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  color: #0069be;
}

.nv-chat-location-distance,
.nv-chat-location-rating {
  margin: 0 0 6px;
  font-size: 12px;
  color: #6b7280;
}

.nv-chat-location-address {
  display: block;
  font-size: 13px;
  line-height: 1.4;
  color: #374151;
  text-decoration: none;
  margin-bottom: 10px;
  font-style: normal;
}

a.nv-chat-location-address:hover {
  text-decoration: underline;
  color: #0069be;
}

.nv-chat-location-card-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-top: 4px;
}

.nv-chat-book-now {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  background: #fbb040;
  color: #1a1a1a;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 8px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.nv-chat-book-now:hover {
  background: #f9a825;
  color: #1a1a1a;
}

.nv-chat-learn-more-btn {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  background: #0069be;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 8px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 105, 190, 0.25);
}

.nv-chat-learn-more-btn:hover {
  background: #005a9e;
  color: #fff;
}

.nv-chat-location-card .nv-chat-location-phone {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #0069be;
  text-decoration: none;
  margin: 0 0 10px;
}

.nv-chat-location-card .nv-chat-location-phone:hover {
  text-decoration: underline;
}

/* Inline tel links inside bot prose (speak-to-someone, etc.) */
.nv-chat-html p .nv-chat-location-phone,
.nv-chat-ai p .nv-chat-location-phone {
  display: inline;
  margin: 0;
  font-size: inherit;
  font-weight: 600;
  color: #0069be;
  text-decoration: none;
  white-space: nowrap;
}

.nv-chat-html p .nv-chat-location-phone:hover,
.nv-chat-ai p .nv-chat-location-phone:hover {
  text-decoration: underline;
}

.nv-chat-consultation-zip {
  margin-top: 4px;
}
