/* HOAI chat styles (v1.2 - White Card Fix) */
.hoai-chat-root {
  max-width: 780px;
  margin: 16px auto;
  padding: 16px;
  border: 1px solid #e2e4e7;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: #0f172a;
}

.hoai-chat-header {
  font-weight: 700;
  font-size: 18px;
  color: #111;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f0f1f4;
}

.hoai-chat-messages {
  min-height: 120px;
  max-height: 520px;
  overflow-y: auto;
  padding: 10px 4px;
}

.hoai-msg {
  display: flex;
  margin: 12px 0;
}

.hoai-msg.me {
  justify-content: flex-end;
}

.hoai-msg .bubble {
  max-width: 86%;
  padding: 14px 18px;
  border-radius: 14px;
  line-height: 1.6;
  font-size: 15px;
  white-space: pre-wrap; 
  word-break: break-word;
}

/* Fix for trailing empty space in bubbles */
.hoai-msg .bubble p:last-child {
  margin-bottom: 0;
}

/* User Bubble: Black Background, White Text */
.hoai-msg.me .bubble {
  background: #111;
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Bot Bubble: Grey Background, Dark Text */
.hoai-msg.bot .bubble {
  background: #f2f4f7;
  color: #101828;
  border-bottom-left-radius: 4px;
}

.hoai-chat-composer {
  display: flex;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid #f0f1f4;
}

.hoai-chat-input {
  flex: 1;
  padding: 12px;
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

.hoai-chat-input:focus {
  border-color: #111;
}

.hoai-chat-send {
  padding: 10px 20px;
  border: 1px solid #111;
  background: #111;
  color: #fff;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.hoai-chat-send:hover {
  opacity: 0.9;
}

.hoai-chat-send:disabled,
.hoai-chat-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: #f9fafb;
}

.hoai-chat-status {
  margin-top: 8px;
  font-size: 12px;
  color: #667085;
  min-height: 18px;
  padding-left: 4px;
}

/* Contact Form */
.hoai-contact {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid #eaecf0;
  border-radius: 12px;
  background: #f9fafb;
}

.hoai-contact .label {
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 14px;
}

.hoai-contact .contact-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  margin-bottom: 8px;
  box-sizing: border-box;
}

.hoai-contact .contact-submit {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: none;
  background: #111;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
}

.hoai-contact .email-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 12px 0;
  font-size: 14px;
  color: #475467;
}

/* --- RESULT CARDS (Fixes "White Blanks" issue) --- */

.hoai-hits {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed #d0d5dd;
}

.hoai-hits-title {
  font-weight: 700;
  margin-bottom: 12px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #475467;
}

.hoai-hit-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Style the Hits as Cards */
.hoai-hit {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05); /* Subtle shadow for depth */
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  display: flex;
  flex-direction: column;
}

.hoai-hit:hover {
  border-color: #b0b0b0;
  box-shadow: 0 4px 6px rgba(0,0,0,0.08);
}

.hoai-hit .hit-title {
  text-decoration: none;
  color: #026aa7; /* Nice link blue */
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 4px;
  line-height: 1.4;
}

.hoai-hit .hit-title:hover {
  text-decoration: underline;
}

.hoai-hit .hit-metric {
  color: #344054;
  font-size: 14px;
  font-weight: 500;
  margin-top: 4px;
  display: block;
}

.hoai-cta {
  display: block;
  text-align: center;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid #111;
  border-radius: 8px;
  text-decoration: none;
  color: #111;
  font-weight: 600;
  background: #fff;
  transition: background 0.2s;
}
.hoai-cta:hover {
  background: #f2f4f7;
}

/* Structured Lists inside Bot Bubbles */
.hoai-msg.bot .bubble p { margin: 0 0 10px; }
.hoai-msg.bot .bubble ol.hoai-cases { margin: 8px 0 12px 1.4em; padding: 0; }
.hoai-msg.bot .bubble li.hoai-case { margin: 8px 0; }
.hoai-msg.bot .bubble .case-title { font-weight: 700; color: #000; }
.hoai-msg.bot .bubble .case-desc { font-size: 14px; color: #475467; margin-top: 2px; }
.hoai-msg.bot .bubble .hoai-next-step { margin-top: 12px; font-weight: 600; font-style: italic; color: #111; }