<?php
/**
 * HR Press Lite — Upgrade notice partial.
 *
 * Hooked to `admin_notices`. Only shown on HR Press Lite admin pages.
 * Permanently dismissed per-user via user meta (Guideline 11 compliant).
 * Must NOT be included directly — called via HRP_Upgrade_Notice::maybe_show().
 *
 * @package HR_Press_Lite
 */

defined( 'ABSPATH' ) || exit;

// Guard: only render on HR Press Lite pages.
$screen = get_current_screen();
if ( ! $screen || strpos( $screen->id, 'hr_press' ) === false ) {
	return;
}

// Guard: already dismissed.
if ( get_user_meta( get_current_user_id(), 'hrp_lite_upgrade_notice_dismissed', true ) ) {
	return;
}

// Guard: only for admins.
if ( ! current_user_can( 'manage_options' ) ) {
	return;
}

$upgrade_url = admin_url( 'admin.php?page=hrp_upgrade_pro' );
?>
<div id="hrp-upgrade-notice"
	class="notice hrp-notice-upgrade"
	role="alert"
	style="display:flex; align-items:center; justify-content:space-between; padding: 12px 16px; border-left: 4px solid #854fff; background:#f8f6ff;">

	<div style="display:flex; align-items:center; gap:12px;">
		<span style="font-size:22px;" aria-hidden="true">&#9889;</span>
		<p style="margin:0; font-size:14px;">
			<strong><?php esc_html_e( 'HR Press Pro is available!', 'hr-press-lite' ); ?></strong>
			<?php esc_html_e( 'Unlock Leave Management, Payroll &amp; Advanced Reports.', 'hr-press-lite' ); ?>
			<a id="hrp-notice-learn-more"
				href="<?php echo esc_url( $upgrade_url ); ?>"
				style="margin-left:8px; color:#854fff; font-weight:600; text-decoration:underline;">
				<?php esc_html_e( 'Learn More', 'hr-press-lite' ); ?>
			</a>
		</p>
	</div>

	<button
		id="hrp-dismiss-upgrade-notice"
		type="button"
		class="notice-dismiss hrp-notice-dismiss-btn"
		data-nonce="<?php echo esc_attr( wp_create_nonce( 'hrp-dismiss-upgrade-notice' ) ); ?>"
		aria-label="<?php esc_attr_e( 'Dismiss this notice', 'hr-press-lite' ); ?>">
		<span class="screen-reader-text"><?php esc_html_e( 'Dismiss', 'hr-press-lite' ); ?></span>
	</button>

</div>
