/* dYdX live equity badge */

.account-where {
  min-width: 280px;
}

.account-where__row {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

tr[data-dydx-status] .account-where__row > input,
tr[data-zerion-status] .account-where__row > input {
  padding-right: 26px;
}

tr[data-dydx-status][data-zerion-status] .account-where__row > input {
  padding-right: 44px;
}

tr[data-dydx-status][data-zerion-status] .account-where__row > .live-dot--dydx {
  right: 30px;
}

.account-where__row > input {
  flex: 1 1 auto;
  min-width: 0;
  font-feature-settings: "tnum" 1;
}

tr[data-dydx-status] .account-where input {
  font-family: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;
  letter-spacing: -0.01em;
  font-size: 12.5px;
}

tr[data-dydx-status="ok"] td input[readonly],
tr[data-dydx-status="ok"] td select[disabled],
tr[data-zerion-status="ok"] td input[readonly],
tr[data-zerion-status="ok"] td select[disabled] {
  color: var(--muted-color);
  border-color: var(--border-strong);
  cursor: not-allowed;
}

.live-dot {
  --dot-color: var(--muted-color);
  --dot-offset-y: 0;
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot-color);
  cursor: help;
}

.account-where__row > .live-dot {
  --dot-offset-y: -50%;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(var(--dot-offset-y));
}

.live-dot--dydx { --dot-color: #6966ff; }
.live-dot--zerion { --dot-color: #627eea; }

.live-dot--ok {
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--dot-color) 18%, transparent),
    0 0 10px color-mix(in srgb, var(--dot-color) 45%, transparent);
  animation: live-dot-pulse 2.4s ease-in-out infinite;
}

@keyframes live-dot-pulse {
  0%, 100% {
    transform: translateY(var(--dot-offset-y));
    box-shadow:
      0 0 0 3px color-mix(in srgb, var(--dot-color) 14%, transparent),
      0 0 8px color-mix(in srgb, var(--dot-color) 35%, transparent);
  }
  50% {
    transform: translateY(var(--dot-offset-y));
    box-shadow:
      0 0 0 5px color-mix(in srgb, var(--dot-color) 6%, transparent),
      0 0 14px color-mix(in srgb, var(--dot-color) 60%, transparent);
  }
}

.live-dot--loading {
  animation: live-dot-loading 1.1s ease-in-out infinite;
}

@keyframes live-dot-loading {
  0%, 100% { opacity: 0.3; transform: translateY(var(--dot-offset-y)) scale(0.8); }
  50% { opacity: 1; transform: translateY(var(--dot-offset-y)) scale(1.2); }
}

.live-dot--error {
  --dot-color: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent);
}

.dydx-refresh {
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1;
  padding: 6px 10px;
  margin-right: 6px;
  color: #6966ff;
}

.dydx-refresh:hover {
  background: rgba(105, 102, 255, 0.08);
  border-color: var(--border-strong);
}

tr[data-dydx-status="loading"] .account-where input {
  border-color: rgba(105, 102, 255, 0.32);
  box-shadow: 0 0 0 2px rgba(105, 102, 255, 0.08);
}

tr[data-dydx-status="error"] .account-where input {
  border-color: rgba(194, 82, 74, 0.4);
}

tr[data-dydx-status="ok"] .account-where input {
  border-color: rgba(105, 102, 255, 0.36);
}

.zerion-refresh {
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1;
  padding: 6px 10px;
  margin-right: 6px;
  color: #627eea;
}

.zerion-refresh:hover {
  background: rgba(98, 126, 234, 0.08);
  border-color: var(--border-strong);
}

tr[data-zerion-status="loading"] .account-where input {
  border-color: rgba(98, 126, 234, 0.32);
  box-shadow: 0 0 0 2px rgba(98, 126, 234, 0.08);
}

tr[data-zerion-status="error"] .account-where input {
  border-color: rgba(194, 82, 74, 0.4);
}

tr[data-zerion-status="ok"] .account-where input {
  border-color: rgba(98, 126, 234, 0.36);
}

@media (prefers-reduced-motion: reduce) {
  .live-dot--ok,
  .live-dot--loading {
    animation: none;
  }
}
