/* Advisor mascot state card
 *
 * All motion and transforms are deliberately scoped to .advisor-assistant so
 * the mascot never alters Lucide icons or other interactive controls.
 */

.advisor-assistant[data-state] {
  --advisor-mascot-size: 152px;
  --advisor-assistant-accent: #1675d1;
  --advisor-assistant-accent-soft: rgba(22, 117, 209, 0.12);
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: calc(var(--advisor-mascot-size) + 24px) minmax(0, 1fr);
  min-width: 0;
  min-height: 196px;
  align-items: center;
  gap: clamp(14px, 3vw, 28px);
  overflow: hidden;
  padding: clamp(18px, 3vw, 26px);
  border: 1px solid
    color-mix(in srgb, var(--advisor-assistant-accent) 22%, var(--line));
  border-radius: var(--radius);
  color: var(--ink);
  background:
    radial-gradient(
      circle at 13% 20%,
      rgba(48, 180, 186, 0.16),
      transparent 34%
    ),
    linear-gradient(
      132deg,
      color-mix(in srgb, var(--surface) 92%, #eaf5ff),
      color-mix(in srgb, var(--surface) 94%, #eafaf7)
    );
  box-shadow:
    0 18px 48px rgba(27, 70, 112, 0.11),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(24px) saturate(145%);
  -webkit-backdrop-filter: blur(24px) saturate(145%);
}

.advisor-assistant[data-state]::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: 0.54;
  background:
    linear-gradient(
      90deg,
      transparent 49%,
      rgba(37, 133, 201, 0.055) 50%,
      transparent 51%
    ),
    linear-gradient(
      transparent 49%,
      rgba(37, 133, 201, 0.045) 50%,
      transparent 51%
    );
  background-size: 28px 28px;
  content: "";
  pointer-events: none;
}

.advisor-assistant[data-state="loading"] {
  --advisor-assistant-accent: #087f87;
  --advisor-assistant-accent-soft: rgba(8, 127, 135, 0.12);
}

.advisor-assistant[data-state="success"] {
  --advisor-assistant-accent: #087b71;
  --advisor-assistant-accent-soft: rgba(8, 123, 113, 0.13);
}

.advisor-assistant[data-state="insufficient"] {
  --advisor-assistant-accent: #a56c16;
  --advisor-assistant-accent-soft: rgba(165, 108, 22, 0.12);
}

.advisor-assistant[data-state="error"] {
  --advisor-assistant-accent: #c33f4a;
  --advisor-assistant-accent-soft: rgba(195, 63, 74, 0.12);
}

.advisor-evidence-status.limited {
  color: #96610e;
  background: rgba(210, 145, 35, 0.14);
}

.advisor-evidence-status.not_found,
.advisor-evidence-status.none {
  color: #a13d48;
  background: rgba(195, 63, 74, 0.12);
}

.advisor-mascot-stage {
  position: relative;
  display: grid;
  width: calc(var(--advisor-mascot-size) + 24px);
  min-width: 0;
  height: calc(var(--advisor-mascot-size) + 20px);
  place-items: center;
  justify-self: center;
  pointer-events: none;
}

.advisor-mascot-frame {
  position: relative;
  z-index: 1;
  display: grid;
  width: var(--advisor-mascot-size);
  height: var(--advisor-mascot-size);
  place-items: end center;
}

/* The mascot is a little taller than wide; size it by its height so it fills the frame. */
.advisor-mascot-frame .uw-mascot {
  --uw-mascot-size: calc(var(--advisor-mascot-size) * 0.8);
  margin-bottom: 4px;
}

/* One mascot, five moods: the same suitcase moves differently for each state of the assistant. */
.advisor-assistant[data-state="loading"] .uw-mascot-body {
  animation: advisor-mascot-loading-bob 1.9s ease-in-out infinite;
}

.advisor-assistant[data-state="loading"] .uw-mascot-eyes {
  animation-duration: 2.2s;
}

.advisor-assistant[data-state="success"] .uw-mascot-body {
  animation: advisor-mascot-success-pop 680ms cubic-bezier(0.2, 0.86, 0.28, 1.18)
    both;
}

.advisor-assistant[data-state="insufficient"] .uw-mascot-body {
  animation: advisor-mascot-insufficient-tilt 720ms ease-out both;
}

.advisor-assistant[data-state="error"] .uw-mascot-body {
  animation: advisor-mascot-error-shake 560ms ease-out both;
}

/* When there is not enough to answer with, the suitcase looks up and to the side, as if thinking. */
.advisor-assistant[data-state="insufficient"] .uw-mascot-eyes,
.advisor-assistant[data-state="error"] .uw-mascot-eyes {
  transform: translate(-1.9%, -1.5%);
  animation: none;
}

.advisor-mascot-scan,
.advisor-mascot-paper,
.advisor-mascot-confetti,
.advisor-mascot-alert {
  position: absolute;
  z-index: 2;
  pointer-events: none;
}

.advisor-mascot-scan {
  top: 30%;
  left: 21%;
  width: 64%;
  height: 2px;
  border-radius: 999px;
  opacity: 0;
  background: linear-gradient(
    90deg,
    transparent,
    #43d7d0 24%,
    #eefeff 50%,
    #43d7d0 76%,
    transparent
  );
  box-shadow: 0 0 11px rgba(47, 210, 203, 0.78);
}

.advisor-assistant[data-state="loading"] .advisor-mascot-scan {
  opacity: 0.86;
  animation: advisor-mascot-scan 1.7s ease-in-out infinite;
}

.advisor-mascot-paper {
  top: 24%;
  width: 28px;
  height: 36px;
  border: 1px solid rgba(31, 115, 183, 0.32);
  border-radius: 5px;
  opacity: 0;
  background:
    linear-gradient(#65a8df, #65a8df) 7px 10px / 14px 2px no-repeat,
    linear-gradient(#8fc4e8, #8fc4e8) 7px 16px / 11px 2px no-repeat,
    linear-gradient(#8fc4e8, #8fc4e8) 7px 22px / 14px 2px no-repeat,
    rgba(250, 254, 255, 0.95);
  box-shadow: 0 7px 15px rgba(27, 83, 133, 0.14);
}

.advisor-mascot-paper.one {
  right: 2%;
  transform: rotate(7deg);
}

.advisor-mascot-paper.two {
  top: 48%;
  left: 0;
  transform: rotate(-8deg) scale(0.9);
}

.advisor-assistant[data-state="loading"] .advisor-mascot-paper.one {
  animation: advisor-mascot-page-one 1.8s ease-in-out infinite;
}

.advisor-assistant[data-state="loading"] .advisor-mascot-paper.two {
  animation: advisor-mascot-page-two 1.8s 420ms ease-in-out infinite;
}

.advisor-mascot-confetti {
  inset: 1% 0 13%;
  opacity: 0;
  background:
    radial-gradient(circle, #26b8a9 0 3px, transparent 4px) 8% 32% / 28px 28px,
    radial-gradient(circle, #f2b84b 0 3px, transparent 4px) 86% 15% / 34px 34px,
    radial-gradient(circle, #438fe5 0 3px, transparent 4px) 90% 72% / 30px 30px,
    radial-gradient(circle, #ff8088 0 2px, transparent 3px) 14% 76% / 26px 26px;
  transform-origin: 50% 55%;
}

.advisor-assistant[data-state="success"] .advisor-mascot-confetti {
  animation: advisor-mascot-confetti-burst 880ms 80ms
    cubic-bezier(0.18, 0.82, 0.24, 1) both;
}

.advisor-mascot-alert {
  top: 6%;
  right: 4%;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  opacity: 0;
  color: #fff;
  background: #d33f4d;
  box-shadow: 0 8px 18px rgba(169, 39, 52, 0.28);
  font-size: 21px;
  font-weight: 850;
  line-height: 1;
}

.advisor-mascot-alert::before {
  width: 4px;
  height: 13px;
  border-radius: 999px;
  background: currentColor;
  content: "";
  transform: translateY(-3px);
}

.advisor-mascot-alert::after {
  position: absolute;
  bottom: 7px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.advisor-assistant[data-state="error"] .advisor-mascot-alert {
  animation: advisor-mascot-alert-pop 520ms 120ms
    cubic-bezier(0.18, 0.88, 0.24, 1.2) both;
}

.advisor-assistant-copy {
  position: relative;
  z-index: 3;
  display: grid;
  min-width: 0;
  justify-items: start;
  gap: 7px;
  padding-right: clamp(0px, 2vw, 16px);
}

.advisor-assistant-eyebrow {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid
    color-mix(in srgb, var(--advisor-assistant-accent) 18%, transparent);
  border-radius: 999px;
  color: var(--advisor-assistant-accent);
  background: var(--advisor-assistant-accent-soft);
  font-size: 11px;
  font-weight: 780;
  letter-spacing: 0.05em;
}

#advisor-assistant-title {
  margin: 0;
  color: var(--ink);
  font-size: clamp(20px, 2.2vw, 26px);
  line-height: 1.25;
  letter-spacing: -0.015em;
}

#advisor-assistant-detail {
  max-width: 520px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.advisor-assistant.is-entering .advisor-mascot-stage,
.advisor-assistant.is-entering .advisor-assistant-copy {
  animation: advisor-mascot-state-enter 420ms cubic-bezier(0.2, 0.76, 0.3, 1)
    both;
}

.advisor-assistant.is-entering .advisor-assistant-copy {
  animation-delay: 50ms;
}

html[data-theme="dark"] .advisor-assistant[data-state] {
  border-color: color-mix(
    in srgb,
    var(--advisor-assistant-accent) 34%,
    var(--line)
  );
  background:
    radial-gradient(
      circle at 13% 20%,
      rgba(35, 166, 171, 0.16),
      transparent 35%
    ),
    linear-gradient(132deg, rgba(19, 34, 51, 0.96), rgba(15, 43, 49, 0.88));
  box-shadow:
    0 20px 52px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .advisor-assistant[data-state]::before {
  opacity: 0.34;
}

html[data-theme="dark"] .advisor-mascot-paper {
  border-color: rgba(103, 188, 226, 0.42);
  background:
    linear-gradient(#74b9e8, #74b9e8) 7px 10px / 14px 2px no-repeat,
    linear-gradient(#4b8db9, #4b8db9) 7px 16px / 11px 2px no-repeat,
    linear-gradient(#4b8db9, #4b8db9) 7px 22px / 14px 2px no-repeat,
    rgba(28, 48, 64, 0.96);
}

@keyframes advisor-mascot-state-enter {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes advisor-mascot-loading-bob {
  0%,
  100% {
    transform: translateY(0) rotate(0.35deg);
  }
  50% {
    transform: translateY(-5px) rotate(-0.35deg);
  }
}

@keyframes advisor-mascot-scan {
  0%,
  100% {
    opacity: 0.18;
    transform: translateY(-26px) scaleX(0.82);
  }
  45%,
  55% {
    opacity: 0.92;
  }
  50% {
    transform: translateY(56px) scaleX(1);
  }
}

@keyframes advisor-mascot-page-one {
  0%,
  18%,
  100% {
    opacity: 0;
    transform: translate(7px, 12px) rotate(11deg) scale(0.84);
  }
  35%,
  70% {
    opacity: 0.9;
  }
  68% {
    transform: translate(-4px, -8px) rotate(3deg) scale(1);
  }
}

@keyframes advisor-mascot-page-two {
  0%,
  16%,
  100% {
    opacity: 0;
    transform: translate(-5px, 11px) rotate(-12deg) scale(0.76);
  }
  34%,
  70% {
    opacity: 0.78;
  }
  68% {
    transform: translate(5px, -8px) rotate(-5deg) scale(0.9);
  }
}

@keyframes advisor-mascot-success-pop {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.86);
  }
  58% {
    opacity: 1;
    transform: translateY(-5px) scale(1.08);
  }
  78% {
    transform: translateY(1px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes advisor-mascot-confetti-burst {
  0% {
    opacity: 0;
    transform: scale(0.56) rotate(-3deg);
  }
  34% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.18) rotate(3deg);
  }
}

@keyframes advisor-mascot-insufficient-tilt {
  0% {
    opacity: 0;
    transform: translateY(4px) rotate(0deg) scale(0.96);
  }
  42% {
    opacity: 1;
    transform: translateY(0) rotate(-4deg) scale(1);
  }
  72% {
    transform: rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: rotate(0deg);
  }
}

@keyframes advisor-mascot-error-shake {
  0% {
    opacity: 0;
    transform: translateX(0) scale(0.97);
  }
  22% {
    opacity: 1;
    transform: translateX(-6px) rotate(-2deg) scale(1);
  }
  42% {
    transform: translateX(6px) rotate(2deg);
  }
  62% {
    transform: translateX(-4px) rotate(-1deg);
  }
  80% {
    transform: translateX(3px) rotate(1deg);
  }
  100% {
    opacity: 1;
    transform: translateX(0) rotate(0deg);
  }
}

@keyframes advisor-mascot-alert-pop {
  0% {
    opacity: 0;
    transform: translateY(5px) scale(0.5);
  }
  68% {
    opacity: 1;
    transform: translateY(-2px) scale(1.12);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 700px) {
  .advisor-assistant[data-state] {
    --advisor-mascot-size: 128px;
    grid-template-columns: 128px minmax(0, 1fr);
    min-height: 166px;
    gap: 10px;
    padding: 14px;
  }

  .advisor-mascot-stage {
    width: 128px;
    height: 148px;
  }

  .advisor-assistant-copy {
    gap: 5px;
    padding-right: 0;
  }

  .advisor-assistant-eyebrow {
    min-height: 26px;
    padding-inline: 8px;
    font-size: 10px;
  }

  #advisor-assistant-title {
    font-size: clamp(17px, 5.2vw, 21px);
  }

  #advisor-assistant-detail {
    font-size: 12px;
    line-height: 1.55;
  }

  .advisor-mascot-alert {
    right: 0;
    width: 30px;
    height: 30px;
    font-size: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .advisor-assistant[data-state],
  .advisor-assistant[data-state] *,
  .advisor-assistant[data-state] *::before,
  .advisor-assistant[data-state] *::after {
    animation: none !important;
    transition: none !important;
  }

  .advisor-assistant .advisor-mascot-scan,
  .advisor-assistant .advisor-mascot-paper,
  .advisor-assistant .advisor-mascot-confetti {
    display: none;
  }

  .advisor-assistant[data-state="error"] .advisor-mascot-alert {
    opacity: 1;
    transform: none;
  }
}
