<?php

namespace Repetito\Admin;

// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

use Repetito\Traits\Singleton;
use Repetito\Web\Frontend;

use const Repetito\API_URL;
use const Repetito\NOREPETITO_TAG;
use const Repetito\PRIVACY_POLICY_URL;
use WC_Tax;
use WC_Countries;

class AdminPage {
    use Singleton;

    public function register() {
        add_action('admin_menu', array($this, 'addAdminMenu'));
        add_action('admin_init', array($this, 'registerSettings'));
        add_action('admin_enqueue_scripts', array($this, 'enqueueAdminStyles'));
    }

    public function enqueueAdminStyles($hook) {
        // Only load on our plugin's settings page
        if ('toplevel_page_repetito-settings' !== $hook) {
            return;
        }

        wp_enqueue_style(
            'repetito-admin-styles',
            plugins_url('assets/admin/admin-styles.css', dirname(__DIR__)),
            array(),
            \Repetito\VERSION
        );
    }

    public function addAdminMenu() {
        add_menu_page(
            __('Repetito Settings', 'repetito'),
            __('Repetito', 'repetito'),
            'manage_options',
            'repetito-settings',
            array($this, 'renderAdminPage'),
            'dashicons-store',
            56
        );
    }

    public function registerSettings() {
        // Register all settings under one option
        register_setting('repetito-settings', 'repetito-settings', array(
            'sanitize_callback' => array($this, 'sanitizeSettings')
        ));

        // General Settings Section
        add_settings_section(
            'repetito_general_section',
            __('General Settings', 'repetito'),
            null,
            'repetito-settings'
        );

        // Fee Settings Section
        add_settings_section(
            'repetito_fees_section',
            __('Fee Settings', 'repetito'),
            null,
            'repetito-settings'
        );

        // Package Settings Section
        add_settings_section(
            'repetito_packages_section',
            __('Package Settings', 'repetito'),
            null,
            'repetito-settings'
        );

        // Privacy & Data Section
        add_settings_section(
            'repetito_privacy_section',
            __('Privacy & Data', 'repetito'),
            array($this, 'renderPrivacySectionDescription'),
            'repetito-settings'
        );

        // Integration Status Section
        add_settings_section(
            'repetito_integration_status_section',
            __('Integration Status', 'repetito'),
            array($this, 'renderIntegrationStatusSectionDescription'),
            'repetito-settings'
        );

        // Product Exclusion Section
        add_settings_section(
            'repetito_exclusion_section',
            __('Product Exclusion', 'repetito'),
            array($this, 'renderExclusionSectionDescription'),
            'repetito-settings'
        );

        // Add fields for general settings
        add_settings_field(
            'general_service_active',
            __('Service Active', 'repetito'),
            array($this, 'renderCheckboxField'),
            'repetito-settings',
            'repetito_general_section',
            array(
                'label_for' => 'general_service_active',
                'description' => __('Enable or disable the Repetito service globally. When disabled, the service will not be available to customers.', 'repetito')
            )
        );

        add_settings_field(
            'api_key',
            __('API Key', 'repetito'),
            array($this, 'renderTextField'),
            'repetito-settings',
            'repetito_general_section',
            array(
                'label_for' => 'api_key',
                'description' => __('Enter your Repetito API key. You can find this in your Repetito account settings.', 'repetito')
            )
        );

        add_settings_field(
            'general_show_image',
            __('Show Logo', 'repetito'),
            array($this, 'renderCheckboxField'),
            'repetito-settings',
            'repetito_general_section',
            array(
                'label_for' => 'general_show_image',
                'description' => __('Display the Repetito logo in the checkout form.', 'repetito')
            )
        );

        // Add fields for fees
        add_settings_field(
            'tax_country',
            __('Country Code', 'repetito'),
            array($this, 'renderCountrySelectField'),
            'repetito-settings',
            'repetito_fees_section',
            array(
                'label_for' => 'tax_country',
                'description' => __('Select the country where the Repetito service is available.', 'repetito')
            )
        );

        add_settings_field(
            'tax_price',
            /* translators: %s: Currency symbol */
            sprintf(__('Fee Price (%s)', 'repetito'), get_woocommerce_currency_symbol()),
            array($this, 'renderNumberField'),
            'repetito-settings',
            'repetito_fees_section',
            array(
                'label_for' => 'tax_price',
                /* translators: %s: Currency symbol */
                'description' => sprintf(__('The price of the Repetito packaging fee (excluding tax) in %s.', 'repetito'), get_woocommerce_currency_symbol())
            )
        );

        add_settings_field(
            'tax_weight',
            /* translators: %s: Weight unit (e.g., kg, lbs) */
            sprintf(__('Max Weight Threshold (%s)', 'repetito'), get_option('woocommerce_weight_unit')),
            array($this, 'renderNumberField'),
            'repetito-settings',
            'repetito_fees_section',
            array(
                'label_for' => 'tax_weight',
                /* translators: %s: Weight unit (e.g., kg, lbs) */
                'description' => sprintf(__('Maximum order weight in %s for which the Repetito service is available.', 'repetito'), get_option('woocommerce_weight_unit'))
            )
        );

        add_settings_field(
            'tax_class',
            __('Tax Rate Class', 'repetito'),
            array($this, 'renderTaxSelectField'),
            'repetito-settings',
            'repetito_fees_section',
            array(
                'label_for' => 'tax_class',
                'description' => __('Select the tax class that should be applied to the Repetito fee.', 'repetito')
            )
        );

        // Add fields for package settings
        add_settings_field(
            'packages_dimension_fitting',
            __('Enable Dimension Fitting', 'repetito'),
            array($this, 'renderCheckboxField'),
            'repetito-settings',
            'repetito_packages_section',
            array(
                'label_for' => 'packages_dimension_fitting',
                'description' => __('When enabled, the system will check if cart items fit into available packages using dimension calculations. When disabled, package dimensions will not be considered.', 'repetito')
            )
        );

        add_settings_field(
            'packages_selection',
            __('Available Packages', 'repetito'),
            array($this, 'renderPackagesField'),
            'repetito-settings',
            'repetito_packages_section',
            array(
                'label_for' => 'packages_selection',
                'description' => __('Select which Repetito packages are available for your store. Only enabled packages will be considered when dimension fitting is active.', 'repetito')
            )
        );

        // Add fields for privacy settings
        add_settings_field(
            'privacy_anonymize_data',
            __('Anonymize Customer Data', 'repetito'),
            array($this, 'renderCheckboxField'),
            'repetito-settings',
            'repetito_privacy_section',
            array(
                'label_for' => 'privacy_anonymize_data',
                'description' => __('When enabled, phone numbers and addresses will be partially anonymized (only last 2 characters visible, rest replaced with *) before sending to Repetito API. Order number and email address are always sent for service functionality.', 'repetito')
            )
        );

        // Add fields for integration status settings
        add_settings_field(
            'allow_integration_status_metadata',
            __('Allow Integration Status Updates', 'repetito'),
            array($this, 'renderCheckboxField'),
            'repetito-settings',
            'repetito_integration_status_section',
            array(
                'label_for' => 'allow_integration_status_metadata',
                'description' => __('When enabled, the plugin will periodically send integration status updates metadata (including WordPress version, WooCommerce version, plugin version, and last order/error information) to the Repetito API. This helps with troubleshooting and support. Disable this if you prefer not to share this information. Plugin liveness is always sent.', 'repetito')
            )
        );
    }

    public function sanitizeSettings($input) {
        $sanitized = array();

        // API settings
        if (isset($input['api_key'])) {
            $sanitized['api_key'] = sanitize_text_field($input['api_key']);
        }

        // Tax settings
        if (isset($input['tax_country'])) {
            $sanitized['tax_country'] = sanitize_text_field($input['tax_country']);
        }

        if (isset($input['tax_price'])) {
            $sanitized['tax_price'] = floatval($input['tax_price']);
        }

        if (isset($input['tax_weight'])) {
            $sanitized['tax_weight'] = intval($input['tax_weight']);
        }

        if (isset($input['tax_class'])) {
            $sanitized['tax_class'] = sanitize_text_field($input['tax_class']);
        }

        // General settings
        $sanitized['general_service_active'] = isset($input['general_service_active']) ? true : false;
        $sanitized['general_show_image'] = isset($input['general_show_image']) ? true : false;
        $sanitized['allow_integration_status_metadata'] = isset($input['allow_integration_status_metadata']) ? true : false;

        // Package settings
        $sanitized['packages_dimension_fitting'] = isset($input['packages_dimension_fitting']) ? true : false;

        if (isset($input['packages_selection']) && is_array($input['packages_selection'])) {
            $sanitized['packages_selection'] = array_map('sanitize_text_field', $input['packages_selection']);
        } else {
            $sanitized['packages_selection'] = array();
        }

        // Privacy settings
        $sanitized['privacy_anonymize_data'] = isset($input['privacy_anonymize_data']) ? true : false;

        return $sanitized;
    }

    public function renderAdminPage() {
        if (!current_user_can('manage_options')) {
            return;
        }
        ?>
        <div class="wrap repetito-settings-form">
            <h1><?php echo esc_html(get_admin_page_title()); ?> <span style="font-size: 0.6em; color: #666; font-weight: normal;">v<?php echo esc_html(\Repetito\VERSION); ?></span></h1>
            <form action="options.php" method="post">
                <?php
                settings_fields('repetito-settings');
                do_settings_sections('repetito-settings');
                submit_button();
                ?>
            </form>
        </div>
        <?php
    }

    public function renderTextField($args) {
        $options = get_option('repetito-settings');
        $value = isset($options[$args['label_for']]) ? $options[$args['label_for']] : '';
        ?>
        <input type="text"
               id="<?php echo esc_attr($args['label_for']); ?>"
               name="repetito-settings[<?php echo esc_attr($args['label_for']); ?>]"
               value="<?php echo esc_attr($value); ?>"
               class="regular-text">
        <?php if (isset($args['description'])) : ?>
            <p class="description"><?php echo esc_html($args['description']); ?></p>
        <?php endif; ?>
        <?php
    }

    public function renderNumberField($args) {
        $options = get_option('repetito-settings');
        $value = isset($options[$args['label_for']]) ? $options[$args['label_for']] : '';
        ?>
        <input type="number"
               id="<?php echo esc_attr($args['label_for']); ?>"
               name="repetito-settings[<?php echo esc_attr($args['label_for']); ?>]"
               value="<?php echo esc_attr($value); ?>"
               step="0.01"
               class="regular-text">
        <?php if (isset($args['description'])) : ?>
            <p class="description"><?php echo esc_html($args['description']); ?></p>
        <?php endif; ?>
        <?php
    }

    public function renderCheckboxField($args) {
        $options = get_option('repetito-settings');
        $value = isset($options[$args['label_for']]) ? (bool) $options[$args['label_for']] : false;
        $is_service_active = $args['label_for'] === 'general_service_active';
        ?>
        <fieldset>
            <label for="<?php echo esc_attr($args['label_for']); ?>" class="<?php echo $is_service_active ? 'service-active-label' : ''; ?>">
                <input type="checkbox"
                       id="<?php echo esc_attr($args['label_for']); ?>"
                       name="repetito-settings[<?php echo esc_attr($args['label_for']); ?>]"
                       value="1"
                       <?php checked($value, true); ?>>
                <?php if ($is_service_active) : ?>
                    <span class="service-active-text"><?php esc_html_e('Enable Repetito Service', 'repetito'); ?></span>
                <?php endif; ?>
            </label>
            <?php if (isset($args['description'])) : ?>
                <p class="description"><?php echo esc_html($args['description']); ?></p>
            <?php endif; ?>
        </fieldset>
        <?php
    }

    public function renderTaxSelectField($args) {
        $options = get_option('repetito-settings');
        $value = isset($options[$args['label_for']]) ? $options[$args['label_for']] : '';

        // Get all tax classes
        $tax_classes = WC_Tax::get_tax_classes();

        // Add standard rate as first option
        array_unshift($tax_classes, '');

        ?>
        <select id="<?php echo esc_attr($args['label_for']); ?>"
                name="repetito-settings[<?php echo esc_attr($args['label_for']); ?>]"
                class="regular-text">
            <?php foreach ($tax_classes as $tax_class) : ?>
                <option value="<?php echo esc_attr($tax_class); ?>" <?php selected($value, $tax_class); ?>>
                    <?php echo $tax_class === '' ? esc_html__('Standard Rate', 'repetito') : esc_html($tax_class); ?>
                </option>
            <?php endforeach; ?>
        </select>
        <?php if (isset($args['description'])) : ?>
            <p class="description"><?php echo esc_html($args['description']); ?></p>
        <?php endif; ?>
        <?php
    }

    public function renderCountrySelectField($args) {
        $options = get_option('repetito-settings');
        $value = isset($options[$args['label_for']]) ? $options[$args['label_for']] : '';

        // Get WooCommerce countries
        $countries = new WC_Countries();
        $countries_list = $countries->get_countries();

        ?>
        <select id="<?php echo esc_attr($args['label_for']); ?>"
                name="repetito-settings[<?php echo esc_attr($args['label_for']); ?>]"
                class="regular-text">
            <option value=""><?php esc_html_e('Select a country', 'repetito'); ?></option>
            <?php foreach ($countries_list as $code => $name) : ?>
                <option value="<?php echo esc_attr($code); ?>" <?php selected($value, $code); ?>>
                    <?php echo esc_html($name); ?>
                </option>
            <?php endforeach; ?>
        </select>
        <?php if (isset($args['description'])) : ?>
            <p class="description"><?php echo esc_html($args['description']); ?></p>
        <?php endif; ?>
        <?php
    }

    public function renderPackagesField($args) {
        $options = get_option('repetito-settings');
        $selected_packages = isset($options['packages_selection']) ? $options['packages_selection'] : array();

        ?>
        <fieldset>
            <?php foreach (Frontend::PACKAGES as $package) : ?>
                <div class="repetito-package-option">
                    <label class="repetito-package-checkbox">
                        <input type="checkbox"
                               name="repetito-settings[packages_selection][]"
                               value="<?php echo esc_attr($package['name']); ?>"
                               <?php checked(in_array($package['name'], $selected_packages)); ?>>
                        <strong><?php echo esc_html($package['niceName']); ?></strong>
                        <span class="description"> (<?php echo esc_html($package['width'] . ' x ' . $package['height'] . ' x ' . $package['length'] . ' ' . $package['unit']); ?>)</span>
                    </label>
                </div>
            <?php endforeach; ?>
            <?php if (isset($args['description'])) : ?>
                <p class="description"><?php echo esc_html($args['description']); ?></p>
            <?php endif; ?>
        </fieldset>
        <?php
    }

    public function renderPrivacySectionDescription() {
        $settings = get_option('repetito-settings');
        $anonymize = isset($settings['privacy_anonymize_data']) ? (bool) $settings['privacy_anonymize_data'] : false;
        ?>
        <div class="repetito-info-box">
            <h3>
                <span class="dashicons dashicons-shield"></span>
                <?php esc_html_e('Data Sent to Repetito API', 'repetito'); ?>
            </h3>
            <p>
                <?php
                /* translators: %s: API endpoint URL */
                echo esc_html( sprintf( __( 'When a customer selects reusable packaging, the following order data is sent to Repetito servers (%s) to process the packaging service:', 'repetito' ), API_URL ) );
                ?>
            </p>
            <h4><?php esc_html_e('Always Sent:', 'repetito'); ?></h4>
            <ul style="list-style: disc; margin-left: 2em;">
                <li><strong><?php esc_html_e('Order Number', 'repetito'); ?></strong> - <?php esc_html_e('Required for tracking', 'repetito'); ?></li>
                <li><strong><?php esc_html_e('Email Address', 'repetito'); ?></strong> - <?php esc_html_e('Required for service communication', 'repetito'); ?></li>
                <li><strong><?php esc_html_e('Order Completion Date', 'repetito'); ?></strong> - <?php esc_html_e('Used for service scheduling', 'repetito'); ?></li>
            </ul>
            <?php if (!$anonymize) : ?>
                <h4><?php esc_html_e('Additional Data Sent (Anonymization Disabled):', 'repetito'); ?></h4>
                <ul style="list-style: disc; margin-left: 2em;">
                    <li><strong><?php esc_html_e('Phone Number', 'repetito'); ?></strong> - <?php esc_html_e('Used for delivery coordination', 'repetito'); ?></li>
                    <li><strong><?php esc_html_e('Billing Address', 'repetito'); ?></strong> - <?php esc_html_e('Street, town, postal code, and country', 'repetito'); ?></li>
                    <li><strong><?php esc_html_e('Shipping Address', 'repetito'); ?></strong> - <?php esc_html_e('Street, town, postal code, and country', 'repetito'); ?></li>
                </ul>
            <?php else : ?>
                <h4><?php esc_html_e('Additional Data Sent (Anonymization Enabled):', 'repetito'); ?></h4>
                <ul style="list-style: disc; margin-left: 2em;">
                    <li><strong><?php esc_html_e('Phone Number', 'repetito'); ?></strong> - <em><?php esc_html_e('Partially anonymized (e.g., +421900123456 → ************56)', 'repetito'); ?></em></li>
                    <li><strong><?php esc_html_e('Street', 'repetito'); ?></strong> - <em><?php esc_html_e('Partially anonymized (e.g., Main Street 123 → *************23)', 'repetito'); ?></em></li>
                    <li><strong><?php esc_html_e('Town', 'repetito'); ?></strong> - <em><?php esc_html_e('Partially anonymized (e.g., Bratislava → ********va)', 'repetito'); ?></em></li>
                    <li><strong><?php esc_html_e('Postal Code', 'repetito'); ?></strong> - <em><?php esc_html_e('Partially anonymized (e.g., 81101 → ***01)', 'repetito'); ?></em></li>
                    <li><strong><?php esc_html_e('Country', 'repetito'); ?></strong> - <em><?php esc_html_e('Partially anonymized (e.g., SK → *K)', 'repetito'); ?></em></li>
                </ul>
            <?php endif; ?>
            <p class="description">
                <span class="dashicons dashicons-info"></span>
                <?php esc_html_e('No product details, payment information, or tracking data is collected by this plugin.', 'repetito'); ?>
            </p>
            <?php if ($anonymize) : ?>
                <p class="description" style="color: #2271b1;">
                    <span class="dashicons dashicons-shield-alt"></span>
                    <strong><?php esc_html_e('Data Anonymization Active:', 'repetito'); ?></strong>
                    <?php esc_html_e('Phone numbers and addresses are being partially anonymized (only last 2 characters visible) before transmission.', 'repetito'); ?>
                </p>
            <?php endif; ?>
            <p style="margin-top: 1.5em;">
                <a href="<?php echo esc_url(PRIVACY_POLICY_URL); ?>" target="_blank" rel="noopener noreferrer" class="button button-secondary">
                    <span class="dashicons dashicons-privacy"></span>
                    <?php esc_html_e('View Privacy Policy', 'repetito'); ?>
                </a>
            </p>
        </div>
        <?php
    }

    public function renderIntegrationStatusSectionDescription() {
        $settings = get_option('repetito-settings');
        $allow_integration_status_metadata = isset($settings['allow_integration_status_metadata']) ? (bool) $settings['allow_integration_status_metadata'] : false;
        ?>
        <div class="repetito-info-box">
            <h3>
                <span class="dashicons dashicons-admin-tools"></span>
                <?php esc_html_e('Integration Status Updates', 'repetito'); ?>
            </h3>
            <p>
                <?php
                /* translators: %s: API endpoint URL */
                echo esc_html( sprintf( __( 'When enabled, the plugin periodically sends integration status updates to Repetito servers (%s/integration/status) to help with troubleshooting and support:', 'repetito' ), API_URL ) );
                ?>
            </p>
            <h4><?php esc_html_e('Data Sent in Integration Status Updates:', 'repetito'); ?></h4>
            <ul style="list-style: disc; margin-left: 2em;">
                <li><strong><?php esc_html_e('Platform Type', 'repetito'); ?></strong> - <code>wordpress</code> (<?php esc_html_e('Identifies the platform', 'repetito'); ?>)</li>
                <li><strong><?php esc_html_e('Plugin Version', 'repetito'); ?></strong> - <?php echo esc_html( \Repetito\VERSION ); ?> (<?php esc_html_e('Current Repetito plugin version', 'repetito'); ?>)</li>
                <li><strong><?php esc_html_e('PHP Version', 'repetito'); ?></strong> - <?php echo esc_html( phpversion() ); ?> (<?php esc_html_e('Server PHP version', 'repetito'); ?>)</li>
                <li><strong><?php esc_html_e('WordPress Version', 'repetito'); ?></strong> - <?php echo esc_html( get_bloginfo('version') ); ?> (<?php esc_html_e('Current WordPress version', 'repetito'); ?>)</li>
                <li><strong><?php esc_html_e('WooCommerce Version', 'repetito'); ?></strong> - <?php echo esc_html( defined('WC_VERSION') ? WC_VERSION : 'unknown' ); ?> (<?php esc_html_e('Current WooCommerce version', 'repetito'); ?>)</li>
                <li><strong><?php esc_html_e('Plugin Versions', 'repetito'); ?></strong> - <?php esc_html_e('List of all installed plugins with their version numbers', 'repetito'); ?></li>
                <li><strong><?php esc_html_e('Last Order Sent', 'repetito'); ?></strong> - <?php esc_html_e('Timestamp of the last successfully sent order (if any)', 'repetito'); ?></li>
                <li><strong><?php esc_html_e('Last Error', 'repetito'); ?></strong> - <?php esc_html_e('Last error message encountered (if any)', 'repetito'); ?></li>
            </ul>
            <p class="description">
                <span class="dashicons dashicons-info"></span>
                <?php esc_html_e('This information helps our support team diagnose issues and ensure compatibility with your WordPress environment. No customer data, order details, or sensitive information is included in these status updates.', 'repetito'); ?>
            </p>
            <?php if ($allow_integration_status_metadata) : ?>
                <p class="description" style="color: #2271b1;">
                    <span class="dashicons dashicons-yes-alt"></span>
                    <strong><?php esc_html_e('Integration Status Updates Active:', 'repetito'); ?></strong>
                    <?php esc_html_e('Status updates are being sent to Repetito servers.', 'repetito'); ?>
                </p>
            <?php else : ?>
                <p class="description" style="color: #d63638;">
                    <span class="dashicons dashicons-dismiss"></span>
                    <strong><?php esc_html_e('Integration Status Updates Disabled:', 'repetito'); ?></strong>
                    <?php esc_html_e('Status updates are not being sent. Enable the checkbox above to allow status updates.', 'repetito'); ?>
                </p>
            <?php endif; ?>
        </div>
        <?php
    }

    public function renderExclusionSectionDescription() {
        $tag = get_term_by('slug', NOREPETITO_TAG, 'product_tag');
        $tag_link = $tag ? admin_url('term.php?taxonomy=product_tag&tag_ID=' . $tag->term_id . '&post_type=product') : admin_url('edit-tags.php?taxonomy=product_tag&post_type=product');
        $tag_name = NOREPETITO_TAG;
        ?>
        <div class="repetito-info-box">
            <h3>
                <span class="dashicons dashicons-tag"></span>
                <?php
                /* translators: %s: Product tag name */
                printf(esc_html__('Using the "%s" Product Tag', 'repetito'), esc_html($tag_name));
                ?>
            </h3>
            <p>
                <?php
                /* translators: %s: Product tag name */
                echo wp_kses_post(sprintf(__('You can exclude specific products from the Repetito service by tagging them with <strong>%s</strong>.', 'repetito'), esc_html($tag_name)));
                ?>
            </p>
            <p>
                <?php
                /* translators: %s: Product tag name */
                echo wp_kses_post(sprintf(__('When a customer has at least one product tagged with <strong>%s</strong> in their cart, the Repetito reusable packaging option will not be offered at checkout.', 'repetito'), esc_html($tag_name)));
                ?>
            </p>
            <h4><?php esc_html_e('How to use:', 'repetito'); ?></h4>
            <ol>
                <li><?php esc_html_e('Go to your product edit page in WooCommerce', 'repetito'); ?></li>
                <li><?php esc_html_e('Find the "Product tags" section (usually in the right sidebar)', 'repetito'); ?></li>
                <li>
                    <?php
                    /* translators: %s: Product tag name */
                    echo wp_kses_post(sprintf(__('Add the tag <code>%s</code> to the product', 'repetito'), esc_html($tag_name)));
                    ?>
                </li>
                <li><?php esc_html_e('Save/Update the product', 'repetito'); ?></li>
            </ol>
            <p>
                <a href="<?php echo esc_url($tag_link); ?>" class="button button-secondary">
                    <span class="dashicons dashicons-admin-tags"></span>
                    <?php esc_html_e('Manage Product Tags', 'repetito'); ?>
                </a>
            </p>
            <p class="description">
                <span class="dashicons dashicons-info"></span>
                <?php esc_html_e('Tip: Use this tag for fragile items, oversized products, or any items that are not suitable for reusable packaging.', 'repetito'); ?>
            </p>
        </div>
        <?php
    }
}