<?php

if ( ! defined( 'ABSPATH' ) ) exit;

class Logindes_login_customizer_Admin {
    /**
     * Module tabs for settings page
     */
    private static $modules = array(
        'login-customizer' => 'Login Customizer',
    );

    public static function init() {
        add_action( 'admin_menu', array( __CLASS__, 'add_menu' ) );
    }

    public static function add_menu() {
        add_menu_page(
            'Login Screen Designer',                 // Page title
            'Login Screen Designer',                 // Menu title
            'manage_options',                      // Capability
            'wplc-login-customizer',               // Slug
            array( __CLASS__, 'render_admin_page'),// Callback
            LOGINDES_URL . 'assets/img/wplc-login-icon.png', // Icon URL
            80                                     // Position
        );
    }

    public static function render_admin_page() {
        echo '<div class="wrap">';
        echo '<p class="wplc-back"><a href="' . esc_url( admin_url( 'index.php' ) ) . '">
        <svg width="26" height="18" viewBox="0 0 26 18" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path d="M2.5 9L25 8.99963" stroke="#141B34" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
            <path d="M8.5 1.49988L1.70711 8.29277C1.37377 8.6261 1.20711 8.79277 1.20711 8.99988C1.20711 9.20698 1.37377 9.37365 1.70711 9.70698L8.5 16.4999" stroke="#141B34" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
        </svg>
        Back to Dashboard</a></p>';

        // ✅ Always load login-style.php as main screen
        $login_style_view = LOGINDES_DIR . 'templates/login-style.php';
        if ( file_exists( $login_style_view ) ) {
            require $login_style_view;
        } else {
            echo '<p>Login Style view not found.</p>';
        }

        echo '</div>'; // wrap end
    }    
}
?>
