/* ===========================================================
   Gray's Autonomy — AI concierge + semantic search widgets
   Matches the blueprint / parchment aesthetic in styles.css
   =========================================================== */

/* ---- semantic search bar (hero) ---- */
.ai-search {
  margin: 2rem 0 0;
  max-width: 34ch;
}
.ai-search form {
  display: flex;
  border: 1px solid var(--line);
  background: var(--paper);
}
.ai-search input {
  flex: 1;
  border: 0;
  background: transparent;
  font-family: var(--body);
  font-size: 1rem;
  padding: 12px 14px;
  color: var(--ink);
}
.ai-search input:focus { outline: 2px solid var(--blue); outline-offset: -2px; }
.ai-search button {
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  padding: 0 16px;
  cursor: pointer;
}
.ai-search button:hover { background: var(--blue-deep); }
.ai-search .ai-search-hint {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin: 8px 2px 0;
  text-transform: uppercase;
}
.ai-search-result {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  background: var(--paper);
  padding: 14px 16px;
  font-size: 1rem;
}
.ai-search-result[hidden] { display: none; }
.ai-search-result a {
  display: inline-block;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--blue-deep);
  text-decoration: none;
  border-bottom: 1px solid var(--blue);
}
.ai-search-result a.ai-search-ask { margin-left: 16px; }

/* ---- floating chat launcher ---- */
.ai-launcher {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 20px 13px 16px;
  border: 1px solid var(--line);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 4px 6px 0 rgba(31, 37, 48, 0.15);
  transition: background 0.2s, transform 0.15s;
}
.ai-launcher:hover { background: var(--blue-deep); transform: translateY(-2px); }
.ai-launcher .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--blue); box-shadow: 0 0 0 0 rgba(26, 156, 196, 0.6);
  animation: ai-pulse 2s infinite;
}
@keyframes ai-pulse {
  0% { box-shadow: 0 0 0 0 rgba(26, 156, 196, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(26, 156, 196, 0); }
  100% { box-shadow: 0 0 0 0 rgba(26, 156, 196, 0); }
}

/* ---- chat panel ---- */
.ai-panel {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 51;
  width: min(390px, calc(100vw - 40px));
  height: min(560px, calc(100vh - 56px));
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 6px 10px 0 rgba(31, 37, 48, 0.18);
}
.ai-panel[hidden] { display: none; }
.ai-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
}
.ai-panel-head .title {
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.06em;
}
.ai-panel-head .title small {
  display: block;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: var(--blue-deep);
  text-transform: uppercase;
  margin-top: 2px;
}
.ai-panel-head button {
  border: 0; background: transparent; cursor: pointer;
  font-size: 1.3rem; line-height: 1; color: var(--ink-soft);
}
.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-msg { max-width: 85%; padding: 10px 13px; font-size: 0.96rem; line-height: 1.45; }
.ai-msg.bot {
  align-self: flex-start;
  background: var(--paper-2);
  border: 1px solid var(--line-faint);
}
.ai-msg.user {
  align-self: flex-end;
  background: var(--ink);
  color: var(--paper);
}
.ai-msg.note {
  align-self: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--blue-deep);
  background: var(--accent-bg);
  border: 1px dashed var(--blue);
  padding: 6px 10px;
}
.ai-typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 12px 14px; }
.ai-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ink-soft);
  animation: ai-bounce 1.2s infinite;
}
.ai-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ai-bounce { 0%, 60%, 100% { opacity: 0.3; } 30% { opacity: 1; } }

.ai-input {
  display: flex;
  border-top: 1px solid var(--line);
}
.ai-input textarea {
  flex: 1;
  border: 0;
  resize: none;
  font-family: var(--body);
  font-size: 0.96rem;
  padding: 12px 14px;
  background: var(--paper);
  color: var(--ink);
  max-height: 100px;
}
.ai-input textarea:focus { outline: none; }
.ai-input button {
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0 18px;
  cursor: pointer;
}
.ai-input button:hover { background: var(--blue-deep); }
.ai-input button:disabled { opacity: 0.5; cursor: default; }

@media (max-width: 520px) {
  .ai-launcher { right: 16px; bottom: 16px; }
  .ai-panel { right: 8px; bottom: 8px; }
}
