using Gtk 4.0;
using Adw 1;

Adw.Window _root {
  default-width: 360;
  modal: true;
  resizable: false;
  default-widget: _applyButton;

  content: Adw.ToolbarView {
    [top]
    Adw.HeaderBar {
      title-widget: Gtk.Label {};
    }

    Gtk.WindowHandle {
      Gtk.Box {
        orientation: vertical;
        spacing: 24;

        Gtk.Label _titleLabel {
          styles ["title-2"]
        }

        Adw.PreferencesGroup {
          margin-start: 24;
          margin-end: 24;

          Adw.EntryRow _nameRow {
            title: _("Name");
            input-hints: spellcheck;
            activates-default: true;
          }

          Adw.EntryRow _descriptionRow {
            title: _("Description");
            input-hints: spellcheck;
            activates-default: true;
          }

          Adw.ActionRow {
            title: _("Color");
            activatable-widget: _colorButton;
        
            [suffix]
            Gtk.ColorDialogButton _colorButton {
              valign: center;
            }
          }
        }

        Gtk.Box {
          orientation: horizontal;
          spacing: 24;
          halign: center;
          homogeneous: true;
          margin-top: 24;
          margin-bottom: 24;

          Gtk.Button _deleteButton {
            valign: center;
            label: _("Delete");

            styles ["pill", "destructive-action"]
          }

          Gtk.Button _applyButton {
            valign: center;

            styles ["pill", "suggested-action"]
          }
        }
      }
    }
  };
  
  Gtk.ShortcutController {
    Gtk.Shortcut {
      trigger: "Escape";
      action: "action(window.close)";
    }
  }
}