{
  "namespace": "anvil_pocket",

  "generic_label": {
    "type": "label",
    "color": "$pocket_title_text_color",
    "anchor_from": "center",
    "anchor_to": "center"
  },

  // Backgrounds //

  "background_image": {
    "type": "image",
    "size": [ "85%", "85%" ],
    "texture": "textures/ui/background_panel"
  },

  // Arrow //

  "arrow_icon": {
    "type": "image",
    "texture": "textures/ui/arrow_icon",
    "size": [ 24, 16 ]
  },

  // Labels //

  "cost_label@anvil_pocket.generic_label": {
    "shadow": true,
    "text": "#text",
    "anchor_from": "left_middle",
    "anchor_to": "left_middle",
    "layer": 2,
    "controls": [
      {
        "gray@resource_packs.gray_image": {
          "layer": -1,
          "size": [ "105%", "105%" ],
          "alpha": 0.3
        }
      }
    ]
  },
  "title_label@anvil_pocket.generic_label": {
    "anchor_from": "left_middle", // the parent
    "anchor_to": "left_middle", // this control
    "text": "container.repair"
  },

  // Text Edit //

  "text_edit_control@common.text_edit_box": {
    "anchor_from": "left_middle", // the parent
    "anchor_to": "left_middle", // this control
    "size": [ 142, 16 ],

    "property_bag": {
      "#property_field": "#item_name"
    },
    "max_length": 30,
    "$text_edit_binding_name": "#text_box_item_name"
  },
  "anvil_title_and_text_panel": {
    "type": "panel",
    "anchor_from": "left_middle",
    "anchor_to": "left_middle",
    "controls": [
      {
        "title_label@anvil_pocket.title_label": {
          "layer": 1,
          "offset": [ 5, -8 ]
        }
      },
      {
        "text_edit_control@anvil_pocket.text_edit_control": {
          "offset": [ 0, 8 ]
        }
      }
    ]
  },

  // Slots //

  "slots_panel": {
    "type": "panel",
    "anchor_from": "left_middle",
    "anchor_to": "left_middle",
    "controls": [
      {
        "input_slot@common.pocket_ui_large_container_item": {
          "offset": [ 0, 0 ],
          "anchor_from": "left_middle",
          "anchor_to": "left_middle",
          "$item_collection_name": "anvil_input_items"
        }
      },
      {
        "material_slot@common.pocket_ui_large_container_item": {
          "offset": [ 48, 0 ],
          "anchor_from": "left_middle",
          "anchor_to": "left_middle",
          "$item_collection_name": "anvil_material_items"
        }
      },
      {
        "result_slot@common.pocket_ui_large_container_item": {
          "offset": [ 109, 0 ],
          "anchor_from": "left_middle",
          "anchor_to": "left_middle",
          "$item_collection_name": "anvil_result_items",
          "$button_ref": "anvil.anvil_output_slot_button"
        }
      },
      {
        "plus_sign@anvil_pocket.generic_label": {
          "text": "+",
          "offset": [ 38, 0 ],
          "anchor_from": "left_middle",
          "anchor_to": "left_middle",
          "layer": 1
        }
      },
      {
        "arrow": {
          "type": "image",
          "texture": "textures/ui/arrow_inactive",
          "size": [ 22, 15 ],
          "anchor_from": "left_middle",
          "anchor_to": "left_middle",
          "offset": [ 83, 0 ],
          "controls": [
            {
              "cross_out": {
                "type": "image",
                "layer": 1,
                "texture": "textures/ui/crossout",
                "bindings": [
                  {
                    "binding_name": "#cross_out_icon",
                    "binding_name_override": "#visible"
                  }
                ]
              }
            }
          ]
        }
      }
    ]
  },

  // Anvil Panel //

  "anvil_contents_panel": {
    "type": "panel",
    "size": [ 144, 100 ],
    "offset": [ 0, 16 ],
    "anchor_from": "center",
    "anchor_to": "center",
    "controls": [
      {
        "red_cost@anvil_pocket.cost_label": {
          "offset": [ 40, -27 ],
          "color": "$anvil_cost_fail_text_color",
          "bindings": [
            {
              "binding_name": "#cost_text",
              "binding_name_override": "#text"
            },
            {
              "binding_name": "#cost_text_red",
              "binding_name_override": "#visible"
            }
          ]
        }
      },
      {
        "green_cost@anvil_pocket.cost_label": {
          "offset": [ 40, -27 ],
          "color": "$anvil_cost_success_text_color",
          "bindings": [
            {
              "binding_name": "#cost_text",
              "binding_name_override": "#text"
            },
            {
              "binding_name": "#cost_text_green",
              "binding_name_override": "#visible"
            }
          ]
        }
      },
      {
        "slots_panel@anvil_pocket.slots_panel": {
          "offset": [ 0, -2 ]
        }
      },
      {
        "anvil_title_and_text_panel@anvil_pocket.anvil_title_and_text_panel": {
          "offset": [ 0, -50 ]
        }
      }
    ]
  },

  // Inventory Grids //

  "inventory_grid": {
    "type": "grid",
    "grid_rescaling_type": "horizontal",
    "anchor_to": "top_left",
    "anchor_from": "top_left",
    "size": [ "100%", "default" ],
    "maximum_grid_items": 36,
    "collection_name": "combined_hotbar_and_inventory_items",
    "grid_item_template": "common.pocket_ui_container_item",
    "$item_collection_name": "combined_hotbar_and_inventory_items"
  },

  "inventory_content": {
    "type": "panel",
    "size": [ "100%-5px", "100%-5px" ],
    "offset": [ "5px", "2px" ],
    "anchor_to": "top_left",
    "anchor_from": "top_left",
    "controls": [
      {
        "scrolling_panel@common.scrolling_panel": {
          "$allow_scrolling_even_when_content_fits": false,
          "$scrolling_pane_size": [ "100%", "100%-2px" ],
          "$scrolling_content": "anvil_pocket.inventory_grid",
          "$scroll_box_mouse_image_control": "common-classic.button_state_default",
          "$scroll_size": [ "8px", "100%" ]
        }
      }
    ]
  },

  
  // Layout Content Panels //

  "inventory_and_anvil_panel": {
    "type": "panel",
    "controls": [
      {
        "inventory_half_screen": {
          "type": "panel",
          "size": [ "50%", "100%" ],
          "anchor_from": "left_middle",
          "anchor_to": "left_middle",

          "controls": [
            { "inventory_content@anvil_pocket.inventory_content": {} }
          ]
        }
      },
      {
        "anvil_half_screen": {
          "type": "panel",
          "size": [ "50%", "100%" ],
          "anchor_from": "right_middle",
          "anchor_to": "right_middle",

          "controls": [
            { "anvil_contents_panel@anvil_pocket.anvil_contents_panel": {} }
          ]
        }
      }
    ]
  },

  // Header //

  "header": {
    "type": "panel",
    "size": [ "100%", 28 ],
    "anchor_from": "top_middle",
    "anchor_to": "top_middle",
    "controls": [
      {
        "header_background": {
          "type": "image",
          "texture": "textures/ui/header_bar_2"
        }
      },
      { "legacy_pocket_close_button@common.legacy_pocket_close_button": { "offset": [ -3, 3 ] } },
      {
        "panel": {
          "type": "panel",
          "anchor_from": "center",
          "anchor_to": "center",
          "controls": [
            {
              "title_label@anvil_pocket.generic_label": {
                "text": "tile.anvil.name",
                "layer": 1
              }
            }
          ]
        }
      }
    ]
  },


  "header_and_content_stack_panel": {
    "type": "stack_panel",
    "orientation": "vertical",
    "size": [ "85%", "85%" ],
    "controls": [
      { "header@anvil_pocket.header": { "layer": 2 } },
      {
        "inventory_and_anvil_panel@anvil_pocket.inventory_and_anvil_panel": {
          "size": [ "100%", "fill" ]
        }
      }
    ]
  },

  // Anvil Screen //

  "anvil_panel": {
    "type": "panel",
    "controls": [
      { "bg@anvil_pocket.background_image": {} },
      { "root_panel@common.root_panel": { "size": [ "85%", "85%" ], "layer": 1  } },
      { "header_and_content_stack_panel@anvil_pocket.header_and_content_stack_panel": {} },

      { "container_gamepad_helpers@common.container_gamepad_helpers": { "layer": 2 } },
      { "inventory_selected_icon_button@common.inventory_selected_icon_button": {} },
      { "hold_icon@common.inventory_take_progress_icon_button": {} },
      { "selected_item_details_factory@common.selected_item_details_factory": {} },
      {
        "item_lock_notification_factory@common.item_lock_notification_factory": {
          "$offset": [ 0, "85%" ]
        }
      },
      { "flying_item_renderer@common.flying_item_renderer": {} }
    ]
  }
}
