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

import SwiftUI
import Bedrock

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

            SettingsCard(backgroundColor: AppSurface.card, borderColor: AppBorder.subtle) {
                SettingsToggle(
                    title: "24‑Hour Format",
                    subtitle: "Use military time",
                    isOn: $style.use24Hour,
                    accentColor: AppAccent.primary
                )

                SettingsToggle(
                    title: "Show Seconds",
                    subtitle: "Display seconds in the clock",
                    isOn: $style.showSeconds,
                    accentColor: AppAccent.primary
                )

                if !style.use24Hour {
                    SettingsToggle(
                        title: "Show AM/PM",
                        subtitle: "Add an AM/PM indicator",
                        isOn: $style.showAmPm,
                        accentColor: AppAccent.primary
                    )
                }

                SettingsToggle(
                    title: "Auto Brightness",
                    subtitle: "Adapt brightness to ambient light",
                    isOn: $style.autoBrightness,
                    accentColor: AppAccent.primary
                )

                if UIDevice.current.orientation.isPortrait || UIDevice.current.orientation == .unknown {
                    SettingsToggle(
                        title: "Horizontal Mode",
                        subtitle: "Force a wide layout in portrait",
                        isOn: $style.forceHorizontalMode,
                        accentColor: AppAccent.primary
                    )
                }
            }

            Text("Basic display settings for your clock.")
                .font(.caption)
                .foregroundStyle(AppTextColors.tertiary)
        }
    }
}
