<?php

if (!defined('ABSPATH')) {
	exit; // Exit if accessed directly
}

function induxter_inline_style() {

	wp_enqueue_style('induxter-inline-style', get_theme_file_uri('assets/css/inline-style.css'), array(), INDUXTER_VERSION, 'all');

	$induxter_inline_css = '
        .elementor-inner {margin-left: -10px;margin-right: -10px;}.elementor-inner .elementor-section-wrap > section:first-of-type .elementor-editor-element-settings {display: block !important;}.elementor-inner .elementor-section-wrap > section:first-of-type .elementor-editor-element-settings li {display: inline-block !important;}.elementor-editor-active .elementor-editor-element-setting{height: 25px;line-height: 25px;text-align: center;}.elementor-section.elementor-section-boxed>.elementor-container {max-width: 1170px !important;}.elementor-section-stretched.elementor-section-boxed .elementor-row{padding-left: 5px;padding-right: 5px;}.elementor-section-stretched.elementor-section-boxed .elementor-container.elementor-column-gap-extended {margin-left: auto;margin-right: auto;}  
    ';

	$primary_color = induxter_option('theme_primary_color', '');

	if(!empty($primary_color)){
		$induxter_inline_css .= '
			@media only screen and (min-width: 1200px) {
			    .header-style-four.home-banner-three .header-top-area li.top-social-item a:hover {
			        border-color: '.esc_attr($primary_color).';
			    }
			
			    .header-style-four.home-banner-three .header-cta-button a,
			    .header-style-four.home-banner-three .main-menu-area.uk-sticky.uk-active{
			        background-color: '.esc_attr($primary_color).';
			    }
			}
			
			body .woocommerce a.remove {
		        color: '.esc_attr($primary_color).' !important;
		    }
		';
	}

	$dropdown_indicator = induxter_option('dropdown_indicator', 'plus');

	if($dropdown_indicator === 'arrow'){
		$induxter_inline_css .= '
			.main-navigation ul li.menu-item-has-children > a:before {
			    content: "";
			    height: 7px;
			    width: 7px;
			    border-right: 2px solid;
			    -ms-transform: rotate(45deg);
			    -webkit-transform: rotate(45deg);
			    transform: rotate(45deg);
			    border-bottom: 2px solid;
			    top: 50%;
			    margin-top: -4px;
			}
			
			.main-navigation ul li ul li.menu-item-has-children a:before{
			    -ms-transform: rotate(320deg);
			    -webkit-transform: rotate(320deg);
			    transform: rotate(320deg);
			}
		';

		if(is_rtl()){
			$induxter_inline_css .= '
				.main-navigation ul li.menu-item-has-children > a:before {
					margin-top: -6px;
				}
				
				.main-navigation ul li ul li.menu-item-has-children a:before{
				    -ms-transform: rotate(130deg);
				    -webkit-transform: rotate(130deg);
				    transform: rotate(130deg);
				}
			';
		}
	}

	$header_top_bg_color = induxter_option('header_top_bg_color');
	if(!empty($header_top_bg_color)){
		$induxter_inline_css .= '
			@media only screen and (min-width: 1200px) {
				.header-style-four.home-banner-three .header-top-area {
				    background-color: '.esc_attr($header_top_bg_color).';
				}
			}
		';
	}

	$header_top_text_color = induxter_option('header_top_text_color');
	if(!empty($header_top_text_color)){
		$induxter_inline_css .= '
			@media only screen and (min-width: 1200px) {
				.header-style-four.home-banner-three .header-top-area li.top-social-item a {
				    color: '.esc_attr($header_top_text_color).';
				    border-color: '.esc_attr($header_top_text_color).';
				}
			}
		';
	}

	$menu_area_bg_color = induxter_option('menu_area_bg_color');
	if(!empty($menu_area_bg_color)){
		$induxter_inline_css .= '
			@media only screen and (min-width: 1200px) {
				.header-style-four.home-banner-three .main-menu-area.uk-sticky.uk-active {
				    background-color: '.esc_attr($menu_area_bg_color).';
				}
			}
		';

		$induxter_inline_css .= '
			@media only screen and (max-width: 1024px) {
				.header-style-three .main-menu-area {
				    background-color: '.esc_attr($menu_area_bg_color).';
				}
			}
		';
	}

	$custom_css = induxter_option('induxter_custom_css');

	$induxter_inline_css .= ''.$custom_css.'';

	wp_add_inline_style('induxter-inline-style', $induxter_inline_css);
}

add_action('wp_enqueue_scripts', 'induxter_inline_style');