//! UI layer — toolbar, image area, status bar, thumbnail bar, context menu.

pub mod about_dialog;
pub mod context_menu;
pub mod error_modal;
pub mod exif_panel;
pub mod export_dialog;
pub mod icons;
pub mod image_view;
pub mod sidebar;
pub mod status_bar;
pub mod thumbnail_bar;
pub mod toolbar;

/// The refined dark palette. See DECISION.md D004.
pub mod theme {
    use iced::Color;

    pub const BG_IMAGE_AREA: Color = Color::from_rgb(0.055, 0.055, 0.063); // #0e0e10
    pub const BG_CHROME: Color = Color::from_rgb(0.086, 0.086, 0.102);     // #16161a
    pub const BG_CHROME_BORDER: Color = Color::from_rgb(0.149, 0.149, 0.173); // #26262c
    pub const BG_CHROME_HOVER: Color = Color::from_rgb(0.118, 0.118, 0.137); // #1e1e23
    pub const TEXT_PRIMARY: Color = Color::from_rgb(0.894, 0.894, 0.922);  // #e4e4e7
    pub const TEXT_SECONDARY: Color = Color::from_rgb(0.631, 0.631, 0.678); // #a1a1aa
    pub const TEXT_DIM: Color = Color::from_rgb(0.502, 0.502, 0.549);     // #80808c
    pub const ACCENT: Color = Color::from_rgb(0.486, 0.227, 0.929);        // #7c3aed
    pub const ACCENT_DIM: Color = Color::from_rgb(0.353, 0.165, 0.675);   // #5a2a9c
    pub const DANGER: Color = Color::from_rgb(0.863, 0.149, 0.149);        // #dc2626
    pub const DANGER_DIM: Color = Color::from_rgb(0.624, 0.106, 0.106);    // #9f1b1b

    /// Convert a Color to a hex string for SVG stroke attributes.
    pub fn to_hex(c: Color) -> String {
        let r = (c.r * 255.0) as u8;
        let g = (c.g * 255.0) as u8;
        let b = (c.b * 255.0) as u8;
        format!("#{:02x}{:02x}{:02x}", r, g, b)
    }

    pub fn text_primary_hex() -> String { to_hex(TEXT_PRIMARY) }
    pub fn text_secondary_hex() -> String { to_hex(TEXT_SECONDARY) }
    pub fn text_dim_hex() -> String { to_hex(TEXT_DIM) }
    pub fn danger_hex() -> String { to_hex(DANGER) }
}
