/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  backdrop-filter: blur(4px);
  border: 1px solid var(--glass-border);
  transition: all 0.3s ease;
}

.badge-flash {
  animation: badgeUpdate 0.5s ease-out;
}

.badge-error-flash {
  animation: badgeErrorUpdate 0.5s ease-out;
}

@keyframes badgeUpdate {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes badgeErrorUpdate {
  0% {
    transform: scale(1);
    background-color: rgba(239, 68, 68, 0.1);
  }

  50% {
    transform: scale(1.15);
    background-color: rgba(239, 68, 68, 0.4);
  }

  100% {
    transform: scale(1);
    background-color: rgba(239, 68, 68, 0.1);
  }
}

.icon-shake {
  animation: iconShake 0.4s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes iconShake {

  10%,
  90% {
    transform: translate3d(-1px, 0, 0) rotate(-5deg);
  }

  20%,
  80% {
    transform: translate3d(2px, 0, 0) rotate(5deg);
  }

  30%,
  50%,
  70% {
    transform: translate3d(-4px, 0, 0) rotate(-10deg);
  }

  40%,
  60% {
    transform: translate3d(4px, 0, 0) rotate(10deg);
  }
}

.status-checking {
  background: rgba(100, 116, 139, 0.2);
  color: var(--text-secondary);
}

.status-available {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.2);
}

.status-downloadable {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary-color);
  border-color: rgba(99, 102, 241, 0.2);
  cursor: pointer;
}

.status-downloadable:hover {
  background: rgba(99, 102, 241, 0.2);
}

.status-downloading {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.2);
  cursor: pointer;
}

.status-downloading:hover {
  background: rgba(245, 158, 11, 0.2);
}

.status-unavailable,
.status-error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
  border-color: rgba(239, 68, 68, 0.2);
}

.status-badge-container {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;

  /* Initial load debounce */
  opacity: 0;
  animation: delayedBadgeFadeIn 0.3s ease forwards 0.8s;
}

.status-badge-container.resolved {
  opacity: 1;
  animation: none;
}

@keyframes delayedBadgeFadeIn {
  to {
    opacity: 1;
  }
}

/* Info Icon Tooltip */
.info-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  opacity: 0.8;
  cursor: help;
  transition: opacity 0.2s ease;
}

.info-icon:hover {
  opacity: 1;
}

.info-icon .tooltip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  width: 250px;
  background: var(--bg-gradient);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  font-size: 0.85rem;
  line-height: 1.5;
  text-align: left;
  color: var(--text-primary);
  z-index: 50;
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  pointer-events: auto;
  transform: translateY(5px);
}

.info-icon .tooltip::before {
  content: '';
  position: absolute;
  top: -1rem;
  left: 0;
  width: 100%;
  height: 1rem;
}

.info-icon:hover .tooltip {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.tooltip strong {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--warning);
}

.tooltip ul {
  margin-left: 1.25rem;
  color: var(--text-secondary);
}

.tooltip li {
  margin-bottom: 0.25rem;
}

/* Progress Bar */
.progress-container {
  flex: 1;
  max-width: 200px;
  opacity: 0;
  visibility: hidden;
  /* Fast hide */
  transition: opacity 0.3s ease, visibility 0.3s ease;
  display: flex;
  align-items: center;
  justify-self: center;
  width: 100%;
}

.progress-container.show {
  opacity: 1;
  visibility: visible;
  /* Debounced show: wait 0.6s to avoid transient flashes */
  transition: opacity 0.4s ease 0.6s, visibility 0.4s ease 0.6s;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary-color);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 9999px;
}

.progress-percent {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 42px;
  text-align: right;
}

