/* Unified Compact Stats Bar */
.unified-stats-bar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: rgba(26, 26, 26, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(251, 191, 36, 0.2);
  border-radius: 12px;
  padding: 0.75rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 
    0 4px 16px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(251, 191, 36, 0.1);
  position: relative;
  overflow: hidden;
  will-change: transform;
}

.unified-stats-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(251, 191, 36, 0.1), transparent);
  animation: unifiedSweep 8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes unifiedSweep {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Stat Sections */
.stat-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.stat-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}

.health-section .stat-icon {
  background: radial-gradient(circle, rgba(220, 38, 38, 0.2) 0%, transparent 70%);
  color: var(--dragon-red);
}

.mana-section .stat-icon {
  background: radial-gradient(circle, rgba(59, 130, 246, 0.2) 0%, transparent 70%);
  color: var(--mana-blue);
}

.xp-section .stat-icon {
  background: radial-gradient(circle, rgba(251, 191, 36, 0.2) 0%, transparent 70%);
  color: var(--dragon-gold);
}

.stat-bar-container {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
}

/* Compact Bars */
.health-bar-compact,
.mana-bar-compact,
.xp-bar-compact {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

.health-fill-compact {
  height: 100%;
  background: linear-gradient(90deg, #dc2626 0%, #ef4444 50%, #f87171 100%);
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

.mana-fill-compact {
  height: 100%;
  background: linear-gradient(90deg, #1e40af 0%, #3b82f6 50%, #60a5fa 100%);
  border-radius: 4px;
  transition: width 0.6s ease;
  position: relative;
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.4);
}

.xp-fill-compact {
  height: 100%;
  background: linear-gradient(90deg, #d97706 0%, #f59e0b 50%, #fbbf24 100%);
  border-radius: 4px;
  transition: width 0.6s ease;
  position: relative;
  box-shadow: 0 0 6px rgba(251, 191, 36, 0.4);
}

/* Shimmer Effects */
.health-fill-compact::before,
.mana-fill-compact::before,
.xp-fill-compact::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: compactShimmer 2s ease-in-out infinite;
}

@keyframes compactShimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Stat Text */
.stat-text {
  font-family: 'Orbitron', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  color: #f1f5f9;
  text-align: center;
  white-space: nowrap;
}

/* Quick Stats */
.quick-stats {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-left: 1rem;
  border-left: 1px solid rgba(251, 191, 36, 0.2);
  flex-shrink: 0;
}

.quick-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(251, 191, 36, 0.2);
  transition: all 0.3s ease;
  cursor: pointer;
  min-width: 40px;
}

.quick-stat:hover {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.4);
  transform: translateY(-1px);
}

.quick-stat i {
  font-size: 0.875rem;
  color: var(--dragon-gold);
}

.quick-stat span {
  font-family: 'Orbitron', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  color: #f1f5f9;
}

/* Critical Health Warning */
.health-critical .health-bar-compact {
  animation: healthCriticalCompact 1s ease-in-out infinite alternate;
}

@keyframes healthCriticalCompact {
  0% {
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5), 0 0 8px rgba(220, 38, 38, 0.6);
  }
  100% {
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5), 0 0 16px rgba(239, 68, 68, 1);
  }
}

.health-critical .health-fill-compact {
  background: linear-gradient(90deg, #dc2626 0%, #ef4444 50%, #dc2626 100%);
  animation: healthPulseCompact 0.8s ease-in-out infinite alternate;
}

@keyframes healthPulseCompact {
  0% { box-shadow: 0 0 6px rgba(239, 68, 68, 0.4); }
  100% { box-shadow: 0 0 12px rgba(239, 68, 68, 1); }
}

/* Performance Optimizations */
.unified-stats-bar,
.health-bar-compact,
.mana-bar-compact,
.xp-bar-compact {
  transform: translateZ(0);
  backface-visibility: hidden;
}

.health-fill-compact,
.mana-fill-compact,
.xp-fill-compact {
  will-change: width;
  transform: translateZ(0);
}

/* Responsive Design */
@media (max-width: 768px) {
  .unified-stats-bar {
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.75rem;
  }
  
  .stat-section {
    flex: 1 1 calc(50% - 0.5rem);
    min-width: 120px;
  }
  
  .quick-stats {
    flex: 1 1 100%;
    justify-content: center;
    padding-left: 0;
    border-left: none;
    border-top: 1px solid rgba(251, 191, 36, 0.2);
    padding-top: 0.75rem;
    margin-top: 0.5rem;
  }
}

@media (max-width: 480px) {
  .unified-stats-bar {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .stat-section {
    flex: none;
    width: 100%;
  }
  
  .quick-stats {
    gap: 0.75rem;
  }
  
  .quick-stat {
    flex: 1;
  }
}

/* Reduce animations on lower-end devices */
@media (prefers-reduced-motion: reduce) {
  .health-fill-compact::before,
  .mana-fill-compact::before,
  .xp-fill-compact::before,
  .unified-stats-bar::before {
    animation: none;
  }
  
  .health-critical .health-bar-compact,
  .health-critical .health-fill-compact {
    animation: none;
  }
}
