<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

if ( ! function_exists( 'nevo_customizer_styling_config' ) ) {

	function nevo_customizer_styling_config( $configs = array() ) {

		$config = array(

			array(
				'name'     => 'global_style',
				'type'     => 'section',
				'priority' => 20,
				'panel'    => 'general_panel',
				'title'    => __( 'Global Styles', 'nevo' ),
			),
			
			array(
				'name'       => 'outsite_background',
				'type'       => 'styling',
				'section'    => 'global_style',
				'title'      => __( 'Out Site Background', 'nevo' ),
				'selector'   => array(
					'normal' => 'body',
				),
				'default'   => array(
					'normal' => array(
						'bg_color' => '#f7f8f9',
					),
				),
				'css_format' => 'styling',
				'fields'     => array(
					'normal_fields' => array(
						'primary'	=> false,
						'secondary' => false,
						'success'	=> false,
						'info'	=> false,
						'warning'	=> false,
						'type_heading'	=> false,
						'link'	=> false,
						'link_hover'	=> false,
						'base'	=> false,
						'title'	=> false,
						'meta'	=> false,
						'heading'	=> false,
						'text_color'     => false,
						'link_color'     => false,
						'padding'        => false,
						'paddinga'    	 => false,
						'margin'         => false,
						'bg_heading' 	 => false,
						'border_heading' => false,
						'border_width'   => false,
						'border_color'   => false,
						'border_radius'  => false,
						'box_shadow'     => false,
						'border_style'   => false,
					),
					'hover_fields'  => false,
				),
				'required'   => array(
					array( 'site_layout', '=', 'nevo-container' ),
				),
			),
			
			array(
				'name'       => 'site_background',
				'type'       => 'styling',
				'section'    => 'global_style',
				'title'      => __( 'Site Background', 'nevo' ),
				'selector'   => array(
					'normal' => '.site',
				),
				'default'   => array(
					'normal' => array(
						'bg_color' => '#f7f8f9',
					),
				),
				'css_format' => 'styling',
				'fields'     => array(
					'normal_fields' => array(
						'primary'	=> false,
						'secondary' => false,
						'success'	=> false,
						'info'	=> false,
						'warning'	=> false,
						'type_heading'	=> false,
						'link'	=> false,
						'link_hover'	=> false,
						'base'	=> false,
						'title'	=> false,
						'meta'	=> false,
						'heading'	=> false,
						'text_color'     => false,
						'link_color'     => false,
						'padding'        => false,
						'paddinga'    	 => false,
						'margin'         => false,
						'bg_heading' 	 => false,
						'border_heading' => false,
						'border_width'   => false,
						'border_color'   => false,
						'border_radius'  => false,
						'box_shadow'     => false,
						'border_style'   => false,
					),
					'hover_fields'  => false,
				),
			),
			
			array(
				'name'       => 'content_styling',
				'type'       => 'styling',
				'section'    => 'global_style_none',
				'title'      => __( 'Content Background', 'nevo' ),
				'selector'   => array(
					'normal' => '.separate-containers .inside-article, .separate-containers .comments-area, .one-container .site-content, .separate-containers .paging-navigation, .separate-containers .single-after-entry > *',
				),
				'default'   => array(
					'normal' => array(
						'bg_color' => '#FFFFFF',
					),
				),
				'css_format' => 'styling',
				'fields'     => array(
					'normal_fields' => array(
						'primary'	=> false,
						'secondary' => false,
						'success'	=> false,
						'info'	=> false,
						'warning'	=> false,
						'type_heading'	=> false,
						'link'	=> false,
						'link_hover'	=> false,
						'base'	=> false,
						'title'	=> false,
						'meta'	=> false,
						'heading'	=> false,
						'padding'        => false,
						'paddinga'    	 => false,
						'margin'         => false,
						'text_color'     => false,
						'link_color'     => false,
						'bg_heading' 	 => false,
						'border_heading' => false,
						'border_width'   => false,
						'border_color'   => false,
						'border_radius'  => false,
						'box_shadow'     => false,
						'border_style'   => false,
					),
					'hover_fields'  => false,
				),
			),
			
			array(
				'name'       => 'button_styling',
				'type'       => 'styling',
				'section'    => 'global_style',
				'title'      => __( 'Button', 'nevo' ),
				'selector'   => array(
					'normal' => '.site button, html input[type="button"], html input[type="reset"], html input[type="submit"], html a.button, html a.button:visited, .wp-block-button .wp-block-button__link:not(.has-background), .wp-block-search__button',
					'hover' => '.site button:hover, html input[type="button"]:hover, html input[type="reset"]:hover, html input[type="submit"]:hover, html a.button:hover, html a.button:focus, html a.button:visited:hover, .wp-block-button .wp-block-button__link:not(.has-background):hover, wp-block-search__button:hover',
					
				),
				'default'   => array(
					'normal' => array(
					),
				),
				'css_format' => 'styling',
				'fields'     => array(
					'normal_fields' => array(
						'primary'	=> false,
						'secondary' => false,
						'success'	=> false,
						'info'	=> false,
						'warning'	=> false,
						'type_heading'	=> false,
						'link'	=> false,
						'link_hover'	=> false,
						'base'	=> false,
						'title'	=> false,
						'meta'	=> false,
						'heading'	=> false,
						'link_color' 	=> false,
						'padding'       => false,
						'paddinga'    	=> false,
						'margin'        => false,
						//'bg_heading' 	=> false,
						//'bg_color' 	=> false,
						'bg_image' 		=> false,
						'bg_repeat'	 	=> false,
						'bg_position'	=> false,
						'bg_attachment' => false,
						'box_shadow' 	=> false,
					),
					'hover_fields' => array(
						'link_color' 	=> false,
						//'bg_heading' 	=> false,
						//'bg_color' 	=> false,
						'bg_image' 		=> false,
						'padding'       => false,
						'margin'        => false,
						'bg_repeat'	 	=> false,
						'bg_position'	=> false,
						'bg_attachment' => false,
						'box_shadow' 	=> false,
					),
				),
			),
			
			array(
				'name'       => 'form_input_styling',
				'type'       => 'styling',
				'section'    => 'global_style',
				'title'      => __( 'Form Input', 'nevo' ),
				'selector'   => array(
					'normal' => 'input[type="text"], input[type="email"], input[type="url"], input[type="password"], input[type="search"], input[type="number"], input[type="tel"], textarea, select, .wp-block-search__input, input::placeholder, input:placeholder-shown',
					//'normal_text_color' => 'input[type="text"], input[type="email"], input[type="url"], input[type="password"], input[type="search"], input[type="number"], input[type="tel"], textarea, select, .wp-block-search__input, input:-ms-input-placeholder, input::-ms-input-placeholder, input::placeholder',
					'normal_border_style' => 'input[type="text"], input[type="email"], input[type="url"], input[type="password"], input[type="search"], input[type="number"], input[type="tel"], textarea, select, .wp-block-search__input, body .search-form button.search-submit, .coupon button[type="submit"], body .search-form button.search-submit:hover, .coupon button[type="submit"]:hover',
					'normal_border_width' => 'input[type="text"], input[type="email"], input[type="url"], input[type="password"], input[type="search"], input[type="number"], input[type="tel"], textarea, select, .wp-block-search__input, body .search-form button.search-submit, .coupon button[type="submit"], body .search-form button.search-submit:hover, .coupon button[type="submit"]:hover',
					'normal_border_color' => 'input[type="text"], input[type="email"], input[type="url"], input[type="password"], input[type="search"], input[type="number"], input[type="tel"], textarea, select, .wp-block-search__input, body .search-form button.search-submit, .coupon button[type="submit"], body .search-form button.search-submit:hover, .coupon button[type="submit"]:hover',
					'hover' => 'input[type="text"]:focus, input[type="email"]:focus, input[type="url"]:focus, input[type="password"]:focus, input[type="search"]:focus, input[type="number"]:focus, input[type="tel"]:focus, textarea:focus, select:focus, .wp-block-search__input:focus',
					'normal_border_radius' => 'input[type="text"], input[type="email"], input[type="url"], input[type="password"], input[type="search"], input[type="number"], input[type="tel"], textarea, select, .wp-block-search__input, body .search-form button.search-submit, .coupon button[type="submit"], .wp-block-search__input:hover, body .search-form button.search-submit:hover, .coupon button[type="submit"]:hover',
				),
				'default'   => array(
					'normal' => array(
					),
				),
				'css_format' => 'styling',
				'fields'     => array(
					'normal_fields' => array(
						'primary'	=> false,
						'secondary' => false,
						'success'	=> false,
						'info'	=> false,
						'warning'	=> false,
						'type_heading'	=> false,
						'link'	=> false,
						'link_hover'	=> false,
						'base'	=> false,
						'title'	=> false,
						'meta'	=> false,
						'heading'	=> false,
						'link_color'	=> false,
						'padding'       => false,
						'paddinga'    	=> false,
						'margin'        => false,
						'bg_image' 		=> false,
						'bg_repeat'	 	=> false,
						'bg_position'	=> false,
						'bg_attachment' => false,
						'box_shadow' 	=> false,
					),
					'hover_fields' => array(
						'link_color' 	=> false,
						'bg_image' 		=> false,
						'padding'       => false,
						'margin'        => false,
						'bg_repeat'	 	=> false,
						'bg_position'	=> false,
						'bg_attachment' => false,
						'border_radius' => false,
						'border_style'  => false,
						'border_width'  => false,
						'border_color'  => false,
						'border_heading' => false,
						'box_shadow' 	=> false,
					),
					'tabs'          => array(
						'normal' => __( 'Normal', 'nevo' ),
						'hover'  => __( 'Focus', 'nevo' ),
					),
				),
			),
			
			array(
				'name'       => 'content_heading_title',
				'type'       => 'modal',
				'section'    => 'global_style',
				'title'      => __( 'Heading Title', 'nevo' ),
				'description' => __( 'Used for global titles like Modules, Section,</br> Related Posts, Comments, Sidebar Classic Widget Title.', 'nevo' ),
				'selector'   => '.site-content .heading-title',
				'css_format' => 'styling',
				'fields'     => array(
					'tabs'          => array(
						'general' => __( 'General', 'nevo' ),
					),
					'general_fields' => array(
						array(
							'name'       => 'text_color',
							'type'       => 'color',
							'label'      => __( 'Color', 'nevo' ),
							'selector'   => '.site-content .general-title',
							'css_format' => 'color: {{value}}; text-decoration-color: {{value}};',
						),
						array(
							'name'            => 'text_align',
							'type'            => 'text_align_no_justify',
							'selector'   	  => ".site-content .heading-title, .site-content .heading-subtitle",
							'css_format'      => 'text-align: {{value}};',
							'label'           => __( 'Text Align', 'nevo' ),
						),
						array(
							'name'            => 'padding',
							'type'            => 'css_ruler',
							'device_settings' => false,
							'selector'   => '.site-content .general-title',
							'css_format' => array(
								'top'    => 'padding-top: {{value}};',
								'right'  => 'padding-right: {{value}};',
								'bottom' => 'padding-bottom: {{value}};',
								'left'   => 'padding-left: {{value}};',
							),
							'label'           => __( 'Padding', 'nevo' ),
						),
						array(
							'name'            => 'margin',
							'type'            => 'css_ruler',
							'device_settings' => false,
							'selector'   => '.site-content .heading-title, .widget .heading-title',
							'css_format'      => array(
								'top'    => 'margin-top: {{value}};',
								'right'  => 'margin-right: {{value}};',
								'bottom' => 'margin-bottom: {{value}};',
								'left'   => 'margin-left: {{value}};',
							),
							'label'           => __( 'Margin', 'nevo' ),
						),
						array(
							'name'  => 'bg_heading',
							'type'  => 'heading',
							'label' => __( 'Background', 'nevo' ),
						),

						array(
							'name'       => 'bg_color',
							'type'       => 'color',
							'label'      => __( 'Background Color', 'nevo' ),
							'selector'   => '.site-content .general-title',
							'css_format' => 'background-color: {{value}};',
							'device_settings' => false,
						),
						array(
							'name'       => 'bg_image',
							'type'       => 'image',
							'label'      => __( 'Background Image', 'nevo' ),
							'selector'   => '.site-content .heading-title',
							'css_format' => 'background-image: url("{{value}}");',
							'device_settings' => false,
						),
						array(
							'name'       => 'bg_cover',
							'type'       => 'select',
							'choices'    => array(
								''        => __( 'Default', 'nevo' ),
								'auto'    => __( 'Auto', 'nevo' ),
								'cover'   => __( 'Cover', 'nevo' ),
								'contain' => __( 'Contain', 'nevo' ),
							),
							'selector'   => '.site-content .heading-title',
							'required'   => array( 'bg_image', 'not_empty', '' ),
							'label'      => __( 'Size', 'nevo' ),
							'class'      => 'field-half-left',
							'css_format' => '-webkit-background-size: {{value}}; -moz-background-size: {{value}}; -o-background-size: {{value}}; background-size: {{value}};',
						),
						array(
							'name'       => 'bg_position',
							'type'       => 'select',
							'label'      => __( 'Position', 'nevo' ),
							'required'   => array( 'bg_image', 'not_empty', '' ),
							'class'      => 'field-half-right',
							'choices'    => array(
								''              => __( 'Default', 'nevo' ),
								'center'        => __( 'Center', 'nevo' ),
								'top left'      => __( 'Top Left', 'nevo' ),
								'top right'     => __( 'Top Right', 'nevo' ),
								'top center'    => __( 'Top Center', 'nevo' ),
								'bottom left'   => __( 'Bottom Left', 'nevo' ),
								'bottom center' => __( 'Bottom Center', 'nevo' ),
								'bottom right'  => __( 'Bottom Right', 'nevo' ),
							),
							'selector'   => '.site-content .heading-title',
							'css_format' => 'background-position: {{value}};',
						),
						array(
							'name'       => 'bg_repeat',
							'type'       => 'select',
							'label'      => __( 'Repeat', 'nevo' ),
							'class'      => 'field-half-left',
							'required'   => array(
								array( 'bg_image', 'not_empty', '' ),
							),
							'choices'    => array(
								'repeat'    => __( 'Default', 'nevo' ),
								'no-repeat' => __( 'No repeat', 'nevo' ),
								'repeat-x'  => __( 'Repeat horizontal', 'nevo' ),
								'repeat-y'  => __( 'Repeat vertical', 'nevo' ),
							),
							'selector'   => '.site-content .heading-title',
							'css_format' => 'background-repeat: {{value}};',
						),

						array(
							'name'       => 'bg_attachment',
							'type'       => 'select',
							'label'      => __( 'Attachment', 'nevo' ),
							'class'      => 'field-half-right',
							'required'   => array(
								array( 'bg_image', 'not_empty', '' ),
							),
							'choices'    => array(
								''       => __( 'Default', 'nevo' ),
								'scroll' => __( 'Scroll', 'nevo' ),
								'fixed'  => __( 'Fixed', 'nevo' ),
							),
							'selector'   => '.site-content .heading-title',
							'css_format' => 'background-attachment: {{value}};',
						),
						array(
							'name'  => 'border_heading',
							'type'  => 'heading',
							'label' => __( 'Border', 'nevo' ),
						),

						array(
							'name'       => 'border_style',
							'type'       => 'select',
							'class'      => 'clear',
							'label'      => __( 'Border Style', 'nevo' ),
							'default'    => '',
							'choices'    => array(
								''       => __( 'Default', 'nevo' ),
								'none'   => __( 'None', 'nevo' ),
								'solid'  => __( 'Solid', 'nevo' ),
								'dotted' => __( 'Dotted', 'nevo' ),
								'dashed' => __( 'Dashed', 'nevo' ),
								'double' => __( 'Double', 'nevo' ),
								'ridge'  => __( 'Ridge', 'nevo' ),
								'inset'  => __( 'Inset', 'nevo' ),
								'outset' => __( 'Outset', 'nevo' ),
							),
							'selector'   => '.site-content .heading-title',
							'css_format' => 'border-style: {{value}};',
						),

						array(
							'name'       => 'border_width',
							'type'       => 'css_ruler',
							'label'      => __( 'Border Width', 'nevo' ),
							'required'   => array(
								array( 'border_style', '!=', 'none' ),
								array( 'border_style', '!=', '' ),
							),
							'selector'   => '.site-content .heading-title',
							'css_format' => array(
								'top'    => 'border-top-width: {{value}};',
								'right'  => 'border-right-width: {{value}};',
								'bottom' => 'border-bottom-width: {{value}};',
								'left'   => 'border-left-width: {{value}};',
							),
						),
						array(
							'name'       => 'border_color',
							'type'       => 'color',
							'label'      => __( 'Border Color', 'nevo' ),
							'required'   => array(
								array( 'border_style', '!=', 'none' ),
								array( 'border_style', '!=', '' ),
							),
							'selector'   => '.site-content .heading-title',
							'css_format' => 'border-color: {{value}};',
						),

						array(
							'name'       => 'border_radius',
							'type'       => 'css_ruler',
							'label'      => __( 'Border Radius', 'nevo' ),
							'selector'   => '.site-content .general-title',
							'css_format' => array(
								'top'    => 'border-top-left-radius: {{value}};',
								'right'  => 'border-top-right-radius: {{value}};',
								'bottom' => 'border-bottom-right-radius: {{value}};',
								'left'   => 'border-bottom-left-radius: {{value}};',
							),
						),
					),
				),
			),
		);

		return array_merge( $configs, $config );
	}
}
add_filter( 'nevo/customizer/config', 'nevo_customizer_styling_config', 299 );