/**
 * AimHome Realty — Chat Widget
 * SNRS Innovations Inc.
 *
 * Linked statically from each page's <head> (not injected from JS —
 * that caused a brief unstyled flash before the stylesheet loaded).
 * Relies on brand.css tokens (--color-navy, --color-gold, --font-body,
 * --space-*), which load first.
 */

.chat-widget-bubble {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-gold, #C9A84C);
  color: var(--color-navy-dark, #122f4b);
  border: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.chat-widget-bubble:hover {
  transform: scale(1.06);
}

.chat-widget-bubble svg {
  width: 26px;
  height: 26px;
}

/* Clear the sticky mobile contact bar (64px + shadow) so the bubble
   doesn't sit on top of it. */
@media (max-width: 767px) {
  .chat-widget-bubble {
    bottom: 80px;
  }
}

.chat-widget-panel {
  position: fixed;
  right: 20px;
  bottom: 88px;
  z-index: 1000;
  width: 340px;
  max-width: calc(100vw - 40px);
  max-height: 480px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-body, sans-serif);
}

@media (max-width: 767px) {
  .chat-widget-panel {
    bottom: 148px;
  }
}

.chat-widget-panel.is-open {
  display: flex;
}

.chat-widget-panel__header {
  background: var(--color-navy, #1F4E79);
  color: #fff;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-widget-panel__title {
  font-size: 0.9375rem;
  font-weight: 600;
}

.chat-widget-panel__close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

.chat-widget-panel__close:hover {
  color: #fff;
}

.chat-widget-actions {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.chat-widget-actions a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--color-navy, #1F4E79);
}

.chat-widget-actions a:first-child {
  border-right: 1px solid #e5e7eb;
}

.chat-widget-actions svg {
  width: 15px;
  height: 15px;
}

.chat-widget-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: #f8fafc;
}

.chat-widget-msg {
  max-width: 85%;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  font-size: 0.8438rem;
  line-height: 1.45;
}

.chat-widget-msg--bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e5e7eb;
  color: #1a1a2e;
}

.chat-widget-msg--user {
  align-self: flex-end;
  background: var(--color-navy, #1F4E79);
  color: #fff;
}

.chat-widget-chips {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.chat-widget-chip {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--color-gold, #C9A84C);
  color: var(--color-navy, #1F4E79);
  border-radius: 100px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.chat-widget-chip:hover {
  background: rgba(201, 168, 76, 0.1);
}

.chat-widget-input-row {
  display: flex;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.chat-widget-input-row input {
  flex: 1;
  border: none;
  padding: 0.7rem 0.85rem;
  font-family: var(--font-body, sans-serif);
  font-size: 0.8438rem;
  outline: none;
}

.chat-widget-input-row button {
  border: none;
  background: var(--color-gold, #C9A84C);
  color: var(--color-navy-dark, #122f4b);
  padding: 0 1.1rem;
  font-weight: 700;
  cursor: pointer;
}

.chat-widget-lead-form {
  border-top: 1px solid #e5e7eb;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: #fff;
  flex-shrink: 0;
}

/* [hidden] and .chat-widget-lead-form carry equal specificity, and this
   file loads after the browser's UA stylesheet, so without this rule
   `display: flex` above wins and the form ignores its hidden attribute. */
.chat-widget-lead-form[hidden] {
  display: none;
}

.chat-widget-lead-form input[type="text"],
.chat-widget-lead-form input[type="email"],
.chat-widget-lead-form input[type="tel"] {
  padding: 0.55rem 0.7rem;
  border: 1.5px solid #e5e7eb;
  border-radius: 6px;
  font-family: var(--font-body, sans-serif);
  font-size: 0.8438rem;
  outline: none;
}

.chat-widget-lead-form label {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.7188rem;
  line-height: 1.4;
  color: #6b7280;
}

.chat-widget-lead-form label input[type="checkbox"] {
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.chat-widget-lead-form button {
  border: none;
  border-radius: 6px;
  background: var(--color-navy, #1F4E79);
  color: #fff;
  padding: 0.65rem;
  font-weight: 600;
  font-size: 0.8438rem;
  cursor: pointer;
}

.chat-widget-lead-form button:disabled {
  opacity: 0.6;
  cursor: default;
}

.chat-widget-lead-form__success {
  font-size: 0.8125rem;
  color: #15803d;
  font-weight: 600;
  text-align: center;
  padding: 0.5rem 0;
}
