@import "https://fonts.googleapis.com/css2?family=Manrope:wght@200..800&family=Saira:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap";

html[data-ui-whatsynaptor="active"] {
  --bg: #12141a !important;
  --bg-accent: #14161d !important;
  --bg-elevated: #1a1d25 !important;
  --bg-hover: #262a35 !important;
  --bg-muted: #262a35 !important;
  --card: #181b22 !important;
  --card-foreground: #f4f4f5 !important;
  --popover: #181b22 !important;
  --popover-foreground: #f4f4f5 !important;
  --panel: #12141a !important;
  --panel-strong: #1a1d25 !important;
  --panel-hover: #262a35 !important;
  --chrome: rgba(18, 20, 26, 0.95) !important;
  --chrome-strong: rgba(18, 20, 26, 0.98) !important;
  --text: #e4e4e7 !important;
  --text-strong: #fafafa !important;
  --chat-text: #e4e4e7 !important;
  --muted: #71717a !important;
  --muted-strong: #52525b !important;
  --muted-foreground: #71717a !important;
  --border: #27272a !important;
  --border-strong: #3f3f46 !important;
  --border-hover: #52525b !important;
  --input: #27272a !important;
  --accent: var(--ui-brand-accent, var(--accent));
  --primary: var(--ui-brand-accent, var(--primary));
  --ring: var(--ui-brand-accent, var(--ring));
  --accent-hover: var(--ui-brand-accent-hover, var(--accent-hover));
  --accent-muted: var(--ui-brand-accent, var(--accent-muted));
  --accent-glow: var(--ui-brand-accent-glow, var(--accent-glow));
  --focus: color-mix(in srgb, var(--ui-brand-accent, var(--ring)) 20%, transparent);
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 3px color-mix(in srgb, var(--ui-brand-accent, var(--ring)) 70%, transparent);
  --font-body: var(--ui-brand-font-body, var(--font-body));
  --font-display: var(--ui-brand-font-display, var(--font-display));
}

html[data-ui-whatsynaptor="active"] body {
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--ui-brand-accent-glow, transparent) 72%, transparent), transparent 28%),
    var(--bg);
}

html[data-ui-whatsynaptor="active"] .login-gate__header {
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
}

html[data-ui-whatsynaptor="active"] .login-gate__logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

html[data-ui-whatsynaptor="active"] .login-gate__title {
  font-family: "Saira", var(--ui-brand-font-display, var(--font-display));
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text-strong);
  text-transform: none;
}

html[data-ui-whatsynaptor="active"] .login-gate__sub {
  font-family: "Manrope", var(--ui-brand-font-body, var(--font-body));
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1.2;
  color: var(--muted);
  text-transform: uppercase;
}

html[data-ui-whatsynaptor="active"] .topbar-video-layer,
html[data-ui-whatsynaptor="active"] .ui-whatsynaptor-topbar-video-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  clip-path: inset(0);
  contain: paint;
  pointer-events: none;
}

html[data-ui-whatsynaptor="active"] .topbar-video,
html[data-ui-whatsynaptor="active"] .ui-whatsynaptor-topbar-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: none;
  filter: brightness(.9) saturate(1.2);
}

html[data-ui-whatsynaptor="active"] .topbar-video-scrim,
html[data-ui-whatsynaptor="active"] .ui-whatsynaptor-topbar-video-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #06091247, #0609123d),
    linear-gradient(90deg, #0609122e, #0609120f 45%, #06091229);
}

html[data-ui-whatsynaptor="active"] .topbar,
html[data-ui-whatsynaptor="active"] [class*="topbar"],
html[data-ui-whatsynaptor="active"] header {
  position: relative;
  isolation: isolate;
}

html[data-ui-whatsynaptor="active"] .topbar > *,
html[data-ui-whatsynaptor="active"] [class*="topbar"] > *,
html[data-ui-whatsynaptor="active"] header > * {
  position: relative;
  z-index: 1;
}

html[data-ui-whatsynaptor="active"] .nav-item__icon,
html[data-ui-whatsynaptor="active"] .nav-collapse-toggle__icon,
html[data-ui-whatsynaptor="active"] .nav-item__external-icon {
  color: var(--ui-brand-accent, var(--accent)) !important;
  text-shadow: none;
}

html[data-ui-whatsynaptor="active"] .topbar-theme-mode {
  display: none !important;
}

html[data-ui-whatsynaptor-custom-page] .content-header {
  display: none !important;
}

html[data-ui-whatsynaptor="active"] .ui-whatsynaptor-page {
  display: flex;
  width: 100%;
  min-height: calc(100vh - 56px);
  padding: 10px;
  background: var(--bg);
  box-sizing: border-box;
  overflow: auto;
}

html[data-ui-whatsynaptor="active"] .ui-whatsynaptor-browser-shell {
  position: relative;
  display: flex;
  width: min(100%, 1600px);
  height: min(920px, calc(100vh - 76px));
  min-width: 420px;
  min-height: 420px;
  margin: 0 auto;
  overflow: hidden;
  resize: both;
  border: 1px solid color-mix(in srgb, var(--ui-brand-accent, #5da78b) 74%, var(--border));
  border-radius: 8px;
  background: #000;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--ui-brand-accent, #5da78b) 22%, transparent),
    0 18px 48px rgba(0, 0, 0, 0.32);
  animation: ui-whatsynaptor-frame-pulse 2.8s ease-in-out infinite;
}

html[data-ui-whatsynaptor="active"] .ui-whatsynaptor-browser-shell:hover,
html[data-ui-whatsynaptor="active"] .ui-whatsynaptor-browser-shell:focus-within {
  border-color: var(--ui-brand-accent-hover, #74b89d);
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--ui-brand-accent, #5da78b) 34%, transparent),
    0 20px 54px rgba(0, 0, 0, 0.38);
}

html[data-ui-whatsynaptor="active"] .ui-whatsynaptor-browser-shell::after {
  content: "";
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 22px;
  height: 22px;
  pointer-events: none;
  border-right: 3px solid var(--ui-brand-accent-hover, #74b89d);
  border-bottom: 3px solid var(--ui-brand-accent-hover, #74b89d);
  border-radius: 0 0 5px 0;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--ui-brand-accent, #5da78b) 72%, transparent));
}

html[data-ui-whatsynaptor="active"] .ui-whatsynaptor-browser-shell::before {
  content: "";
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 15px;
  height: 15px;
  pointer-events: none;
  background:
    linear-gradient(135deg, transparent 0 42%, color-mix(in srgb, var(--ui-brand-accent-hover, #74b89d) 86%, transparent) 44% 52%, transparent 54%),
    linear-gradient(135deg, transparent 0 68%, color-mix(in srgb, var(--ui-brand-accent-hover, #74b89d) 76%, transparent) 70% 78%, transparent 80%);
}

html[data-ui-whatsynaptor="active"] .ui-whatsynaptor-browser-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  display: flex;
  gap: 8px;
  align-items: center;
}

html[data-ui-whatsynaptor="active"] .ui-whatsynaptor-browser-control {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  color: var(--text-strong, #fafafa);
  border: 1px solid color-mix(in srgb, var(--ui-brand-accent, #5da78b) 58%, rgba(255, 255, 255, 0.18));
  border-radius: 8px;
  background: color-mix(in srgb, #0b0d12 72%, transparent);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--ui-brand-accent, #5da78b) 16%, transparent),
    0 10px 24px rgba(0, 0, 0, 0.34);
  cursor: pointer;
  opacity: 0.74;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease,
    transform 160ms ease;
}

html[data-ui-whatsynaptor="active"] .ui-whatsynaptor-browser-control:hover,
html[data-ui-whatsynaptor="active"] .ui-whatsynaptor-browser-control:focus-visible {
  opacity: 1;
  border-color: var(--ui-brand-accent-hover, #74b89d);
  background: color-mix(in srgb, #0b0d12 86%, var(--ui-brand-accent, #5da78b) 14%);
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--ui-brand-accent, #5da78b) 26%, transparent),
    0 12px 28px rgba(0, 0, 0, 0.4);
  outline: none;
  transform: translateY(-1px);
}

html[data-ui-whatsynaptor="active"] .ui-whatsynaptor-browser-fullscreen--error {
  border-color: #ef4444;
  color: #fecaca;
}

html[data-ui-whatsynaptor="active"] .ui-whatsynaptor-browser-control svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

html[data-ui-whatsynaptor="active"] .ui-whatsynaptor-browser-refresh--active svg {
  animation: ui-whatsynaptor-refresh-spin 700ms ease;
}

html[data-ui-whatsynaptor="active"] .ui-whatsynaptor-browser-shell:fullscreen {
  width: 100vw;
  height: 100vh;
  min-width: 0;
  min-height: 0;
  margin: 0;
  resize: none;
  border: 0;
  border-radius: 0;
  animation: none;
}

html[data-ui-whatsynaptor="active"] .ui-whatsynaptor-browser-shell:fullscreen::before,
html[data-ui-whatsynaptor="active"] .ui-whatsynaptor-browser-shell:fullscreen::after {
  display: none;
}

html[data-ui-whatsynaptor="active"] .ui-whatsynaptor-browser-shell:fullscreen .ui-whatsynaptor-browser-controls {
  top: 14px;
  right: 14px;
}

html[data-ui-whatsynaptor="active"] .ui-whatsynaptor-browser {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100%;
  border: 0;
  background: #000;
}

@keyframes ui-whatsynaptor-frame-pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 1px color-mix(in srgb, var(--ui-brand-accent, #5da78b) 18%, transparent),
      0 18px 48px rgba(0, 0, 0, 0.32);
  }
  50% {
    box-shadow:
      0 0 0 3px color-mix(in srgb, var(--ui-brand-accent, #5da78b) 30%, transparent),
      0 18px 48px rgba(0, 0, 0, 0.32);
  }
}

@keyframes ui-whatsynaptor-refresh-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-ui-whatsynaptor="active"] .topbar {
    background: var(--bg);
  }

  html[data-ui-whatsynaptor="active"] .whatsapp-guide-btn,
  html[data-ui-whatsynaptor="active"] .whatsapp-guide-btn__icon {
    animation: none;
  }

  html[data-ui-whatsynaptor="active"] .ui-whatsynaptor-browser-shell {
    animation: none;
  }
}

/* ui-patcher hardcoded accent cleanup */
html[data-ui-whatsynaptor="active"]:root[data-theme="light"] .chat-group.user .chat-bubble,
html[data-ui-whatsynaptor="active"]:root[data-theme="light"] .chat-line.user .chat-bubble {
  border-color: color-mix(in srgb, var(--ui-brand-accent, #3d8f6e) 20%, transparent) !important;
  background: color-mix(in srgb, var(--ui-brand-accent, #3d8f6e) 12%, transparent) !important;
}

html[data-ui-whatsynaptor="active"]:root[data-theme="light"] .chat-group.user .chat-bubble:hover,
html[data-ui-whatsynaptor="active"]:root[data-theme="light"] .chat-line.user .chat-bubble:hover {
  background: color-mix(in srgb, var(--ui-brand-accent, #3d8f6e) 16%, transparent) !important;
}

html[data-ui-whatsynaptor="active"] .config-changes-badge,
html[data-ui-whatsynaptor="active"] .config-diff,
html[data-ui-whatsynaptor="active"] .config-subnav__item.active {
  border-color: color-mix(in srgb, var(--ui-brand-accent, #3d8f6e) 35%, transparent) !important;
  color: var(--ui-brand-accent, #3d8f6e) !important;
}

html[data-ui-whatsynaptor="active"] .config-diff {
  background: color-mix(in srgb, var(--ui-brand-accent, #3d8f6e) 10%, transparent) !important;
}

html[data-ui-whatsynaptor="active"] .startup-overlay,
html[data-ui-whatsynaptor="active"] .topbar-video-layer,
html[data-ui-whatsynaptor="active"] .ui-whatsynaptor-topbar-video-layer,
html[data-ui-whatsynaptor="active"] .ui-whatsynaptor-loader {
  display: none !important;
}

html[data-ui-whatsynaptor="active"] .agent-chat__avatar--logo,
html[data-ui-whatsynaptor="active"] .chat-avatar.assistant.chat-avatar--logo {
  background-image: url("/plugins/ui-whatsynaptor/assets/logo_animated.svg") !important;
  background-size: contain !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
}

html[data-ui-whatsynaptor="active"] .agent-chat__avatar--logo > img,
html[data-ui-whatsynaptor="active"] .chat-avatar.assistant.chat-avatar--logo > img,
html[data-ui-whatsynaptor="active"] .agent-chat__avatar--logo img[src$="apple-touch-icon.png"],
html[data-ui-whatsynaptor="active"] .chat-avatar.assistant.chat-avatar--logo img[src$="apple-touch-icon.png"],
html[data-ui-whatsynaptor="active"] .agent-chat__avatar--logo img[src$="favicon.svg"],
html[data-ui-whatsynaptor="active"] .chat-avatar.assistant.chat-avatar--logo img[src$="favicon.svg"] {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

html[data-ui-whatsynaptor="active"] .update-banner.callout.danger {
  display: none !important;
}

:root {
  --ui-brand-accent: #5da78b;
  --ui-brand-accent-hover: #74b89d;
  --ui-brand-accent-glow: rgba(93, 167, 139, 0.26);
  --ui-brand-font-body: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ui-brand-font-display: "Saira", "Manrope", sans-serif;
}
