/* AXIOM_PROFIT_PERFORMANCE_V1 */

#axiomTop24hProfitCard {
  --profit-accent: #43e4a0;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  box-sizing: border-box;
  width: min(760px, calc(100% - 32px));
  margin: 22px auto 28px;
  padding: clamp(19px, 3vw, 27px);
  overflow: hidden;
  color: #eef6ff;
  background:
    radial-gradient(ellipse at 100% 0%, rgba(44, 177, 124, .19), transparent 42%),
    radial-gradient(ellipse at 0% 100%, rgba(61, 111, 190, .13), transparent 48%),
    linear-gradient(140deg, #13243a 0%, #0b1524 58%, #101e30 100%);
  border: 1px solid rgba(83, 224, 166, .28);
  border-radius: 20px;
  box-shadow:
    0 16px 42px rgba(0, 0, 0, .24),
    0 0 30px rgba(40, 208, 137, .07),
    inset 0 1px 0 rgba(255, 255, 255, .055);
  font-family: inherit;
}

#axiomTop24hProfitCard::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, #9af6ca, #22c982, #167e9a);
}

#axiomTop24hProfitCard::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: -50%;
  bottom: -50%;
  left: -35%;
  width: 24%;
  transform: skewX(-24deg);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(139, 255, 200, .055),
    transparent
  );
  animation: axiomProfitCardShimmer 7s ease-in-out infinite;
  pointer-events: none;
}

#axiomTop24hProfitCard .apf-left {
  display: flex;
  align-items: center;
  gap: 15px;
  min-width: 0;
}

#axiomTop24hProfitCard .apf-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  color: #67efb1;
  background: rgba(39, 198, 132, .12);
  border: 1px solid rgba(83, 224, 166, .25);
  border-radius: 15px;
  box-shadow: 0 0 22px rgba(38, 213, 137, .08);
}

#axiomTop24hProfitCard .apf-icon svg {
  display: block;
  width: 25px;
  height: 25px;
}

#axiomTop24hProfitCard .apf-label {
  margin: 0 0 7px;
  color: #c0cde0;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .14em;
  line-height: 1.4;
  text-transform: uppercase;
}

#axiomTop24hProfitCard .apf-subtitle {
  margin: 0;
  color: #839ab4;
  font-size: 12px;
  line-height: 1.5;
}

#axiomTop24hProfitCard .apf-right {
  min-width: 0;
  text-align: right;
}

#axiomTop24hProfitCard .apf-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-bottom: 8px;
  padding: 5px 9px;
  color: #8af0bd;
  background: rgba(30, 188, 119, .10);
  border: 1px solid rgba(72, 221, 151, .18);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .09em;
  white-space: nowrap;
}

#axiomTop24hProfitCard .apf-status-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  background: #41e69a;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(65, 230, 154, .65);
  animation: axiomProfitDotPulse 2s ease-in-out infinite;
}

#axiomTop24hProfitCard .apf-value {
  display: block;
  color: #6aefb0;
  font-size: clamp(24px, 4.2vw, 35px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 24px rgba(66, 229, 156, .14);
  white-space: nowrap;
}

#axiomTop24hProfitCard.is-negative .apf-value {
  color: #ff929c;
  text-shadow: 0 0 24px rgba(255, 90, 112, .13);
}

#axiomTop24hProfitCard.value-updated .apf-value {
  animation: axiomProfitValuePop .45s ease-out;
}

@keyframes axiomProfitCardShimmer {
  0%, 65% { left: -35%; opacity: 0; }
  72% { opacity: 1; }
  90%, 100% { left: 125%; opacity: 0; }
}

@keyframes axiomProfitDotPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px rgba(65, 230, 154, .45); }
  50% { opacity: .65; box-shadow: 0 0 15px rgba(65, 230, 154, .8); }
}

@keyframes axiomProfitValuePop {
  0% { opacity: .65; transform: translateY(3px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Keep the lower legend available to the existing calculation as a fallback,
   but display the profit only once above the graph. */
#graphContainer #legendProfit {
  display: none !important;
}

/* Hide the old mobile chart profit card whenever the chart script creates it. */
#graphContainer > :has(#axiomMobileV5ProfitValue) {
  display: none !important;
}

@media (max-width: 480px) {
  #axiomTop24hProfitCard {
    grid-template-columns: minmax(0, 1fr);
    gap: 17px;
    width: calc(100% - 24px);
    margin: 17px auto 22px;
    padding: 18px;
    border-radius: 17px;
  }

  #axiomTop24hProfitCard .apf-right {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 14px;
    border-top: 1px solid rgba(168, 195, 221, .12);
    text-align: left;
  }

  #axiomTop24hProfitCard .apf-status {
    margin-bottom: 0;
  }

  #axiomTop24hProfitCard .apf-value {
    font-size: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #axiomTop24hProfitCard::after,
  #axiomTop24hProfitCard .apf-status-dot,
  #axiomTop24hProfitCard.value-updated .apf-value {
    animation: none !important;
  }
}

/* AXIOM_PROFIT_COMPACT_V2 */

#axiomTop24hProfitCard {
  width: min(660px, calc(100% - 32px));
  margin: 15px auto 21px;
  padding: 13px 20px;
  gap: 12px;
  border-radius: 16px;
}

#axiomTop24hProfitCard .apf-left {
  gap: 12px;
}

#axiomTop24hProfitCard .apf-icon {
  width: 40px;
  height: 40px;
  flex-basis: 40px;
  border-radius: 12px;
}

#axiomTop24hProfitCard .apf-icon svg {
  width: 22px;
  height: 22px;
}

#axiomTop24hProfitCard .apf-label {
  margin: 0;
  font-size: 11px;
  letter-spacing: .12em;
}

#axiomTop24hProfitCard .apf-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  text-align: right;
}

#axiomTop24hProfitCard .apf-status {
  flex: 0 0 auto;
  margin: 0;
  padding: 5px 8px;
  font-size: 9px;
}

#axiomTop24hProfitCard .apf-value {
  font-size: clamp(34px, 4.8vw, 43px);
  font-weight: 850;
  line-height: 1.05;
  letter-spacing: -.05em;
  text-shadow:
    0 0 15px rgba(66, 229, 156, .22),
    0 0 30px rgba(66, 229, 156, .10);
}

#axiomTop24hProfitCard.is-negative .apf-value {
  text-shadow: 0 0 20px rgba(255, 90, 112, .18);
}

@media (max-width: 560px) {
  #axiomTop24hProfitCard {
    width: calc(100% - 24px);
    padding: 15px;
    gap: 12px;
  }

  #axiomTop24hProfitCard .apf-right {
    justify-content: space-between;
    gap: 10px;
    padding-top: 11px;
    border-top: 1px solid rgba(168, 195, 221, .12);
    text-align: left;
  }

  #axiomTop24hProfitCard .apf-value {
    font-size: clamp(30px, 8vw, 38px);
  }
}

/* AXIOM_PROFIT_NARROW_V3 */

#axiomTop24hProfitCard {
  width: min(560px, calc(100% - 32px));
}

#axiomTop24hProfitCard .apf-label {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .13em;
}

@media (max-width: 560px) {
  #axiomTop24hProfitCard {
    width: calc(100% - 24px);
  }
}
