/* TechMerge AI assistant widget */

/* Footer links: let them wrap on narrow screens instead of forcing horizontal scroll.
   Kept here (versioned file) because app.css is served as immutable/long-cached. */
.footer__links { flex-wrap: wrap; gap: 0.75rem 1.75rem; }

.tm-ai-fab {
  position: fixed;
  right: 20px; bottom: 20px;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  height: 52px;
  padding: 0 1.2rem 0 1rem;
  border: none;
  border-radius: 26px;
  background: var(--amber);
  color: var(--accent-contrast);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 28px -10px rgba(10, 22, 40, 0.55);
  transition: transform 0.2s, box-shadow 0.2s;
}
.tm-ai-fab:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -10px rgba(10, 22, 40, 0.6); }
.tm-ai-fab:focus-visible, .tm-ai-send:focus-visible, .tm-ai-chip:focus-visible, .tm-ai-close:focus-visible {
  outline: 2px solid var(--amber); outline-offset: 2px;
}
.tm-ai-fab svg { width: 22px; height: 22px; flex: none; }
.tm-ai-fab[hidden], .tm-ai-panel[hidden], .tm-ai-chips[hidden] { display: none; }

.tm-ai-panel {
  position: fixed;
  right: 20px; bottom: 20px;
  z-index: 1001;
  width: min(390px, calc(100vw - 32px));
  height: min(600px, calc(100vh - 40px));
  display: flex;
  flex-direction: column;
  background: var(--navy-mid);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 60px -18px rgba(10, 22, 40, 0.5);
  overflow: hidden;
  animation: tm-ai-in 0.22s ease-out;
}
@keyframes tm-ai-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.tm-ai-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: var(--amber);
  color: var(--accent-contrast);
}
.tm-ai-head__icon { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,0.18); display: flex; align-items: center; justify-content: center; flex: none; }
.tm-ai-head__icon svg { width: 18px; height: 18px; }
.tm-ai-head__title { font-family: var(--font-display); font-weight: 700; font-size: 0.98rem; line-height: 1.2; }
.tm-ai-head__sub { font-size: 0.74rem; opacity: 0.85; }
.tm-ai-close {
  margin-left: auto;
  width: 32px; height: 32px;
  border: none; border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 1.4rem; line-height: 1;
  cursor: pointer;
}
.tm-ai-close:hover { background: rgba(255,255,255,0.18); }

.tm-ai-log {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  scroll-behavior: smooth;
}
.tm-ai-msg {
  max-width: 86%;
  padding: 0.65rem 0.9rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.tm-ai-msg--bot { align-self: flex-start; background: var(--navy-light); color: var(--text); border-bottom-left-radius: 4px; }
.tm-ai-msg--user { align-self: flex-end; background: var(--amber); color: var(--accent-contrast); border-bottom-right-radius: 4px; }
.tm-ai-msg a { color: inherit; text-decoration: underline; font-weight: 600; }

.tm-ai-typing { display: inline-flex; gap: 4px; align-items: center; padding: 0.85rem 0.9rem; }
.tm-ai-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--steel); animation: tm-ai-dot 1.1s infinite ease-in-out; }
.tm-ai-typing span:nth-child(2) { animation-delay: 0.15s; }
.tm-ai-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes tm-ai-dot { 0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }

.tm-ai-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0 1rem 0.75rem; }
.tm-ai-chip {
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  border-radius: 16px;
  padding: 0.4rem 0.8rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.tm-ai-chip:hover { border-color: var(--amber); color: var(--amber); }

.tm-ai-form { display: flex; align-items: flex-end; gap: 0.5rem; padding: 0.75rem 1rem; border-top: 1px solid var(--border); background: var(--navy-mid); }
.tm-ai-input {
  flex: 1;
  resize: none;
  max-height: 110px;
  min-height: 40px;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--field-bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.4;
}
.tm-ai-input:focus { outline: 2px solid var(--amber); outline-offset: 0; border-color: transparent; }
.tm-ai-send {
  flex: none;
  width: 40px; height: 40px;
  border: none; border-radius: 10px;
  background: var(--amber);
  color: var(--accent-contrast);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.tm-ai-send svg { width: 18px; height: 18px; }
.tm-ai-send:disabled { opacity: 0.45; cursor: not-allowed; }

.tm-ai-foot { padding: 0 1rem 0.8rem; font-size: 0.7rem; color: var(--steel); line-height: 1.5; background: var(--navy-mid); }
.tm-ai-foot a { color: var(--amber); font-weight: 600; }

@media (max-width: 600px) {
  .tm-ai-fab { right: 14px; bottom: 14px; }
  .tm-ai-panel { right: 0; bottom: 0; width: 100vw; height: min(84vh, 640px); border-radius: 14px 14px 0 0; border-bottom: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tm-ai-panel { animation: none; }
  .tm-ai-typing span { animation: none; opacity: 0.6; }
  .tm-ai-log { scroll-behavior: auto; }
}
