/**
 * Assistente SOU — tema nas cores do mascote (coruja SOU).
 * Cookie-Script: canto superior direito.
 */

#cookiescript_injected {
  left: auto !important;
  right: 12px !important;
  top: 72px !important;
  bottom: auto !important;
}

.corujaAjuda--assistant {
  cursor: pointer;
  z-index: 100002 !important;
}

.corujaAjuda--assistant:focus-visible {
  outline: 3px solid rgba(232, 137, 53, 0.65);
  outline-offset: 4px;
  border-radius: 8px;
}

.corujaAjuda--assistant.is-asf-open img {
  filter: drop-shadow(0 0 8px rgba(110, 200, 232, 0.75));
}

.asf-assistant {
  /* Paleta mascote */
  --asf-sky: #6ec8e8;
  --asf-sky-soft: #b8e6f5;
  --asf-sky-bg: #e8f6fb;
  --asf-navy: #1a3558;
  --asf-navy-mid: #243d5c;
  --asf-lime: #8fd96a;
  --asf-orange: #e88935;
  --asf-orange-hover: #d67a28;
  --asf-teal: #2a8b8b;
  --asf-surface: #f6fbfd;
  --asf-bubble-bot: #ffffff;
  --asf-bubble-user: #d4efff;
  --asf-border: rgba(26, 53, 88, 0.14);
  --asf-shadow: 0 14px 44px rgba(26, 53, 88, 0.16);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  position: fixed;
  left: 8px;
  bottom: 4px;
  right: auto;
  z-index: 100001;
  isolation: isolate;
  width: 0;
  height: 0;
  pointer-events: none;
}

.asf-assistant * {
  pointer-events: auto;
}

.asf-assistant__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.asf-assistant__panel {
  position: absolute;
  left: 0;
  right: auto;
  bottom: 76px;
  width: min(400px, calc(100vw - 24px));
  max-height: min(560px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  background: var(--asf-surface);
  border-radius: 16px;
  box-shadow: var(--asf-shadow);
  border: 1px solid var(--asf-border);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.98);
  transform-origin: bottom left;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
}

.asf-assistant.is-open .asf-assistant__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.asf-assistant__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(100deg, var(--asf-navy) 0%, var(--asf-navy-mid) 48%, #1a3558 100%);
  color: #fff;
  border-bottom: 3px solid var(--asf-lime);
  box-shadow: inset 0 -1px 0 rgba(143, 217, 106, 0.35);
}

.asf-assistant__title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.asf-assistant__title strong {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.asf-assistant__subtitle {
  font-size: 11px;
  font-weight: 400;
  color: var(--asf-sky-soft);
  opacity: 0.95;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asf-assistant__close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: rgba(110, 200, 232, 0.2);
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.asf-assistant__close:hover {
  background: rgba(143, 217, 106, 0.35);
  color: #fff;
}

.asf-assistant__messages {
  flex: 1;
  min-height: 220px;
  max-height: 340px;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(180deg, var(--asf-sky-bg) 0%, var(--asf-surface) 38%);
}

.asf-assistant__msg {
  max-width: 92%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
}

.asf-assistant__msg--bot {
  align-self: flex-start;
  background: var(--asf-bubble-bot);
  border: 1px solid var(--asf-border);
  border-left: 3px solid var(--asf-teal);
  border-bottom-left-radius: 4px;
  color: var(--asf-navy);
}

.asf-assistant__msg--user {
  align-self: flex-end;
  background: var(--asf-bubble-user);
  color: var(--asf-navy);
  border: 1px solid rgba(110, 200, 232, 0.45);
  border-bottom-right-radius: 4px;
  box-shadow: 0 1px 0 rgba(26, 53, 88, 0.06);
}

.asf-assistant__msg--error {
  align-self: stretch;
  max-width: 100%;
  background: #fff5f5;
  border: 1px solid rgba(200, 40, 40, 0.35);
  border-radius: 10px;
  color: #8a1c1c;
  font-size: 12px;
}

.asf-assistant__retry-wrap {
  align-self: stretch;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0;
  margin: 0;
}

.asf-assistant__retry-wrap .asf-assistant__msg--error {
  margin: 0;
}

.asf-assistant__retry-btn {
  align-self: flex-start;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--asf-border);
  background: #fff;
  color: var(--asf-navy);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.asf-assistant__retry-btn:hover {
  background: var(--asf-sky-bg);
  border-color: var(--asf-sky);
}

.asf-assistant__retry-btn:focus-visible {
  outline: 3px solid rgba(110, 200, 232, 0.45);
  outline-offset: 2px;
}

/* Estado “processando” enquanto a IA responde */
.asf-assistant__thinking {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 92%;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--asf-border);
  border-left: 3px solid var(--asf-teal);
  border-bottom-left-radius: 4px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 0 rgba(26, 53, 88, 0.06);
}

.asf-assistant__thinking-label {
  font-size: 12px;
  font-weight: 500;
  color: rgba(26, 53, 88, 0.72);
  letter-spacing: 0.01em;
}

.asf-assistant__thinking-dots {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.asf-assistant__thinking-dots > span {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--asf-teal);
  opacity: 0.45;
  animation: asf-thinking-dot 1.05s ease-in-out infinite;
}

.asf-assistant__thinking-dots > span:nth-child(2) {
  animation-delay: 0.14s;
}

.asf-assistant__thinking-dots > span:nth-child(3) {
  animation-delay: 0.28s;
}

@keyframes asf-thinking-dot {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  50% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .asf-assistant__thinking-dots > span {
    animation: none;
    opacity: 0.75;
  }
}

.asf-assistant__hint {
  margin: 0;
  font-size: 11px;
  color: rgba(42, 139, 139, 0.85);
  text-align: center;
  padding: 0 8px 4px;
}

.asf-assistant__external-wrap {
  margin: 4px 0 0;
  text-align: center;
}

.asf-assistant__external {
  font-size: 12px;
  font-weight: 600;
  color: var(--asf-navy);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.asf-assistant__external:hover {
  color: var(--asf-orange);
}

.asf-assistant__composer {
  padding: 12px 14px 16px;
  border-top: 1px solid var(--asf-border);
  background: #fff;
  min-width: 0;
}

.asf-assistant__row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  min-width: 0;
  width: 100%;
}

/* Webflow global: textarea { min-width: 100% !important } */
.asf-assistant textarea.asf-assistant__input {
  flex: 1 1 0% !important;
  min-width: 0 !important;
  max-width: none !important;
  width: auto !important;
  min-height: 44px;
  max-height: 120px;
  padding: 11px 14px;
  border: 1px solid var(--asf-border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  resize: none;
  line-height: 1.4;
  background: #fafdfe;
  color: var(--asf-navy);
  display: block;
  box-sizing: border-box;
}

.asf-assistant textarea.asf-assistant__input:focus {
  outline: none;
  border-color: var(--asf-sky);
  box-shadow: 0 0 0 3px rgba(110, 200, 232, 0.35);
}

.asf-assistant textarea.asf-assistant__input::placeholder {
  color: rgba(42, 139, 139, 0.45);
}

/* Mesmo gradiente do cabeçalho (.asf-assistant__head) */
.asf-assistant__send {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 2px solid rgba(143, 217, 106, 0.85);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, transparent 45%),
    linear-gradient(100deg, var(--asf-navy) 0%, var(--asf-navy-mid) 48%, #1a3558 100%);
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.15s, opacity 0.15s, transform 0.12s, border-color 0.15s;
  box-shadow:
    0 2px 10px rgba(26, 53, 88, 0.35),
    inset 0 -1px 0 rgba(143, 217, 106, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.asf-assistant__send:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
  border-color: var(--asf-lime);
  box-shadow:
    0 4px 14px rgba(26, 53, 88, 0.42),
    inset 0 -1px 0 rgba(143, 217, 106, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.asf-assistant__send:disabled {
  cursor: not-allowed;
  color: #fff !important;
  opacity: 0.88;
  border: 2px solid rgba(143, 217, 106, 0.45) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, transparent 48%),
    linear-gradient(100deg, var(--asf-navy) 0%, var(--asf-navy-mid) 48%, #1a3558 100%) !important;
  box-shadow:
    0 1px 4px rgba(26, 53, 88, 0.2),
    inset 0 -1px 0 rgba(143, 217, 106, 0.15);
  transform: none;
  filter: brightness(0.92) saturate(0.85);
}

.asf-assistant__send.is-loading {
  pointer-events: none;
  opacity: 0.75;
}

@media (max-width: 480px) {
  .asf-assistant__panel {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 100px);
    bottom: 72px;
  }

  .asf-assistant__messages {
    max-height: min(280px, 45vh);
  }

  #cookiescript_injected {
    top: 56px !important;
    right: 8px !important;
    max-width: calc(100vw - 16px);
  }
}
