/**
 * ProRank Design System - Badge Components
 * 
 * Badges, status indicators, tags, and labels for displaying
 * metadata, counts, and states throughout the interface.
 * 
 * @module components/badges
 * @since 3.0.0
 */

/* ============================================
   BASE BADGE
   Foundation badge styles
   ============================================ */

.prorank-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--prorank-bg-tertiary);
  color: var(--prorank-text-secondary);
  border: 1px solid transparent;
  transition: var(--prorank-transition);
  white-space: nowrap;
}

/* Badge Sizes */
.prorank-badge--small {
  padding: 2px 6px;
  font-size: 10px;
}

.prorank-badge--large {
  padding: 6px 12px;
  font-size: 14px;
  border-radius: 16px;
}

/* ============================================
   BADGE VARIANTS
   Different badge types and colors
   ============================================ */

/* Status Badges */
.prorank-badge--success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--prorank-success);
  border-color: rgba(16, 185, 129, 0.2);
}

.prorank-badge--warning {
  background: rgba(251, 191, 36, 0.1);
  color: var(--prorank-warning);
  border-color: rgba(251, 191, 36, 0.2);
}

.prorank-badge--error,
.prorank-badge--danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--prorank-error);
  border-color: rgba(239, 68, 68, 0.2);
}

.prorank-badge--info {
  background: rgba(37, 99, 235, 0.1);
  color: var(--prorank-primary);
  border-color: rgba(37, 99, 235, 0.2);
}

/* Tier Badges - Used in tab navigation */
.prorank-tier-free {
  background: rgba(107, 114, 128, 0.1);
  color: var(--prorank-text-secondary);
  border-color: rgba(107, 114, 128, 0.2);
}

/* Tier classes with solid backgrounds are defined below in "TIER BADGES" section */

/* Solid Badges */
.prorank-badge--solid {
  color: white;
  border: none;
}

.prorank-badge--solid.prorank-badge--success {
  background: var(--prorank-success);
}

.prorank-badge--solid.prorank-badge--warning {
  background: var(--prorank-warning);
  color: var(--prorank-text);
}

.prorank-badge--solid.prorank-badge--error {
  background: var(--prorank-error);
}

.prorank-badge--solid.prorank-badge--info {
  background: var(--prorank-primary);
}

/* Core Web Vitals Badges */
.prorank-badge--good {
  background: rgba(16, 185, 129, 0.1);
  color: #0f9d58;
  border-color: rgba(15, 157, 88, 0.2);
}

.prorank-badge--needs-improvement {
  background: rgba(251, 191, 36, 0.1);
  color: #ffa400;
  border-color: rgba(255, 164, 0, 0.2);
}

.prorank-badge--poor {
  background: rgba(239, 68, 68, 0.1);
  color: #ff4e42;
  border-color: rgba(255, 78, 66, 0.2);
}

/* Special Badges */
.prorank-badge--new {
  background: #f5f5f5;
  color: #374151;
  border: 1px solid #e0e0e0;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

.prorank-badge--beta {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: white;
  border: none;
}

.prorank-badge--premium,
.prorank-badge--pro {
  background: var(--prorank-gradient-accent);
  color: white;
  border: none;
}

/* ============================================
   TIER BADGES
   Subscription tier indicators with distinct colors
   ============================================ */

.prorank-tier-badge,
.prorank-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border-radius: 2px;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1px;
  line-height: 1.2;
  white-space: nowrap;
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  height: 12px;
}

/* Free Tier - Gray */
.prorank-tier-badge--free,
.prorank-tier-free {
  background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Pro Tier - Primary */
.prorank-tier-badge--pro,
.prorank-tier-badge--core,
.prorank-tier-pro,
.prorank-tier-core {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Business Tier - Orange */
.prorank-tier-badge--business,
.prorank-tier-business {
  background: linear-gradient(135deg, #ff6900 0%, #e55a00 100%);
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 3px rgba(255, 105, 0, 0.2);
}

/* Agency Tier - Gold (Highest Tier) */
.prorank-tier-badge--agency,
.prorank-tier-agency {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #7c2d12;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
  font-weight: 700;
}

/* ============================================
   COUNT BADGES
   Numeric count indicators
   ============================================ */

.prorank-badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--prorank-error);
  color: white;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.prorank-badge-count--small {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
}

.prorank-badge-count--large {
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  font-size: 12px;
}

/* Count variations */
.prorank-badge-count--primary {
  background: var(--prorank-primary);
}

.prorank-badge-count--success {
  background: var(--prorank-success);
}

.prorank-badge-count--warning {
  background: var(--prorank-warning);
  color: var(--prorank-text);
}

/* Notification Count Badge - For tab navigation */
.prorank-tab-badge.prorank-notification-count {
  position: relative;
  top: auto;
  right: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
  background: var(--prorank-error, #ef4444);
  color: white;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  animation: notificationPulse 2s ease-in-out infinite;
}

@keyframes notificationPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0);
  }
}

/* Primary active tab state */
.prorank-tab-button.active .prorank-notification-count {
  background: white;
  color: var(--prorank-primary, #2563eb);
  animation: none;
}

/* ============================================
   STATUS INDICATORS
   Small status dots and indicators
   ============================================ */

.prorank-status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--prorank-bg-tertiary);
  position: relative;
}

.prorank-status-indicator--online,
.prorank-status-indicator--active {
  background: var(--prorank-success);
}

.prorank-status-indicator--offline,
.prorank-status-indicator--inactive {
  background: var(--prorank-text-tertiary);
}

.prorank-status-indicator--busy,
.prorank-status-indicator--pending {
  background: var(--prorank-warning);
}

.prorank-status-indicator--error {
  background: var(--prorank-error);
}

/* Pulsing animation for active states */
.prorank-status-indicator--pulse::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  background: inherit;
  animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* ============================================
   TAGS
   Keyword and content tags
   ============================================ */

.prorank-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--prorank-bg-secondary);
  border: 1px solid var(--prorank-border);
  border-radius: 4px;
  font-size: 13px;
  color: var(--prorank-text);
  transition: var(--prorank-transition);
  cursor: default;
}

.prorank-tag:hover {
  background: var(--prorank-bg-tertiary);
  border-color: var(--prorank-border-dark);
}

/* Clickable tags */
.prorank-tag--clickable {
  cursor: pointer;
}

.prorank-tag--clickable:hover {
  background: var(--prorank-primary);
  color: white;
  border-color: var(--prorank-primary);
}

/* Tag with remove button */
.prorank-tag--removable {
  padding-right: 4px;
}

.prorank-tag-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  cursor: pointer;
  transition: var(--prorank-transition);
}

.prorank-tag-remove:hover {
  background: var(--prorank-error);
  color: white;
}

/* Tag Groups */
.prorank-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prorank-tags--small {
  gap: 4px;
}

.prorank-tags--small .prorank-tag {
  padding: 2px 6px;
  font-size: 11px;
}

/* ============================================
   ACTION BADGES
   Badges for actions (CRUD operations)
   ============================================ */

.prorank-action-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.prorank-action-badge--create {
  background: rgba(16, 185, 129, 0.1);
  color: var(--prorank-success);
}

.prorank-action-badge--update {
  background: rgba(37, 99, 235, 0.1);
  color: var(--prorank-primary);
}

.prorank-action-badge--delete {
  background: rgba(239, 68, 68, 0.1);
  color: var(--prorank-error);
}

.prorank-action-badge--view {
  background: var(--prorank-bg-tertiary);
  color: var(--prorank-text-secondary);
}

/* ============================================
   BADGE GROUPS
   Multiple badges together
   ============================================ */

.prorank-badge-group {
  display: inline-flex;
  gap: 4px;
}

.prorank-badge-group--vertical {
  flex-direction: column;
  align-items: flex-start;
}

/* Overlapping badges */
.prorank-badge-group--overlap {
  gap: 0;
}

.prorank-badge-group--overlap .prorank-badge {
  margin-left: -8px;
  border: 2px solid white;
}

.prorank-badge-group--overlap .prorank-badge:first-child {
  margin-left: 0;
}

/* ============================================
   RESPONSIVE DESIGN
   Mobile adjustments
   ============================================ */

@media (max-width: 768px) {
  .prorank-badge {
    font-size: 11px;
    padding: 3px 6px;
  }
  
  .prorank-tags {
    gap: 4px;
  }
  
  .prorank-tag {
    font-size: 12px;
    padding: 3px 8px;
  }
}
