<?php
if ( ! defined( 'ABSPATH' ) ) exit;
?>
<div class="wrap">
    <h1 class="iccb-admin-notice">ConsentPress</h1>
    <div class="iccb-dashboard-header">
        <div class="iccb-title-holder">
            <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="consentpress-icon" width="24px" height="24px" viewBox="0 0 24 24" version="1.1">
                <g id="surface2">
                    <path class="circle" d="M 62 32 C 62 15.427083 48.572917 2 32 2 C 15.427083 2 2 15.427083 2 32 C 2 48.572917 15.427083 62 32 62 C 48.572917 62 62 48.572917 62 32 Z M 62 32 " transform="matrix(0.375,0,0,0.375,0,0)"/>
                    <path class="dot" d="M 9.75 9 C 9.75 8.171875 9.078125 7.5 8.25 7.5 C 7.421875 7.5 6.75 8.171875 6.75 9 C 6.75 9.828125 7.421875 10.5 8.25 10.5 C 9.078125 10.5 9.75 9.828125 9.75 9 Z M 9.75 9 "/>
                    <path class="dot" d="M 15.375 6.75 C 15.375 6.128906 14.871094 5.625 14.25 5.625 C 13.628906 5.625 13.125 6.128906 13.125 6.75 C 13.125 7.371094 13.628906 7.875 14.25 7.875 C 14.871094 7.875 15.375 7.371094 15.375 6.75 Z M 15.375 6.75 "/>
                    <path class="dot" d="M 17.625 12 C 17.625 10.964844 16.785156 10.125 15.75 10.125 C 14.714844 10.125 13.875 10.964844 13.875 12 C 13.875 13.035156 14.714844 13.875 15.75 13.875 C 16.785156 13.875 17.625 13.035156 17.625 12 Z M 17.625 12 "/>
                    <path class="dot" d="M 12 15.75 C 12 14.921875 11.328125 14.25 10.5 14.25 C 9.671875 14.25 9 14.921875 9 15.75 C 9 16.578125 9.671875 17.25 10.5 17.25 C 11.328125 17.25 12 16.578125 12 15.75 Z M 12 15.75 "/>
                </g>
            </svg>
            <?php esc_html_e('GTM & Pixel Settings', 'consentpress'); ?>
        </div>
        <p><?php esc_html_e('Connect one GTM container and optional pixel IDs.', 'consentpress'); ?></p>
    </div>

    <form method="post">
        <?php wp_nonce_field('iccb_save_pixels'); ?>

        <div class="iccb-card">
            <h2><?php esc_html_e('Tracking Mode', 'consentpress'); ?></h2>
            <label><input type="radio" name="pixel_mode" value="gtm_only" <?php checked($settings['mode'], 'gtm_only'); ?>> <?php esc_html_e('Use only Google Tag Manager', 'consentpress'); ?></label><br>
            <label><input type="radio" name="pixel_mode" value="gtm_plus_pixels" <?php checked($settings['mode'], 'gtm_plus_pixels'); ?>> <?php esc_html_e('Use GTM and also load Facebook/LinkedIn Pixels after marketing consent', 'consentpress'); ?></label>
        </div>

        <div class="iccb-card">
            <h2><?php esc_html_e('Tracking IDs', 'consentpress'); ?></h2>
            <table class="form-table">
                <tr>
                    <th><label for="gtm_id"><?php esc_html_e('GTM Container ID', 'consentpress'); ?></label></th>
                    <td><input type="text" id="gtm_id" name="gtm_id" class="regular-text" placeholder="GTM-XXXXXXX" value="<?php echo esc_attr($settings['gtm']); ?>"></td>
                </tr>
                <tr>
                    <th><label for="facebook_pixel"><?php esc_html_e('Facebook Pixel ID', 'consentpress'); ?></label></th>
                    <td><input type="text" id="facebook_pixel" name="facebook_pixel" class="regular-text" value="<?php echo esc_attr($settings['facebook']); ?>"></td>
                </tr>
                <tr>
                    <th><label for="linkedin_pixel"><?php esc_html_e('LinkedIn Pixel ID', 'consentpress'); ?></label></th>
                    <td><input type="text" id="linkedin_pixel" name="linkedin_pixel" class="regular-text" value="<?php echo esc_attr($settings['linkedin']); ?>"></td>
                </tr>
            </table>
            <p class="description"><?php esc_html_e('Per-domain tracking IDs, advanced script blocking, and diagnostics are available in ConsentPress Pro.', 'consentpress'); ?></p>
        </div>

        <?php submit_button(esc_html__('Save Settings', 'consentpress'), 'primary', 'iccb_pixel_submit'); ?>
    </form>
</div>
