{
  "version": "1.0.0",
  "layout_name": "admin_forgot_password",
  "meta": {
    "title": "$t:auth.forgot_password.title",
    "description": "관리자 비밀번호 찾기 페이지",
    "auth_required": false
  },
  "data_sources": [],
  "init_actions": [
    {
      "handler": "initTheme",
      "target": "{{query.theme}}"
    },
    {
      "handler": "setState",
      "params": {
        "target": "local",
        "isSubmitting": false,
        "success": false,
        "forgotError": null,
        "forgotErrors": null
      }
    }
  ],
  "components": [
    {
      "id": "forgot_page_wrapper",
      "type": "basic",
      "name": "Div",
      "props": {
        "className": "flex-center min-h-screen justify-center bg-gray-50 dark:bg-gray-900 px-4 sm:px-6 lg:px-8"
      },
      "children": [
        {
          "id": "forgot_card_container",
          "type": "basic",
          "name": "Div",
          "props": {
            "className": "max-w-md w-full space-y-8"
          },
          "children": [
            {
              "id": "forgot_card",
              "type": "basic",
              "name": "Div",
              "props": {
                "className": "bg-white dark:bg-gray-800 rounded-lg shadow-md p-8"
              },
              "children": [
                {
                  "comment": "헤더",
                  "id": "forgot_header",
                  "type": "basic",
                  "name": "Div",
                  "props": {
                    "className": "text-center mb-8"
                  },
                  "children": [
                    {
                      "id": "forgot_lock_icon_wrapper",
                      "type": "basic",
                      "name": "Div",
                      "props": {
                        "className": "flex-center w-16 h-16 mx-auto mb-4 bg-blue-100 dark:bg-blue-900/30 rounded-full justify-center"
                      },
                      "children": [
                        {
                          "id": "forgot_lock_icon",
                          "type": "basic",
                          "name": "Icon",
                          "props": {
                            "name": "lock",
                            "size": "xl",
                            "color": "text-blue-600 dark:text-blue-400"
                          }
                        }
                      ]
                    },
                    {
                      "id": "forgot_title",
                      "type": "basic",
                      "name": "H1",
                      "props": {
                        "className": "text-page-heading mb-2"
                      },
                      "text": "$t:auth.forgot_password.title"
                    },
                    {
                      "id": "forgot_subtitle",
                      "type": "basic",
                      "name": "P",
                      "if": "{{!_local.success}}",
                      "props": {
                        "className": "text-label"
                      },
                      "text": "$t:auth.forgot_password.subtitle"
                    }
                  ]
                },
                {
                  "comment": "성공 메시지",
                  "id": "forgot_success_message",
                  "type": "basic",
                  "name": "Div",
                  "if": "{{_local.success}}",
                  "props": {
                    "className": "alert-success"
                  },
                  "children": [
                    {
                      "id": "forgot_success_text",
                      "type": "basic",
                      "name": "P",
                      "props": {
                        "className": "text-success-soft text-sm text-center"
                      },
                      "text": "$t:auth.forgot_password.success"
                    }
                  ]
                },
                {
                  "comment": "폼",
                  "id": "forgot_form",
                  "type": "basic",
                  "name": "Form",
                  "if": "{{!_local.success}}",
                  "actions": [
                    {
                      "type": "submit",
                      "handler": "sequence",
                      "actions": [
                        {
                          "handler": "setState",
                          "params": {
                            "target": "local",
                            "isSubmitting": true,
                            "forgotError": null,
                            "forgotErrors": null
                          }
                        },
                        {
                          "handler": "apiCall",
                          "target": "/api/auth/forgot-password",
                          "params": {
                            "method": "POST",
                            "body": {
                              "email": "{{form.email}}",
                              "redirect_prefix": "admin"
                            }
                          },
                          "onSuccess": {
                            "handler": "setState",
                            "params": {
                              "target": "local",
                              "isSubmitting": false,
                              "success": true
                            }
                          },
                          "onError": [
                            {
                              "handler": "setState",
                              "params": {
                                "target": "local",
                                "isSubmitting": false,
                                "forgotError": "{{error.message ?? ''}}",
                                "forgotErrors": "{{error.errors ?? null}}"
                              }
                            }
                          ]
                        }
                      ]
                    }
                  ],
                  "children": [
                    {
                      "comment": "일반 에러 메시지 (필드 에러가 아닌 경우)",
                      "id": "forgot_error_message",
                      "type": "basic",
                      "name": "Div",
                      "if": "{{_local.forgotError && !_local.forgotErrors}}",
                      "props": {
                        "className": "alert-danger"
                      },
                      "children": [
                        {
                          "id": "forgot_error_text",
                          "type": "basic",
                          "name": "P",
                          "props": {
                            "className": "text-error-soft text-center"
                          },
                          "text": "{{_local.forgotError}}"
                        }
                      ]
                    },
                    {
                      "comment": "이메일 입력",
                      "id": "forgot_email_field",
                      "type": "basic",
                      "name": "Div",
                      "children": [
                        {
                          "id": "forgot_email_label",
                          "type": "basic",
                          "name": "Label",
                          "props": {
                            "htmlFor": "email",
                            "className": "form-label"
                          },
                          "text": "$t:auth.forgot_password.email"
                        },
                        {
                          "id": "forgot_email_input",
                          "type": "basic",
                          "name": "Input",
                          "props": {
                            "id": "email",
                            "type": "email",
                            "name": "email",
                            "placeholder": "$t:auth.forgot_password.email_placeholder",
                            "className": "{{_local.forgotErrors?.email ? 'input-error px-4 disabled:opacity-50 disabled:cursor-not-allowed' : 'px-4 disabled:opacity-50 disabled:cursor-not-allowed'}}",
                            "required": true,
                            "disabled": "{{_local.isSubmitting ?? false}}"
                          }
                        },
                        {
                          "id": "forgot_email_error",
                          "type": "basic",
                          "name": "P",
                          "if": "{{_local.forgotErrors?.email}}",
                          "props": {
                            "className": "mt-2 text-sm text-red-600 dark:text-red-400"
                          },
                          "text": "{{Array.isArray(_local.forgotErrors?.email) ? _local.forgotErrors.email[0] : _local.forgotErrors?.email}}"
                        }
                      ]
                    },
                    {
                      "type": "basic",
                      "name": "Div",
                      "children": [
                        {
                          "comment": "제출 버튼",
                          "id": "forgot_submit_button",
                          "type": "basic",
                          "name": "Button",
                          "props": {
                            "type": "submit",
                            "className": "flex-center w-full px-4 py-3 rounded-lg font-medium bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 text-white focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900 disabled:opacity-50 disabled:cursor-not-allowed transition-colors duration-200 justify-center gap-2",
                            "disabled": "{{_local.isSubmitting ?? false}}"
                          },
                          "children": [
                            {
                              "id": "forgot_submit_spinner",
                              "type": "basic",
                              "name": "Div",
                              "if": "{{_local.isSubmitting}}",
                              "props": {
                                "className": "w-5 h-5 border-2 border-white/30 border-t-white rounded-full animate-spin"
                              }
                            },
                            {
                              "id": "forgot_submit_text",
                              "type": "basic",
                              "name": "Span",
                              "if": "{{!_local.isSubmitting}}",
                              "text": "$t:auth.forgot_password.submit"
                            },
                            {
                              "id": "forgot_submit_processing",
                              "type": "basic",
                              "name": "Span",
                              "if": "{{_local.isSubmitting}}",
                              "text": "$t:auth.forgot_password.processing"
                            }
                          ]
                        }
                      ]
                    }
                  ],
                  "props": {
                  }
                },
                {
                  "comment": "로그인 링크",
                  "id": "forgot_back_to_login",
                  "type": "basic",
                  "name": "Div",
                  "props": {
                    "className": "mt-6 text-center"
                  },
                  "children": [
                    {
                      "id": "forgot_login_link",
                      "type": "basic",
                      "name": "Button",
                      "props": {
                        "type": "button",
                        "className": "text-sm text-blue-600 dark:text-blue-400 hover:text-blue-500 dark:hover:text-blue-300 transition-colors duration-200 cursor-pointer"
                      },
                      "actions": [
                        {
                          "type": "click",
                          "handler": "navigate",
                          "params": {
                            "path": "/admin/login"
                          }
                        }
                      ],
                      "text": "$t:auth.forgot_password.back_to_login"
                    }
                  ]
                }
              ]
            },
            {
              "comment": "언어 셀렉터",
              "id": "forgot_language_selector_container",
              "type": "basic",
              "name": "Div",
              "props": {
                "className": "mt-6"
              },
              "children": [
                {
                  "id": "forgot_language_selector",
                  "type": "basic",
                  "name": "Select",
                  "props": {
                    "className": "block w-full px-4 py-2.5 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 shadow-sm focus:border-blue-500 focus:ring-blue-500 text-sm",
                    "value": "{{$locale}}",
                    "options": "{{$locales}}"
                  },
                  "actions": [
                    {
                      "type": "change",
                      "handler": "setLocale",
                      "target": "{{$event.target.value}}"
                    }
                  ]
                }
              ]
            },
            {
              "comment": "테마 Segmented Control",
              "id": "forgot_theme_selector_container",
              "type": "basic",
              "name": "Div",
              "props": {
                "className": "mt-4 flex justify-center"
              },
              "children": [
                {
                  "id": "forgot_theme_segmented_control",
                  "type": "basic",
                  "name": "Div",
                  "props": {
                    "className": "inline-flex bg-gray-100 dark:bg-gray-800 rounded-lg p-1 gap-1"
                  },
                  "children": [
                    {
                      "id": "forgot_theme_light_button",
                      "type": "basic",
                      "name": "Button",
                      "props": {
                        "type": "button",
                        "className": "{{_global.theme === 'light' ? 'p-2 rounded-md bg-white dark:bg-gray-700 shadow-sm text-blue-600 dark:text-blue-400 transition-all duration-200' : 'p-2 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-all duration-200'}}",
                        "title": "$t:admin.theme.light"
                      },
                      "actions": [
                        {
                          "type": "click",
                          "handler": "setTheme",
                          "params": {
                            "theme": "light"
                          }
                        }
                      ],
                      "children": [
                        {
                          "id": "forgot_theme_light_icon",
                          "type": "basic",
                          "name": "Icon",
                          "props": {
                            "name": "sun",
                            "size": "sm"
                          }
                        }
                      ]
                    },
                    {
                      "id": "forgot_theme_dark_button",
                      "type": "basic",
                      "name": "Button",
                      "props": {
                        "type": "button",
                        "className": "{{_global.theme === 'dark' ? 'p-2 rounded-md bg-white dark:bg-gray-700 shadow-sm text-blue-600 dark:text-blue-400 transition-all duration-200' : 'p-2 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-all duration-200'}}",
                        "title": "$t:admin.theme.dark"
                      },
                      "actions": [
                        {
                          "type": "click",
                          "handler": "setTheme",
                          "params": {
                            "theme": "dark"
                          }
                        }
                      ],
                      "children": [
                        {
                          "id": "forgot_theme_dark_icon",
                          "type": "basic",
                          "name": "Icon",
                          "props": {
                            "name": "moon",
                            "size": "sm"
                          }
                        }
                      ]
                    },
                    {
                      "id": "forgot_theme_auto_button",
                      "type": "basic",
                      "name": "Button",
                      "props": {
                        "type": "button",
                        "className": "{{_global.theme === 'auto' || !_global.theme ? 'p-2 rounded-md bg-white dark:bg-gray-700 shadow-sm text-blue-600 dark:text-blue-400 transition-all duration-200' : 'p-2 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-all duration-200'}}",
                        "title": "$t:admin.theme.auto"
                      },
                      "actions": [
                        {
                          "type": "click",
                          "handler": "setTheme",
                          "params": {
                            "theme": "auto"
                          }
                        }
                      ],
                      "children": [
                        {
                          "id": "forgot_theme_auto_icon",
                          "type": "basic",
                          "name": "Icon",
                          "props": {
                            "name": "desktop",
                            "size": "sm"
                          }
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}
