/* Danahe Auto Rebuilders — on-site chat assistant. Red/black theme to match the site. */
#danahe-chat-btn {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9998;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: #c8102e;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform .15s ease, background .15s ease;
}
#danahe-chat-btn:hover { background: #9a0b23; transform: scale(1.05); }
#danahe-chat-btn:focus-visible { outline: 3px solid #e8a317; outline-offset: 2px; }
#danahe-chat-btn svg { width: 28px; height: 28px; }
#danahe-chat-btn .danahe-chat-close { display: none; }
#danahe-chat-btn.danahe-open .danahe-chat-bubble { display: none; }
#danahe-chat-btn.danahe-open .danahe-chat-close { display: block; }

#danahe-chat-panel {
  position: fixed;
  right: 18px;
  bottom: 86px;
  z-index: 9999;
  width: 360px;
  max-width: calc(100vw - 36px);
  height: 480px;
  max-height: calc(100vh - 120px);
  max-height: calc(100dvh - 120px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .35);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: #14171b;
}
#danahe-chat-panel.danahe-open { display: flex; }

.danahe-chat-head {
  background: #14171b;
  color: #fff;
  padding: 14px 16px;
  flex-shrink: 0;
}
.danahe-chat-head strong { display: block; font-size: 16px; line-height: 1.25; }
.danahe-chat-head span { display: block; font-size: 12.5px; color: #c9cdd2; margin-top: 2px; }
.danahe-chat-head span b { color: #e8a317; font-weight: 600; }

#danahe-chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 14px 6px;
  background: #f4f4f5;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.danahe-msg {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
}
.danahe-msg a { color: #c8102e; font-weight: 600; }
.danahe-msg.danahe-bot { background: #fff; border: 1px solid #e3e5e8; align-self: flex-start; border-bottom-left-radius: 4px; }
.danahe-msg.danahe-user { background: #c8102e; color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.danahe-msg.danahe-user a { color: #fff; }
.danahe-msg.danahe-typing { color: #6b7280; font-style: italic; }

#danahe-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 14px 4px;
  background: #f4f4f5;
  flex-shrink: 0;
}
.danahe-chip {
  border: 1px solid #c8102e;
  background: #fff;
  color: #c8102e;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12.5px;
  cursor: pointer;
  font-family: inherit;
}
.danahe-chip:hover { background: #fdeef0; }

#danahe-chat-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #e3e5e8;
  flex-shrink: 0;
}
#danahe-chat-input {
  flex: 1;
  min-width: 0;
  border: 1px solid #c9cdd2;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 14px;
  font-family: inherit;
  color: #14171b;
}
#danahe-chat-input:focus { outline: 2px solid #c8102e; outline-offset: -1px; border-color: #c8102e; }
#danahe-chat-send {
  border: none;
  background: #c8102e;
  color: #fff;
  border-radius: 999px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
}
#danahe-chat-send:hover { background: #9a0b23; }

@media (max-width: 480px) {
  #danahe-chat-panel {
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 70vh;
    height: 70dvh;
    max-height: 70vh;
    max-height: 70dvh;
    border-radius: 14px 14px 0 0;
  }
  #danahe-chat-btn { right: 14px; bottom: 14px; }
}

/* Callback handoff UI for the chat assistant. */
#danahe-chat-callback-btn {
  display: block;
  width: 100%;
  border: none;
  background: #14171b;
  color: #fff;
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
}
#danahe-chat-callback-btn:hover { background: #2a2f36; }
#danahe-chat-callback-btn[hidden], #danahe-chat-callback[hidden] { display: none; }
#danahe-chat-callback {
  background: #fff;
  border-top: 1px solid #e3e5e8;
  padding: 12px 14px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.danahe-cb-title { font-size: 13px; line-height: 1.45; color: #374151; }
#danahe-chat-callback label { display: block; font-size: 12.5px; font-weight: 600; color: #14171b; }
#danahe-chat-callback input {
  display: block;
  width: 100%;
  margin-top: 3px;
  border: 1px solid #c9cdd2;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
}
#danahe-chat-callback input:focus { outline: 2px solid #c8102e; outline-offset: -1px; border-color: #c8102e; }
.danahe-cb-optional { font-weight: 400; color: #6b7280; }
#danahe-cb-error { font-size: 13px; color: #c8102e; }
.danahe-cb-actions { display: flex; gap: 8px; }
#danahe-cb-submit {
  flex: 1;
  border: none;
  background: #c8102e;
  color: #fff;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
#danahe-cb-submit:hover { background: #9a0b23; }
#danahe-cb-cancel {
  border: 1px solid #c9cdd2;
  background: #fff;
  color: #374151;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
.danahe-callback-offer {
  display: inline-block;
  margin-top: 8px;
  border: none;
  background: #c8102e;
  color: #fff;
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.danahe-callback-offer:hover { background: #9a0b23; }
