/* ============================================================
   UNATU Assistant widget styles
   All selectors are namespaced under #unatu-chatbot-root so they
   cannot collide with the host WordPress theme.
   ============================================================ */

#unatu-chatbot-root {
  --uc-primary: #e8730c;          /* brand orange */
  --uc-primary-dark: #c45f06;
  --uc-bg: #ffffff;
  --uc-surface: #f4f6f8;
  --uc-bot-bubble: #f1f3f5;
  --uc-text: #1f2933;
  --uc-text-muted: #6b7280;
  --uc-border: #e5e7eb;
  --uc-user-bubble: var(--uc-primary);
  --uc-user-text: #ffffff;
  --uc-error: #b42318;

  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000; /* above virtually everything */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--uc-text);
}

#unatu-chatbot-root *,
#unatu-chatbot-root *::before,
#unatu-chatbot-root *::after {
  box-sizing: border-box;
}

/* ── Floating button ─────────────────────────────────────── */
.uc-fab {
  position: relative;
  width: 60px;
  height: 60px;
  border: none;
  border-radius: 50%;
  background: var(--uc-primary);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.18s ease, background 0.18s ease;
}
.uc-fab:hover {
  background: var(--uc-primary-dark);
}
.uc-fab:active {
  transform: scale(0.94);
}
.uc-fab:focus-visible {
  outline: 3px solid rgba(232, 115, 12, 0.45);
  outline-offset: 2px;
}
.uc-fab svg {
  width: 28px;
  height: 28px;
}

/* Pulsing ring — continuously grows and fades */
.uc-fab::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--uc-primary);
  z-index: -1;
  animation: uc-pulse 1.8s ease-out infinite;
}
@keyframes uc-pulse {
  0% {
    transform: scale(1);
    opacity: 0.45;
  }
  70% {
    transform: scale(1.6);
    opacity: 0;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}
/* Stop pulsing while the panel is open */
#unatu-chatbot-root.uc-open .uc-fab::after {
  animation: none;
}
@media (prefers-reduced-motion: reduce) {
  .uc-fab::after {
    animation: none;
  }
}

/* ── Proactive greeting bubble (teaser) ──────────────────── */
.uc-teaser {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: 300px;
  max-width: calc(100vw - 40px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease;
}
#unatu-chatbot-root.uc-teaser-open .uc-teaser {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
/* Once the panel is open the teaser is no longer relevant */
#unatu-chatbot-root.uc-open .uc-teaser {
  display: none;
}

.uc-teaser-bubble {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  width: 100%;
  background: var(--uc-bg);
  border: 1px solid var(--uc-border);
  border-radius: 16px;
  border-bottom-right-radius: 4px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  padding: 14px 14px 14px 13px;
  cursor: pointer;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.uc-teaser-bubble:hover {
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.24);
  transform: translateY(-1px);
}
.uc-teaser-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  flex: 0 0 auto;
  background: var(--uc-surface);
  display: flex;
  align-items: center;
  justify-content: center;
}
.uc-teaser-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.uc-teaser-avatar svg {
  width: 20px;
  height: 20px;
}
.uc-teaser-content {
  flex: 1 1 auto;
  min-width: 0;
  padding-right: 14px;
}
.uc-teaser-text {
  margin: 0 0 4px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--uc-text);
}
.uc-teaser-meta {
  margin: 0;
  font-size: 11px;
  color: var(--uc-text-muted);
}
.uc-teaser-dismiss {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--uc-text-muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.uc-teaser-dismiss:hover {
  background: var(--uc-surface);
  color: var(--uc-text);
}
.uc-teaser-reply {
  border: none;
  background: var(--uc-primary);
  color: #fff;
  border-radius: 14px;
  padding: 9px 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(232, 115, 12, 0.35);
  transition: background 0.18s ease;
}
.uc-teaser-reply:hover {
  background: var(--uc-primary-dark);
}

/* Chat panel  */
.uc-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: 370px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 120px);
  background: var(--uc-bg);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
#unatu-chatbot-root.uc-open .uc-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header  */
.uc-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--uc-primary);
  color: #fff;
}
.uc-logo {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  overflow: hidden;
}
.uc-logo svg {
  width: 22px;
  height: 22px;
}
.uc-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.uc-header-text {
  flex: 1 1 auto;
  min-width: 0;
}
.uc-title {
  font-weight: 700;
  font-size: 15px;
  margin: 0;
}
.uc-subtitle {
  font-size: 12px;
  opacity: 0.85;
  margin: 0;
}
.uc-close {
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.uc-close:hover {
  background: rgba(255, 255, 255, 0.18);
}
.uc-close svg {
  width: 20px;
  height: 20px;
}

/* Messages */
.uc-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  background: var(--uc-surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.uc-msg {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.uc-msg-bot {
  align-self: flex-start;
  background: var(--uc-bot-bubble);
  color: var(--uc-text);
  border-bottom-left-radius: 4px;
}
.uc-msg-user {
  align-self: flex-end;
  background: var(--uc-user-bubble);
  color: var(--uc-user-text);
  border-bottom-right-radius: 4px;
}
.uc-msg-error {
  align-self: flex-start;
  background: #fdecec;
  color: var(--uc-error);
  border: 1px solid #f6caca;
  border-bottom-left-radius: 4px;
}
.uc-msg a {
  color: inherit;
  text-decoration: underline;
}

/* Typing indicator */
.uc-typing {
  align-self: flex-start;
  background: var(--uc-bot-bubble);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 12px 14px;
  display: inline-flex;
  gap: 5px;
}
.uc-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--uc-text-muted);
  opacity: 0.5;
  animation: uc-bounce 1.2s infinite ease-in-out;
}
.uc-typing span:nth-child(2) {
  animation-delay: 0.18s;
}
.uc-typing span:nth-child(3) {
  animation-delay: 0.36s;
}
@keyframes uc-bounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

/* Composer  */
.uc-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--uc-border);
  background: var(--uc-bg);
}
.uc-input {
  flex: 1 1 auto;
  resize: none;
  border: 1px solid var(--uc-border);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  color: var(--uc-text);
  max-height: 120px;
  min-height: 42px;
  outline: none;
  background: #fff;
}
.uc-input:focus {
  border-color: var(--uc-primary);
}
.uc-send {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 12px;
  background: var(--uc-primary);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.uc-send:hover:not(:disabled) {
  background: var(--uc-primary-dark);
}
.uc-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.uc-send svg {
  width: 20px;
  height: 20px;
}

/* .uc-footer {
  text-align: center;
  font-size: 11px;
  color: var(--uc-text-muted);
  padding: 0 10px 8px;
  background: var(--uc-bg);
} */

/* Mobile */
@media (max-width: 480px) {
  #unatu-chatbot-root {
    right: 14px;
    bottom: 14px;
  }
  .uc-panel {
    position: fixed;
    right: 10px;
    left: 10px;
    bottom: 84px;
    width: auto;
    max-width: none;
    height: auto;
    top: 64px;
    max-height: none;
  }
  .uc-teaser {
    right: 0;
    bottom: 80px;
    width: 280px;
    max-width: calc(100vw - 28px);
  }
}

/*  Feedback row (like / dislike)*/
#unatu-chatbot-root .uc-feedback {
  align-self: flex-start;
  display: flex;
  gap: 8px;
  align-items: center;
  margin: -4px 0 2px 2px;
  font-size: 12px;
  color: var(--uc-text-muted);
}
#unatu-chatbot-root .uc-fb-btn {
  border: none;
  background: var(--uc-bot-bubble);
  border-radius: 14px;
  padding: 4px 9px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
#unatu-chatbot-root .uc-fb-btn:hover {
  background: #e6e9ec;
}
#unatu-chatbot-root .uc-fb-done {
  color: var(--uc-text-muted);
}
#unatu-chatbot-root .uc-fb-pending {
  font-size: 12px;
  color: var(--uc-text-muted);
}
#unatu-chatbot-root .uc-fb-reason {
  flex-direction: column;
  align-items: stretch;
  width: 84%;
  gap: 6px;
}
#unatu-chatbot-root .uc-fb-input {
  border: 1px solid var(--uc-border);
  border-radius: 10px;
  padding: 8px;
  font: inherit;
  resize: none;
  outline: none;
}
#unatu-chatbot-root .uc-fb-input:focus {
  border-color: var(--uc-primary);
}
#unatu-chatbot-root .uc-fb-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
#unatu-chatbot-root .uc-fb-cancel,
#unatu-chatbot-root .uc-fb-submit {
  border: none;
  border-radius: 10px;
  padding: 6px 12px;
  cursor: pointer;
  font: inherit;
}
#unatu-chatbot-root .uc-fb-cancel {
  background: var(--uc-bot-bubble);
  color: var(--uc-text);
}
#unatu-chatbot-root .uc-fb-submit {
  background: var(--uc-primary);
  color: #fff;
}

/* force icon + button colours regardless of host theme */
#unatu-chatbot-root .uc-fab {
  background: var(--uc-primary) !important;
  color: #fff !important;
}
#unatu-chatbot-root .uc-send {
  background: var(--uc-primary) !important;
  color: #fff !important;
}
#unatu-chatbot-root .uc-teaser-reply {
  background: var(--uc-primary) !important;
  color: #fff !important;
}
#unatu-chatbot-root .uc-close {
  color: #fff !important;
}
#unatu-chatbot-root .uc-fab svg,
#unatu-chatbot-root .uc-close svg,
#unatu-chatbot-root .uc-logo svg,
#unatu-chatbot-root .uc-send svg {
  width: 20px;
  height: 20px;
  color: #fff !important;
  stroke: #fff !important;
}
#unatu-chatbot-root .uc-fab svg {
  width: 28px;
  height: 28px;
}
/* Outline icons must not be filled by theme svg rules */
#unatu-chatbot-root .uc-fab svg [fill="none"],
#unatu-chatbot-root .uc-close svg,
#unatu-chatbot-root .uc-send svg path,
#unatu-chatbot-root .uc-send svg polygon,
#unatu-chatbot-root .uc-send svg line {
  fill: none !important;
  stroke: #fff !important;
}
/* The robot eyes and the send filled dots use currentColor fills — keep white */
#unatu-chatbot-root .uc-logo svg circle[fill] {
  fill: #fff !important;
  stroke: none !important;
}
