/*
  WebsDocs Premium AI Business Assistant
  File: /ai-kit/v1/premium/ai-assistant-premium.css
  Version: premium-client-ui-v4

  Final behavior:
  - No avatar path in CSS.
  - Avatar is loaded by JS as <img>.
  - Launcher shows avatar only.
  - Header, buttons, prompt pills: dark navy.
  - Panel body, messages area, footer: light grey.
  - No Premium/WebsDocs branding in visitor-facing header.
*/

:root {
  --wd-premium-ai-navy: #0b1626;
  --wd-premium-ai-navy-2: #111f33;
  --wd-premium-ai-navy-3: #182a42;

  --wd-premium-ai-grey: #eef2f6;
  --wd-premium-ai-grey-2: #e5eaf0;
  --wd-premium-ai-grey-3: #d5dde7;

  --wd-premium-ai-white: #ffffff;
  --wd-premium-ai-text: #172233;
  --wd-premium-ai-text-soft: #536173;
  --wd-premium-ai-text-muted: #728092;

  --wd-premium-ai-gold: #c8ad78;
  --wd-premium-ai-green: #48b58e;

  --wd-premium-ai-border: rgba(15, 31, 51, 0.12);
  --wd-premium-ai-border-strong: rgba(15, 31, 51, 0.2);

  --wd-premium-ai-shadow: 0 22px 60px rgba(0, 0, 0, 0.24);
}

.wd-premium-ai-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.wd-premium-ai-widget,
.wd-premium-ai-widget * {
  box-sizing: border-box;
}

.wd-premium-ai-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--wd-premium-ai-text);
  line-height: 1.4;
}

/* =========================
   AVATAR-ONLY LAUNCHER
========================= */

.wd-premium-ai-launcher {
  width: 72px;
  height: 72px;
  padding: 0;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  background: transparent;
  box-shadow: none;
  display: grid;
  place-items: center;
  overflow: visible;
  transition: transform 160ms ease, opacity 160ms ease;
}

.wd-premium-ai-launcher:hover {
  transform: translateY(-2px);
}

.wd-premium-ai-launcher:focus-visible {
  outline: 2px solid rgba(200, 173, 120, 0.45);
  outline-offset: 5px;
}

.wd-premium-ai-launcher-avatar {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: contain;
  object-position: center;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

/* =========================
   PANEL
========================= */

.wd-premium-ai-panel {
  position: absolute;
  right: 0;
  bottom: 88px;
  width: min(432px, calc(100vw - 32px));
  max-height: min(742px, calc(100vh - 112px));
  overflow: hidden;
  border: 1px solid rgba(15, 31, 51, 0.16);
  border-radius: 24px;
  background: var(--wd-premium-ai-grey);
  box-shadow: var(--wd-premium-ai-shadow);
  opacity: 0;
  transform: translateY(14px) scale(0.985);
  pointer-events: none;
  transform-origin: right bottom;
  transition: opacity 180ms ease, transform 180ms ease;
}

.wd-premium-ai-widget.is-open .wd-premium-ai-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* =========================
   HEADER — DARK NAVY
========================= */

.wd-premium-ai-header {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 40px;
  gap: 13px;
  align-items: center;
  padding: 17px;
  background: linear-gradient(180deg, var(--wd-premium-ai-navy-2), var(--wd-premium-ai-navy));
  color: var(--wd-premium-ai-white);
}

.wd-premium-ai-header-avatar {
  display: block;
  width: 46px;
  height: 46px;
  object-fit: contain;
  object-position: center;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.wd-premium-ai-header-copy {
  min-width: 0;
}

.wd-premium-ai-title {
  margin: 0;
  color: var(--wd-premium-ai-white);
  font-size: 1.02rem;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.wd-premium-ai-subtitle {
  margin: 5px 0 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.82rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.wd-premium-ai-close {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.84);
  background: rgba(255, 255, 255, 0.07);
  font-size: 1.48rem;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.wd-premium-ai-close:hover {
  background: rgba(255, 255, 255, 0.13);
  color: var(--wd-premium-ai-white);
}

.wd-premium-ai-close:focus-visible,
.wd-premium-ai-input:focus-visible,
.wd-premium-ai-send:focus-visible,
.wd-premium-ai-prompt:focus-visible,
.wd-premium-ai-action:focus-visible {
  outline: 2px solid rgba(200, 173, 120, 0.44);
  outline-offset: 2px;
}

/* =========================
   STATUS
========================= */

.wd-premium-ai-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 17px;
  border-bottom: 1px solid var(--wd-premium-ai-border);
  color: var(--wd-premium-ai-text-soft);
  background: var(--wd-premium-ai-grey);
  font-size: 0.79rem;
  font-weight: 700;
}

.wd-premium-ai-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--wd-premium-ai-green);
  box-shadow: 0 0 0 5px rgba(73, 181, 142, 0.13);
}

/* =========================
   BODY — LIGHT GREY
========================= */

.wd-premium-ai-body {
  height: min(392px, calc(100vh - 342px));
  min-height: 258px;
  overflow: hidden;
  background: var(--wd-premium-ai-grey);
}

.wd-premium-ai-messages {
  height: 100%;
  overflow-y: auto;
  padding: 17px;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 31, 51, 0.26) transparent;
}

.wd-premium-ai-messages::-webkit-scrollbar {
  width: 8px;
}

.wd-premium-ai-messages::-webkit-scrollbar-track {
  background: transparent;
}

.wd-premium-ai-messages::-webkit-scrollbar-thumb {
  background: rgba(15, 31, 51, 0.22);
  border-radius: 999px;
}

.wd-premium-ai-message {
  display: grid;
  gap: 6px;
  margin-bottom: 15px;
}

.wd-premium-ai-message.is-user {
  justify-items: end;
}

.wd-premium-ai-message.is-assistant {
  justify-items: start;
}

.wd-premium-ai-meta {
  color: #6e7c8d;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.wd-premium-ai-bubble {
  max-width: 92%;
  padding: 13px 15px;
  border-radius: 18px;
  font-size: 0.94rem;
  line-height: 1.58;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.wd-premium-ai-message.is-assistant .wd-premium-ai-bubble {
  color: var(--wd-premium-ai-text);
  background: var(--wd-premium-ai-white);
  border: 1px solid rgba(15, 31, 51, 0.08);
  border-top-left-radius: 8px;
}

.wd-premium-ai-message.is-user .wd-premium-ai-bubble {
  color: var(--wd-premium-ai-white);
  background: var(--wd-premium-ai-navy);
  border: 1px solid rgba(15, 31, 51, 0.1);
  border-top-right-radius: 8px;
  font-weight: 600;
}

/* =========================
   ACTION LINKS
========================= */

.wd-premium-ai-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 3px;
}

.wd-premium-ai-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 8px 11px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--wd-premium-ai-white);
  background: var(--wd-premium-ai-navy);
  font-size: 0.78rem;
  font-weight: 800;
}

/* =========================
   TYPING
========================= */

.wd-premium-ai-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 42px;
}

.wd-premium-ai-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--wd-premium-ai-navy);
  animation: wdPremiumAiTyping 1.05s infinite ease-in-out;
}

.wd-premium-ai-typing span:nth-child(2) {
  animation-delay: 0.14s;
}

.wd-premium-ai-typing span:nth-child(3) {
  animation-delay: 0.28s;
}

@keyframes wdPremiumAiTyping {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.36;
  }

  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* =========================
   PROMPT PILLS — DARK NAVY
========================= */

.wd-premium-ai-prompts {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 17px 15px;
  background: var(--wd-premium-ai-grey);
  scrollbar-width: none;
}

.wd-premium-ai-prompts::-webkit-scrollbar {
  display: none;
}

.wd-premium-ai-prompts.is-collapsed {
  display: none;
}

.wd-premium-ai-prompt {
  flex: 0 0 auto;
  max-width: 260px;
  border: 0;
  border-radius: 999px;
  padding: 10px 13px;
  cursor: pointer;
  color: var(--wd-premium-ai-white);
  background: var(--wd-premium-ai-navy);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 760;
  white-space: nowrap;
  transition: background 160ms ease, transform 160ms ease;
}

.wd-premium-ai-prompt:hover {
  background: var(--wd-premium-ai-navy-3);
  transform: translateY(-1px);
}

/* =========================
   FOOTER / INPUT — CONTAINED
========================= */

.wd-premium-ai-footer {
  padding: 14px 17px 16px;
  border-top: 1px solid var(--wd-premium-ai-border);
  background: var(--wd-premium-ai-grey);
}

.wd-premium-ai-form {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px;
  gap: 10px;
  align-items: center;
}

.wd-premium-ai-input {
  width: 100%;
  min-width: 0;
  height: 48px;
  border: 1px solid var(--wd-premium-ai-border-strong);
  border-radius: 999px;
  padding: 0 16px;
  color: var(--wd-premium-ai-text);
  background: var(--wd-premium-ai-white);
  font: inherit;
  font-size: 0.93rem;
  outline: none;
}

.wd-premium-ai-input::placeholder {
  color: #7c8998;
}

.wd-premium-ai-input:disabled {
  opacity: 0.66;
  cursor: not-allowed;
}

.wd-premium-ai-send {
  width: 86px;
  min-width: 86px;
  height: 48px;
  border: 0;
  border-radius: 999px;
  padding: 0 16px;
  cursor: pointer;
  color: var(--wd-premium-ai-white);
  background: var(--wd-premium-ai-navy);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 850;
  text-align: center;
  white-space: nowrap;
}

.wd-premium-ai-send:hover {
  background: var(--wd-premium-ai-navy-3);
}

.wd-premium-ai-send:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.wd-premium-ai-note {
  margin-top: 10px;
  color: var(--wd-premium-ai-text-soft);
  font-size: 0.73rem;
  line-height: 1.5;
}

.wd-premium-ai-note[hidden],
.wd-premium-ai-powered[hidden] {
  display: none !important;
}

.wd-premium-ai-powered {
  display: inline-flex;
  margin-top: 8px;
  color: var(--wd-premium-ai-text-soft);
  font-size: 0.72rem;
  text-decoration: none;
}

/* =========================
   MOBILE
========================= */

@media (max-width: 560px) {
  .wd-premium-ai-widget {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }

  .wd-premium-ai-launcher {
    width: 68px;
    height: 68px;
    margin-left: auto;
  }

  .wd-premium-ai-launcher-avatar {
    width: 68px;
    height: 68px;
  }

  .wd-premium-ai-panel {
    left: 0;
    right: 0;
    bottom: 82px;
    width: auto;
    max-height: calc(100vh - 102px);
    border-radius: 22px;
  }

  .wd-premium-ai-header {
    grid-template-columns: 42px minmax(0, 1fr) 38px;
    padding: 15px;
  }

  .wd-premium-ai-header-avatar {
    width: 42px;
    height: 42px;
  }

  .wd-premium-ai-title {
    font-size: 0.98rem;
  }

  .wd-premium-ai-subtitle {
    font-size: 0.79rem;
    line-height: 1.4;
  }

  .wd-premium-ai-body {
    height: calc(100vh - 350px);
    min-height: 230px;
  }

  .wd-premium-ai-messages {
    padding: 15px;
  }

  .wd-premium-ai-prompts {
    padding-left: 15px;
    padding-right: 15px;
  }

  .wd-premium-ai-footer {
    padding: 13px 15px 15px;
  }

  .wd-premium-ai-form {
    grid-template-columns: minmax(0, 1fr) 78px;
    gap: 8px;
  }

  .wd-premium-ai-send {
    width: 78px;
    min-width: 78px;
    padding: 0 12px;
  }
}

@media (max-width: 380px) {
  .wd-premium-ai-form {
    grid-template-columns: 1fr;
  }

  .wd-premium-ai-send {
    width: 100%;
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wd-premium-ai-launcher,
  .wd-premium-ai-panel,
  .wd-premium-ai-close,
  .wd-premium-ai-prompt {
    transition: none !important;
  }

  .wd-premium-ai-typing span {
    animation: none !important;
  }
}
/* =========================================================
   Elite final overrides
   Version: elite-client-ui-v6-fullpage-avatar-fallback
   - Transparent avatar image: no bubble, no background.
   - If avatar fails/missing: show text fallback "AI Agent" with icon.
   - Light premium panel with dark lining.
   - Expand mode creates full-page premium chat canvas.
========================================================= */

.wd-premium-ai-widget[data-premium-plan-key="elite"],
.wd-premium-ai-widget[data-premium-variant="elite"] {
  --wd-premium-ai-navy: #0a1020;
  --wd-premium-ai-navy-2: #101a2c;
  --wd-premium-ai-navy-3: #1a2a46;
  --wd-premium-ai-grey: #f4f7fb;
  --wd-premium-ai-grey-2: #e8eef6;
  --wd-premium-ai-grey-3: #d8e1ed;
  --wd-premium-ai-white: #ffffff;
  --wd-premium-ai-text: #101828;
  --wd-premium-ai-text-soft: #516071;
  --wd-premium-ai-text-muted: #697789;
  --wd-premium-ai-accent: #3d42e7;
  --wd-premium-ai-border: rgba(10, 16, 32, 0.16);
  --wd-premium-ai-border-strong: rgba(10, 16, 32, 0.32);
  --wd-premium-ai-shadow: 0 28px 80px rgba(4, 10, 22, 0.32);
}

/* Avatar image remains pure image: no chip, no bubble, no background. */
.wd-premium-ai-launcher-avatar,
.wd-premium-ai-header-avatar {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  object-fit: contain;
}

.wd-premium-ai-launcher-fallback,
.wd-premium-ai-header-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #3540ec;
  background: transparent;
  border: 0;
  box-shadow: none;
  font-weight: 950;
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
}

.wd-premium-ai-launcher-fallback[hidden],
.wd-premium-ai-header-avatar-fallback[hidden] {
  display: none !important;
}

.wd-premium-ai-launcher-fallback {
  min-width: 92px;
  font-size: 0.82rem;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.72);
}

.wd-premium-ai-header-avatar-wrap {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  overflow: visible;
}

.wd-premium-ai-header-avatar-fallback {
  width: auto;
  font-size: 0.72rem;
}

.wd-premium-ai-fallback-icon {
  display: inline-grid;
  place-items: center;
  font-size: 1.05em;
  color: #3540ec;
}

/* Premium light panel with dark lining. */
.wd-premium-ai-panel {
  border: 1.5px solid rgba(10, 16, 32, 0.44);
  outline: 1px solid rgba(255, 255, 255, 0.78);
  outline-offset: -3px;
  background: linear-gradient(180deg, #fbfcff 0%, #f2f6fb 100%);
}

.wd-premium-ai-header {
  grid-template-columns: 46px minmax(0, 1fr) auto;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(239,244,250,0.98));
  color: var(--wd-premium-ai-text);
  border-bottom: 1px solid rgba(10, 16, 32, 0.18);
}

.wd-premium-ai-title {
  color: var(--wd-premium-ai-text);
}

.wd-premium-ai-subtitle {
  color: var(--wd-premium-ai-text-soft);
}

.wd-premium-ai-header-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.wd-premium-ai-close,
.wd-premium-ai-expand {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(10, 16, 32, 0.18);
  border-radius: 999px;
  cursor: pointer;
  color: #111827;
  background: rgba(255, 255, 255, 0.72);
  font-size: 1.25rem;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.wd-premium-ai-close {
  font-size: 1.45rem;
}

.wd-premium-ai-close:hover,
.wd-premium-ai-expand:hover {
  transform: translateY(-1px);
  background: #0a1020;
  color: #ffffff;
  border-color: #0a1020;
}

.wd-premium-ai-status,
.wd-premium-ai-body,
.wd-premium-ai-prompts,
.wd-premium-ai-footer {
  background: transparent;
}

.wd-premium-ai-message.is-assistant .wd-premium-ai-bubble {
  background: rgba(255,255,255,0.92);
  border-color: rgba(10, 16, 32, 0.14);
  box-shadow: 0 10px 30px rgba(10, 16, 32, 0.06);
}

.wd-premium-ai-message.is-user .wd-premium-ai-bubble,
.wd-premium-ai-send,
.wd-premium-ai-prompt,
.wd-premium-ai-action {
  background: linear-gradient(135deg, #0a1020, #2428d8);
}

/* Expanded full-page mode. */
.wd-premium-ai-widget.is-expanded {
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}

.wd-premium-ai-widget.is-expanded::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 20, 0.34);
  backdrop-filter: blur(10px);
  pointer-events: auto;
}

.wd-premium-ai-widget.is-expanded .wd-premium-ai-launcher {
  display: none;
}

.wd-premium-ai-widget.is-expanded .wd-premium-ai-panel {
  position: fixed;
  left: 50%;
  right: auto;
  top: 50%;
  bottom: auto;
  width: min(1120px, calc(100vw - 40px));
  height: min(900px, calc(100vh - 40px));
  max-height: none;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center center;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  pointer-events: auto;
  border-radius: 30px;
}

.wd-premium-ai-widget.is-expanded .wd-premium-ai-body {
  height: auto;
  min-height: 0;
}

.wd-premium-ai-widget.is-expanded .wd-premium-ai-messages {
  padding: 24px;
}

.wd-premium-ai-widget.is-expanded .wd-premium-ai-bubble {
  max-width: min(820px, 88%);
}

@media (max-width: 760px) {
  .wd-premium-ai-widget.is-expanded .wd-premium-ai-panel {
    inset: 0;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    transform: none;
  }

  .wd-premium-ai-widget.is-expanded::before {
    display: none;
  }

  .wd-premium-ai-header {
    grid-template-columns: 42px minmax(0, 1fr) auto;
  }

  .wd-premium-ai-header-controls {
    gap: 6px;
  }

  .wd-premium-ai-close,
  .wd-premium-ai-expand {
    width: 38px;
    height: 38px;
  }
}
