/* Global Badge System with Icons */

/* Base badge styling */
.badge {
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

/* Add default icons to common badge types */
.badge i {
  font-size: 0.75rem;
}

/* Success badges - Active, Valid, Running, etc. */
.badge.bg-success::before {
  content: "\f058"; /* fa-check-circle */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-right: 0.375rem;
}

/* Danger badges - Failed, Invalid, Blocked, etc. */
.badge.bg-danger::before {
  content: "\f057"; /* fa-times-circle */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-right: 0.375rem;
}

/* Warning badges - Deactivated, Pending, etc. */
.badge.bg-warning::before {
  content: "\f071"; /* fa-exclamation-triangle */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-right: 0.375rem;
}

/* Info badges - Process info, status info, etc. */
.badge.bg-info::before {
  content: "\f05a"; /* fa-info-circle */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-right: 0.375rem;
}

/* Secondary badges - Inactive, Unknown, etc. */
.badge.bg-secondary::before {
  content: "\f111"; /* fa-circle */
  font-family: "Font Awesome 6 Free";
  font-weight: 400;
  margin-right: 0.375rem;
  font-size: 0.5rem;
}

/* Primary badges */
.badge.bg-primary::before {
  content: "\f005"; /* fa-star */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-right: 0.375rem;
}

/* Specific badge types with custom icons */
.badge.status-active::before,
.badge:contains("Active")::before {
  content: "\f00c"; /* fa-check */
}

.badge.status-running::before,
.badge:contains("Running")::before {
  content: "\f04b"; /* fa-play */
}

.badge.status-blocked::before,
.badge:contains("Blocked")::before {
  content: "\f05e"; /* fa-ban */
}

.badge.status-deactivated::before,
.badge:contains("Deactivated")::before {
  content: "\f04c"; /* fa-pause */
}

/* Size badges (file sizes) */
.badge.badge-size::before {
  content: "\f15b"; /* fa-file */
  font-family: "Font Awesome 6 Free";
  font-weight: 400;
  margin-right: 0.375rem;
}

/* Enhanced styling for different badge types */
.badge.bg-success {
  background-color: #28a745 !important;
  color: #ffffff !important;
  border-color: #28a745 !important;
}

/* Override site.css color for success badges */
.bg-success.badge,
.badge.bg-success {
  color: #ffffff !important;
}

.badge.bg-danger {
  background-color: #dc3545 !important;
  color: white !important;
  border-color: #dc3545 !important;
}

.badge.bg-warning {
  background-color: #ffc107 !important;
  color: #212529 !important;
  border-color: #ffc107 !important;
}

.badge.bg-info {
  background-color: #17a2b8 !important;
  color: white !important;
  border-color: #17a2b8 !important;
}

.badge.bg-secondary {
  background-color: #6c757d !important;
  color: white !important;
  border-color: #6c757d !important;
}

.badge.bg-primary {
  background-color: #871a67 !important;
  color: white !important;
  border-color: #871a67 !important;
}

/* Hover effects */
.badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Dark mode adjustments */
html.dark-mode .badge {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

html.dark-mode .badge.bg-success {
  background-color: #28a745 !important;
  color: #ffffff !important;
  border-color: #34ce57 !important;
}

html.dark-mode .badge.bg-danger {
  background-color: #dc3545 !important;
  border-color: #e74c5c !important;
}

html.dark-mode .badge.bg-warning {
  background-color: #ffc107 !important;
  color: #212529 !important;
  border-color: #ffcd39 !important;
}

html.dark-mode .badge.bg-info {
  background-color: #17a2b8 !important;
  border-color: #20c3e3 !important;
}

html.dark-mode .badge.bg-secondary {
  background-color: #6c757d !important;
  border-color: #868e96 !important;
}

html.dark-mode .badge.bg-primary {
  background-color: #871a67 !important;
  border-color: #a84d8a !important;
}

/* Special badge classes that already have icons - prevent double icons */
.badge.activity-badge::before,
.badge.dealer-badge::before {
  content: none !important;
}

/* Ensure activity badges keep their specific icons */
.activity-badge i,
.dealer-badge i {
  margin-right: 0.25rem;
}

/* File size badges */
.badge[class*="file-size"]::before {
  content: "\f15c"; /* fa-file-alt */
  font-family: "Font Awesome 6 Free";
  font-weight: 400;
  margin-right: 0.375rem;
}

/* Process/PID badges */
.badge:contains("PID")::before {
  content: "\f085"; /* fa-cog */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-right: 0.375rem;
}

/* Remote access badge */
.badge:contains("Remote Access")::before {
  content: "\f0ac"; /* fa-globe */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-right: 0.375rem;
}

/* Authentication type badges */
.badge:contains("Azure Active Directory")::before {
  content: "\f2f5"; /* fa-microsoft */
  font-family: "Font Awesome 6 Brands";
  font-weight: 400;
  margin-right: 0.375rem;
}

/* Orphaned/reason badges */
.badge.bg-warning[class*="reason"]::before,
.badge.bg-warning:contains("Orphaned")::before {
  content: "\f128"; /* fa-question */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-right: 0.375rem;
}

/* Deployment status badges */
.badge:contains("Success")::before {
  content: "\f00c"; /* fa-check */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-right: 0.375rem;
}

.badge:contains("Failed")::before {
  content: "\f00d"; /* fa-times */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-right: 0.375rem;
}

.badge:contains("Pending")::before {
  content: "\f017"; /* fa-clock */
  font-family: "Font Awesome 6 Free";
  font-weight: 400;
  margin-right: 0.375rem;
}

/* Version badges */
.badge[id*="version"]::before {
  content: "\f02b"; /* fa-tag */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-right: 0.375rem;
}

/* Ensure badges in tables and lists maintain proper spacing */
td .badge,
li .badge {
  margin: 0.125rem 0;
}

/* Badge groups */
.badge + .badge {
  margin-left: 0.5rem;
}

/* Animation for status changes */
@keyframes badgePulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.badge.status-changed {
  animation: badgePulse 0.3s ease-in-out;
}

/* Ensure consistent line height */
.badge {
  line-height: 1;
}

/* Fix for badges inside buttons or links */
a .badge,
button .badge {
  pointer-events: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .badge {
    font-size: 0.8125rem;
    padding: 0.25rem 0.5rem;
  }
  
  .badge::before,
  .badge i {
    font-size: 0.7rem;
  }
}

/* Final overrides to ensure correct text colors */
.badge.bg-success,
.bg-success.badge,
html.dark-mode .badge.bg-success,
html.dark-mode .bg-success.badge {
  color: #ffffff !important;
}

.badge.bg-warning,
.bg-warning.badge {
  color: #212529 !important;
}

html.dark-mode .badge.bg-warning,
html.dark-mode .bg-warning.badge {
  color: #212529 !important;
}