<?php
// Security Check
defined('ABSPATH') || die();

if(!function_exists('masterpiece_dynamic_style')):

function masterpiece_dynamic_style(){
	$primary_color = get_theme_mod('primary_color', "#e84855");
	$primary_dark = get_theme_mod('secondary_color', "#372248");
	$primary_bg = get_theme_mod('tertiary_color', "#e8d7f1");
	
	$logo_text_color = get_theme_mod('logo_text_color', get_theme_mod('link_color', get_theme_mod('primary_color', '#e84855')));
	
	$link_color = get_theme_mod('link_color', get_theme_mod('primary_color', '#e84855'));
	$link_hover_color = get_theme_mod('link_hover_color', get_theme_mod('secondary_color', '#372248'));

	$menu_link_color = get_theme_mod('menu_link_color', get_theme_mod('link_color', get_theme_mod('primary_color', '#e84855')));;
	$menu_link_hover_color = get_theme_mod('menu_link_hover_color', get_theme_mod('link_hover_color', get_theme_mod('secondary_color', '#372248')));
	
	$submenu_link_color = get_theme_mod('submenu_link_color', $menu_link_color);
	$submenu_link_hover_color = get_theme_mod('submenu_link_hover_color', $menu_link_hover_color);
?>

<style type="text/css">

	/* Log Text Color*/
	.navbar-brand,
	.navbar-brand:hover,
	.navbar-brand a,
	.navbar-brand a:hover{
		color: <?php echo $logo_text_color; ?>;
	}

	/* Link Color */
	a,
	.navbar-nav .menu-item .nav-link,
	.entry-title a,
	#primary #main .post .entry-header .entry-title a,
	.widget ul li a,
	.masterpiece-more-link,
	.pagination .page-item .page-link,
	#primary #main .post .entry-header .entry-meta a{
		color: <?php echo $link_color; ?>;
	}

	a:hover,
	.navbar-nav .menu-item .nav-link:hover,
	.entry-title a:hover,
	#primary #main .post .entry-header .entry-title a:hover,
	.widget ul li a:hover,
	.masterpiece-more-link:hover,
	.pagination .page-item .page-link:hover,
	#primary #main .post .entry-header .entry-meta a:hover,
	.widget a:hover,
	.widget ul li a:hover{
		color: <?php echo $link_hover_color; ?>;
	}

	/* #primary #main .post .entry-header .entry-meta a{
		color: <?php echo $link_color; ?>;
	} */

	/* Menu */
	.navbar-nav .menu-item .nav-link{
		color: <?php echo $menu_link_color; ?>;
	}

	.navbar-nav .menu-item .nav-link:hover{
		color: <?php echo $menu_link_hover_color; ?>;
	}

	/* Submenu */
	.dropdown-menu .menu-item .dropdown-item{
		color: <?php echo $submenu_link_color; ?>;
	}

	.dropdown-menu .menu-item .dropdown-item:hover{
		color: <?php echo $submenu_link_hover_color; ?>;
	}

	.dropdown-menu{
		background-color: <?php echo esc_html(get_theme_mod('submenu_background_color', '#fff')); ?>
	}

	.dropdown-menu .menu-item .dropdown-item:hover{
		background-color: <?php echo esc_html(get_theme_mod('submenu_background_hover_color', '#fff')); ?>
	}

	/* Post Title */
	#primary #main .post .entry-header .entry-title a{
		color: <?php echo esc_html(get_theme_mod('post_title_color', get_theme_mod('primary_color', '#e84855'))); ?>;
	}
	#primary #main .post .entry-header .entry-title a:hover{
		color: <?php echo esc_html(get_theme_mod('post_title_hover_color', get_theme_mod('secondary_color', '#372248'))); ?>;
	}


	input[type=text],
	textarea,
	.form-control {
		border: 1px solid <?php echo $primary_color;?>;
	}

	input[type=text]:focus,
	textarea:focus,
	.form-control:focus {
		border: 1px solid <?php echo $primary_color;?>;
		box-shadow: 0 0 5px <?php echo $primary_color; ?>;
	}

	.navbar-toggler{
		color: <?php echo $primary_color;?>;
	}


	/* #primary #main .post .entry-header .entry-meta a:hover{
		color: <?php echo $primary_dark; ?>;
	} */

	.bg-primary{
		background-color: <?php echo $primary_dark; ?> !important;
	}
	.footer-widget .widget-title, .widget .widget-title{
		background-color: <?php echo $primary_color; ?>;
		border-left-color: <?php echo $primary_dark; ?>;
	}

	.btn-secondary:hover,
	.masterpiece-more-link:hover{
		border-color: <?php echo $primary_dark; ?>;
		background-color: <?php echo $primary_color; ?>;
	}

	.top-bar-section{
		background-color: <?php echo $primary_color; ?>;
	}

	#primary #main .post-navigation .nav-next a,
	#primary #main .post-navigation .nav-previous a{
		color: <?php echo $primary_color; ?>;
	}

	#primary #main .post-navigation .nav-next a:hover,
	#primary #main .post-navigation .nav-previous a:hover{
		color: <?php echo $primary_dark; ?>;
	}

	/* .footer-widget ul li a:hover, .widget ul li a:hover{
		color: <?php echo $primary_color; ?>;
	} */

	#wrapper-footer a:hover{
		color: <?php echo $primary_color; ?>;
	}

	/* #primary #main .post{
		border-top: 1px dashed <?php echo $primary_dark;?>;
	} */

	.footer-widget .tagcloud .tag-cloud-link,
	.widget .tagcloud .tag-cloud-link {
		color: <?php echo $primary_dark; ?>;
	}

	.footer-widget .tagcloud .tag-cloud-link:hover,
	.widget .tagcloud .tag-cloud-link:hover {
		color: <?php echo $primary_color; ?>;
	}

	#searchform .submit{
		color: <?php echo $primary_color; ?>;
		border-color: <?php echo $primary_color; ?>;
	}

	#searchform .submit:hover{
		color: <?php echo $primary_dark; ?>;
		border-color: <?php echo $primary_dark; ?>;
	}

	blockquote,
	.blockquote{
		border-bottom: 5px solid <?php echo $primary_color; ?>;
		background-color: <?php echo $primary_bg; ?>;
	}

	mark{
		background-color: <?php echo $primary_bg; ?>;
	}

	/* .pagination .page-item .page-link{
		color: <?php echo $primary_color; ?>;
		border: 1px solid <?php echo $primary_color;?>;
	}

	.pagination .page-item .page-link:hover{
		background-color: <?php echo $primary_bg; ?>	;
	} */

	/* .pagination .active .current{
		background-color: <?php echo $primary_color; ?>;
		border: 1px solid <?php echo $primary_dark; ?>;
		color: #fff;
	} */

	.pagination .active .current{
		color: #fff;
		background-color: <?php echo $primary_color;?>;
	}

	.pagination .active .current:hover{
		color: #fff;
	}

</style>

<?php
}

add_action('wp_head', 'masterpiece_dynamic_style');


endif;
