/* "Ask Rodney" — public capabilities chat widget (WP #28). Vanilla CSS, brand tokens from
   styles.css. A floating launcher + a panel; hidden entirely until the endpoint is configured. */

.rodney {
  position: fixed;
  right: clamp(14px, 4vw, 28px);
  bottom: clamp(14px, 4vw, 28px);
  z-index: 60;
  font-family: var(--font-body);
}
.rodney[hidden] { display: none; }

/* Launcher */
.rodney__launch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px 12px 14px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  color: var(--white);
  background: linear-gradient(135deg, var(--blue) 0%, var(--cyan) 100%);
  box-shadow: var(--shadow-md);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 15px;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.rodney__launch:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.rodney__launch svg { width: 26px; height: 26px; flex: none; }
.rodney.is-open .rodney__launch { display: none; }

/* Backdrop — dims the page behind the centered modal (only while open). */
.rodney__backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: rgba(4, 10, 20, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
}
.rodney.is-open .rodney__backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* Panel — a compact bottom-right box by default; a centered modal when open. */
.rodney__panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(380px, calc(100vw - 28px));
  height: min(560px, calc(100vh - 100px));
  display: none;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--white);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-lg);
}
/* Open = centered on the page, larger, above the backdrop. */
.rodney.is-open .rodney__panel {
  display: flex;
  position: fixed;
  z-index: 1;
  inset: auto;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(720px, 94vw);
  height: min(80vh, 780px);
  animation: rodney-pop 0.22s var(--ease);
}
@keyframes rodney-pop {
  from { opacity: 0; transform: translate(-50%, -46%) scale(0.98); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.rodney__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  color: var(--white);
  background: var(--navy-900);
  border-bottom: 1px solid var(--line);
}
.rodney__head svg { width: 30px; height: 30px; flex: none; }
.rodney__title { font-family: var(--font-head); font-weight: 700; font-size: 15px; line-height: 1.1; }
.rodney__sub { font-size: 12px; color: var(--slate-400); }
.rodney__close {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--slate-400);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 8px;
}
.rodney__close:hover { color: var(--white); background: rgba(255, 255, 255, 0.08); }

.rodney__log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--slate-50);
}
.rodney__msg {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.rodney__msg--bot { align-self: flex-start; background: var(--white); color: var(--ink); border: 1px solid var(--slate-200); border-bottom-left-radius: 5px; }
.rodney__msg--me { align-self: flex-end; background: var(--navy-900); color: var(--white); border-bottom-right-radius: 5px; }

/* Complly Risk beta CTA — a clickable logo card that appears after a trial-nudge reply. */
.rodney__cta {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 90%;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--navy-900);
  border: 1px solid rgba(34, 211, 238, 0.35);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.rodney__cta:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.rodney__cta svg { width: 26px; height: 26px; flex: none; filter: drop-shadow(0 3px 8px rgba(34, 211, 238, 0.4)); }
.rodney__cta-word { font-family: var(--font-head); font-weight: 700; font-size: 15px; letter-spacing: -0.02em; color: var(--white); }
.rodney__cta-risk { font-style: italic; color: var(--cyan); }
.rodney__cta-go { margin-left: 4px; font-size: 12px; font-weight: 600; color: var(--cyan); white-space: nowrap; }

/* Cross-sell promo chip (WP #34) — admin-curated other-product nudge Rodney surfaced. Same shape as
   the beta CTA but with the amber safety accent, so it reads as a distinct "have you seen this". */
.rodney__promo {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 90%;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--navy-900);
  border: 1px solid rgba(245, 158, 11, 0.4);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.rodney__promo:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.rodney__promo-tag {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.5);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.rodney__promo-go { font-size: 13px; font-weight: 600; color: var(--white); }

.rodney__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.rodney__chip {
  border: 1px solid rgba(34, 211, 238, 0.4);
  background: rgba(34, 211, 238, 0.08);
  color: var(--blue-deep);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: background 0.15s var(--ease);
}
.rodney__chip:hover { background: rgba(34, 211, 238, 0.16); }

.rodney__typing { display: inline-flex; gap: 4px; align-self: flex-start; padding: 12px 14px; }
.rodney__typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--slate-400);
  animation: rodney-blink 1.2s infinite ease-in-out both;
}
.rodney__typing span:nth-child(2) { animation-delay: 0.2s; }
.rodney__typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes rodney-blink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }

.rodney__form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--slate-200); background: var(--white); }
.rodney__input {
  flex: 1;
  border: 1px solid var(--slate-300);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--ink);
  resize: none;
  max-height: 96px;
}
.rodney__input:focus { outline: 2px solid var(--cyan); outline-offset: 1px; border-color: transparent; }
.rodney__send {
  border: 0;
  border-radius: 12px;
  padding: 0 14px;
  cursor: pointer;
  color: var(--white);
  background: linear-gradient(135deg, var(--blue) 0%, var(--cyan) 100%);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 14px;
}
.rodney__send:disabled { opacity: 0.5; cursor: default; }

.rodney__foot { padding: 0 12px 10px; font-size: 11px; color: var(--slate-500); text-align: center; background: var(--white); }
.rodney__foot a { color: var(--blue-deep); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .rodney__launch, .rodney__chip, .rodney__cta, .rodney__promo { transition: none; }
  .rodney__typing span { animation: none; }
  .rodney.is-open .rodney__panel { animation: none; }
  .rodney__backdrop { transition: none; }
}
