//
//  TipsSection.swift
//  SportsTime
//
//  Shared component for displaying planning tips across all home content variants.
//  Uses Theme colors to adapt to light/dark mode and various design styles.
//

import SwiftUI

struct TipsSection: View {
    let tips: [PlanningTip]

    @Environment(\.colorScheme) private var colorScheme

    var body: some View {
        if !tips.isEmpty {
            VStack(alignment: .leading, spacing: Theme.Spacing.sm) {
                Text("Planning Tips")
                    .font(.headline)
                    .foregroundStyle(Theme.textPrimary(colorScheme))

                VStack(spacing: Theme.Spacing.xs) {
                    ForEach(tips) { tip in
                        TipRow(icon: tip.icon, title: tip.title, subtitle: tip.subtitle)
                    }
                }
                .padding(Theme.Spacing.md)
                .background(Theme.cardBackground(colorScheme))
                .clipShape(RoundedRectangle(cornerRadius: Theme.CornerRadius.medium))
            }
        }
    }
}

#Preview {
    let tips = PlanningTips.random(3)
    VStack {
        TipsSection(tips: tips)
            .padding()
    }
    .background(Color.gray.opacity(0.1))
}
