/* ── Site-wide AI assistant "Tailor" — floating orb + chat panel ──────────────
   Loaded on every page via _footer.html. Namespaced .tcv-agent-* so it can't
   collide with page styles. Dark navy + blue/violet to match the brand. */

.tcv-agent-orb {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2147483000;
  width: 60px;
  height: 60px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: radial-gradient(120% 120% at 30% 20%, #6aa0ff 0%, #7c3aed 60%, #4c1d95 100%);
  box-shadow: 0 10px 26px rgba(76, 29, 149, .5), 0 0 0 1px rgba(255,255,255,.08) inset;
  transition: transform .2s ease, box-shadow .2s ease;
}
.tcv-agent-orb:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 16px 34px rgba(76, 29, 149, .6); }
.tcv-agent-orb:active { transform: scale(.97); }
.tcv-agent-orb svg { width: 26px; height: 26px; }
.tcv-agent-orb .tcv-agent-orb-close { display: none; }
.tcv-agent[data-open="true"] .tcv-agent-orb .tcv-agent-orb-open { display: none; }
.tcv-agent[data-open="true"] .tcv-agent-orb .tcv-agent-orb-close { display: block; }
@media (prefers-reduced-motion: no-preference) {
  .tcv-agent[data-open="false"] .tcv-agent-orb { animation: tcvAgentPulse 2.8s ease-in-out infinite; }
}
@keyframes tcvAgentPulse {
  0%, 100% { box-shadow: 0 10px 26px rgba(76,29,149,.5), 0 0 0 0 rgba(124,58,237,.5); }
  50%      { box-shadow: 0 10px 26px rgba(76,29,149,.5), 0 0 0 10px rgba(124,58,237,0); }
}

/* A tiny "chat with me" nudge dot */
.tcv-agent-badge {
  position: absolute;
  top: -2px; right: -2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #22d3ee;
  border: 2px solid #0a0f24;
}
.tcv-agent[data-open="true"] .tcv-agent-badge,
.tcv-agent[data-seen="true"] .tcv-agent-badge { display: none; }

.tcv-agent-panel {
  position: fixed;
  right: 22px;
  bottom: 92px;
  z-index: 2147483000;
  width: 370px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 130px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px;
  background: linear-gradient(180deg, #0d1530, #0a0f24);
  border: 1px solid rgba(124,58,237,.28);
  box-shadow: 0 24px 60px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.04) inset;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  opacity: 0;
  transform: translateY(14px) scale(.98);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}
.tcv-agent[data-open="true"] .tcv-agent-panel {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.tcv-agent-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: linear-gradient(180deg, rgba(124,58,237,.14), transparent);
}
.tcv-agent-av {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: radial-gradient(120% 120% at 30% 20%, #6aa0ff, #7c3aed 65%, #4c1d95);
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.tcv-agent-av svg { width: 20px; height: 20px; }
.tcv-agent-id { flex: 1; min-width: 0; }
.tcv-agent-id b { display: block; color: #eaf1ff; font-size: 15px; font-weight: 700; line-height: 1.2; }
.tcv-agent-id small { display: flex; align-items: center; gap: 5px; color: #8ea3c8; font-size: 12px; }
.tcv-agent-id small::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; }
.tcv-agent-hbtn {
  width: 32px; height: 32px; border: none; border-radius: 9px; cursor: pointer;
  background: rgba(255,255,255,.06); color: #c7d3ee; display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, color .15s ease;
}
.tcv-agent-hbtn:hover { background: rgba(255,255,255,.12); color: #fff; }
.tcv-agent-hbtn svg { width: 18px; height: 18px; }
.tcv-agent-hbtn.is-off { opacity: .5; }

.tcv-agent-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(124,58,237,.5) transparent;
}
.tcv-agent-msgs::-webkit-scrollbar { width: 7px; }
.tcv-agent-msgs::-webkit-scrollbar-thumb { background: rgba(124,58,237,.5); border-radius: 4px; }

.tcv-agent-msg {
  max-width: 84%;
  padding: 10px 13px;
  font-size: 13.5px;
  line-height: 1.5;
  border-radius: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.tcv-agent-msg.bot {
  align-self: flex-start;
  background: rgba(255,255,255,.06);
  color: #dce6fb;
  border: 1px solid rgba(255,255,255,.07);
  border-bottom-left-radius: 5px;
}
.tcv-agent-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #3392ff, #7c3aed);
  color: #fff;
  border-bottom-right-radius: 5px;
}
.tcv-agent-msg a { color: #93c5fd; text-decoration: underline; }
.tcv-agent-msg.user a { color: #eaf1ff; }

.tcv-agent-cta {
  align-self: flex-start;
  margin-top: -2px;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 8px 20px rgba(34,197,94,.28);
}

.tcv-agent-typing { display: flex; gap: 4px; align-self: flex-start; padding: 12px 14px; }
.tcv-agent-typing i {
  width: 7px; height: 7px; border-radius: 50%; background: #8ea3c8;
  animation: tcvAgentDot 1.2s ease-in-out infinite;
}
.tcv-agent-typing i:nth-child(2) { animation-delay: .18s; }
.tcv-agent-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes tcvAgentDot { 0%,100% { opacity:.35; transform: translateY(0);} 50% { opacity:1; transform: translateY(-4px);} }

.tcv-agent-foot {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.tcv-agent-input {
  flex: 1;
  resize: none;
  max-height: 96px;
  min-height: 22px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  background: rgba(255,255,255,.05);
  color: #eaf1ff;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.4;
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.tcv-agent-input:focus { border-color: rgba(124,58,237,.8); box-shadow: 0 0 0 3px rgba(124,58,237,.18); }
.tcv-agent-input::placeholder { color: #7488ad; }
.tcv-agent-send {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border: none; border-radius: 12px; cursor: pointer;
  background: linear-gradient(135deg, #3392ff, #7c3aed);
  color: #fff; display: flex; align-items: center; justify-content: center;
  transition: filter .15s ease, transform .1s ease;
}
.tcv-agent-send:hover { filter: brightness(1.1); }
.tcv-agent-send:active { transform: scale(.94); }
.tcv-agent-send:disabled { opacity: .5; cursor: not-allowed; }
.tcv-agent-send svg { width: 18px; height: 18px; }

@media (max-width: 480px) {
  .tcv-agent-panel {
    right: 10px; left: 10px; bottom: 84px;
    width: auto; max-width: none;
    height: calc(100vh - 150px);
  }
  .tcv-agent-orb { right: 16px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .tcv-agent-orb, .tcv-agent-panel, .tcv-agent-typing i { animation: none !important; transition: none !important; }
}
