"""
About dialog — application info, features, quick start.
"""

import customtkinter as ctk
from version import __version__, __author__
from core.i18n import t


class AboutDialog(ctk.CTkToplevel):
    def __init__(self, master):
        super().__init__(master)

        self.title(f"{t('about_title')} — {t('version')} {__version__}")
        self.geometry("500x480")
        self.resizable(False, False)
        self.transient(master)
        self.grab_set()

        # ── Header ──
        ctk.CTkLabel(
            self, text=t("about_title"),
            font=ctk.CTkFont(size=24, weight="bold")
        ).pack(padx=20, pady=(25, 2))

        ctk.CTkLabel(
            self, text=f"v{__version__}",
            font=ctk.CTkFont(size=13), text_color="#9ca3af"
        ).pack()

        ctk.CTkLabel(
            self, text=f"by {__author__}",
            font=ctk.CTkFont(size=11), text_color="#6b7280"
        ).pack(pady=(0, 10))

        # ── Separator ──
        ctk.CTkFrame(self, height=1, fg_color="gray40").pack(fill="x", padx=30, pady=5)

        # ── Description ──
        ctk.CTkLabel(
            self, text=t("about_desc"),
            font=ctk.CTkFont(size=12), text_color="#9ca3af",
            justify="center", wraplength=440
        ).pack(padx=20, pady=(8, 5))

        # ── Separator ──
        ctk.CTkFrame(self, height=1, fg_color="gray40").pack(fill="x", padx=30, pady=5)

        # ── Features ──
        ctk.CTkLabel(
            self, text=t("about_features_title"),
            font=ctk.CTkFont(size=14, weight="bold"), anchor="w"
        ).pack(fill="x", padx=35, pady=(8, 3))

        ctk.CTkLabel(
            self, text=t("about_features"),
            font=ctk.CTkFont(size=12), anchor="w", justify="left"
        ).pack(fill="x", padx=40, pady=(0, 5))

        # ── Separator ──
        ctk.CTkFrame(self, height=1, fg_color="gray40").pack(fill="x", padx=30, pady=5)

        # ── Quick Start ──
        ctk.CTkLabel(
            self, text=t("about_howto_title"),
            font=ctk.CTkFont(size=14, weight="bold"), anchor="w"
        ).pack(fill="x", padx=35, pady=(8, 3))

        ctk.CTkLabel(
            self, text=t("about_howto"),
            font=ctk.CTkFont(size=12), anchor="w", justify="left"
        ).pack(fill="x", padx=40, pady=(0, 10))

        # ── Close button ──
        ctk.CTkButton(
            self, text=t("close"), width=120, command=self.destroy
        ).pack(pady=(10, 20))
