/* ============================================================================
   GREEN PROGRAM BADGES - Product Certification Badges
   ============================================================================ */

/* Badge Container */
.product-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  align-items: center;
}

/* Badge Sizes */
.product-badges-sm {
  gap: 4px;
  margin-top: 4px;
}

.product-badges-md {
  gap: 6px;
  margin-top: 8px;
}

.product-badges-lg {
  gap: 8px;
  margin-top: 12px;
}

/* Individual Badge */
.badge-green {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 12px;
  color: white;
  font-weight: 500;
  white-space: nowrap;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: help;
  line-height: 1;
}

/* Small badges */
.product-badges-sm .badge-green {
  font-size: 0.65rem;
  padding: 2px 6px;
  gap: 3px;
}

.product-badges-sm .badge-icon {
  width: 12px !important;
  height: 12px !important;
}

/* Hide text label in sm badges — icon-only, tooltip on hover */
.product-badges-sm .badge-text {
  display: none;
}

/* Tooltip for sm badges (CSS-only, avoids JS/overflow issues) */
.product-badges-sm .badge-green {
  position: relative;
}

.product-badges-sm .badge-green::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  background: #1f2937;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 500;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 50;
  line-height: 1.4;
}

.product-badges-sm .badge-green:hover::after {
  opacity: 1;
}

/* Large badges */
.product-badges-lg .badge-green {
  font-size: 0.85rem;
  padding: 6px 12px;
  gap: 6px;
}

.product-badges-lg .badge-icon {
  width: 20px !important;
  height: 20px !important;
}

/* Badge Hover Effect */
.badge-green:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Badge Icon */
.badge-icon {
  width: 16px !important;
  height: 16px !important;
  max-width: 20px !important;
  max-height: 20px !important;
  object-fit: contain;
  vertical-align: middle;
  filter: brightness(0) invert(1); /* Make SVG white */
}

/* Badge Text */
.badge-text {
  font-size: inherit;
  font-weight: inherit;
}

/* "+X more" Badge */
.badge-more {
  background-color: #6B7280 !important;
  color: white;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 10px;
  font-weight: 500;
  cursor: help;
}

.product-badges-sm .badge-more {
  font-size: 0.65rem;
  padding: 2px 6px;
}

.product-badges-lg .badge-more {
  font-size: 0.75rem;
  padding: 5px 10px;
}

/* Category-Specific Colors */
.badge-general {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
}

.badge-energy {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
}

.badge-materials {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.badge-carbon {
  background: linear-gradient(135deg, #065F46 0%, #064E3B 100%);
}

.badge-renewable {
  background: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
}

.badge-production {
  background: linear-gradient(135deg, #0284C7 0%, #0369A1 100%);
}

/* Tooltip Styling (if using Bootstrap tooltips) */
.tooltip-inner {
  max-width: 250px;
  text-align: left;
  font-size: 0.75rem;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .product-badges {
    gap: 4px;
    margin-top: 6px;
  }
  
  .badge-green {
    font-size: 0.65rem;
    padding: 3px 6px;
  }
  
  .badge-icon {
    width: 14px !important;
    height: 14px !important;
  }
  
  .badge-more {
    font-size: 0.65rem;
    padding: 2px 6px;
  }
}

/* Print Styles */
@media print {
  .product-badges {
    gap: 3px;
  }
  
  .badge-green {
    border: 1px solid #ccc;
    color: #000 !important;
    padding: 2px 6px;
  }
  
  .badge-icon {
    display: none;
  }
}

/* Accessibility */
.badge-green:focus {
  outline: 2px solid #3B82F6;
  outline-offset: 2px;
}

/* Animation for newly added badges */
@keyframes badgeFadeIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.badge-green.badge-new {
  animation: badgeFadeIn 0.3s ease-out;
}

/* Badge in Product Card */
.product-card .product-badges {
  position: relative;
  z-index: 1;
}

/* Badge in Product Grid */
.product-grid .product-badges {
  margin-bottom: 8px;
}

/* Badge on Dark Background */
.bg-dark .badge-green,
.dark-mode .badge-green {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Loading State */
.badge-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
  border-radius: 12px;
  height: 24px;
  width: 100px;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Empty State */
.product-badges-empty {
  min-height: 28px;
  /* Reserve space even when no badges */
}
