<?php if (!defined('ABSPATH')) exit; ?>

<?php
wp_nonce_field('assi_security_nonce', 'assi_security_nonce');
$assi_content = '<div class="ass-header">header</div>';
$pages = array('dashboard', 'chat', 'template', 'notification', 'account', 'settings');
$assi_blogLanguage = get_locale();
?>

<div class="ass-header">
    <input id="ass-plugin-token" type="hidden" value="<?php echo esc_attr(ASSI_PLUGIN_BLOG_USER_TOKEN) ?>" />
    <input id="ass-blog-language" type="hidden" value="<?php echo esc_attr($assi_blogLanguage) ?>" />
    <input id="ass-current-page" type="hidden" value="" />
    <input id="ass-oauth-connection" type="hidden" value="<?php echo defined('ASSI_PLUGIN_BLOG_USER_TOKEN') && !empty(ASSI_PLUGIN_BLOG_USER_TOKEN) ? 'true' : 'false' ?>" />
    <input id="ass-oauth-display-name" type="hidden" value="<?php echo defined('ASSI_OAUTH_DISPLAY_NAME') && !empty(ASSI_OAUTH_DISPLAY_NAME) ? esc_attr(ASSI_OAUTH_DISPLAY_NAME) : '' ?>" />
    <input id="ass-account-plan-id" type="hidden" value="<?php echo defined('ASSI_ACCOUNT_PLAN_ID') ? (int) ASSI_ACCOUNT_PLAN_ID : 0 ?>" />
    <input id="ass-account-credits-open" type="hidden" value="<?php echo defined('ASSI_ACCOUNT_CREDITS_OPEN') ? (int) ASSI_ACCOUNT_CREDITS_OPEN : 0 ?>" />
    <input id="ass-account-credits-total" type="hidden" value="<?php echo defined('ASSI_ACCOUNT_CREDITS_TOTAL') ? (int) ASSI_ACCOUNT_CREDITS_TOTAL : 0 ?>" />
    <input id="ass-account-max-chats" type="hidden" value="<?php echo defined('ASSI_ACCOUNT_MAX_CHATS') ? esc_attr(ASSI_ACCOUNT_MAX_CHATS) : 0 ?>" />
    <input id="ass-account-max-templates" type="hidden" value="<?php echo defined('ASSI_ACCOUNT_MAX_TEMPLATES') ? esc_attr(ASSI_ACCOUNT_MAX_TEMPLATES) : 0 ?>" />
</div>
<div class="ass-general-body d-flex h-100 w-100">
    <?php
    require_once('html/sidebar.php');
    require_once('html/sidebar.island.php');
    ?>

    <div class="h-100 w-100">
        <div class="d-flex justify-content-center">
            <div class="ass-page-content-loader mt-5 spinner-border text-primary" role="status">
                <span class="visually-hidden">Loading...</span>
            </div>
        </div>
        <div class="ass-page-content">
            <?php
            foreach ($pages as $page) {
                echo '<div class="ass-page-item" style="display: none;" data-ident="' . esc_attr($page) . '">';
                require_once($page . '.php');
                echo '</div>';
            }
            ?>
        </div>
    </div>
</div>
<div class="ass-footer">
    <!-- SECTION: modals -->
    <div class="modal modal-xl fade" id="ass-modal-templates-add" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content ass-modal-templates-add-content" data-id="main">
                <div class="modal-header">
                    <div class="d-flex gap-3">
                        <h5 class="modal-title" id="exampleModalLabel"><?php esc_html_e('Create template', 'assistini'); ?></h5>
                    </div>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body pe-0">
                    <div class="d-flex">
                        <form id="ass-modal-templates-add-form" class="w-100 pe-3">
                            <div class="mb-2">
                                <label class="ass-fw-500 mb-1" for="ass-templates-add-name"><?php esc_html_e('Template name', 'assistini'); ?>:</label>
                                <input type="text" class="form-control ass-form-control" id="ass-templates-add-name" placeholder="<?php esc_attr_e('Name...', 'assistini'); ?>" />
                            </div>
                            <div class="mb-2">
                                <div class="d-flex justify-content-between align-items-center mb-1">
                                    <label class="ass-fw-500" for="ass-templates-add-prompt"><?php esc_html_e('Prompt', 'assistini'); ?>:</label>
                                    <div class="d-flex gap-2 align-items-center">
                                        <div class="d-flex gap-1 align-items-center">
                                            <button class="ass-size-12 btn btn-sm btn-primary ass-modal-templates-add-prompt-action" data-origin="add" data-action="assistant" type="button"><?php esc_html_e('Create prompt with AI', 'assistini'); ?></button>
                                            <i class="ass-option-info bi bi-question-circle-fill text-secondary" data-action="assistant"></i>
                                        </div>
                                        <div class="d-flex gap-1 align-items-center">
                                            <button class="ass-size-12 btn btn-sm btn-primary ass-modal-templates-add-prompt-action" data-origin="add" data-action="analyze" type="button"><?php esc_html_e('Check prompt', 'assistini'); ?></button>
                                            <i class="ass-option-info bi bi-question-circle-fill text-secondary" data-action="analyze"></i>
                                        </div>
                                        <span class="badge bg-secondary ass-modal-templates-add-prompt-action-analyze-badge" style="display:none;"><?php esc_html_e('SMART', 'assistini'); ?></span>      
                                    </div>
                                </div>
                                <textarea class="form-control ass-custom-scrollbar" id="ass-templates-add-prompt" rows="6" placeholder="<?php esc_attr_e('Prompt...', 'assistini'); ?>" maxlength="10000"></textarea>
                                <div class="d-flex justify-content-end small">
                                    <span class="ass-templates-add-prompt-length">0</span>/10000
                                </div>
                            </div>
                            <div class="mb-2">
                                <div class="d-flex justify-content-between align-items-center mb-1">
                                    <label class="ass-fw-500 mb-1" for="ass-templates-add-reference"><?php esc_html_e('Text Structure & Writing Style (Optional)', 'assistini'); ?>:</label>
                                    <div class="d-flex gap-1 align-items-center">
                                        <button class="ass-size-12 btn btn-sm btn-primary ass-modal-templates-add-prompt-action" data-origin="add" data-action="structure" type="button"><?php esc_html_e('Create structure & style with AI', 'assistini'); ?></button>
                                        <i class="ass-option-info bi bi-question-circle-fill text-secondary" data-action="structure"></i>
                                    </div>
                                </div>
                                <textarea class="form-control ass-custom-scrollbar" id="ass-templates-add-reference" rows="6" placeholder="<?php esc_attr_e('Reference...', 'assistini'); ?>" maxlength="10000"></textarea>
                                <div class="d-flex justify-content-end small">
                                    <span class="ass-templates-add-reference-length">0</span>/10000
                                </div>
                            </div>
                            <div class="mb-2">
                                <div class="d-flex gap-2">
                                    <div class="w-100">
                                        <label class="ass-fw-500 mb-1" for="ass-templates-add-language"><?php esc_html_e('Language', 'assistini'); ?>:</label>
                                        <select class="ass-templates-add-language form-select ass-form-select" style="min-width: 100%;">
                                            <?php
                                            $assi_languages = ASSI_Tools::getAllLanguages();
                                            foreach ($assi_languages as $assi_value => $assi_name) {
                                                if (isset($assi_name) && !empty($assi_name)) {
                                                    echo '<option value="' . esc_attr($assi_value) . '" ' . ($assi_blogLanguage == $assi_value ? 'selected' : '') . '>' . esc_html($assi_name) . '</option>';
                                                }
                                            }
                                            ?>
                                        </select>
                                    </div>
                                    <div class="w-100">
                                        <label class="ass-fw-500 mb-1" for="ass-templates-add-tone"><?php esc_html_e('Tone', 'assistini'); ?>:</label>
                                        <select class="ass-templates-add-tone form-select ass-form-select" style="min-width: 100%;">
                                            <?php
                                            $assi_tone = ASSI_Tools::getTonality();
                                            echo '<option value="" selected>' . esc_html__('Select Tone', 'assistini') . '</option>';
                                            foreach ($assi_tone as $assi_value => $assi_name) {
                                                if (isset($assi_name) && !empty($assi_name)) {
                                                    echo '<option value="' . esc_attr($assi_value) . '">' . esc_html($assi_name) . '</option>';
                                                }
                                            }
                                            ?>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="mb-2">
                                <div class="d-flex gap-2">
                                    <div class="w-100">
                                        <label class="ass-fw-500 mb-1" for="ass-templates-add-view"><?php esc_html_e('Point of View', 'assistini'); ?>: <i class="ass-option-pov-info bi bi-question-circle-fill text-secondary"></i></label>
                                        <select class="ass-templates-add-view form-select ass-form-select" style="min-width: 100%;">
                                            <?php
                                            $assi_views = ASSI_Tools::getPointOfView();
                                            echo '<option value="" selected>' . esc_html__('Select Point of View', 'assistini') . '</option>';
                                            foreach ($assi_views as $assi_value => $assi_name) {
                                                if (isset($assi_name) && !empty($assi_name)) {
                                                    echo '<option value="' . esc_attr($assi_value) . '">' . esc_html($assi_name) . '</option>';
                                                }
                                            }
                                            ?>
                                        </select>
                                    </div>
                                    <div class="w-100">
                                        <label class="ass-fw-500 mb-1" for="ass-templates-add-length"><?php esc_html_e('Content Length', 'assistini'); ?>: <i class="ass-option-length-info bi bi-question-circle-fill text-secondary"></i></label>
                                        <select class="ass-templates-add-length form-select ass-form-select" style="min-width: 100%;">
                                            <?php
                                            $assi_lengths = ASSI_Tools::getContentLength();
                                            echo '<option value="" selected>' . esc_html__('Select Content Length', 'assistini') . '</option>';
                                            foreach ($assi_lengths as $assi_value => $assi_name) {
                                                if (isset($assi_name) && !empty($assi_name)) {
                                                    echo '<option value="' . esc_attr($assi_value) . '">' . esc_html($assi_name) . '</option>';
                                                }
                                            }
                                            ?>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </form>
                        <div class="ass-modal-templates-add-sidebar me-2 ass-shadow" data-id="assistant" style="display:none;">
                            <div class="d-flex align-items-center px-2 pt-2 gap-1">
                                <span class="ass-modal-templates-add-sidebar-close ass-size-14 px-1"><i class="bi bi-caret-right-fill"></i></span>
                                <span class="ass-fw-500 ass-size-16"><?php esc_html_e('Create prompt with AI', 'assistini'); ?>:</span>
                            </div>
                            <div class="form-check form-switch mx-2 mt-2">
                                <input role="switch" type="checkbox" class="ass-form-switch form-check-input" id="ass-modal-templates-add-assistant-toggle" data-type="add">
                                <label class="ass-size-14 form-check-label ass-modal-templates-add-assistant-toggle-label-off" data-type="add" for="ass-modal-templates-add-assistant-toggle"><?php esc_html_e('Use custom content', 'assistini'); ?></label>
                                <label class="ass-size-14 form-check-label ass-modal-templates-add-assistant-toggle-label-on" data-type="add" for="ass-modal-templates-add-assistant-toggle" style="display:none;"><?php esc_html_e('Use Blog content', 'assistini'); ?></label>
                            </div>
                            <form id="ass-modal-templates-add-assistant-form" class="px-2 pt-2 pb-0">
                                <div class="mb-2 ass-modal-templates-add-assistant-blog">
                                    <div class="w-100">
                                        <label class="ass-fw-500 mb-1 ass-size-14" for="ass-modal-templates-add-assistant-post-dropdown"><?php esc_html_e('Select content', 'assistini'); ?>:</label>
                                        <div id="ass-modal-templates-add-assistant-post-dropdown" data-type="add" data-selected-id="0" class="dropdown">
                                            <div class="ass-size-14 border rounded dropdown-toggle d-flex align-items-center justify-content-between px-2 py-1 bg-white" data-bs-toggle="dropdown">
                                                <span class="text-truncate"><?php esc_html_e('Select content', 'assistini'); ?></span>
                                            </div>
                                            <ul class="dropdown-menu ass-max-w-inherit" aria-labelledby="dropdownMenuButton1">
                                                <li><div class="px-2"><input id="ass-modal-templates-assistant-posts-search" class="w-100 ass-size-14" type="text" placeholder="<?php esc_html_e('Search for blog title...', 'assistini'); ?>"></div></li>
                                                <li class="ass-modal-templates-assistant-post-item"><a class="ass-size-14 dropdown-item" data-id="0"><?php esc_html_e('Select content', 'assistini'); ?></a></li>
                                                <div class="ass-modal-templates-assistant-posts-list ass-max-w-inherit">
                                                </div>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                                <div class="mb-2 ass-modal-templates-add-assistant-custom" style="display:none;">
                                    <div class="d-flex justify-content-between align-items-center">
                                        <label class="ass-fw-500 mb-1 ass-size-14" for="ass-templates-add-assistant-content"><?php esc_html_e('Content', 'assistini'); ?>:</label>
                                    </div>
                                    <textarea class="form-control ass-custom-scrollbar" id="ass-templates-add-assistant-content" data-type="add" rows="6" placeholder="<?php esc_attr_e('Content...', 'assistini'); ?>" maxlength="10000"></textarea>
                                    <div class="d-flex justify-content-end small">
                                        <span class="ass-templates-add-assistant-content-length">0</span>/10000
                                    </div>
                                </div>
                            </form>
                            <div class="ass-modal-templates-add-assistant-footer d-flex justify-content-end px-2 pt-1 pb-2">
                                <div class="d-flex gap-3">
                                    <button type="button" class="btn btn-sm btn-primary ass-templates-add-assistant-start-btn" data-type="add">
                                        <span class="ass-templates-add-assistant-start-text" data-type="add"><?php esc_html_e('Create', 'assistini'); ?></span>
                                        <div class="spinner-border spinner-border-sm text-light ass-templates-add-assistant-start-loader" data-type="add" role="status" style="display:none;">
                                        </div>
                                    </button>
                                </div>
                            </div>
                        </div>
                        <div class="ass-modal-templates-add-sidebar me-2 ass-shadow" data-id="structure" style="display:none;">
                            <div class="d-flex align-items-center px-2 pt-2 gap-1">
                                <span class="ass-modal-templates-add-sidebar-close ass-size-14 px-1"><i class="bi bi-caret-right-fill"></i></span>
                                <span class="ass-fw-500 ass-size-16"><?php esc_html_e('Structure Assistant', 'assistini'); ?>:</span>
                            </div>
                            <div class="form-check form-switch mx-2 mt-2">
                                <input role="switch" type="checkbox" class="ass-form-switch form-check-input" id="ass-modal-templates-add-structure-toggle" data-type="add">
                                <label class="ass-size-14 form-check-label ass-modal-templates-add-structure-toggle-label-off" data-type="add" for="ass-modal-templates-add-structure-toggle"><?php esc_html_e('Use custom content', 'assistini'); ?></label>
                                <label class="ass-size-14 form-check-label ass-modal-templates-add-structure-toggle-label-on" data-type="add" for="ass-modal-templates-add-structure-toggle" style="display:none;"><?php esc_html_e('Use Blog content', 'assistini'); ?></label>
                            </div>
                            <form id="ass-modal-templates-add-structure-form" class="px-2 pt-2 pb-0">
                                <div class="mb-2 ass-modal-templates-add-structure-blog">
                                    <div class="w-100">
                                        <label class="ass-fw-500 mb-1 ass-size-14" for="ass-modal-templates-add-structure-post-dropdown"><?php esc_html_e('Select content', 'assistini'); ?>:</label>
                                        <div id="ass-modal-templates-add-structure-post-dropdown" data-type="add" data-selected-id="0" class="dropdown">
                                            <div class="ass-size-14 border rounded dropdown-toggle d-flex align-items-center justify-content-between px-2 py-1 bg-white" data-bs-toggle="dropdown">
                                                <span class="text-truncate"><?php esc_html_e('Select content', 'assistini'); ?></span>
                                            </div>
                                            <ul class="dropdown-menu ass-max-w-inherit" aria-labelledby="dropdownMenuButton1">
                                                <li><div class="px-2"><input id="ass-modal-templates-structure-posts-search" class="w-100 ass-size-14" type="text" placeholder="<?php esc_html_e('Search for blog title...', 'assistini'); ?>"></div></li>
                                                <li class="ass-modal-templates-structure-post-item"><a class="ass-size-14 dropdown-item" data-id="0"><?php esc_html_e('Select content', 'assistini'); ?></a></li>
                                                <div class="ass-modal-templates-structure-posts-list ass-max-w-inherit">
                                                </div>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                                <div class="mb-2 ass-modal-templates-add-structure-custom" style="display:none;">
                                    <div class="d-flex justify-content-between align-items-center">
                                        <label class="ass-fw-500 mb-1 ass-size-14" for="ass-templates-add-structure-content"><?php esc_html_e('Content', 'assistini'); ?>:</label>
                                    </div>
                                    <textarea class="form-control ass-custom-scrollbar" id="ass-templates-add-structure-content" data-type="add" rows="6" placeholder="<?php esc_attr_e('Content...', 'assistini'); ?>" maxlength="10000"></textarea>
                                    <div class="d-flex justify-content-end small">
                                        <span class="ass-templates-add-structure-content-length">0</span>/10000
                                    </div>
                                </div>
                            </form>
                            <div class="ass-modal-templates-add-structure-footer d-flex justify-content-end px-2 pt-1 pb-2">
                                <div class="d-flex gap-3">
                                    <button type="button" class="btn btn-sm btn-primary ass-templates-add-structure-start-btn" data-type="add">
                                        <span class="ass-templates-add-structure-start-text" data-type="add"><?php esc_html_e('Create', 'assistini'); ?></span>
                                        <div class="spinner-border spinner-border-sm text-light ass-templates-add-structure-start-loader" data-type="add" role="status" style="display:none;">
                                        </div>
                                    </button>
                                </div>
                            </div>
                        </div>
                        <div class="ass-modal-templates-add-sidebar me-2 ass-shadow ass-flex flex-column" data-id="analyze" style="display:none;">
                            <div class="d-flex justify-content-between px-2 pt-2">
                                <div class="d-flex align-items-center gap-1">
                                    <span class="ass-modal-templates-add-sidebar-close ass-size-14 px-1"><i class="bi bi-caret-right-fill"></i></span>
                                    <span class="ass-fw-500 ass-size-16"><?php esc_html_e('Check prompt', 'assistini'); ?>:</span>
                                </div>
                                <span class="ass-modal-templates-add-analyze-reload btn btn-sm btn-primary ass-size-16 py-0 px-1" data-type="add"><i class="bi bi-sm bi-arrow-repeat"></i></span>
                            </div>
                            <div class="ass-modal-templates-add-analyze-loader px-2 py-2" style="display:none;">
                                <div class="d-flex flex-column gap-3 placeholder-wave ass-position-relative align-items-center justify-content-center">
                                    <span class="placeholder rounded w-100"></span>
                                    <div class="ass-modal-templates-add-analyze-loader-circle bg-light ps-2 pt-2 pe-2"></div>
                                    <span class="ass-modal-templates-add-analyze-loader-circle-text"></span>
                                </div>
                            </div>
                            <div class="ass-modal-templates-add-analyze-ctn ass-flex flex-column gap-3 px-2 py-2">
                                <div class="ass-modal-templates-add-analyze-results d-flex flex-column gap-2"></div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer justify-content-between">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e('Dismiss', 'assistini'); ?></button>
                    <div class="d-flex gap-3">
                        <div class="ass-templates-add-blog-access-ctn d-flex align-items-center gap-1">
                            <input type="checkbox" id="ass-templates-add-blog-access">
                            <label class="ass-size-14" for="ass-templates-add-blog-access"><?php esc_html_e('Share my template with other blog users', 'assistini'); ?></label>
                            <span class="badge bg-secondary ass-templates-add-blog-access-badge" style="display:none;"><?php esc_html_e('SMART', 'assistini'); ?></span>
                        </div>
                        <button type="button" class="btn btn-primary ass-templates-add-save-btn">
                            <span class="ass-templates-add-save-text"><?php esc_html_e('Save', 'assistini'); ?></span>
                            <div class="spinner-border spinner-border-sm text-light ass-templates-add-save-loader" role="status" style="display:none;"></div>
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal modal-xl fade" id="ass-modal-templates-edit" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <input type="hidden" id="ass-modal-templates-edit-id" value="" />
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="exampleModalLabel"><?php esc_html_e('Edit template', 'assistini'); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body pe-0">
                    <div class="d-flex">
                        <form id="ass-modal-templates-edit-form" class="w-100 pe-3">
                            <div class="mb-2">
                                <label class="ass-fw-500 mb-1" for="ass-templates-edit-name"><?php esc_html_e('Template name', 'assistini'); ?>:</label>
                                <input type="text" class="form-control ass-form-control" id="ass-templates-edit-name" placeholder="<?php esc_attr_e('Name...', 'assistini'); ?>" />
                            </div>
                            <div class="mb-2">
                                <div class="d-flex justify-content-between align-items-center mb-1">
                                    <label class="ass-fw-500" for="ass-templates-edit-prompt"><?php esc_html_e('Prompt', 'assistini'); ?>:</label>
                                    <div class="d-flex gap-2 align-items-center">
                                        <div class="d-flex gap-1 align-items-center">
                                            <button class="ass-size-12 btn btn-sm btn-primary ass-modal-templates-add-prompt-action" data-origin="edit" data-action="assistant" type="button"><?php esc_html_e('Create prompt with AI', 'assistini'); ?></button>
                                            <i class="ass-option-info bi bi-question-circle-fill text-secondary" data-action="assistant"></i>
                                        </div>
                                        <div class="d-flex gap-1 align-items-center">
                                            <button class="ass-size-12 btn btn-sm btn-primary ass-modal-templates-add-prompt-action" data-origin="edit" data-action="analyze" type="button"><?php esc_html_e('Check prompt', 'assistini'); ?></button>
                                            <i class="ass-option-info bi bi-question-circle-fill text-secondary" data-action="analyze"></i>
                                        </div>
                                        <span class="badge bg-secondary ass-modal-templates-add-prompt-action-analyze-badge" style="display:none;"><?php esc_html_e('SMART', 'assistini'); ?></span>      
                                    </div>
                                </div>
                                <textarea class="form-control ass-custom-scrollbar" id="ass-templates-edit-prompt" rows="6" placeholder="<?php esc_attr_e('Prompt...', 'assistini'); ?>" maxlength="10000"></textarea>
                                <div class="d-flex justify-content-end small">
                                    <span class="ass-templates-edit-prompt-length">0</span>/10000
                                </div>
                            </div>
                            <div class="mb-2">
                                <div class="d-flex justify-content-between align-items-center mb-1">
                                    <label class="ass-fw-500 mb-1" for="ass-templates-edit-reference"><?php esc_html_e('Text Structure & Writing Style (Optional)', 'assistini'); ?>:</label>
                                    <div class="d-flex gap-1 align-items-center">
                                        <button class="ass-size-12 btn btn-sm btn-primary ass-modal-templates-add-prompt-action" data-origin="edit" data-action="structure" type="button"><?php esc_html_e('Create structure & style with AI', 'assistini'); ?></button>
                                        <i class="ass-option-info bi bi-question-circle-fill text-secondary" data-action="structure"></i>
                                    </div>
                                </div>
                                
                                <textarea class="form-control ass-custom-scrollbar" id="ass-templates-edit-reference" rows="6" placeholder="<?php esc_attr_e('Reference...', 'assistini'); ?>" maxlength="10000"></textarea>
                                <div class="d-flex justify-content-end small">
                                    <span class="ass-templates-edit-reference-length">0</span>/10000
                                </div>
                            </div>
                            <div class="mb-2">
                                <div class="d-flex gap-2">
                                    <div class="w-100">
                                        <label class="ass-fw-500 mb-1" for="ass-templates-edit-language"><?php esc_html_e('Language', 'assistini'); ?>:</label>
                                        <select class="ass-templates-edit-language form-select ass-form-select" style="min-width: 100%;">
                                            <?php
                                            $assi_languages = ASSI_Tools::getAllLanguages();
                                            foreach ($assi_languages as $assi_langCode => $assi_langName) {
                                                if (isset($assi_langName) && !empty($assi_langName)) {
                                                    echo '<option value="' . esc_attr($assi_langCode) . '">' . esc_html($assi_langName) . '</option>';
                                                }
                                            }
                                            ?>
                                        </select>
                                    </div>
                                    <div class="w-100">
                                        <label class="ass-fw-500 mb-1" for="ass-templates-edit-tone"><?php esc_html_e('Tone', 'assistini'); ?>:</label>
                                        <select class="ass-templates-edit-tone form-select ass-form-select" style="min-width: 100%;">
                                            <?php
                                            $assi_tone = ASSI_Tools::getTonality();
                                            echo '<option value="" selected>' . esc_html__('Select Tone', 'assistini') . '</option>';
                                            foreach ($assi_tone as $assi_value => $assi_name) {
                                                if (isset($assi_name) && !empty($assi_name)) {
                                                    echo '<option value="' . esc_attr($assi_value) . '">' . esc_html($assi_name) . '</option>';
                                                }
                                            }
                                            ?>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="mb-2">
                                <div class="d-flex gap-2">
                                    <div class="w-100">
                                        <label class="ass-fw-500 mb-1" for="ass-templates-edit-view"><?php esc_html_e('Point of View', 'assistini'); ?>: <i class="ass-option-pov-info bi bi-question-circle-fill text-secondary"></i></label>
                                        <select class="ass-templates-edit-view form-select ass-form-select" style="min-width: 100%;">
                                            <?php
                                            $assi_views = ASSI_Tools::getPointOfView();
                                            echo '<option value="" selected>' . esc_html__('Select Point of View', 'assistini') . '</option>';
                                            foreach ($assi_views as $assi_value => $assi_name) {
                                                if (isset($assi_langName) && !empty($assi_langName)) {
                                                    echo '<option value="' . esc_attr($assi_value) . '">' . esc_html($assi_name) . '</option>';
                                                }
                                            }
                                            ?>
                                        </select>
                                    </div>
                                    <div class="w-100">
                                        <label class="ass-fw-500 mb-1" for="ass-templates-edit-length"><?php esc_html_e('Content Length', 'assistini'); ?>: <i class="ass-option-length-info bi bi-question-circle-fill text-secondary"></i></label>
                                        <select class="ass-templates-edit-length form-select ass-form-select" style="min-width: 100%;">
                                            <?php
                                            $assi_lengths = ASSI_Tools::getContentLength();
                                            echo '<option value="" selected>' . esc_html__('Select Content Length', 'assistini') . '</option>';
                                            foreach ($assi_lengths as $assi_value => $assi_name) {
                                                if (isset($assi_name) && !empty($assi_name)) {
                                                    echo '<option value="' . esc_attr($assi_value) . '">' . esc_html($assi_name) . '</option>';
                                                }
                                            }
                                            ?>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </form>
                        <div class="ass-modal-templates-add-sidebar me-2 ass-shadow" data-id="assistant" style="display:none;">
                            <div class="d-flex align-items-center px-2 pt-2 gap-1">
                                <span class="ass-modal-templates-add-sidebar-close ass-size-14 px-1"><i class="bi bi-caret-right-fill"></i></span>
                                <span class="ass-fw-500 ass-size-16"><?php esc_html_e('Create prompt with AI', 'assistini'); ?>:</span>
                            </div>
                            <div class="form-check form-switch mx-2 mt-2">
                                <input role="switch" type="checkbox" class="ass-form-switch form-check-input" id="ass-modal-templates-add-assistant-toggle" data-type="edit">
                                <label class="ass-size-14 form-check-label ass-modal-templates-add-assistant-toggle-label-off" data-type="edit" for="ass-modal-templates-add-assistant-toggle"><?php esc_html_e('Use custom content', 'assistini'); ?></label>
                                <label class="ass-size-14 form-check-label ass-modal-templates-add-assistant-toggle-label-on" data-type="edit" for="ass-modal-templates-add-assistant-toggle" style="display:none;"><?php esc_html_e('Use Blog content', 'assistini'); ?></label>
                            </div>
                            <form id="ass-modal-templates-add-assistant-form" class="px-2 pt-2 pb-0">
                                <div class="mb-2 ass-modal-templates-add-assistant-blog">
                                    <div class="w-100">
                                        <label class="ass-fw-500 mb-1 ass-size-14" for="ass-modal-templates-add-assistant-post-dropdown"><?php esc_html_e('Select content', 'assistini'); ?>:</label>
                                        <div id="ass-modal-templates-add-assistant-post-dropdown" data-type="edit" data-selected-id="0" class="dropdown">
                                            <div class="ass-size-14 border rounded dropdown-toggle d-flex align-items-center justify-content-between px-2 py-1 bg-white" data-bs-toggle="dropdown">
                                                <span class="text-truncate"><?php esc_html_e('Select content', 'assistini'); ?></span>
                                            </div>
                                            <ul class="dropdown-menu ass-max-w-inherit" aria-labelledby="dropdownMenuButton1">
                                                <li><div class="px-2"><input id="ass-modal-templates-assistant-posts-search" class="w-100 ass-size-14" type="text" placeholder="<?php esc_html_e('Search for blog title...', 'assistini'); ?>"></div></li>
                                                <li class="ass-modal-templates-assistant-post-item"><a class="ass-size-14 dropdown-item" data-id="0"><?php esc_html_e('Select content', 'assistini'); ?></a></li>
                                                <div class="ass-modal-templates-assistant-posts-list ass-max-w-inherit">
                                                </div>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                                <div class="mb-2 ass-modal-templates-add-assistant-custom" style="display:none;">
                                    <div class="d-flex justify-content-between align-items-center">
                                        <label class="ass-fw-500 mb-1 ass-size-14" for="ass-templates-add-assistant-content"><?php esc_html_e('Content', 'assistini'); ?>:</label>
                                    </div>
                                    <textarea class="form-control ass-custom-scrollbar" id="ass-templates-add-assistant-content" data-type="edit" rows="6" placeholder="<?php esc_attr_e('Content...', 'assistini'); ?>" maxlength="10000"></textarea>
                                    <div class="d-flex justify-content-end small">
                                        <span class="ass-templates-add-assistant-content-length">0</span>/10000
                                    </div>
                                </div>
                            </form>
                            <div class="ass-modal-templates-add-assistant-footer d-flex justify-content-end px-2 pt-1 pb-2">
                                <div class="d-flex gap-3">
                                    <button type="button" class="btn btn-sm btn-primary ass-templates-add-assistant-start-btn" data-type="edit">
                                        <span class="ass-templates-add-assistant-start-text" data-type="edit"><?php esc_html_e('Create', 'assistini'); ?></span>
                                        <div class="spinner-border spinner-border-sm text-light ass-templates-add-assistant-start-loader" data-type="edit" role="status" style="display:none;">
                                        </div>
                                    </button>
                                </div>
                            </div>
                        </div>
                        <div class="ass-modal-templates-add-sidebar me-2 ass-shadow" data-id="structure" style="display:none;">
                            <div class="d-flex align-items-center px-2 pt-2 gap-1">
                                <span class="ass-modal-templates-add-sidebar-close ass-size-14 px-1"><i class="bi bi-caret-right-fill"></i></span>
                                <span class="ass-fw-500 ass-size-16"><?php esc_html_e('Structure Assistant', 'assistini'); ?>:</span>
                            </div>
                            <div class="form-check form-switch mx-2 mt-2">
                                <input role="switch" type="checkbox" class="ass-form-switch form-check-input" id="ass-modal-templates-add-structure-toggle" data-type="edit">
                                <label class="ass-size-14 form-check-label ass-modal-templates-add-structure-toggle-label-off" data-type="edit" for="ass-modal-templates-add-structure-toggle"><?php esc_html_e('Use custom content', 'assistini'); ?></label>
                                <label class="ass-size-14 form-check-label ass-modal-templates-add-structure-toggle-label-on" data-type="edit" for="ass-modal-templates-add-structure-toggle" style="display:none;"><?php esc_html_e('Use Blog content', 'assistini'); ?></label>
                            </div>
                            <form id="ass-modal-templates-add-structure-form" class="px-2 pt-2 pb-0">
                                <div class="mb-2 ass-modal-templates-add-structure-blog">
                                    <div class="w-100">
                                        <label class="ass-fw-500 mb-1 ass-size-14" for="ass-modal-templates-add-structure-post-dropdown"><?php esc_html_e('Select content', 'assistini'); ?>:</label>
                                        <div id="ass-modal-templates-add-structure-post-dropdown" data-type="edit" data-selected-id="0" class="dropdown">
                                            <div class="ass-size-14 border rounded dropdown-toggle d-flex align-items-center justify-content-between px-2 py-1 bg-white" data-bs-toggle="dropdown">
                                                <span class="text-truncate"><?php esc_html_e('Select content', 'assistini'); ?></span>
                                            </div>
                                            <ul class="dropdown-menu ass-max-w-inherit" aria-labelledby="dropdownMenuButton1">
                                                <li><div class="px-2"><input id="ass-modal-templates-structure-posts-search" class="w-100 ass-size-14" type="text" placeholder="<?php esc_html_e('Search for blog title...', 'assistini'); ?>"></div></li>
                                                <li class="ass-modal-templates-structure-post-item"><a class="ass-size-14 dropdown-item" data-id="0"><?php esc_html_e('Select content', 'assistini'); ?></a></li>
                                                <div class="ass-modal-templates-structure-posts-list ass-max-w-inherit">
                                                </div>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                                <div class="mb-2 ass-modal-templates-add-structure-custom" style="display:none;">
                                    <div class="d-flex justify-content-between align-items-center">
                                        <label class="ass-fw-500 mb-1 ass-size-14" for="ass-templates-add-structure-content"><?php esc_html_e('Content', 'assistini'); ?>:</label>
                                    </div>
                                    <textarea class="form-control ass-custom-scrollbar" id="ass-templates-add-structure-content" data-type="edit" rows="6" placeholder="<?php esc_attr_e('Content...', 'assistini'); ?>" maxlength="10000"></textarea>
                                    <div class="d-flex justify-content-end small">
                                        <span class="ass-templates-add-structure-content-length">0</span>/10000
                                    </div>
                                </div>
                            </form>
                            <div class="ass-modal-templates-add-structure-footer d-flex justify-content-end px-2 pt-1 pb-2">
                                <div class="d-flex gap-3">
                                    <button type="button" class="btn btn-sm btn-primary ass-templates-add-structure-start-btn" data-type="edit">
                                        <span class="ass-templates-add-structure-start-text" data-type="edit"><?php esc_html_e('Create', 'assistini'); ?></span>
                                        <div class="spinner-border spinner-border-sm text-light ass-templates-add-structure-start-loader" data-type="edit" role="status" style="display:none;">
                                        </div>
                                    </button>
                                </div>
                            </div>
                        </div>
                        <div class="ass-modal-templates-add-sidebar me-2 ass-shadow ass-flex flex-column" data-id="analyze" style="display:none;">
                            <div class="d-flex justify-content-between px-2 pt-2">
                                <div class="d-flex align-items-center gap-1">
                                    <span class="ass-modal-templates-add-sidebar-close ass-size-14 px-1"><i class="bi bi-caret-right-fill"></i></span>
                                    <span class="ass-fw-500 ass-size-16"><?php esc_html_e('Check prompt', 'assistini'); ?>:</span>
                                </div>
                                <span class="ass-modal-templates-add-analyze-reload btn btn-sm btn-primary ass-size-16 py-0 px-1" data-type="edit"><i class="bi bi-sm bi-arrow-repeat"></i></span>
                            </div>
                            <div class="ass-modal-templates-add-analyze-loader px-2 py-2" style="display:none;">
                                <div class="d-flex flex-column gap-3 placeholder-wave ass-position-relative align-items-center justify-content-center">
                                    <span class="placeholder rounded w-100"></span>
                                    <div class="ass-modal-templates-add-analyze-loader-circle bg-light ps-2 pt-2 pe-2"></div>
                                    <span class="ass-modal-templates-add-analyze-loader-circle-text"></span>
                                </div>
                            </div>
                            <div class="ass-modal-templates-add-analyze-ctn ass-flex flex-column gap-3 px-2 py-2">
                                <div class="ass-modal-templates-add-analyze-results d-flex flex-column gap-2"></div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer justify-content-between">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e('Dismiss', 'assistini'); ?></button>
                    <div class="d-flex gap-3">
                        <div class="ass-templates-edit-blog-access-ctn d-flex align-items-center gap-1">
                            <input type="checkbox" id="ass-templates-edit-blog-access">
                            <label class="ass-size-14" for="ass-templates-edit-blog-access"><?php esc_html_e('Share my template with other blog users', 'assistini'); ?></label>
                            <span class="badge bg-secondary ass-templates-edit-blog-access-badge" style="display:none;"><?php esc_html_e('SMART', 'assistini'); ?></span>
                        </div>
                        <button type="button" class="btn btn-primary ass-templates-edit-save-btn">
                            <span class="ass-templates-edit-save-text"><?php esc_html_e('Save', 'assistini'); ?></span>
                            <div class="spinner-border spinner-border-sm text-light ass-templates-edit-save-loader" role="status" style="display:none;">
                            </div>
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade" id="ass-modal-chat-delete" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <input type="hidden" id="ass-modal-chat-id" value="" />
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="exampleModalLabel"><?php esc_html_e('Delete Chat', 'assistini'); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body d-flex justify-content-between">
                    <button type="button" class="btn btn-primary" data-bs-dismiss="modal"><?php esc_html_e('Dismiss', 'assistini'); ?></button>
                    <button type="button" class="btn btn-danger ass-modal-chat-delete-btn">
                        <span class="ass-modal-chat-delete-text"><?php esc_html_e('Delete', 'assistini'); ?></span>
                        <div class="spinner-border spinner-border-sm text-light ass-modal-chat-delete-loader" role="status" style="display:none;"></div>
                    </button>
                </div>
                <!-- <div class="modal-footer justify-content-between">
                </div> -->
            </div>
        </div>
    </div>
    <div class="modal modal-lg fade" id="ass-modal-chat-new" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="exampleModalLabel"><?php esc_html_e('Select Mode', 'assistini'); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <div class="d-flex flex-column gap-2">
                        <div class="card ass-max-w-none m-0 w-100 h-100 px-3">
                            <div class="d-flex justify-content-between gap-3">
                                <div>
                                    <div class="d-flex flex-column">
                                        <span class="fw-bold text-primary ass-size-16"><?php echo esc_html(ASSI_Tools::getSystemTemplateTranslation(1)['header']) ?></span>
                                        <span class="ass-size-14"><?php echo esc_html(ASSI_Tools::getSystemTemplateTranslation(1)['info']) ?></span>
                                        <div class="mt-2">
                                            <div class="ass-template-badge badge bg-secondary"><?php esc_html_e('by Assistini', 'assistini'); ?></div>
                                        </div>
                                    </div>
                                </div>
                                <div class="d-flex align-items-center justify-content-center">
                                    <button class="ass-modal-chat-new-guided-btn btn btn-sm btn-outline-secondary ass-w-max-content" data-id="1"><?php esc_html_e('+ Create Content', 'assistini'); ?></button>
                                </div>
                            </div>
                        </div>
                        <div class="card ass-max-w-none m-0 w-100 h-100 px-3">
                            <div class="d-flex justify-content-between gap-3">
                                <div>
                                    <div class="d-flex flex-column">
                                        <span class="fw-bold text-primary ass-size-16"><?php echo esc_html(ASSI_Tools::getSystemTemplateTranslation(2)['header']) ?></span>
                                        <span class="ass-size-14"><?php echo esc_html(ASSI_Tools::getSystemTemplateTranslation(2)['info']) ?></span>
                                        <div class="mt-2">
                                            <div class="ass-template-badge badge bg-secondary"><?php esc_html_e('by Assistini', 'assistini'); ?></div>
                                        </div>
                                    </div>
                                </div>
                                <div class="d-flex align-items-center justify-content-center">
                                    <button class="ass-modal-chat-new-guided-btn btn btn-sm btn-outline-secondary ass-w-max-content" data-id="2"><?php esc_html_e('+ Create Content', 'assistini'); ?></button>
                                </div>
                            </div>
                        </div>
                        <div class="card ass-max-w-none m-0 w-100 h-100 px-3">
                            <div class="d-flex justify-content-between gap-3">
                                <div>
                                    <div class="d-flex flex-column">
                                        <span class="fw-bold text-primary ass-size-16"><?php echo esc_html_e('Custom Prompt', 'assistini'); ?></span>
                                        <span class="ass-size-14"><?php echo esc_html_e('Enter your own prompts and let the AI generate exactly what you need.', 'assistini'); ?></span>
                                    </div>
                                </div>
                                <div class="d-flex align-items-center justify-content-center">
                                    <button class="ass-modal-chat-new-easy-btn btn btn-sm btn-outline-secondary ass-w-max-content"><?php esc_html_e('+ Create Content', 'assistini'); ?></button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- support modal -->
    <div class="modal fade" id="ass-modal-support" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title"><?php esc_html_e('Support', 'assistini'); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <div class="ass-modal-support-confirmation alert alert-success" style="display:none;"><?php echo nl2br(esc_html__("We have received your question and created a ticket.\n\nOur support team will address your concern promptly.\nYou will also receive a confirmation at the email address you provided.\n\nIf you have any further questions, please feel free to contact us at any time.\n\nBest regards, Your Assistini Support Team", "assistini")); ?></div>
                    <form id="ass-modal-support-form">

                        <div class="mb-3">
                            <label class="ass-fw-500 mb-1" for="ass-modal-support-name"><?php esc_html_e('Name', 'assistini'); ?>:</label>
                            <input type="text" class="form-control ass-form-control" id="ass-modal-support-name" placeholder="<?php esc_attr_e('Name...', 'assistini'); ?>" />
                        </div>
                        <div class="mb-3">
                            <label class="ass-fw-500 mb-1" for="ass-modal-support-email"><?php esc_html_e('E-Mail', 'assistini'); ?>:</label>
                            <input type="text" class="form-control ass-form-control" id="ass-modal-support-email" placeholder="<?php esc_attr_e('E-Mail...', 'assistini'); ?>" />
                        </div>
                        <div class="mb-3">
                            <label class="ass-fw-500 mb-1" for="ass-modal-support-message"><?php esc_html_e('Your Message', 'assistini'); ?>:</label>
                            <textarea class="form-control ass-custom-scrollbar" id="ass-modal-support-message" rows="3" placeholder="<?php esc_attr_e('Message...', 'assistini'); ?>" maxlength="3000"></textarea>
                        </div>
                        <div class="mb-3">
                            <label class="ass-fw-500 mb-1" for="ass-modal-support-session-id"><?php esc_html_e('Chat-ID (Optional)', 'assistini'); ?>:</label>
                            <input type="text" class="form-control ass-form-control" id="ass-modal-support-session-id" placeholder="<?php esc_attr_e('Chat-ID...', 'assistini'); ?>" />
                        </div>
                    </form>
                </div>
                <div class="modal-footer justify-content-between">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e('Dismiss', 'assistini'); ?></button>
                    <button type="button" class="btn btn-primary ass-modal-support-save-btn">
                        <span class="ass-modal-support-save-text"><?php esc_html_e('Send', 'assistini'); ?></span>
                        <div class="spinner-border spinner-border-sm text-light ass-modal-support-save-loader" role="status" style="display:none;">
                        </div>
                    </button>
                </div>
            </div>
        </div>
    </div>

    <!-- upgrade modal -->
    <div class="modal fade" id="ass-modal-upgrade" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content ass-modal-upgrade-content" data-type="credits" data-plan="1" style="display:none;">
                <div class="modal-header">
                    <h5 class="modal-title"><?php esc_html_e('Notice', 'assistini'); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <h4 class="ass-modal-upgrade-header"><?php esc_html_e('You want to create more content?', 'assistini'); ?></h4>
                    <p><?php esc_html_e('Please upgrade your current free version to the smart version or add further word contingents to create new content.', 'assistini'); ?></p>
                </div>
                <div class="modal-footer justify-content-between">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e('Dismiss', 'assistini'); ?></button>
                    <a type="button" class="btn btn-primary ass-modal-upgrade-smart-btn" href="https://app.assistini.com/?screen=Plan" target="_blank" rel="noopener noreferrer"><?php esc_html_e('Upgrade', 'assistini'); ?></a>
                </div>
            </div>
            <div class="modal-content ass-modal-upgrade-content" data-type="credits" data-plan="2" style="display:none;">
                <div class="modal-header">
                    <h5 class="modal-title"><?php esc_html_e('Notice', 'assistini'); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <h4 class="ass-modal-upgrade-header"><?php esc_html_e('You want to create more content?', 'assistini'); ?></h4>
                    <p><?php esc_html_e('Please upgrade your current free version to the smart version or add further word contingents to create new content.', 'assistini'); ?></p>
                </div>
                <div class="modal-footer justify-content-between">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e('Dismiss', 'assistini'); ?></button>
                    <a type="button" class="btn btn-primary ass-modal-upgrade-smart-btn" href="https://app.assistini.com/?screen=Plan" target="_blank" rel="noopener noreferrer"><?php esc_html_e('Upgrade', 'assistini'); ?></a>
                </div>
            </div>
            <div class="modal-content ass-modal-upgrade-content" data-type="chat" data-plan="1" style="display:none;">
                <div class="modal-header">
                    <h5 class="modal-title"><?php esc_html_e('Notice', 'assistini'); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <h4 class="ass-modal-upgrade-header"><?php esc_html_e('You want to create more content tabs?', 'assistini'); ?></h4>
                    <p><?php esc_html_e('Please upgrade your current free version to the smart version or delete an existing tab to create new content.', 'assistini'); ?></p>
                </div>
                <div class="modal-footer justify-content-between">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e('Dismiss', 'assistini'); ?></button>
                    <a type="button" class="btn btn-primary ass-modal-upgrade-smart-btn" href="https://app.assistini.com/?screen=Plan" target="_blank" rel="noopener noreferrer"><?php esc_html_e('Upgrade', 'assistini'); ?></a>
                </div>
            </div>
            <div class="modal-content ass-modal-upgrade-content" data-type="chat" data-plan="2" style="display:none;">
                <div class="modal-header">
                    <h5 class="modal-title"><?php esc_html_e('Notice', 'assistini'); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <h4 class="ass-modal-upgrade-header"><?php esc_html_e('You want to create more content tabs?', 'assistini'); ?></h4>
                    <p><?php esc_html_e('Feel free to contact our sales team for a custom solution or delete an existing tab to create new content.', 'assistini'); ?></p>
                </div>
                <div class="modal-footer justify-content-between">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e('Dismiss', 'assistini'); ?></button>
                    <button type="button" class="btn btn-primary ass-modal-upgrade-contact-btn"><?php esc_html_e('Contact our Team', 'assistini'); ?></button>
                </div>
            </div>
            <div class="modal-content ass-modal-upgrade-content" data-type="template" data-plan="1" style="display:none;">
                <div class="modal-header">
                    <h5 class="modal-title"><?php esc_html_e('Notice', 'assistini'); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <h4 class="ass-modal-upgrade-header"><?php esc_html_e('You want to add more templates for use?', 'assistini'); ?></h4>
                    <p><?php esc_html_e('Please upgrade your current free version to the smart version or delete an existing template to add new template.', 'assistini'); ?></p>
                </div>
                <div class="modal-footer justify-content-between">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e('Dismiss', 'assistini'); ?></button>
                    <a type="button" class="btn btn-primary ass-modal-upgrade-smart-btn" href="https://app.assistini.com/?screen=Plan" target="_blank" rel="noopener noreferrer"><?php esc_html_e('Upgrade', 'assistini'); ?></a>
                </div>
            </div>
            <div class="modal-content ass-modal-upgrade-content" data-type="template" data-plan="2" style="display:none;">
                <div class="modal-header">
                    <h5 class="modal-title"><?php esc_html_e('Notice', 'assistini'); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <h4 class="ass-modal-upgrade-header"><?php esc_html_e('You want to add more templates for use?', 'assistini'); ?></h4>
                    <p><?php esc_html_e('Feel free to contact our sales team for a custom solution or delete an existing template to add new template.', 'assistini'); ?></p>
                </div>
                <div class="modal-footer justify-content-between">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e('Dismiss', 'assistini'); ?></button>
                    <button type="button" class="btn btn-primary ass-modal-upgrade-contact-btn" data-bs-dismiss="modal"><?php esc_html_e('Contact our Team', 'assistini'); ?></button>
                </div>
            </div>
        </div>
    </div>

    <!-- upgrade bonus modal -->
    <div class="modal fade" id="ass-modal-upgrade-bonus" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-hidden="true">
        <div class="px-5 modal-dialog modal-dialog-centered">
            <div class="ass-modal-upgrade-bonus-ctn modal-content">
                <div class="text-white modal-body d-flex flex-column gap-2">
                    <div class="d-flex justify-content-between">
                        <h2 class="fw-bold text-white"><?php esc_html_e('Get 10,000 Bonus Words', 'assistini'); ?></h2>
                        <button type="button" class="btn-close mt-2" style="filter:invert(1);" data-bs-dismiss="modal" aria-label="Close"></button>
                    </div>
                    <span class="ass-size-14 pe-5"><?php esc_html_e('Your monthly free word quota is used up for now.', 'assistini'); ?></span>
                    <span class="ass-size-14 pe-5"><?php
                        /* translators: 1: strong open tag 2: strong close tag 3: strong open tag 4: strong close tag */
                        printf(esc_html__('%1$sNeed more words?%2$s Just sign up for a free account with a %3$s10,000-word boost for 30 days.%4$s', 'assistini'), '<strong>', '</strong>', '<strong>', '</strong>');
                        ?></span>
                    <span class="ass-size-14 pe-5"><?php esc_html_e('No subscription. No strings attached.', 'assistini'); ?></span>
                    <div>
                        <button type="button" class="btn ass-modal-upgrade-bonus-btn mt-3 mb-3" data-bs-dismiss="modal" href="#/account"><?php esc_html_e('Get Bonus now', 'assistini'); ?></button>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- point of view info modal -->
    <div class="modal fade" id="ass-modal-chat-pov-info" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title"><?php esc_html_e('Info: Point of View', 'assistini'); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <h5 class="mb-4"><?php esc_html_e('What narrative perspective or addressing should be used for the content?', 'assistini'); ?></h5>
                    <ul class="ass-modal-chat-info-list ass-size-14">
                        <li><strong><?php esc_html_e('Neutral', 'assistini'); ?>:</strong> <?php esc_html_e('Uses impersonal language - often avoiding any direct pronouns (I, you, he/she) - and can employ passive constructions or general statements. Ideal for reporting facts, presenting balanced viewpoints, or technical documentation. This approach emphasizes objectivity and lets the information stand on its own, without the writer\'s personal voice or a direct address to the reader.', 'assistini'); ?></li>
                        <li><strong><?php esc_html_e('First Person (I, We)', 'assistini'); ?>:</strong> <?php esc_html_e('Allows writers to share personal experiences and opinions, creating a more intimate connection with readers. This is particularly effective in personal blogs or narrative-driven content.', 'assistini'); ?></li>
                        <li><strong><?php esc_html_e('2nd Person (You)', 'assistini'); ?>:</strong> <?php esc_html_e('Engages readers directly, making them feel involved in the content. This style is useful for instructional or persuasive writing, where the writer wants to guide the reader through a process.', 'assistini'); ?></li>
                        <li><strong><?php esc_html_e('3rd Person (He, She, It, They)', 'assistini'); ?>:</strong> <?php esc_html_e('Provides a more objective viewpoint, suitable for informative or analytical blog posts. It allows the writer to discuss topics without personal bias, which can enhance credibility.', 'assistini'); ?></li>
                    </ul>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e('Dismiss', 'assistini'); ?></button>
                </div>
            </div>
        </div>
    </div>

    <!-- content length info modal -->
    <div class="modal fade" id="ass-modal-chat-length-info" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title"><?php esc_html_e('Info: Content Length', 'assistini'); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <h5 class="mb-4"><?php esc_html_e('The length of the content will be based on the following options.', 'assistini'); ?></h5>
                    <ul class="ass-modal-chat-info-list ass-size-14">
                        <li><strong><?php esc_html_e('Short', 'assistini'); ?>:</strong> <?php esc_html_e('500 Words.', 'assistini'); ?></li>
                        <li><strong><?php esc_html_e('Medium', 'assistini'); ?>:</strong> <?php esc_html_e('1250 Words.', 'assistini'); ?></li>
                        <li><strong><?php esc_html_e('Long', 'assistini'); ?>:</strong> <?php esc_html_e('2000 Words.', 'assistini'); ?></li>
                    </ul>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e('Dismiss', 'assistini'); ?></button>
                </div>
            </div>
        </div>
    </div>

    <!-- general purpose info modal -->
    <div class="modal fade" id="ass-modal-general-info" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered" data-id="assistant">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title"><?php esc_html_e('Info: Create prompt with AI', 'assistini'); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <span class="ass-size-14"><?php esc_html_e('"Create prompt with AI" automatically turns existing content into a clear, actionable prompt. It can draw from a discovered blog post or from text you provide. The AI analyzes title, context, and key points, then organizes them into precise, goal-oriented instructions. This produces time-saving, consistent prompts that reflect your target audience, tone, and keywords. Results are easy to review and fine-tune as needed. The generated prompt is ready for immediate use in your content workflow.', 'assistini'); ?></span>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e('Dismiss', 'assistini'); ?></button>
                </div>
            </div>
        </div>
        <div class="modal-dialog modal-dialog-centered" data-id="structure">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title"><?php esc_html_e('Info: Create structure & style with AI', 'assistini'); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <span class="ass-size-14"><?php esc_html_e('"Create structure & style with AI" generates a clear outline and a consistent writing style from your inputs. It proposes section flow, headings, and subheadings, then defines the formatting guidelines. The AI aligns structure and style with your audience, goals, and keywords to keep content focused and cohesive. You get an editable outline plus a concise style guide (tone notes, do\'s & don\'ts, sample phrasing). The result is ready to apply across drafts, templates, or entire content series for reliable, on-brand writing.', 'assistini'); ?></span>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e('Dismiss', 'assistini'); ?></button>
                </div>
            </div>
        </div>
        <div class="modal-dialog modal-dialog-centered" data-id="analyze">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title"><?php esc_html_e('Info: Check prompt', 'assistini'); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <span class="ass-size-14"><?php esc_html_e('"Check prompt" evaluates your prompt against key criteria that matter to AI systems—clarity, intent, constraints, context, and measurability. It highlights gaps, ambiguity, and unnecessary complexity, then scores the prompt on structure and goal alignment. You\'ll receive targeted improvement suggestions and practical tips to strengthen instructions, examples, and success criteria. The feature also returns an optimized prompt you can use immediately or adapt further. This smart feature helps you achieve more consistent, high-quality results with fewer iterations.', 'assistini'); ?></span>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e('Dismiss', 'assistini'); ?></button>
                </div>
            </div>
        </div>
    </div>

    <!--ai editor dashboard modal -->
    <div class="modal fade" id="ass-modal-ai-editor-selection" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="aiEditorModalLabel"><?php esc_html_e('AI Editor Assistant', 'assistini'); ?></h5>
                </div>
                <div class="modal-body">
                    <p class="mb-4">
                        <?php esc_html_e('The AI Editor Assistant helps you create and edit content in the WordPress Editor using built-in AI features or your own prompt templates.', 'assistini'); ?>
                    </p>
                    <div class="d-flex justify-content-center gap-2">
                        <a href="<?php echo esc_url(admin_url('post-new.php?ass-ai-editor=open')); ?>" class="btn btn-outline-primary">
                            <?php esc_html_e('Create new content', 'assistini'); ?>
                        </a>
                        <a href="<?php echo esc_url(admin_url('post.php')); ?>" class="btn btn-outline-primary">
                            <?php esc_html_e('Edit existing content', 'assistini'); ?>
                        </a>                     
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e('Dismiss', 'assistini'); ?></button>
                </div>
            </div>
        </div>
    </div>


    <!-- connection error modal -->
    <div class="modal fade modal-lg" id="ass-modal-connection-error" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content ass-modal-connection-error-content" data-type="server_blocked" style="display:none;">
                <div class="modal-header">
                    <h5 class="modal-title"><?php esc_html_e('Connection to the Assistini API is restricted!', 'assistini'); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <div class="d-flex flex-column gap-3">
                        <h5><?php echo wp_kses(__('Your connection to the Assistini API is limited due to a <strong>blocked IP address.</strong>', 'assistini'), array('strong' => array())); ?></h5>
                        <h5><?php esc_html_e('Need help? Our support team is here for you.', 'assistini'); ?></h5>
                    </div>
                </div>
                <div class="modal-footer d-flex justify-content-between">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e('Dismiss', 'assistini'); ?></button>
                    <a type="button" href="https://assistini.com/en/contact/" class="btn btn-primary" target="_blank" rel="noopener noreferrer"><?php esc_html_e('Contact Support', 'assistini'); ?></a>
                </div>
            </div>
            <div class="modal-content ass-modal-connection-error-content" data-type="server_auth_failed" style="display:none;">
                <div class="modal-header">
                    <h5 class="modal-title"><?php esc_html_e('Connection to our AI server is required!', 'assistini'); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <div class="d-flex flex-column gap-3">
                        <h5><?php esc_html_e('To use AI-based responses, the plugin must establish a secure connection to the AI server via the Assistini API.', 'assistini'); ?></h5>
                        <div class="d-flex flex-column gap-1">
                            <span class="ass-size-17 mb-1 fw-bold"><?php esc_html_e('Please ensure that outgoing connections are allowed on your server:', 'assistini'); ?></span>
                            <span class="ass-size-15"><i class="bi bi-check-lg text-secondary"></i> <?php esc_html_e('Check WP_HTTP_BLOCK_EXTERNAL in wp-config.php', 'assistini'); ?></span>
                            <span class="ass-size-15"><i class="bi bi-check-lg text-secondary"></i> <?php esc_html_e('Enable the PHP cURL extension', 'assistini'); ?></span>
                            <span class="ass-size-15"><i class="bi bi-check-lg text-secondary"></i> <?php esc_html_e('Allow API access through your firewall (contact your host if needed)', 'assistini'); ?></span>
                        </div>
                        <span><?php esc_html_e('Need help? Our support team is here for you.', 'assistini'); ?></span>
                    </div>
                </div>
                <div class="modal-footer d-flex justify-content-between">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e('Dismiss', 'assistini'); ?></button>
                    <a type="button" href="https://assistini.com/en/contact/" class="btn btn-primary" target="_blank" rel="noopener noreferrer"><?php esc_html_e('Contact Support', 'assistini'); ?></a>
                </div>
            </div>
            <div class="modal-content ass-modal-connection-error-content" data-type="client_blocked" style="display:none;">
                <div class="modal-header">
                    <h5 class="modal-title"><?php esc_html_e('Connection to our AI server is required!', 'assistini'); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <div class="d-flex flex-column gap-3">
                        <h5><?php esc_html_e('To use AI-based responses, the plugin must establish a secure connection to the AI server via the Assistini API.', 'assistini'); ?></h5>
                        <div class="d-flex flex-column gap-1">
                            <span class="ass-size-17 mb-1 fw-bold"><?php esc_html_e('Please ensure that outgoing connections are allowed on your server:', 'assistini'); ?></span>
                            <span class="ass-size-15"><i class="bi bi-check-lg text-secondary"></i> <?php esc_html_e('Check WP_HTTP_BLOCK_EXTERNAL in wp-config.php', 'assistini'); ?></span>
                            <span class="ass-size-15"><i class="bi bi-check-lg text-secondary"></i> <?php esc_html_e('Enable the PHP cURL extension', 'assistini'); ?></span>
                            <span class="ass-size-15"><i class="bi bi-check-lg text-secondary"></i> <?php esc_html_e('Allow API access through your firewall (contact your host if needed)', 'assistini'); ?></span>
                        </div>
                        <span><?php esc_html_e('Need help? Our support team is here for you.', 'assistini'); ?></span>
                    </div>
                </div>
                <div class="modal-footer d-flex justify-content-between">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e('Dismiss', 'assistini'); ?></button>
                    <a type="button" href="https://assistini.com/en/contact/" class="btn btn-primary" target="_blank" rel="noopener noreferrer"><?php esc_html_e('Contact Support', 'assistini'); ?></a>
                </div>
            </div>
        </div>
    </div>

    <!-- onboarding info modal -->
    <div class="modal modal-lg fade" id="ass-modal-onboarding" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content ass-modal-onboarding-bg">
                <div class="ass-modal-onboarding-header">
                    <img src="<?php echo esc_url(plugins_url('/assets/images/ass_sidebar_logo.png', ASSI_PLUGIN_FILE)) ?>">
                </div>
                <div class="modal-body ass-modal-onboarding-body mt-5 text-white d-flex flex-column align-items-center text-center">
                    <h3><b><?php esc_html_e('Welcome to Assistini', 'assistini'); ?></b></h3>
                    <p class="ass-size-14"><?php esc_html_e('Great to have you here! Get started right away. Explore powerful tools to create and customize SEO-optimized website content.', 'assistini'); ?></p>
                    <div class="ass-modal-onboarding-panel d-flex flex-row gap-2">
                        <div class="ass-modal-onboarding-panel-item d-flex flex-column p-3 gap-1">
                            <i class="bi bi-layer-backward ass-size-25 mb-1"></i>
                            <b class="ass-size-15"><?php esc_html_e('Create Content', 'assistini'); ?></b>
                            <span class="ass-size-14"><?php esc_html_e('Build step-by-step, fully structured blog posts—SEO-friendly and easy', 'assistini'); ?></span>
                        </div>
                        <div class="ass-modal-onboarding-panel-item d-flex flex-column p-3 gap-1">
                            <i class="bi bi-file-earmark-check-fill ass-size-25 mb-1"></i>
                            <b class="ass-size-15"><?php esc_html_e('Define Template', 'assistini'); ?></b>
                            <span class="ass-size-14"><?php esc_html_e('Easily create reusable post structures to save time and maintain a consistent style', 'assistini'); ?></span>
                        </div>
                        <div class="ass-modal-onboarding-panel-item d-flex flex-column p-3 gap-1">
                            <i class="bi bi-gear-fill ass-size-25 mb-1"></i>
                            <b class="ass-size-15"><?php esc_html_e('Enhance Content', 'assistini'); ?></b>
                            <span class="ass-size-14"><?php esc_html_e('Improve your posts directly in the Gutenberg editor with AI support for SEO and readability', 'assistini'); ?></span>
                        </div>
                    </div>
                    <button class="ass-modal-onboarding-confirm btn btn-secondary px-5 mb-1 mt-4"><?php esc_html_e('Start now', 'assistini'); ?></button>
                </div>
            </div>
        </div>
    </div>

    <?php if (current_user_can('manage_options')) { ?>
        <!-- connection setting modal - case 1 - is admin, option is off -->
        <div class="modal fade modal" id="ass-modal-connection-consent" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-hidden="true">
            <input id="ass-modal-connection-consent-email" value="" type="hidden" />
            <input id="ass-modal-connection-consent-remove" value="0" type="hidden" />
            <div class="modal-dialog modal-dialog-centered">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title"><?php esc_html_e('Permission required!', 'assistini'); ?></h5>
                        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                    </div>
                    <div class="modal-body">
                        <div class="d-flex flex-column gap-2">
                            <p class="ass-size-15" style="color:#666;">
                                <?php
                                echo wp_kses(
                                        /* translators: 1: Assistini Privacy Policy */
                                        sprintf(__('To use the AI features and receive AI-generated responses, we require your consent to transmit the content you enter in the Assistini Content Creator to the AI server via a secure API connection. You can withdraw your consent at any time by deselecting the option. For details, please see our <a href="%1$s" target="_blank" rel="noopener noreferrer">privacy policy</a>.', 'assistini'), esc_url('https://assistini.com/en/privacy-policy#wp')),
                                        array('a' => array('href' => array(), 'target' => array(), 'rel' => array()))
                                );
                                ?>
                            </p>
                            <div class="d-flex gap-2">
                                <div>
                                    <input type="checkbox" id="ass-modal-consent-checkbox" />
                                </div>
                                <label for="ass-modal-consent-checkbox" style="font-size: 15px;"><?php esc_html_e('I consent to content being sent to OpenAI (ChatGPT), Google (Gemini) and agree to the privacy policy.', 'assistini'); ?></label>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer d-flex justify-content-between">
                        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e('Do not allow', 'assistini'); ?></button>
                        <button type="button" class="ass-modal-connection-consent-save-btn btn btn-primary" disabled><?php esc_html_e('Save', 'assistini'); ?></button>
                    </div>
                </div>
            </div>
        </div>

        <!-- connection setting modal - case 2 - is admin, dismissed option call -->
        <div class="modal fade modal" id="ass-modal-connection-consent-dismissed" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-hidden="true">
            <div class="modal-dialog modal-dialog-centered">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title"><?php esc_html_e('Permission required!', 'assistini'); ?></h5>
                        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                    </div>
                    <div class="modal-body">
                        <div class="d-flex flex-column gap-2">
                            <p class="ass-size-15">
                                <?php
                                echo wp_kses(
                                        /* translators: 1: Link to Assistini Plugin Settings */
                                        sprintf(__('In order to use the AI function of Assistini, we need your consent to transmit content to OpenAI (ChatGPT) and Google (Gemini).<br><br>Please activate the option in the <a href="%1$s" target="_blank" rel="noopener noreferrer">Plugin Settings</a> to continue.', 'assistini'), '#/settings'),
                                        array('a' => array('href' => array(), 'target' => array(), 'rel' => array()), 'br' => array())
                                );
                                ?>

                            </p>
                        </div>
                    </div>
                    <div class="modal-footer d-flex justify-content-end">
                        <button type="button" class="btn btn-primary" data-bs-dismiss="modal"><?php esc_html_e('Got it', 'assistini'); ?></button>
                    </div>
                </div>
            </div>
        </div>
    <?php } ?>

    <!-- connection setting modal - case 3 - no admin, option is off -->
    <div class="modal fade modal" id="ass-modal-connection-consent-no-admin" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title"><?php esc_html_e('Administrator Approval Required!', 'assistini'); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <div class="d-flex flex-column gap-2">
                        <p class="ass-size-15"><?php echo nl2br(esc_html__("The AI functionality has not yet been enabled on this website by the administrator.\n\nPlease inform your site administrator so they can activate the AI server connection in the plugin settings.\n\nWithout this approval, the use of Assistini is not possible.", "assistini")); ?>
                        </p>
                    </div>
                </div>
                <div class="modal-footer d-flex justify-content-end">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e('Dismiss', 'assistini'); ?></button>
                </div>
            </div>
        </div>
    </div>

    <!-- custom ai integration modal -->
    <div class="modal fade modal" id="ass-modal-custom-ai-add" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title"><?php esc_html_e('Add Custom Integration', 'assistini'); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <div class="d-flex flex-column gap-2">
                        <form id="ass-modal-custom-ai-add-form">
                            <div class="mb-3">
                                <label class="ass-fw-500 mb-1" for="ass-modal-custom-ai-add-form-name"><?php esc_html_e('Name', 'assistini'); ?>:</label>
                                <input type="text" class="form-control ass-form-control" id="ass-modal-custom-ai-add-form-name" placeholder="<?php esc_attr_e('Name...', 'assistini'); ?>" />
                            </div>
                            <div class="mb-3">
                                <label class="ass-fw-500 mb-1" for="ass-modal-custom-ai-add-form-key"><?php esc_html_e('Key', 'assistini'); ?>:</label>
                                <input type="text" class="form-control ass-form-control" id="ass-modal-custom-ai-add-form-key" placeholder="<?php esc_attr_e('Key...', 'assistini'); ?>" />
                            </div>
                        </form>
                    </div>
                </div>
                <div class="modal-footer d-flex justify-content-between">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e('Dismiss', 'assistini'); ?></button>
                    <button type="button" class="btn btn-primary ass-modal-custom-ai-add-save"><?php esc_html_e('Save', 'assistini'); ?></button>
                </div>
            </div>
        </div>
    </div>

    <!-- custom ai integration controls info modal -->
    <div class="modal fade" id="ass-modal-settings-custom-ai-info" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered ass-modal-settings-custom-ai-info-content" data-id="temp">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title"><?php esc_html_e('Temperature (Value: 0.0 - 2.0)', 'assistini'); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <h5 class="mb-4"><?php esc_html_e('Controls how creative or random the AI\'s responses are.', 'assistini'); ?></h5>
                    <ul class="ass-modal-chat-info-list ass-size-14">
                        <li><?php esc_html_e('A low value (e.g. 0.2) makes the output more focused, predictable, and safe.', 'assistini'); ?></li>
                        <li><?php esc_html_e('A high value (e.g. 1.5 or 2.0) makes the output more creative, varied, and sometimes surprising.', 'assistini'); ?></li>
                    </ul>
                    <span class="ass-size-14"><?php esc_html_e('Use a higher value if you want more unique or unconventional responses.', 'assistini'); ?></span>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e('Dismiss', 'assistini'); ?></button>
                </div>
            </div>
        </div>
        <div class="modal-dialog modal-dialog-centered ass-modal-settings-custom-ai-info-content" data-id="topp">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title"><?php esc_html_e('Top_p (Value: 0.0 - 1.0)', 'assistini'); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <h5 class="mb-4"><?php esc_html_e('Sets how many word choices the AI considers at each step.', 'assistini'); ?></h5>
                    <ul class="ass-modal-chat-info-list ass-size-14">
                        <li><?php esc_html_e('With low values (e.g. 0.3), only the most likely words are used → safer and more focused output.', 'assistini'); ?></li>
                        <li><?php esc_html_e('With higher values (e.g. 0.9 or 1.0), the AI considers a wider range of words → more diverse and interesting responses.', 'assistini'); ?></li>
                    </ul>
                    <span class="ass-size-14"><?php esc_html_e('Often used together with Temperature to balance creativity and control.', 'assistini'); ?></span>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e('Dismiss', 'assistini'); ?></button>
                </div>
            </div>
        </div>
        <div class="modal-dialog modal-dialog-centered ass-modal-settings-custom-ai-info-content" data-id="pres">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title"><?php esc_html_e('Presence Penalty (Value: -2.0 - 2.0)', 'assistini'); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <h5 class="mb-4"><?php esc_html_e('Influences whether the AI introduces new topics or repeats earlier ones.', 'assistini'); ?></h5>
                    <ul class="ass-modal-chat-info-list ass-size-14">
                        <li><?php esc_html_e('Higher values (e.g. 1.0-2.0) make the AI less likely to mention things it has already said → encourages more variety.', 'assistini'); ?></li>
                        <li><?php esc_html_e('Lower or negative values allow more repetition or sticking to familiar topics.', 'assistini'); ?></li>
                    </ul>
                    <span class="ass-size-14"><?php esc_html_e('Helpful if you want the AI to explore different ideas rather than circle back.', 'assistini'); ?></span>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e('Dismiss', 'assistini'); ?></button>
                </div>
            </div>
        </div>
        <div class="modal-dialog modal-dialog-centered ass-modal-settings-custom-ai-info-content" data-id="freq">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title"><?php esc_html_e('Frequency Penalty (Value: -2.0 - 2.0)', 'assistini'); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <h5 class="mb-4"><?php esc_html_e('Controls how often the AI repeats the same words or phrases.', 'assistini'); ?></h5>
                    <ul class="ass-modal-chat-info-list ass-size-14">
                        <li><?php esc_html_e('Higher values (e.g. 1.0-2.0) reduce repetition → more diverse vocabulary.', 'assistini'); ?></li>
                        <li><?php esc_html_e('Lower values (e.g. 0 or negative) allow more repetition → can be useful for emphasis or consistency.', 'assistini'); ?></li>
                    </ul>
                    <span class="ass-size-14"><?php esc_html_e('Great for reducing wordy or repetitive answers.', 'assistini'); ?></span>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php esc_html_e('Dismiss', 'assistini'); ?></button>
                </div>
            </div>
        </div> 
    </div>

    <!-- SECTION: Toasts -->
    <div id="ass-toast-container" class="toast-container position-fixed bottom-0 end-0 p-3"></div>
</div>