/*
 * Animated illustrations inside the bento cards for newer features:
 *   .ft-diagnocat  patient header with the Diagnocat pill and a timeline
 *                  whose violet report points pop in one after another
 *   .ft-transfer   a treatment folder dragged from one patient to another;
 *                  the second pass holds Shift and copies instead of moving
 * Pure CSS loops; they pause for prefers-reduced-motion and show the end state.
 */

/* Small "New" badge next to a card title. */
.lp-card h3 .lp-new-badge { margin-left: 8px; vertical-align: 3px; font-size: 9.5px; padding: 3px 7px; }

.ft-figure {
  position: relative;
  margin-top: 22px;
  border-radius: 14px;
  border: 1px solid var(--lp-line);
  background: linear-gradient(180deg, #fbfcfe, #f2f4f8);
  overflow: hidden;
  font-size: 12px;
  color: var(--lp-text);
}

/* ---------- Diagnocat ---------- */

.ft-diagnocat { padding: 16px 18px 18px; }
.ft-dc-header { display: flex; align-items: center; gap: 10px; }
.ft-dc-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #cbd5e1, #94a3b8);
}
.ft-dc-name { display: grid; gap: 4px; }
.ft-dc-name b { width: 92px; height: 8px; border-radius: 4px; background: #cfd6e2; }
.ft-dc-name i { width: 54px; height: 6px; border-radius: 3px; background: #e2e7ef; }
.ft-dc-pill {
  margin-left: auto;
  padding: 5px 11px;
  border-radius: 999px;
  background: #7c3aed;
  color: #fff;
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.01em;
  box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.45);
  animation: ftPulse 4.8s ease-out infinite;
}
.ft-dc-line {
  position: relative;
  height: 64px;
  margin-top: 18px;
}
.ft-dc-line::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 22px;
  height: 2px;
  border-radius: 1px;
  background: #d7dde8;
}
.ft-dc-point {
  position: absolute;
  top: 16px;
  left: var(--x);
  width: 14px; height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: #3b82f6;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
}
.ft-dc-point.is-report {
  background: #8b5cf6;
  transform: scale(0);
  animation: ftPop 4.8s var(--lp-ease) infinite;
  animation-delay: var(--d, 0s);
}
.ft-dc-point span {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--lp-muted);
}
.ft-dc-point.is-report span { color: #6d28d9; }

@keyframes ftPop {
  0%, 12% { transform: scale(0); }
  20% { transform: scale(1.25); }
  26%, 88% { transform: scale(1); }
  96%, 100% { transform: scale(0); }
}
@keyframes ftPulse {
  0%, 40% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.45); }
  60% { box-shadow: 0 0 0 10px rgba(124, 58, 237, 0); }
  100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0); }
}

/* ---------- treatment folder transfer ---------- */

.ft-transfer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 16px 16px 40px;
  min-height: 150px;
}
.ft-patient {
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--lp-line);
  padding: 10px;
  display: grid;
  gap: 7px;
  align-content: start;
}
.ft-patient-title { font-weight: 700; font-size: 11.5px; }
.ft-folder {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: #f1f4f9;
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
}
.ft-folder::before {
  content: "";
  flex: none;
  width: 13px; height: 10px;
  border-radius: 2px;
  background: #f5b740;
  box-shadow: inset 0 3px 0 #f8cd6b;
}
/* The folder in the source patient: fades out when moved, stays when copied. */
.ft-folder.is-source { animation: ftSource 9s var(--lp-ease) infinite; }
/* The folder arriving in the target patient. */
.ft-folder.is-target { animation: ftTarget 9s var(--lp-ease) infinite; }
/* The dragged ghost travelling across. */
.ft-ghost {
  position: absolute;
  left: 26px;
  top: 49px;
  width: calc(50% - 43px);
  box-shadow: 0 10px 22px -8px rgba(15, 23, 42, 0.35);
  background: #fff;
  pointer-events: none;
  animation: ftGhost 9s var(--lp-ease) infinite;
}
.ft-key {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--lp-muted);
  animation: ftKey 9s linear infinite;
}
.ft-key kbd {
  font: inherit;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid #cdd4df;
  border-bottom-width: 2px;
  background: #fff;
  color: var(--lp-text);
}

@keyframes ftGhost {
  0%, 6% { transform: translate(0, 0); opacity: 0; }
  10% { transform: translate(0, 0); opacity: 1; }
  34% { transform: translate(calc(100% + 34px), 0); opacity: 1; }
  40%, 52% { transform: translate(calc(100% + 34px), 0); opacity: 0; }
  56% { transform: translate(0, 0); opacity: 1; }
  80% { transform: translate(calc(100% + 34px), 0); opacity: 1; }
  86%, 100% { transform: translate(calc(100% + 34px), 0); opacity: 0; }
}
@keyframes ftSource {
  0%, 8% { opacity: 1; }
  12%, 44% { opacity: 0.25; }
  48%, 100% { opacity: 1; }
}
@keyframes ftTarget {
  0%, 32% { opacity: 0; transform: scale(0.9); }
  38%, 44% { opacity: 1; transform: none; }
  48%, 78% { opacity: 0; transform: scale(0.9); }
  84%, 96% { opacity: 1; transform: none; }
  100% { opacity: 0; }
}
@keyframes ftKey {
  0%, 50% { opacity: 0.35; }
  52%, 86% { opacity: 1; }
  90%, 100% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
  .ft-dc-point.is-report { animation: none; transform: none; }
  .ft-dc-pill, .ft-key, .ft-folder.is-source { animation: none; }
  .ft-ghost { display: none; }
  .ft-folder.is-target { animation: none; opacity: 1; }
}
