//
//  CozyStatBadge.swift
//  lichunWebsocket
//
//  Cozy stat badge with icon and value
//

import SwiftUI

struct CozyStatBadge: View {
    let icon: String
    let label: String
    let value: Int
    let color: Color

    var body: some View {
        VStack(spacing: AppSpacing.xs) {
            // Icon circle with soft background
            ZStack {
                Circle()
                    .fill(color.opacity(0.15))
                    .frame(width: 50, height: 50)

                Image(systemName: icon)
                    .font(.system(size: 20))
                    .foregroundColor(color)
            }

            // Value
            Text("\(value)")
                .font(.system(size: 16, weight: .bold, design: .rounded))
                .foregroundColor(AppColors.primaryText)

            // Label
            Text(label)
                .font(.system(size: 10, weight: .medium, design: .rounded))
                .foregroundColor(AppColors.secondaryText)
                .lineLimit(1)
        }
        .frame(maxWidth: .infinity)
    }
}

// MARK: - Preview
#if DEBUG
struct CozyStatBadge_Previews: PreviewProvider {
    static var previews: some View {
        HStack(spacing: 20) {
            CozyStatBadge(icon: "heart.fill", label: "Health", value: 85, color: AppColors.health)
            CozyStatBadge(icon: "brain.head.profile", label: "Intelligence", value: 72, color: AppColors.intelligence)
            CozyStatBadge(icon: "face.smiling", label: "Looks", value: 90, color: AppColors.looks)
        }
        .padding()
        .background(AppColors.background)
    }
}
#endif
