//
//  DatingLockedView.swift
//  lichunWebsocket
//
//  Shows when dating is locked (player under 16)
//

import SwiftUI

struct DatingLockedView: View {
    let currentAge: Int

    var body: some View {
        VStack {
            Spacer()

            BaseCard {
                ZStack {
                    // Soft romantic gradient background (muted for locked state)
                    LinearGradient(
                        colors: [
                            AppColors.primary.opacity(0.1),
                            Color(hex: 0xFFB3C1).opacity(0.08),
                            Color(hex: 0xD4A5F5).opacity(0.05)
                        ],
                        startPoint: .topLeading,
                        endPoint: .bottomTrailing
                    )
                    .cornerRadius(AppSpacing.cornerRadius)

                    VStack(spacing: AppSpacing.lg) {
                        // Lock icon with subtle glow
                        ZStack {
                            Circle()
                                .fill(
                                    RadialGradient(
                                        colors: [
                                            AppColors.secondaryText.opacity(0.15),
                                            AppColors.secondaryText.opacity(0.0)
                                        ],
                                        center: .center,
                                        startRadius: 20,
                                        endRadius: 50
                                    )
                                )
                                .frame(width: 100, height: 100)

                            Image(systemName: "lock.fill")
                                .font(.system(size: 48))
                                .foregroundStyle(
                                    LinearGradient(
                                        colors: [
                                            AppColors.secondaryText,
                                            AppColors.secondaryText.opacity(0.7)
                                        ],
                                        startPoint: .top,
                                        endPoint: .bottom
                                    )
                                )
                                .shadow(color: AppColors.secondaryText.opacity(0.3), radius: 8, x: 0, y: 4)
                        }

                        // Headline
                        Text("Dating Unlocks at 16")
                            .font(.appLargeTitle)
                            .foregroundColor(AppColors.primaryText)
                            .multilineTextAlignment(.center)

                        // Current age
                        Text("You're currently \(currentAge) years old")
                            .font(.appBody)
                            .foregroundColor(AppColors.secondaryText)
                            .multilineTextAlignment(.center)

                        // Years remaining hint
                        if currentAge < 16 {
                            let yearsRemaining = 16 - currentAge
                            Text(yearsRemaining == 1 ? "Just 1 more year to go!" : "\(yearsRemaining) more years to go")
                                .font(.appCaption)
                                .foregroundColor(AppColors.primary.opacity(0.8))
                                .padding(.top, AppSpacing.xs)
                        }
                    }
                    .padding(AppSpacing.xl)
                }
            }
            .padding(.horizontal, AppSpacing.lg)

            Spacer()
        }
        .background(AppColors.primaryBackground)
    }
}

// MARK: - Preview

#if DEBUG
struct DatingLockedView_Previews: PreviewProvider {
    static var previews: some View {
        Group {
            DatingLockedView(currentAge: 12)
                .previewDisplayName("Age 12")

            DatingLockedView(currentAge: 15)
                .previewDisplayName("Age 15")
        }
    }
}
#endif
