<?php 

function tailor_suits_add_admin_menu() {
    add_menu_page(
        'Theme Settings', // Page title
        'Theme Settings', // Menu title
        'manage_options', // Capability
        'tailor-suits-theme-settings', // Menu slug
        'tailor_suits_settings_page' // Function to display the page
    );
}
add_action( 'admin_menu', 'tailor_suits_add_admin_menu' );

function tailor_suits_settings_page() {
    ?>
    <div class="wrap">
        <h1><?php esc_html_e( 'Theme Settings', 'tailor-suits' ); ?></h1>
        <form action="options.php" method="post">
            <?php
            settings_fields( 'tailor_suits_settings_group' );
            do_settings_sections( 'tailor-suits-theme-settings' );
            submit_button();
            ?>
        </form>
    </div>
    <?php
}

function tailor_suits_register_settings() {
    register_setting( 'tailor_suits_settings_group', 'tailor_suits_enable_animations' );

    add_settings_section(
        'tailor_suits_settings_section',
        __( 'Animation Settings', 'tailor-suits' ),
        null,
        'tailor-suits-theme-settings'
    );

    add_settings_field(
        'tailor_suits_enable_animations',
        __( 'Enable Animations', 'tailor-suits' ),
        'tailor_suits_enable_animations_callback',
        'tailor-suits-theme-settings',
        'tailor_suits_settings_section'
    );
}
add_action( 'admin_init', 'tailor_suits_register_settings' );

function tailor_suits_enable_animations_callback() {
    $checked = get_option( 'tailor_suits_enable_animations', true );
    ?>
    <input type="checkbox" name="tailor_suits_enable_animations" value="1" <?php checked( 1, $checked ); ?> />
    <?php
}

