/* OBD2 Custom AI Chat — dark theme with red accents (matches obd2.ca) */
#obd2-chat-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#obd2-chat-bubble {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: #ef4444;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#obd2-chat-bubble:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
}

#obd2-chat-panel {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 340px;
  max-width: calc(100vw - 48px);
  height: 460px;
  max-height: calc(100vh - 140px);
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}
#obd2-chat-panel[hidden] { display: none; }

#obd2-chat-header {
  background: #1a1a1a;
  border-bottom: 2px solid #ef4444;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#obd2-chat-title {
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.4px;
}
#obd2-chat-subtitle {
  color: #999;
  font-size: 12px;
  margin-top: 2px;
}
#obd2-chat-close {
  background: none;
  border: none;
  color: #999;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
#obd2-chat-close:hover { color: #ef4444; }

#obd2-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#obd2-chat-messages::-webkit-scrollbar { width: 6px; }
#obd2-chat-messages::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

.obd2-msg {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.obd2-msg-ai {
  background: #1e1e1e;
  color: #e8e8e8;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid #2a2a2a;
}
.obd2-msg-user {
  background: #ef4444;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.obd2-msg-typing {
  color: #888;
  font-style: italic;
}

#obd2-chat-inputrow {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #2a2a2a;
  background: #161616;
}
#obd2-chat-input {
  flex: 1;
  background: #222;
  border: 1px solid #333;
  border-radius: 8px;
  color: #fff;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}
#obd2-chat-input:focus { border-color: #ef4444; }
#obd2-chat-input::placeholder { color: #666; }
#obd2-chat-send {
  background: #ef4444;
  border: none;
  border-radius: 8px;
  color: #fff;
  width: 42px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
#obd2-chat-send:hover { background: #dc2626; }
#obd2-chat-send:disabled { background: #555; cursor: default; }

@media (max-width: 420px) {
  #obd2-chat-root { bottom: 16px; right: 16px; }
  #obd2-chat-panel { width: calc(100vw - 32px); }
}
