<?php
add_action( 'wp_head', 'roxima_customizer_css' );
if ( ! function_exists( 'roxima_customizer_css' ) ):
function roxima_customizer_css() {
    ?><style type="text/css"><?php

		//
		// Global
		//
		if ( get_theme_mod( 'primary_color' ) ) {
			?>
			a,
			a:hover,
			.entry-title a:hover,
			.item-title a:hover {
				color: <?php echo get_theme_mod( 'primary_color' ); ?>;
			}

			.btn,
			.btn:hover,
			input[type="submit"],
			input[type="submit"]:hover,
			button,
			button:hover,
			.comment-reply-link,
			.comment-reply-link:hover,
			.item-team:after,
			.map-toggle,
			.social-icon:hover {
				background-color: <?php echo get_theme_mod( 'primary_color' ); ?>
			}

			.item-pricing-featured,
			.el-underline:after,
			.social-iconn:hover{
				border-color: <?php echo get_theme_mod( 'primary_color' ); ?>
			}

			.navigation > li.current-menu-item > a,
			.navigation > li.current-menu-ancestor > a,
			.navigation > li.current-menu-parent > a {
				border-bottom-color: <?php echo get_theme_mod( 'primary_color' ); ?>
			}

			.home .navigation > li.current-menu-item > a,
			.home .navigation > li.current-menu-ancestor > a,
			.home .navigation > li.current-menu-parent > a {
				border-bottom-color: transparent;
			}

			.home .navigation > li.current-menu-item > a:hover,
			.home .navigation > li.current-menu-ancestor > a:hover,
			.home .navigation > li.current-menu-parent > a:hover {
				border-bottom-color: <?php echo get_theme_mod( 'primary_color' ); ?>
			}

			.navigation > li > a:hover,
			.navigation > li.sfHover > a,
			.navigation > li.current > a {
				border-bottom-color: <?php echo get_theme_mod( 'primary_color' ); ?> !important;
			}
			<?php
		}

		if ( get_theme_mod( 'site_text_color' ) ) {
			?>
			body,
			.form-allowed-tags,
			.comment-notes,
			.entry-title a,
			.item-testimonial,
			.item-title a,
			.item-entry,
			.item-testimonial cite {
				color: <?php echo get_theme_mod( 'site_text_color' ); ?>;
			}
			<?php
		}

		if ( get_theme_mod( 'site_link_color' ) ) {
			?>
			a {
				color: <?php echo get_theme_mod( 'site_link_color' ); ?>;
			}
			<?php
		}

		if ( get_theme_mod( 'site_hover_color' ) ) {
			?>
			a:hover,
			.entry-title a:hover,
			.item-title a:hover {
				color: <?php echo get_theme_mod( 'site_hover_color' ); ?>;
			}
			<?php
		}

		if ( get_theme_mod( 'button_bg_color' ) ) {
			?>
			.btn,
			.btn:hover,
			input[type="submit"],
			input[type="submit"]:hover,
			button,
			button:hover,
			.comment-reply-link,
			.comment-reply-link:hover,
			.map-toggle {
				background-color: <?php echo get_theme_mod( 'button_bg_color' ); ?>;
			}
			<?php
		}


		if ( get_theme_mod( 'button_text_color' ) ) {
			?>
			.btn,
			.btn:hover,
			input[type="submit"],
			input[type="submit"]:hover,
			button,
			button:hover,
			.comment-reply-link,
			.comment-reply-link:hover,
			.map-toggle {
				color: <?php echo get_theme_mod( 'button_text_color' ); ?>;
			}
			<?php
		}

		if ( get_theme_mod( 'button_bg_hover_color' ) ) {
			?>
			.btn:focus,
			.btn:hover,
			input[type="submit"]:focus,
			input[type="submit"]:hover,
			button:focus,
			button:hover,
			.comment-reply-link:focus,
			.comment-reply-link:hover,
			.map-toggle:hover,
			.map-toggle:focus {
				background-color: <?php echo get_theme_mod( 'button_bg_hover_color' ); ?>;
			}
			<?php
		}

		//
		// Header
		//
		if ( get_theme_mod( 'header_bg_color' ) ) {
			?>
			.header {
				background-color: <?php echo get_theme_mod( 'header_bg_color' ); ?>;
			}
			<?php
		}

		if ( get_theme_mod( 'header_link_color' ) ) {
			?>
			.navigation > li > a,
			.site-logo a,
			.site-logo a:hover,
			.site-tagline {
				color: <?php echo get_theme_mod( 'header_link_color' ); ?>;
			}
			<?php
		}

		if ( get_theme_mod( 'header_hover_color' ) ) {
			?>
			.navigation > li > a:hover,
			.navigation > li.sfHover > a,
			.site-logo a:hover{
				color: <?php echo get_theme_mod( 'header_hover_color' ); ?>;
			}
			<?php
		}

		if ( get_theme_mod( 'header_subnav_bg_color' ) ) {
			?>
			.navigation ul {
				background-color: <?php echo get_theme_mod( 'header_subnav_bg_color' ); ?>;
			}
			<?php
		}

		if ( get_theme_mod( 'header_subnav_border_color' ) ) {
			?>
			.navigation > li ul a,
			.navigation ul {
				border-color: <?php echo get_theme_mod( 'header_subnav_border_color' ); ?>;
			}
			<?php
		}

		if ( get_theme_mod( 'header_subnav_link_color' ) ) {
			?>
			.header .navigation > li ul a {
				color: <?php echo get_theme_mod( 'header_subnav_link_color' ); ?>;
			}
			<?php
		}

		if ( get_theme_mod( 'header_subnav_hover_color' ) ) {
			?>
			.header .navigation > li ul a:hover,
			.header .navigation ul > li.sfHover > a {
				color: <?php echo get_theme_mod( 'header_subnav_hover_color' ); ?>;
			}
			<?php
		}

		//
		// Sidebar
		//
		if ( get_theme_mod( 'widgets_border_color' ) ) {
			?>
			.widget_meta ul li a,
			.widget_pages ul li a,
			.widget_categories ul li a,
			.widget_archive ul li a,
			.widget_nav_menu ul li a,
			.widget_recent_entries ul li a,
			.widget_recent_comments ul li,
			.sidebar input,
			.sidebar textarea,
			.widget_meta ul li:after, .widget_pages ul li:after, .widget_categories ul li:after, .widget_archive ul li:after, .widget_nav_menu ul li:after, .widget_recent_entries ul li:after,
			.widget_meta ul li .count, .widget_meta ul li .ci-count, .widget_pages ul li .count, .widget_pages ul li .ci-count, .widget_categories ul li .count, .widget_categories ul li .ci-count, .widget_archive ul li .count, .widget_archive ul li .ci-count, .widget_nav_menu ul li .count, .widget_nav_menu ul li .ci-count, .widget_recent_entries ul li .count, .widget_recent_entries ul li .ci-count,
			.sidebar form,
			.sidebar textarea {
				border-color: <?php echo get_theme_mod( 'widgets_border_color' ); ?>;
			}

			.sidebar .searchform .searchsubmit {
				border-color: <?php echo get_theme_mod( 'widgets_border_color' ); ?>;

			}
			<?php
		}

		if ( get_theme_mod( 'widgets_title_bg_color' ) ) {
			?>
			.sidebar .widget-title {
				background-color: <?php echo get_theme_mod( 'widgets_title_bg_color' ); ?>;
				padding: 5px 10px;
			}
			<?php
		}

		if ( get_theme_mod( 'widgets_title_color' ) ) {
			?>
			.sidebar .widget-title {
				color: <?php echo get_theme_mod( 'widgets_title_color' ); ?>;
			}

			.sidebar .widget-title:after {
				border-bottom-color: <?php echo get_theme_mod( 'widgets_title_color' ); ?>;
			}
			<?php
		}

		if ( get_theme_mod( 'widgets_text_color' ) ) {
			?>
			.sidebar {
				color: <?php echo get_theme_mod( 'widgets_text_color' ); ?>;
			}
			<?php
		}

		if ( get_theme_mod( 'widgets_link_color' ) ) {
			?>
			.sidebar a {
				color: <?php echo get_theme_mod( 'widgets_link_color' ); ?>;
			}
			<?php
		}

		if ( get_theme_mod( 'widgets_hover_color' ) ) {
			?>
			.sidebar a:hover {
				color: <?php echo get_theme_mod( 'widgets_hover_color' ); ?>;
			}
			<?php
		}


		//
		// Footer
		//
		if ( get_theme_mod( 'footer_bg_color' ) ) {
			?>
			.footer {
				background-color: <?php echo get_theme_mod( 'footer_bg_color' ); ?>;
			}
			<?php
		}

		if ( get_theme_mod( 'footer_text_color' ) ) {
			?>
			.footer,
			.footer .social-icon{
				color: <?php echo get_theme_mod( 'footer_text_color' ); ?>;
			}

			.footer .social-icon {
				border-color: <?php echo get_theme_mod( 'footer_text_color' ); ?>;
			}
			<?php
		}

		if ( get_theme_mod( 'footer_link_color' ) ) {
			?>
			.footer a {
				color: <?php echo get_theme_mod( 'footer_link_color' ); ?>;
			}
			<?php
		}

		if ( get_theme_mod( 'footer_hover_color' ) ) {
			?>
			.footer a:hover {
				color: <?php echo get_theme_mod( 'footer_hover_color' ); ?>;
			}

			.footer .social-icon:hover {
				color: #FFF;
				border-color: <?php echo get_theme_mod( 'footer_hover_color' ); ?>;
				background-color: <?php echo get_theme_mod( 'footer_hover_color' ); ?>;
			}
			<?php
		}

		//
		// Typography
		//
		if ( get_theme_mod( 'h1_size' ) ) {
			?>
			h1 {
				font-size: <?php echo get_theme_mod( 'h1_size' ); ?>px;
			}
			<?php
		}

		if( get_theme_mod( 'h2_size' ) ) {
			?>
			h2 {
				font-size: <?php echo get_theme_mod( 'h2_size' ); ?>px;
			}
			<?php
		}

		if( get_theme_mod( 'h3_size' ) ) {
			?>
			h3 {
				font-size: <?php echo get_theme_mod( 'h3_size' ); ?>px;
			}
			<?php
		}

		if( get_theme_mod( 'h4_size' ) ) {
			?>
			h4 {
				font-size: <?php echo get_theme_mod( 'h4_size' ); ?>px;
			}
			<?php
		}

		if( get_theme_mod( 'h5_size' ) ) {
			?>
			h5 {
				font-size: <?php echo get_theme_mod( 'h5_size' ); ?>px;
			}
			<?php
		}

		if( get_theme_mod( 'h6_size' ) ) {
			?>
			h6 {
				font-size: <?php echo get_theme_mod( 'h6_size' ); ?>px;
			}
			<?php
		}

		if( get_theme_mod( 'body_text_size' ) ) {
			?>
			body {
				font-size: <?php echo get_theme_mod( 'body_text_size' ); ?>px;
			}
			<?php
		}

		if( get_theme_mod( 'widgets_title_size' ) ) {
			?>
			.sidebar .widget-title {
				font-size: <?php echo get_theme_mod( 'widgets_title_size' ); ?>px;
			}
			<?php
		}

		//
		// Logo
		//
		if ( get_theme_mod( 'logo_padding_top' ) || get_theme_mod( 'logo_padding_top' ) ) {
			?>
			.logo-wrap {
				<?php if( get_theme_mod( 'logo_padding_top' ) ): ?>
					padding-top: <?php echo intval( get_theme_mod( 'logo_padding_top' ) ); ?>px;
				<?php endif; ?>
				<?php if( get_theme_mod( 'logo_padding_bottom' ) ): ?>
					padding-bottom: <?php echo intval( get_theme_mod( 'logo_padding_bottom' ) ); ?>px;
				<?php endif; ?>
			}
			<?php
		}


		if( get_theme_mod( 'custom_css' ) ) {
			echo get_theme_mod( 'custom_css' );
		}
	?></style><?php
}
endif;

if ( ! function_exists( 'roxima_custom_background_cb' ) ) :
function roxima_custom_background_cb() {
	// $background is the saved custom image, or the default image.
	$background = set_url_scheme( get_background_image() );

	// $color is the saved custom color.
	// A default has to be specified in style.css. It will not be printed here.
	$color = get_background_color();

	if ( $color === get_theme_support( 'custom-background', 'default-color' ) ) {
		$color = false;
	}

	if ( ! $background && ! $color )
		return;

	$style = $color ? "background-color: #$color;" : '';

	if ( $background ) {
		$image = " background-image: url('$background');";

		$repeat = get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) );
		if ( ! in_array( $repeat, array( 'no-repeat', 'repeat-x', 'repeat-y', 'repeat' ) ) )
			$repeat = 'repeat';
		$repeat = " background-repeat: $repeat;";

		$position = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );
		if ( ! in_array( $position, array( 'center', 'right', 'left' ) ) )
			$position = 'left';
		$position = " background-position: top $position;";

		$attachment = get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) );
		if ( ! in_array( $attachment, array( 'fixed', 'scroll' ) ) )
			$attachment = 'scroll';
		$attachment = " background-attachment: $attachment;";

		$style .= $image . $repeat . $position . $attachment;
	}

	?>
	<style type="text/css" id="custom-background-css">
		body { <?php echo trim( $style ); ?> }
	</style>
	<?php
}
endif;
