<?php
/**
 * DRBU_Core — singleton loader.
 *
 * Odgovoran je za: učitavanje modula, prevod (text domain), frontend i admin
 * asset-e. Sve ostale klase se instanciraju kroz njega.
 *
 * @package discount-rules-box-upsell
 */

defined( 'ABSPATH' ) || exit;

class DRBU_Core {

	/**
	 * Singleton instanca.
	 *
	 * @var DRBU_Core|null
	 */
	private static $instance = null;

	/**
	 * Vraća jedinu instancu DRBU_Core.
	 *
	 * @return DRBU_Core
	 */
	public static function instance() {
		if ( null === self::$instance ) {
			self::$instance = new self();
		}
		return self::$instance;
	}

	/**
	 * Privatan konstruktor — zabranjuje direktno instanciranje.
	 */
	private function __construct() {
		add_action( 'wp_enqueue_scripts', array( $this, 'register_frontend_assets' ) );
		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_frontend_assets' ) );
		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_assets' ) );
		add_action( 'admin_enqueue_scripts', array( $this, 'render_admin_menu_icon_size_fix' ) );
		add_action( 'admin_footer', array( $this, 'maybe_inject_freemius_license_dialog' ) );
		add_action( 'in_admin_header', array( $this, 'maybe_render_freemius_page_header' ) );
		add_action( 'admin_head', array( $this, 'maybe_render_favicon' ) );

		DRBU_Settings::instance();
		if ( class_exists( 'DRBU_Analytics' ) ) {
			DRBU_Analytics::instance();
		}
		DRBU_Pricing_Engine::instance();
		DRBU_Cart_Handler::instance();
		DRBU_Shortcode::instance();
		DRBU_Product_Display::instance();
		DRBU_License::instance();
	}

	/**
	 * Registruje frontend stilove bez enqueue-ovanja.
	 */
	public function register_frontend_assets() {
		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';

		wp_register_style(
			'drbu-public',
			DRBU_PLUGIN_URL . 'assets/css/discount-rules-box-upsell-public' . $suffix . '.css',
			array(),
			DRBU_VERSION
		);

		wp_register_script(
			'drbu-public-script',
			DRBU_PLUGIN_URL . 'assets/js/discount-rules-box-upsell-public' . $suffix . '.js',
			array( 'jquery' ),
			DRBU_VERSION,
			true
		);

		wp_localize_script(
			'drbu-public-script',
			'drbu_params',
			array(
				'ajax_url' => admin_url( 'admin-ajax.php' ),
			)
		);
	}

	/**
	 * Enqueue-uje frontend stilove i skripte kada su potrebni.
	 */
	public function enqueue_frontend_assets() {
		$needed = is_product() || is_shop() || is_product_category() || is_product_tag() || is_archive();

		if ( is_singular() ) {
			$post = get_post();
			if ( $post && has_shortcode( (string) $post->post_content, 'drbu_tiered_buy_box' ) ) {
				$needed = true;
			}
		}

		if ( apply_filters( 'drbu_enqueue_frontend_assets', $needed ) ) {
			wp_enqueue_style( 'drbu-public' );
			wp_add_inline_style( 'drbu-public', $this->dynamic_css() );
			wp_enqueue_script( 'drbu-public-script' );
		}
	}

	/**
	 * Generiše inline CSS sa bojama iz podešavanja (sekcija "Izgled").
	 *
	 * Boje se izlažu kroz CSS varijable u :root, a statički CSS fajl ih koristi
	 * uz fallback vrednosti, tako da buy box radi i bez ovog inline stila.
	 *
	 * @return string
	 */
	public function dynamic_css() {
		$colors      = DRBU_Settings::instance()->get_primary_colors();
		$btn_radius  = DRBU_Settings::instance()->get( 'drbu_button_radius', '100px' );
		$card_radius = DRBU_Settings::instance()->get( 'drbu_card_radius', '16px' );

		$primary = $colors['primary'];
		$hover   = $this->adjust_hex_brightness( $primary, -0.08 );
		$soft    = $this->mix_hex_with_white( $primary, 0.82 );
		$rgb     = $this->hex_to_rgb_csv( $primary );

		return sprintf(
			':root{--drbu-primary:%1$s;--drbu-primary-hover:%2$s;--drbu-primary-soft:%3$s;--drbu-primary-rgb:%4$s;--drbu-cta-text:%5$s;--drbu-best-value:%6$s;--drbu-card-bg:%7$s;--drbu-btn-radius:%8$s;--drbu-card-radius:%9$s;}',
			$primary,
			$hover,
			$soft,
			$rgb,
			$colors['cta_text'],
			$colors['best_value'],
			$colors['card_bg'],
			$btn_radius,
			$card_radius
		);
	}

	/**
	 * Podešava svetlinu hex boje (factor u rasponu -1 do 1).
	 *
	 * @param string $hex    Hex boja (#rrggbb).
	 * @param float  $factor Faktor osvetljenja (negativno = tamnije).
	 * @return string
	 */
	private function adjust_hex_brightness( $hex, $factor ) {
		$hex = ltrim( (string) $hex, '#' );
		if ( 6 !== strlen( $hex ) ) {
			$hex = 'c49186';
		}

		$r = (int) hexdec( substr( $hex, 0, 2 ) );
		$g = (int) hexdec( substr( $hex, 2, 2 ) );
		$b = (int) hexdec( substr( $hex, 4, 2 ) );

		$step = 255 * (float) $factor;
		$r = (int) max( 0, min( 255, $r + $step ) );
		$g = (int) max( 0, min( 255, $g + $step ) );
		$b = (int) max( 0, min( 255, $b + $step ) );

		return sprintf( '#%02x%02x%02x', $r, $g, $b );
	}

	/**
	 * Meša hex boju sa belom (0–1; 1 = čista bela).
	 *
	 * @param string $hex   Hex boja (#rrggbb).
	 * @param float  $white Udeo bele boje.
	 * @return string
	 */
	private function mix_hex_with_white( $hex, $white ) {
		$hex = ltrim( (string) $hex, '#' );
		if ( 6 !== strlen( $hex ) ) {
			$hex = 'c49186';
		}
		if ( $white > 1 ) {
			$white = $white / 100;
		}

		$r = (int) hexdec( substr( $hex, 0, 2 ) );
		$g = (int) hexdec( substr( $hex, 2, 2 ) );
		$b = (int) hexdec( substr( $hex, 4, 2 ) );

		$r = (int) round( 255 * $white + $r * ( 1 - $white ) );
		$g = (int) round( 255 * $white + $g * ( 1 - $white ) );
		$b = (int) round( 255 * $white + $b * ( 1 - $white ) );

		return sprintf( '#%02x%02x%02x', $r, $g, $b );
	}

	/**
	 * Vraća RGB trojku boje kao "r,g,b" string za rgba().
	 *
	 * @param string $hex Hex boja (#rrggbb).
	 * @return string
	 */
	private function hex_to_rgb_csv( $hex ) {
		$hex = ltrim( (string) $hex, '#' );
		if ( 6 !== strlen( $hex ) ) {
			$hex = 'c49186';
		}

		return (int) hexdec( substr( $hex, 0, 2 ) ) . ',' . (int) hexdec( substr( $hex, 2, 2 ) ) . ',' . (int) hexdec( substr( $hex, 4, 2 ) );
	}

	/**
	 * Enqueue-uje admin stilove i skripte samo na našoj stranici podešavanja.
	 *
	 * @param string $hook_suffix Trenutni admin hook.
	 */
	public function enqueue_admin_assets( $hook_suffix ) {
		$page_param = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended

		// NAPOMENA (bag pronađen live testiranjem): WordPress ne generiše
		// $hook_suffix za podstranice uvek iz slug-a roditeljskog menija —
		// za "DRBU Analytics" (registrovana pod drbu-tiered-buy-box, ali sa
		// sopstvenim slug-om koji ne sadrži "drbu") WordPress je hook_suffix
		// izveo iz naslova STRANICE ("Discount Rules Box" -> sanitize_title
		// -> "discount-rules-box"), pa je hook_suffix bio
		// "discount-rules-box_page_discount-rules-box-upsell-analytics" —
		// ne sadrži "drbu" nigde, pa CSS/JS uopšte nisu bili enqueue-ovani
		// na toj stranici. Zato se ovde eksplicitno proverava i sam
		// Analytics slug (DRBU_Settings::ANALYTICS_SLUG), ne samo "drbu".
		$is_drbu_page = ( false !== strpos( $hook_suffix, DRBU_Settings::MENU_SLUG ) )
			|| ( false !== strpos( $hook_suffix, 'drbu' ) )
			|| ( false !== strpos( $hook_suffix, 'drbu-discount-rules-box-for-woocommerce' ) )
			|| ( false !== strpos( $hook_suffix, DRBU_Settings::ANALYTICS_SLUG ) )
			|| ( false !== strpos( $page_param, 'drbu' ) )
			|| ( false !== strpos( $page_param, 'drbu-discount-rules-box-for-woocommerce' ) )
			|| ( DRBU_Settings::ANALYTICS_SLUG === $page_param );

		if ( $is_drbu_page ) {
			$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';

			// Enqueue public CSS tako da live preview u adminu koristi identičan izgled.
			wp_enqueue_style(
				'drbu-public',
				DRBU_PLUGIN_URL . 'assets/css/discount-rules-box-upsell-public' . $suffix . '.css',
				array(),
				DRBU_VERSION
			);
			wp_add_inline_style( 'drbu-public', $this->dynamic_css() );

			// Enqueue admin komandnu tablu CSS.
			$admin_css_file = file_exists( DRBU_PLUGIN_DIR . 'assets/css/discount-rules-box-upsell-admin' . $suffix . '.css' )
				? 'discount-rules-box-upsell-admin' . $suffix . '.css'
				: 'discount-rules-box-upsell-admin.css';

			wp_enqueue_style(
				'drbu-admin',
				DRBU_PLUGIN_URL . 'assets/css/' . $admin_css_file,
				array( 'drbu-public' ),
				DRBU_VERSION
			);

			// Rebrenduje Freemius-ove sopstvene Account i Pricing/Upgrade stranice
			// (drbu-tiered-buy-box-account / -pricing) da liče na naš dizajn — ova
			// $is_drbu_page provera već pokriva i te dve stranice preko $page_param.
			wp_enqueue_style(
				'drbu-freemius-pages',
				DRBU_PLUGIN_URL . 'assets/css/discount-rules-box-upsell-freemius-pages.css',
				array(),
				DRBU_VERSION
			);

			if ( ! drbu_is_pro_active() ) {
				wp_enqueue_script(
					'freemius-checkout-js',
					'https://checkout.freemius.com/js/v1/',
					array(),
					null, // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion -- externally hosted Freemius SDK; it is versioned via its own URL path (v1) and must not receive a local cache-busting query string.
					true
				);
			}

			// JS skripta za live preview i tabove.
			$js_file = file_exists( DRBU_PLUGIN_DIR . 'assets/js/discount-rules-box-upsell-admin.js' )
				? 'discount-rules-box-upsell-admin.js'
				: 'discount-rules-box-upsell-admin.min.js';

			wp_enqueue_script(
				'drbu-admin-js',
				DRBU_PLUGIN_URL . 'assets/js/' . $js_file,
				array( 'jquery' ),
				DRBU_VERSION,
				true
			);

			// Bezbednosna napomena: drbu_freemius_webhook_secret NIKAD ne sme
			// da ide u JS lokalizovane podatke — 'saved'/'defaults' se
			// ubacuju kao JSON u <script> tag na SVAKOJ admin stranici
			// plugina (za live preview builder), čitljivo u izvoru stranice
			// svakome ko ima pristup, bez obzira koji je tab otvoren. JS
			// live preview ionako ne koristi ovo polje.
			$js_saved_settings   = DRBU_Settings::instance()->gated_all();
			$js_default_settings = DRBU_Settings::instance()->gated_defaults();
			unset( $js_saved_settings['drbu_freemius_webhook_secret'], $js_default_settings['drbu_freemius_webhook_secret'] );

			wp_localize_script(
				'drbu-admin-js',
				'drbuAdminData',
				array(
					'defaults'          => $js_default_settings,
					'saved'             => $js_saved_settings,
					'is_pro_active'     => drbu_is_pro_active(),
					'pro_url'           => DRBU_Settings::instance()->get_pro_url(),
					'freemius_config'   => array(
						'product_id' => '37209',
						'plan_id'    => '61804',
						'public_key' => 'pk_1ed69d2634756f08c2a7bf2187d37',
					),
					'currency_symbol'   => function_exists( 'get_woocommerce_currency_symbol' ) ? html_entity_decode( get_woocommerce_currency_symbol() ) : '$',
					'currency_position' => function_exists( 'get_option' ) ? get_option( 'woocommerce_currency_pos', 'left' ) : 'left',
					'currency_code'     => function_exists( 'get_woocommerce_currency' ) ? get_woocommerce_currency() : 'USD',
					'ajax_url'          => admin_url( 'admin-ajax.php' ),
					'nonce'             => wp_create_nonce( 'drbu_admin_nonce' ),
					// 1-Click Language Presets je Pro funkcija — sam dataset
					// (13 jezika) je u class-drbu-language-presets__premium_only.php,
					// koji Freemius Deployment izbacuje iz Free ZIP-a; Free
					// korisnik dobija prazan niz, bez obzira šta JS/UI dozvoljava.
					'lang_presets'      => ( drbu_is_pro_active() && class_exists( 'DRBU_Language_Presets' ) )
						? DRBU_Language_Presets::get_presets()
						: array(),
					// Freemius SDK nema javnu sync_license() metodu — jedina prava
					// javna komanda za "povuci sveže stanje licence/plana sa
					// Freemius servera" je fs_action=..._sync_license na Account
					// stranici (koju SDK obrađuje interno preko privatne
					// _sync_license()). Fetch na ovaj URL (same-origin, sa admin
					// kolačićem) izvršava tu sinhronizaciju bez da se korisniku
					// ikad prikaže sama Account stranica.
					'fs_sync_license_url' => ( function_exists( 'drbu_fs' ) && drbu_fs() && method_exists( drbu_fs(), '_get_sync_license_url' ) )
						? drbu_fs()->_get_sync_license_url()
						: '',
				)
			);
		}
	}

	/**
	 * Ubacuje Freemius-ov SOPSTVENI dijalog za aktivaciju licence (isti onaj sa
	 * "Change License" linka na Plugins stranici) na našu License stranicu.
	 *
	 * NAPOMENA: naša ranija ručna reimplementacija ($.post na fs_activate_license_*)
	 * je u praksi povremeno padala sa "Invalid license key." bez jasnog razloga,
	 * dok je Freemius-ov native dijalog (forms/license-activation.php) uvek radio
	 * pouzdano sa istim ključem. Umesto da se dalje traži uzrok te razlike, dugme
	 * na našoj stranici sada direktno otvara TAJ isti, dokazano ispravan dijalog —
	 * `_add_license_activation_dialog_box()` je javna SDK metoda, samo obično biva
	 * uključena u DOM isključivo preko admin_footer na Plugins stranici
	 * (Freemius::is_plugins_page() provera u _add_license_action_link()); ovde je
	 * eksplicitno ubacujemo i na našu stranicu, van tog ograničenja.
	 */
	public function maybe_inject_freemius_license_dialog() {
		if ( ! function_exists( 'drbu_fs' ) || ! drbu_fs() ) {
			return;
		}

		$page_param = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
		if ( DRBU_Settings::MENU_SLUG !== $page_param ) {
			return;
		}

		if ( method_exists( drbu_fs(), '_add_license_activation_dialog_box' ) ) {
			drbu_fs()->_add_license_activation_dialog_box();
		}
	}

	/**
	 * Ubacuje isti brendirani header (logo + naslov) koji koristi Dashboard i
	 * Analytics stranica na Freemius-ove SOPSTVENE Account i Upgrade/Pricing
	 * stranice — pošto se te dve stranice u potpunosti generišu iz SDK-a
	 * (vendor/freemius/wordpress-sdk/templates/account.php i pricing.php), ne
	 * mogu se editovati direktno; `in_admin_header` je jedina tačka gde možemo
	 * ubaciti sopstveni HTML PRE njihovog sadržaja na svakoj admin stranici.
	 */
	public function maybe_render_freemius_page_header() {
		$page_param = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
		$pages      = array(
			DRBU_Settings::MENU_SLUG . '-account'  => array(
				'title'    => __( 'Account', 'drbu-discount-rules-box-for-woocommerce' ),
				'subtitle' => __( 'Manage your license, billing, and account details.', 'drbu-discount-rules-box-for-woocommerce' ),
			),
			DRBU_Settings::MENU_SLUG . '-pricing'  => array(
				'title'    => __( 'Upgrade', 'drbu-discount-rules-box-for-woocommerce' ),
				'subtitle' => __( 'Start free on WordPress.org or test every Pro feature 100% free for 30 days. No upfront payment, no risk.', 'drbu-discount-rules-box-for-woocommerce' ),
			),
		);

		if ( ! isset( $pages[ $page_param ] ) ) {
			return;
		}

		$page       = $pages[ $page_param ];
		$is_pricing = ( DRBU_Settings::MENU_SLUG . '-pricing' === $page_param );
		?>
		<div class="wrap drbu-wrap" style="margin-bottom:0;">
			<div class="drbu-header-card">
				<div class="drbu-header-brand">
					<div class="drbu-logo-badge">
						<img src="<?php echo esc_url( DRBU_PLUGIN_URL . 'assets/images/DRBlogo.svg' ); ?>" alt="<?php esc_attr_e( 'Discount Rules Box', 'drbu-discount-rules-box-for-woocommerce' ); ?>" class="drbu-header-logo">
					</div>
					<div>
						<div class="drbu-brand-title">
							<h1><span class="screen-reader-text"><?php echo esc_html__( 'Discount Rules Box', 'drbu-discount-rules-box-for-woocommerce' ); ?> — </span><?php echo esc_html( $page['title'] ); ?> <span class="drbu-version-tag">v<?php echo esc_html( DRBU_VERSION ); ?></span></h1>
						</div>
						<p class="drbu-brand-subtitle"><?php echo esc_html( $page['subtitle'] ); ?></p>
					</div>
				</div>
			</div>
			<?php if ( $is_pricing ) : ?>
				<?php
				/**
				 * Isti "Test Pro Free" banner i garancija badge-ovi kao na
				 * discountrulesbox.com pricing sekciji — Freemius-ov pricing
				 * widget ispod ovoga se učitava iz sopstvenog JS bundle-a i ne
				 * može se editovati kroz PHP, pa ovaj deo (koji MI kontrolišemo)
				 * preuzima landing kopiju radi konzistentnosti.
				 */
				?>
				<div class="drbu-fs-banner">
					<strong><?php echo esc_html__( '🔥 Test Pro Free for 30 Days:', 'drbu-discount-rules-box-for-woocommerce' ); ?></strong>
					<?php echo esc_html__( 'Every Pro plan includes a 30-day free trial. Test 3-tier buy boxes, track added revenue in DRBU Analytics, and verify results before paying a single cent.', 'drbu-discount-rules-box-for-woocommerce' ); ?>
				</div>
			<?php endif; ?>
		</div>
		<?php if ( $is_pricing ) : ?>
			<div class="wrap drbu-wrap" style="margin-top:0;margin-bottom:0;">
				<div class="drbu-trust-badges" style="justify-content:center;margin:0 0 18px;">
					<span class="drbu-trust-badge">
						<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"></path></svg>
						<strong><?php echo esc_html__( '14-Day Money-Back Guarantee', 'drbu-discount-rules-box-for-woocommerce' ); ?></strong> <?php echo esc_html__( 'no questions asked', 'drbu-discount-rules-box-for-woocommerce' ); ?>
					</span>
					<span class="drbu-trust-badge">
						<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path><polyline points="22 4 12 14.01 9 11.01"></polyline></svg>
						<strong><?php echo esc_html__( '30-Day Free Trial', 'drbu-discount-rules-box-for-woocommerce' ); ?></strong> <?php echo esc_html__( 'full Pro access, no upfront payment', 'drbu-discount-rules-box-for-woocommerce' ); ?>
					</span>
					<span class="drbu-trust-badge">
						<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"><path d="M6 2L3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z"></path><line x1="3" y1="6" x2="21" y2="6"></line><path d="M16 10a4 4 0 0 1-8 0"></path></svg>
						<strong><?php echo esc_html__( 'Cancel Anytime', 'drbu-discount-rules-box-for-woocommerce' ); ?></strong> <?php echo esc_html__( 'in 1 click, no long-term contract', 'drbu-discount-rules-box-for-woocommerce' ); ?>
					</span>
				</div>
			</div>
		<?php endif; ?>
		<?php
	}

	/**
	 * Prikazuje favicon.png kao browser tab ikonicu na svim plugin-ovim
	 * brendiranim stranicama (Dashboard, Analytics, Account, Upgrade).
	 */
	public function maybe_render_favicon() {
		$page_param   = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
		$is_drbu_page = ( false !== strpos( $page_param, 'drbu' ) )
			|| ( false !== strpos( $page_param, 'drbu-discount-rules-box-for-woocommerce' ) )
			|| ( DRBU_Settings::ANALYTICS_SLUG === $page_param );

		if ( ! $is_drbu_page ) {
			return;
		}
		?>
		<link rel="icon" type="image/png" href="<?php echo esc_url( DRBU_PLUGIN_URL . 'assets/images/favicon.png' ); ?>">
		<?php
	}

	/**
	 * Prisilno postavlja tačnu 20x20px veličinu za top-level menu ikonicu.
	 *
	 * WordPress-ov standardni #adminmenu CSS (background-size:20px 20px na
	 * .wp-menu-image) po pravilu skalira ikonicu bez obzira na format URL-a
	 * (obična slika ili base64 SVG data-URI) — ali ako neki drugi CSS na
	 * sajtu (tema, drugi plugin) učita pravilo koje pogađa .wp-menu-image sa
	 * VIŠIM specifičnošću ili KASNIJE u redosledu učitavanja, može da
	 * pregazi WP-ov default i ikonica ostane u "prirodnoj" (velikoj)
	 * veličini. Ovo pravilo se učitava na SVAKOJ admin stranici (sidebar
	 * meni se prikazuje svuda, ne samo na našim stranicama) sa !important,
	 * da eksplicitno pobedi bilo šta što ga pregazi.
	 *
	 * Hook: 'admin_enqueue_scripts' (globalno, na svakoj admin stranici) —
	 * NE 'admin_head', jer WP štampa registrovane/enqueue-ovane stilove
	 * (uključujući wp_add_inline_style() sadržaj) tokom 'admin_print_styles',
	 * koji se dešava PRE 'admin_head'-a; da je ovo na 'admin_head', inline
	 * CSS bi bio dodat tek nakon što je prazan style tag već odštampan.
	 * Registruje prazan style handle (bez izvornog fajla) koji samo nosi
	 * inline CSS ispod.
	 */
	public function render_admin_menu_icon_size_fix() {
		wp_register_style( 'drbu-admin-menu-icon', false, array(), DRBU_VERSION );
		wp_enqueue_style( 'drbu-admin-menu-icon' );

		$css = sprintf(
			'#adminmenu #toplevel_page_%1$s .wp-menu-image{background-size:20px 20px !important;background-position:center !important;}
			#adminmenu #toplevel_page_%1$s .wp-menu-image img,#adminmenu #toplevel_page_%1$s .wp-menu-image svg{width:20px !important;height:20px !important;}',
			esc_attr( DRBU_Settings::MENU_SLUG )
		);
		wp_add_inline_style( 'drbu-admin-menu-icon', $css );
	}
}
