/* WordPress ChatBot — widget styles (shades of #047bdd). */
#wpcb-root {
  --wpcb-accent: #047bdd;
  --wpcb-accent-dark: #035fab;
  --wpcb-bg: #ffffff;
  --wpcb-text: #1b1b1b;
  --wpcb-log-bg: #eef6fd;
  --wpcb-bot-border: #cfe6f8;
}

/* Minimized launcher — a small round message icon. */
.wpcb-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99999;
  width: 60px;
  height: 60px;
  padding: 0;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--wpcb-accent);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(4, 123, 221, 0.4);
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  animation: wpcb-launch-in 0.25s ease;
}

.wpcb-launcher svg {
  display: block;
}

.wpcb-launcher:hover,
.wpcb-send:hover {
  background: var(--wpcb-accent-dark);
}

.wpcb-launcher:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 24px rgba(4, 123, 221, 0.5);
}

/* Author rule so the [hidden] attribute actually hides widget elements
   (a bare display:flex would otherwise override the UA [hidden] style). */
#wpcb-root [hidden] {
  display: none !important;
}

@keyframes wpcb-launch-in {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: scale(1); }
}

.wpcb-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99999;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: var(--wpcb-bg);
  color: var(--wpcb-text);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  font: 14px/1.45 system-ui, sans-serif;
  transform-origin: bottom right;
  animation: wpcb-panel-in 0.18s ease;
}

@keyframes wpcb-panel-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

.wpcb-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.85rem;
  background: var(--wpcb-accent);
  color: #fff;
}

.wpcb-head-meta {
  flex: 1;
  min-width: 0;
}

.wpcb-head-name {
  font-weight: 700;
  line-height: 1.1;
}

.wpcb-head-sub {
  font-size: 12px;
  opacity: 0.85;
  line-height: 1.3;
}

.wpcb-close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
}

/* Avatars (header + agent messages) */
.wpcb-avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  color: var(--wpcb-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6);
}

.wpcb-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wpcb-log {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  background: var(--wpcb-log-bg);
}

.wpcb-msg {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
}

.wpcb-msg--user {
  justify-content: flex-end;
}

.wpcb-msg--agent .wpcb-avatar {
  width: 28px;
  height: 28px;
  box-shadow: none;
}

.wpcb-bubble {
  max-width: 78%;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.wpcb-msg--agent .wpcb-bubble {
  background: #fff;
  border: 1px solid var(--wpcb-bot-border);
}

.wpcb-msg--user .wpcb-bubble {
  background: var(--wpcb-accent);
  color: #fff;
}

.wpcb-link {
  color: inherit;
  text-decoration: underline;
}

/* Pre-chat name gate */
.wpcb-gate {
  margin: auto;
  width: 100%;
  max-width: 280px;
  text-align: center;
  padding: 1rem 0.5rem;
}

.wpcb-gate-label {
  font-weight: 600;
  color: var(--wpcb-text);
  margin-bottom: 0.75rem;
}

.wpcb-gate-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.wpcb-gate-input {
  padding: 0.6rem 0.7rem;
  border: 1px solid #cdd9e3;
  border-radius: 10px;
  font-size: 16px;
  text-align: center;
}

.wpcb-gate-input:focus {
  outline: none;
  border-color: var(--wpcb-accent);
}

.wpcb-gate-btn {
  padding: 0.6rem 0.9rem;
  border: none;
  border-radius: 10px;
  background: var(--wpcb-accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.wpcb-gate-btn:hover {
  background: var(--wpcb-accent-dark);
}

/* Centred system notes ("agent joined", "request sent", …) */
.wpcb-system {
  align-self: center;
  max-width: 90%;
  text-align: center;
  font-size: 12px;
  color: #5b6b7a;
  padding: 0.1rem 0.4rem;
}

/* Typing indicator */
.wpcb-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.wpcb-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--wpcb-accent);
  opacity: 0.4;
  animation: wpcb-bounce 1.2s infinite ease-in-out;
}

.wpcb-typing span:nth-child(2) { animation-delay: 0.15s; }
.wpcb-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes wpcb-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.wpcb-form {
  display: flex;
  gap: 0.4rem;
  padding: 0.6rem;
  border-top: 1px solid #e6eef5;
}

.wpcb-input {
  flex: 1;
  padding: 0.55rem 0.7rem;
  border: 1px solid #cdd9e3;
  border-radius: 10px;
  font-size: 16px; /* prevents iOS focus zoom */
}

.wpcb-input:focus {
  outline: none;
  border-color: var(--wpcb-accent);
}

.wpcb-send {
  padding: 0 0.95rem;
  border: none;
  border-radius: 10px;
  background: var(--wpcb-accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

/* Plain text link — no button fill, no hover/mouseover effect.
   High specificity (#wpcb-root) + !important so the site theme's button
   styles can't turn this into a filled button. */
#wpcb-root .wpcb-report,
#wpcb-root .wpcb-report:hover,
#wpcb-root .wpcb-report:focus,
#wpcb-root .wpcb-report:active {
  display: inline-block;
  width: auto;
  border: none !important;
  background: none !important;
  box-shadow: none !important;
  outline: none !important;
  color: var(--wpcb-accent) !important;
  padding: 0 0.6rem 0.6rem !important;
  margin: 0;
  font: 400 12px/1.4 system-ui, sans-serif;
  text-align: left;
  text-decoration: underline;
  text-transform: none;
  cursor: pointer;
  transform: none !important;
  transition: none !important;
}
