<?php
// Add plugin-specific vars to the custom CSS
if ( ! function_exists( 'tourimo_elm_add_theme_vars' ) ) {
	add_filter( 'tourimo_filter_add_theme_vars', 'tourimo_elm_add_theme_vars', 10, 2 );
	function tourimo_elm_add_theme_vars( $rez, $vars ) {
		foreach ( array( 10, 20, 30, 40, 60 ) as $m ) {
			if ( substr( $vars['page'], 0, 2 ) != '{{' ) {
				$rez[ "page{$m}" ]    = ( $vars['page'] + $m ) . 'px';
				$rez[ "content{$m}" ] = ( $vars['page'] - $vars['gap'] - $vars['sidebar'] + $m ) . 'px';
			} else {
				$rez[ "page{$m}" ]    = "{{ data.page{$m} }}";
				$rez[ "content{$m}" ] = "{{ data.content{$m} }}";
			}
		}
		return $rez;
	}
}


// Add plugin-specific colors and fonts to the custom CSS
if ( ! function_exists( 'tourimo_elm_get_css' ) ) {
	add_filter( 'tourimo_filter_get_css', 'tourimo_elm_get_css', 10, 2 );
	function tourimo_elm_get_css( $css, $args ) {

		if ( isset( $css['fonts'] ) && isset( $args['fonts'] ) ) {
			$fonts         = $args['fonts'];
			$css['fonts'] .= <<<CSS


.elementor-widget-tabs .elementor-tab-desktop-title,
.elementor-widget-tabs .elementor-tab-mobile-title {
	{$fonts['h4_font-family']}
}
.elementor-widget-tabs.elementor-tabs-view-vertical figure .wp-caption-text {
	{$fonts['p_font-family']}
	{$fonts['p_font-size']}
	{$fonts['p_font-weight']}
	{$fonts['p_font-style']}
	{$fonts['p_text-decoration']}
	{$fonts['p_text-transform']}
	{$fonts['p_letter-spacing']}
}
.elementor-widget-toggle .elementor-toggle .elementor-tab-title {
	{$fonts['h4_font-family']}
	{$fonts['h4_font-weight']}
	{$fonts['h4_font-style']}	
} 
.elementor-progress-percentage {
	{$fonts['p_font-size']}
	{$fonts['p_font-family']}
}
.elementor-widget-trx_sc_booked_calendar table.booked-calendar span.monthName { 
	{$fonts['h4_font-size']}
	{$fonts['h4_line-height']}
}
.elementor-widget-trx_sc_booked_calendar table.booked-calendar thead tr.days th {
	{$fonts['h6_font-size']}
	{$fonts['h6_line-height']}
}
.esg-loadmore-wrapper .esg-navigationbutton.esg-loadmore {
	{$fonts['button_font-size']}
	{$fonts['button_line-height']} 
	{$fonts['button_font-family']}
	{$fonts['button_font-weight']}
}
.elementor-tab-title.eael-accordion-header span {
	{$fonts['h4_font-family']}
	{$fonts['h4_font-weight']}
}
.eael-adv-accordion .eael-accordion-list .eael-accordion-content {
	{$fonts['p_font-family']}
	{$fonts['p_font-style']}	
	{$fonts['p_font-weight']}
}

CSS;
		}

		if ( isset( $css['vars'] ) && isset( $args['vars'] ) ) {
			extract( $args['vars'] );
			$css['vars'] .= <<<CSS

/* No gap */
.elementor-section.elementor-section-boxed > .elementor-column-gap-no {
	max-width: $page;
}
/* Narrow: 5px */
.elementor-section.elementor-section-boxed > .elementor-column-gap-narrow {
	max-width: $page10;
}
.elementor-section.elementor-section-justified.elementor-section-boxed:not(.elementor-inner-section) > .elementor-container.elementor-column-gap-narrow,
.elementor-section.elementor-section-justified.elementor-section-full_width:not(.elementor-section-stretched):not(.elementor-inner-section) > .elementor-container.elementor-column-gap-narrow {
	width: $page10; 
}
.sidebar_show .content_wrap .elementor-section.elementor-section-justified.elementor-section-boxed:not(.elementor-inner-section) > .elementor-container.elementor-column-gap-narrow,
.sidebar_show .content_wrap .elementor-section.elementor-section-justified.elementor-section-full_width:not(.elementor-section-stretched):not(.elementor-inner-section) > .elementor-container.elementor-column-gap-narrow {
	width: $content10; 
}

/* Default: 10px */
.elementor-section.elementor-section-boxed > .elementor-column-gap-default {
	max-width: $page20;
}
.elementor-section.elementor-section-justified.elementor-section-boxed:not(.elementor-inner-section) > .elementor-container.elementor-column-gap-default,
.elementor-section.elementor-section-justified.elementor-section-full_width:not(.elementor-section-stretched):not(.elementor-inner-section) > .elementor-container.elementor-column-gap-default {
	width: $page20;
}
.sidebar_show .content_wrap .elementor-section.elementor-section-justified.elementor-section-boxed:not(.elementor-inner-section) > .elementor-container.elementor-column-gap-default,
.sidebar_show .content_wrap .elementor-section.elementor-section-justified.elementor-section-full_width:not(.elementor-section-stretched):not(.elementor-inner-section) > .elementor-container.elementor-column-gap-default {
	width: $content20;
}

/* Extended: 15px */
.elementor-section.elementor-section-boxed > .elementor-column-gap-extended {
	max-width: $page30;
}
.elementor-section.elementor-section-justified.elementor-section-boxed:not(.elementor-inner-section) > .elementor-container.elementor-column-gap-extended,
.elementor-section.elementor-section-justified.elementor-section-full_width:not(.elementor-section-stretched):not(.elementor-inner-section) > .elementor-container.elementor-column-gap-extended {
	width: $page30; 
}
.sidebar_show .content_wrap .elementor-section.elementor-section-justified.elementor-section-boxed:not(.elementor-inner-section) > .elementor-container.elementor-column-gap-extended,
.sidebar_show .content_wrap .elementor-section.elementor-section-justified.elementor-section-full_width:not(.elementor-section-stretched):not(.elementor-inner-section) > .elementor-container.elementor-column-gap-extended {
	width: $content30; 
}

/* Wide: 20px */
.elementor-section.elementor-section-boxed > .elementor-column-gap-wide {
	max-width: $page40;
}
.elementor-section.elementor-section-justified.elementor-section-boxed:not(.elementor-inner-section) > .elementor-container.elementor-column-gap-wide,
.elementor-section.elementor-section-justified.elementor-section-full_width:not(.elementor-section-stretched):not(.elementor-inner-section) > .elementor-container.elementor-column-gap-wide {
	width: $page40; 
}
.sidebar_show .content_wrap .elementor-section.elementor-section-justified.elementor-section-boxed:not(.elementor-inner-section) > .elementor-container.elementor-column-gap-wide,
.sidebar_show .content_wrap .elementor-section.elementor-section-justified.elementor-section-full_width:not(.elementor-section-stretched):not(.elementor-inner-section) > .elementor-container.elementor-column-gap-wide {
	width: $content40; 
}

/* Wider: 30px */
.elementor-section.elementor-section-boxed > .elementor-column-gap-wider {
	max-width: $page60;
}
.elementor-section.elementor-section-justified.elementor-section-boxed:not(.elementor-inner-section) > .elementor-container.elementor-column-gap-wider,
.elementor-section.elementor-section-justified.elementor-section-full_width:not(.elementor-section-stretched):not(.elementor-inner-section) > .elementor-container.elementor-column-gap-wider {
	width: $page60; 
}
.sidebar_show .content_wrap .elementor-section.elementor-section-justified.elementor-section-boxed:not(.elementor-inner-section) > .elementor-container.elementor-column-gap-wider,
.sidebar_show .content_wrap .elementor-section.elementor-section-justified.elementor-section-full_width:not(.elementor-section-stretched):not(.elementor-inner-section) > .elementor-container.elementor-column-gap-wider {
	width: $content60; 
}

CSS;
		}

		if ( isset( $css['colors'] ) && isset( $args['colors'] ) ) {
			$colors         = $args['colors'];
			$css['colors'] .= <<<CSS

/* Shape above and below rows */
.elementor-shape .elementor-shape-fill {
	fill: {$colors['bg_color']};
}

/* Divider */
.elementor-divider-separator,
.elementor-widget-divider:not(.elementor-widget-divider--view-line_text):not(.elementor-widget-divider--view-line_icon) .elementor-divider-separator {
	border-color: {$colors['bd_color']};
}

/* Tabs */
.elementor-widget-tabs.elementor-tabs-view-vertical .elementor-tab-content {
	background-color: {$colors['extra_bg_color']};
}

/* Toggle */
.elementor-widget-toggle .elementor-toggle,
.elementor-widget-toggle .elementor-toggle .elementor-toggle-item  {
	border-color: {$colors['bd_color']};
}
.elementor-toggle, 
.elementor-toggle .elementor-tab-title {
	border-color: {$colors['bd_color']};
}
.elementor-widget-toggle .elementor-toggle a {
	color: {$colors['text_link']};
}
.elementor-widget-toggle .elementor-toggle a:hover {
	color: {$colors['text_hover']};
}

/* Skills */
.elementor-progress-percentage {
	color: {$colors['text']};	
}
.elementor-progress-wrapper {
	background-color: {$colors['bd_color']};
}

/* Accordion */
.elementor-tab-title.eael-accordion-header span {
	color: {$colors['alter_text']};	
}

CSS;
		}

		return $css;
	}
}

