//
//  AdvancedDisplaySection.swift
//  TheNoiseClock
//
//  Created by Matt Bruce on 9/7/25.
//

import SwiftUI
import Bedrock

struct AdvancedDisplaySection: View {
    @Binding var style: ClockStyle
    
    var body: some View {
        VStack(alignment: .leading, spacing: Design.Spacing.small) {
            SettingsSectionHeader(
                title: "Advanced Display",
                systemImage: "eye",
                accentColor: AppAccent.primary
            )

            SettingsCard(backgroundColor: AppSurface.card, borderColor: AppBorder.subtle) {
                SettingsToggle(
                    title: "Keep Awake",
                    subtitle: "Prevent sleep in display mode",
                    isOn: $style.keepAwake,
                    accentColor: AppAccent.primary
                )

                if style.autoBrightness {
                    HStack {
                        Text("Current Brightness")
                            .font(.subheadline.weight(.medium))
                            .foregroundStyle(AppTextColors.primary)
                        Spacer()
                        Text("\(Int(style.effectiveBrightness * 100))%")
                            .font(.subheadline)
                            .foregroundStyle(AppTextColors.secondary)
                    }
                }
            }

            Text("Advanced display and system integration settings.")
                .font(.caption)
                .foregroundStyle(AppTextColors.tertiary)

            SettingsSectionHeader(
                title: "Focus Modes",
                systemImage: "moon.zzz.fill",
                accentColor: AppAccent.primary
            )

            SettingsCard(backgroundColor: AppSurface.card, borderColor: AppBorder.subtle) {
                SettingsToggle(
                    title: "Respect Focus Modes",
                    subtitle: "Follow Do Not Disturb rules",
                    isOn: $style.respectFocusModes,
                    accentColor: AppAccent.primary
                )
            }

            Text("Control how the app behaves when Focus modes are active.")
                .font(.caption)
                .foregroundStyle(AppTextColors.tertiary)
        }
    }
}
