from __future__ import annotations

from collections.abc import Iterable

from gradio.themes.base import Base
from gradio.themes.utils import colors, fonts, sizes


class Cyberpunk(Base):
    def __init__(
        self,
        *,
        primary_hue: colors.Color | str = colors.fuchsia,
        secondary_hue: colors.Color | str = colors.cyan,
        neutral_hue: colors.Color | str = colors.slate,
        spacing_size: sizes.Size | str = sizes.spacing_md,
        radius_size: sizes.Size | str = sizes.radius_sm,
        text_size: sizes.Size | str = sizes.text_md,
        font: fonts.Font | str | Iterable[fonts.Font | str] = (
            fonts.GoogleFont("Chakra Petch"),
            "ui-sans-serif",
            "system-ui",
            "sans-serif",
        ),
        font_mono: fonts.Font | str | Iterable[fonts.Font | str] = (
            fonts.GoogleFont("Share Tech Mono"),
            "ui-monospace",
            "Consolas",
            "monospace",
        ),
    ):
        super().__init__(
            primary_hue=primary_hue,
            secondary_hue=secondary_hue,
            neutral_hue=neutral_hue,
            spacing_size=spacing_size,
            radius_size=radius_size,
            text_size=text_size,
            font=font,
            font_mono=font_mono,
        )
        self.name = "cyberpunk"
        super().set(
            # Body — deep violet dark
            body_background_fill="*neutral_100",
            body_background_fill_dark="#0a0416",
            body_text_color="*neutral_800",
            body_text_color_dark="*neutral_300",
            body_text_color_subdued="*neutral_500",
            body_text_color_subdued_dark="*neutral_400",
            # Backgrounds — purple-tinted darks
            background_fill_primary="*neutral_50",
            background_fill_primary_dark="#110b22",
            background_fill_secondary="*neutral_200",
            background_fill_secondary_dark="#1a1030",
            # Shadows — neon bleed only
            shadow_drop="none",
            shadow_drop_lg="none",
            shadow_spread="0px",
            # Blocks — hard-edged, violet-tinted dark panels
            block_background_fill="white",
            block_background_fill_dark="#110b22",
            block_border_width="2px",
            block_border_color="*neutral_300",
            block_border_color_dark=f"{colors.violet.c800}60",
            block_shadow="none",
            block_shadow_dark="none",
            # Labels — neon fuchsia badges
            block_label_background_fill="*primary_100",
            block_label_background_fill_dark=f"{colors.fuchsia.c900}80",
            block_label_text_color="*primary_700",
            block_label_text_color_dark="*primary_300",
            block_label_text_weight="700",
            block_label_text_size="*text_sm",
            block_label_padding="*spacing_sm *spacing_lg",
            block_label_radius="0",
            block_title_background_fill="*primary_100",
            block_title_background_fill_dark=f"{colors.fuchsia.c900}80",
            block_title_text_color="*primary_700",
            block_title_text_color_dark="*primary_300",
            block_title_text_weight="700",
            block_title_padding="*spacing_sm *spacing_lg",
            block_title_radius="0",
            # Inputs — violet-tinted dark, fuchsia focus glow
            input_background_fill="white",
            input_background_fill_dark="#1a1030",
            input_border_color="*neutral_300",
            input_border_color_dark=f"{colors.violet.c700}50",
            input_border_width="2px",
            input_shadow="none",
            input_shadow_focus=f"0 0 0 2px {colors.fuchsia.c300}",
            input_shadow_focus_dark=f"0 0 0 2px {colors.fuchsia.c500}80, 0 0 16px -2px {colors.fuchsia.c600}30",
            input_border_color_focus="*primary_500",
            input_border_color_focus_dark="*primary_500",
            input_background_fill_focus="white",
            input_background_fill_focus_dark="#1e1238",
            # Buttons — solid neon, fuchsia glow in dark
            button_border_width="2px",
            button_transition="all 0.1s ease",
            button_primary_background_fill="*primary_500",
            button_primary_background_fill_hover="*primary_600",
            button_primary_background_fill_dark="*primary_600",
            button_primary_background_fill_hover_dark="*primary_500",
            button_primary_text_color="white",
            button_primary_text_color_dark="white",
            button_primary_border_color="*primary_600",
            button_primary_border_color_dark="*primary_500",
            button_primary_shadow="none",
            button_primary_shadow_hover="none",
            button_primary_shadow_active="none",
            button_primary_shadow_dark=f"0 0 12px -2px {colors.fuchsia.c500}50",
            button_primary_shadow_hover_dark=f"0 0 20px -2px {colors.fuchsia.c500}60",
            button_primary_shadow_active_dark="none",
            button_secondary_background_fill="white",
            button_secondary_background_fill_dark="#1a1030",
            button_secondary_background_fill_hover="*neutral_100",
            button_secondary_background_fill_hover_dark="#241540",
            button_secondary_text_color="*neutral_700",
            button_secondary_text_color_dark="*neutral_300",
            button_secondary_border_color="*neutral_300",
            button_secondary_border_color_dark=f"{colors.violet.c700}50",
            button_secondary_shadow="none",
            button_cancel_background_fill="white",
            button_cancel_background_fill_dark="#1a1030",
            button_cancel_background_fill_hover=colors.red.c50,
            button_cancel_background_fill_hover_dark=f"{colors.red.c900}40",
            button_cancel_text_color=colors.red.c600,
            button_cancel_text_color_dark=colors.red.c400,
            button_cancel_border_color=colors.red.c300,
            button_cancel_border_color_dark=f"{colors.red.c700}60",
            # Checkboxes — fuchsia fill
            checkbox_background_color_selected="*primary_500",
            checkbox_background_color_selected_dark="*primary_500",
            checkbox_border_color="*neutral_400",
            checkbox_border_color_dark=f"{colors.violet.c600}60",
            checkbox_border_color_selected="*primary_600",
            checkbox_border_color_selected_dark="*primary_500",
            checkbox_border_width="2px",
            checkbox_shadow="none",
            checkbox_label_background_fill="white",
            checkbox_label_background_fill_dark="#1a1030",
            checkbox_label_background_fill_hover="*primary_50",
            checkbox_label_background_fill_hover_dark="#241540",
            checkbox_label_background_fill_selected="*primary_600",
            checkbox_label_background_fill_selected_dark="*primary_800",
            checkbox_label_text_color_selected="white",
            checkbox_label_text_color_selected_dark="*primary_200",
            checkbox_label_shadow="none",
            checkbox_label_border_width="2px",
            checkbox_label_border_color="*neutral_300",
            checkbox_label_border_color_dark=f"{colors.violet.c700}50",
            checkbox_label_border_color_selected="*primary_600",
            checkbox_label_border_color_selected_dark="*primary_600",
            # Slider — cyan track
            slider_color="*secondary_500",
            slider_color_dark="*secondary_400",
            # Accents — cyan for selection highlights
            color_accent="*secondary_500",
            color_accent_soft="*secondary_50",
            color_accent_soft_dark=f"{colors.cyan.c900}60",
            # Tables — violet-tinted stripes in dark
            table_even_background_fill="*neutral_50",
            table_even_background_fill_dark="#1a1030",
            table_odd_background_fill="white",
            table_odd_background_fill_dark="#110b22",
            table_border_color="*neutral_300",
            table_border_color_dark=f"{colors.violet.c800}60",
            table_row_focus="*primary_50",
            table_row_focus_dark="#241540",
            # Panels
            panel_border_width="2px",
            panel_border_color="*neutral_300",
            panel_border_color_dark=f"{colors.violet.c800}60",
            # Loader — cyan
            loader_color="*secondary_500",
            loader_color_dark="*secondary_400",
        )
