[gd_scene load_steps=5 format=3 uid="uid://b8qxqvw3n2k4r"]

[ext_resource type="Script" uid="uid://d100mupmyal5" path="res://scripts/main.gd" id="1_main"]
[ext_resource type="Theme" uid="uid://bviqieumdiccr" path="res://assets/themes/main_theme.tres" id="1_sugp2"]
[ext_resource type="Texture2D" uid="uid://cja8kui47qb3d" path="res://assets/ui/main_menu.png" id="3_sugp2"]

[sub_resource type="GDScript" id="GDScript_0wfyh"]
script/source = "extends Button
class_name CustomButton
## Custom Button Component
##
## Enhanced button with icon support, loading state, and themed styling.
##
## Features:
## - Optional icon (left or right)
## - Loading spinner state
## - Hover effects
## - Disabled state management
## - Multiple visual variants
##
## Usage:
##   var btn = CustomButton.new()
##   btn.text = \"Login\"
##   btn.variant = CustomButton.Variant.PRIMARY
##   btn.set_loading(true)

signal button_clicked()

# Button variants
enum Variant {
	PRIMARY,    # Gold accent button (main actions)
	SECONDARY,  # Standard button
	DANGER,     # Red button (destructive actions)
	SUCCESS,    # Green button (positive actions)
	GHOST       # Transparent button (subtle actions)
}

# Icon position
enum IconPosition {
	LEFT,
	RIGHT,
	NONE
}

# Export variables (editable in Godot Inspector)
@export var variant: Variant = Variant.SECONDARY
@export var icon_texture: Texture2D = null
@export var icon_position: IconPosition = IconPosition.LEFT
@export var show_loading: bool = false

# Internal nodes (set up in _ready)
#var _icon: TextureRect = null
#var _label: Label = null
#var _spinner: TextureRect = null


func _ready() -> void:
	# Apply theme based on variant
	

	# Connect press signal
	pressed.connect(_on_button_pressed)



## Set loading state
func set_loading(loading: bool) -> void:
	show_loading = loading
	disabled = loading
	_update_loading_state()



## Internal: Update loading spinner
func _update_loading_state() -> void:
	# TODO: Implement loading spinner when scene is set up
	if show_loading:
		text = \"Loading...\"
	else:
		# Restore original text
		pass


## Internal: Handle button press
func _on_button_pressed() -> void:
	if not disabled and not show_loading:
		button_clicked.emit()
"

[node name="Main" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("1_sugp2")
script = ExtResource("1_main")

[node name="BackgroundPanel" type="Panel" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2

[node name="TextureRect" type="TextureRect" parent="BackgroundPanel"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("3_sugp2")
expand_mode = 4
stretch_mode = 5

[node name="CenterContainer" type="CenterContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2

[node name="PanelContainer" type="PanelContainer" parent="CenterContainer"]
layout_mode = 2

[node name="MarginContainer" type="MarginContainer" parent="CenterContainer/PanelContainer"]
layout_mode = 2
theme = ExtResource("1_sugp2")
theme_override_constants/margin_left = 15
theme_override_constants/margin_top = 15
theme_override_constants/margin_right = 15
theme_override_constants/margin_bottom = 15

[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer"]
layout_mode = 2
theme_override_constants/separation = 20

[node name="TitleLabel" type="Label" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Code of Conquest"
horizontal_alignment = 1
vertical_alignment = 1

[node name="Spacer1" type="Control" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer"]
custom_minimum_size = Vector2(0, 20)
layout_mode = 2

[node name="WelcomeLabel" type="Label" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Welcome, Player"
horizontal_alignment = 1
vertical_alignment = 1

[node name="StatusLabel" type="Label" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Loading..."
horizontal_alignment = 1
vertical_alignment = 1

[node name="Spacer2" type="Control" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer"]
custom_minimum_size = Vector2(0, 30)
layout_mode = 2

[node name="ButtonContainer" type="HBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/separation = 16
alignment = 1

[node name="PlayNowButton" type="Button" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/ButtonContainer"]
custom_minimum_size = Vector2(150, 0)
layout_mode = 2
text = "Play Now"
script = SubResource("GDScript_0wfyh")

[node name="LogoutButton" type="Button" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/ButtonContainer"]
custom_minimum_size = Vector2(150, 0)
layout_mode = 2
text = "Logout"
script = SubResource("GDScript_0wfyh")
