import SwiftUI

// MARK: - Glass Navigation Bar Modifier

/// iOS 26+: native glassmorphism (no explicit background needed).
/// iOS < 26: frosted glass material (Telegram-style).
struct GlassNavBarModifier: ViewModifier {
    func body(content: Content) -> some View {
        if #available(iOS 26, *) {
            content
        } else {
            content
                .toolbarBackground(.regularMaterial, for: .navigationBar)
        }
    }
}

extension View {
    func applyGlassNavBar() -> some View {
        modifier(GlassNavBarModifier())
    }
}

// MARK: - Glass Search Bar Modifier

/// iOS 26+: glassmorphism capsule.
/// iOS < 26: no-op (standard search bar appearance).
struct GlassSearchBarModifier: ViewModifier {
    func body(content: Content) -> some View {
        if #available(iOS 26, *) {
            content
                .glassEffect(.regular, in: .capsule)
        } else {
            content
        }
    }
}

extension View {
    func applyGlassSearchBar() -> some View {
        modifier(GlassSearchBarModifier())
    }
}
