/* The avatar of an agent of Johny (src/views/agentAvatar.ts): Johny's picture in the colour of the area (a „junior wizard“) and the emblem of the
   area centred on its lower right corner. The colours are the ones of the tiles of the areas (kpitiles.css). Copied 1:1 to Finance and Smart. */
.agent-av {
  position: relative;
  display: inline-block;
  flex: none;
  width: var(--av, 36px);
  height: var(--av, 36px);
  border-radius: 50%;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--at) 55%, transparent);
  vertical-align: middle;
}
.agent-av > svg {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}
.at-blue {
  --at: #1f7fc4;
  --at-turn: 0deg;
}
.at-sky {
  --at: #38a3e8;
  --at-turn: -25deg;
}
.at-violet {
  --at: #6a4cc7;
  --at-turn: 35deg;
}
.at-amber {
  --at: #e08a00;
  --at-turn: 170deg;
}
.at-green {
  --at: #1e8e3e;
  --at-turn: -110deg;
}
.at-red {
  --at: #c62828;
  --at-turn: 120deg;
}
.at-teal {
  --at: #0e8a7d;
  --at-turn: -70deg;
}
.at-slate {
  --at: #64748b;
  --at-turn: 0deg;
}
/* alive only with the effects on (the switch Animační efekty, html[data-fx], alone decides) */
html:not([data-fx='off']) .agent-av {
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease;
}
html:not([data-fx='off']) .agent-av:hover,
html:not([data-fx='off']) :hover > .agent-av,
html:not([data-fx='off']) .agent-av:active {
  transform: translateY(-2px);
  box-shadow:
    0 0 0 2px var(--at),
    0 4px 14px color-mix(in srgb, var(--at) 45%, transparent);
}
html:not([data-fx='off']) .agent-av.is-working {
  animation: agent-emb-pulse 1.8s ease-in-out infinite;
}

@keyframes agent-emb-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, #ea580c 55%, transparent);
  }
  50% {
    box-shadow: 0 0 0 5px color-mix(in srgb, #ea580c 0%, transparent);
  }
}
.agent-av.is-working {
  box-shadow: 0 0 0 2px var(--sd-color-orange-600, #ea580c);
}
/* the agents of a message in the chat: „Johny › agent“ with its avatar, above the text */
.johny-agents {
  display: flex;
  align-self: stretch;
  justify-content: flex-start;
  text-align: left;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-bottom: 6px;
}
.johny-agent {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
/* the groups of the agents on the page of Johny: a small heading in the colour of the group, the agents of the group in it */
.agent-group + .agent-group {
  margin-top: 6px;
}
.agent-gh {
  margin: 8px 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: color-mix(in srgb, var(--at, #1f7fc4) 80%, var(--ink, #162033));
}
html[data-theme='dark'] .agent-gh {
  color: color-mix(in srgb, var(--at, #1f7fc4) 70%, #fff);
}
/* the small window of an agent (hover, focus or a tap on its avatar): its name, what it does now, its last result with a link */
.agent-hold {
  position: relative;
  display: inline-flex;
  flex: none;
  border-radius: 50%;
  outline-offset: 4px;
}
.agent-pop {
  position: absolute;
  left: 0;
  top: calc(100% + 10px);
  z-index: 30;
  display: none;
  flex-direction: column;
  gap: 4px;
  width: max-content;
  max-width: min(320px, 80vw);
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.16);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
}
.agent-pop b {
  font-weight: 700;
}
.agent-pop span,
.agent-pop a {
  display: flex;
  gap: 6px;
  align-items: baseline;
  overflow-wrap: anywhere;
}
.agent-hold:hover > .agent-pop,
.agent-hold:focus-within > .agent-pop {
  display: flex;
}
/* the live dot of the state of an agent beside its name: orange pulsing = works or watches, orange ? = waits for you, green = free */
.agent-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 10px;
  height: 10px;
  margin-left: 8px;
  border-radius: 50%;
  vertical-align: middle;
  background: var(--sd-color-green-600, #16a34a);
}
.agent-dot.is-busy {
  background: var(--sd-color-orange-600, #ea580c);
}
.agent-dot.is-ask {
  width: 16px;
  height: 16px;
  background: var(--sd-color-orange-600, #ea580c);
  color: #fff;
  font-size: 9px;
}
html:not([data-fx='off']) .agent-dot.is-busy {
  animation: agent-emb-pulse 1.8s ease-in-out infinite;
}

.badge.agent-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  vertical-align: middle;
  font-size: 12px;
}
/* the trail in the chat: the agents Johny sent go off into the distance (a few steps, a little bob, smaller and fading), a group together;
   back = a green ring and a tick. Without the effects (the switch Animační efekty alone decides): the avatars stand still with the state. */
.agent-trail {
  display: flex;
  align-self: stretch;
  justify-content: flex-start;
  text-align: left;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
.agent-trail .agent-walk {
  display: inline-flex;
  min-width: 64px;
}
.agent-trail .agent-walk .agent-av + .agent-av {
  margin-left: -8px;
}
.agent-trail.is-done .agent-av {
  box-shadow: 0 0 0 2px var(--sd-color-green-600, #16a34a);
}
/* the agents as chips and the state as its own chip, on one axis with the avatars */
.agent-trail-text {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.agent-trail.is-going .agent-av {
  box-shadow: 0 0 0 2px var(--sd-color-orange-600, #ea580c);
}
html:not([data-fx='off']) .agent-trail.is-going.is-fresh .agent-walk .agent-av {
  animation: agent-walk 3.2s ease-in-out 3 alternate;
}
html:not([data-fx='off']) .agent-trail.is-going.is-fresh .agent-walk .agent-av:nth-child(2) {
  animation-delay: 0.25s;
}
html:not([data-fx='off']) .agent-trail.is-going.is-fresh .agent-walk .agent-av:nth-child(3) {
  animation-delay: 0.5s;
}

@keyframes agent-walk {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  20% {
    transform: translate(10px, -2px) scale(0.92);
  }
  40% {
    transform: translate(20px, 0) scale(0.84);
  }
  60% {
    transform: translate(30px, -2px) scale(0.76);
  }
  80% {
    transform: translate(40px, 0) scale(0.68);
    opacity: 0.7;
  }
  100% {
    transform: translate(48px, -1px) scale(0.6);
    opacity: 0;
  }
}
/* the scene of the expedition (public/js/agentforest.js, from RARELO) and the home of the agents on the page of Johny: the whole width, its
   own proportions; with the effects on it tilts a little with the pointer and the wizards move against the land (public/js/agentmap.js) */
.agent-forest,
.agent-map {
  position: relative;
  width: 100%;
  aspect-ratio: 640 / 260;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 8px;
}
.agent-forest > svg,
.agent-map > svg {
  display: block;
  width: 100%;
  height: 100%;
}
.agent-map .nf-wiz,
.agent-forest .nf-wiz {
  cursor: pointer;
}
/* the scene at the last message with agents in the chat (public/js/johny-chat.js forestOf, like RARELO AgentForest): with the effects on
   (the switch alone decides) the wizards walk; it never turns with the pointer (the owner, 30. 11. 2026); the bubble of a wizard under it */
.agent-forest-wrap {
  align-self: stretch;
  margin-bottom: 8px;
}
.agent-forest-wrap > .agent-forest {
  margin-bottom: 0;
  cursor: pointer;
}
.agent-forest-wrap > .agent-forest {
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.22);
}
.agent-forest-say {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 0;
  padding: 6px 6px 6px 10px;
  border-radius: 12px;
  background: var(--paper, #fff);
  border: 1px solid var(--line);
  font-size: 13px;
  text-align: left;
}
.agent-forest-say[hidden] {
  display: none;
}
.agent-say-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}
.agent-say-n {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}
/* the number in a circle of the colour of the agent (grey when nothing); the text dark on the tint, so the contrast holds in every colour */
.agent-say-c {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
  color: var(--ink, #162033);
  background: color-mix(in srgb, var(--at) 18%, transparent);
  box-shadow: inset 0 0 0 2px var(--at);
}
.agent-say-c.is-zero {
  color: var(--muted);
  background: var(--soft2, #eef1f5);
  box-shadow: inset 0 0 0 2px var(--line);
}
html[data-theme='dark'] .agent-say-c {
  color: #fff;
}
html[data-theme='dark'] .agent-say-c.is-zero {
  color: var(--muted);
}
.agent-say-chip {
  white-space: normal;
}
.agent-say-x {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
@media (pointer: coarse), (max-width: 640px) {
  .agent-say-x {
    width: 44px;
    height: 44px;
  }
}
html:not([data-fx='off']) .agent-map .nf-wiz:hover,
html:not([data-fx='off']) .agent-map .nf-wiz.is-picked {
  filter: drop-shadow(0 0 6px #ffe9b8) brightness(1.12);
}
.agent-map > .agent-pop {
  display: flex;
}
.agent-map > .agent-pop[hidden] {
  display: none;
}
/* more instances than the scene holds: „+N“ in the corner of the map */
.agent-map > .agent-map-more {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
}
.agent-trail .agent-trail-text {
  flex: 1 1 auto;
  justify-content: flex-start;
}
