<?php
//Function parses header styles

$options = get_option('second-touch');

if (!function_exists('cr_hex2rgb')) {
    function cr_hex2rgb($hex)
    {
        $hex = str_replace("#", "", $hex);

        if (strlen($hex) == 3) {
            $r = hexdec(substr($hex, 0, 1) . substr($hex, 0, 1));
            $g = hexdec(substr($hex, 1, 1) . substr($hex, 1, 1));
            $b = hexdec(substr($hex, 2, 1) . substr($hex, 2, 1));
        } else {
            $r = hexdec(substr($hex, 0, 2));
            $g = hexdec(substr($hex, 2, 2));
            $b = hexdec(substr($hex, 4, 2));
        }
        $rgb = array($r, $g, $b);
        return implode(",", $rgb); // returns the rgb values separated by commas
        //return $rgb; // returns an array with the rgb values
    }
}

/*
 * Backgrounds
 */
if ($options["wrapper_bg_color"]){
    echo '#change_wrap_div{ background-color: '.$options["wrapper_bg_color"].'}  ';
}
if ($options["wrapper_bg_image"]){
    echo '#change_wrap_div{ background-image: url("'.$options["wrapper_bg_image"].'")} ';
}
if ($options["wrapper_custom_repeat"]){
    echo '#change_wrap_div{ background-repeat: '.$options["wrapper_custom_repeat"].'} ';
}

if ($options["body_bg_color"]){
    echo 'body{ background-color: '.$options["body_bg_color"].'} ';
}
if ($options["body_bg_image"]){
    echo 'body{ background-image: url("'.$options["body_bg_image"].'")} ';
}
if ($options["body_custom_repeat"]){
    echo 'body{ background-repeat: '.$options["body_custom_repeat"].'} ';
}
if ($options["body_bg_fixed"]){
    echo 'body{ background-attachment: fixed;} ';
}

if ($options["footer_font_color"]){
    echo '#footer, #footer .contacts-widget p, #sub-footer{ color: '.$options["footer_font_color"].'} ';
}
if ($options["footer_bg_color"]){
    echo '#footer, #sub-footer{ background-color: '.$options["footer_bg_color"].'} ';
}
if ($options["footer_bg_image"]){
    echo '#footer, #sub-footer{ background-image: url("'.$options["footer_bg_image"].'")} ';
}
if ($options["footer_custom_repeat"]){
    echo '#footer, #sub-footer{ background-repeat: '.$options["footer_custom_repeat"].'} ';
}

if($options["stan_header"] =='0'){
	echo '.page-title-inner{color:inherit !important}';
}

if(isset($options['full_width_layout_width']) && ($options['full_width_layout_width'] > 0)){
	echo '.row{width:'.$options['full_width_layout_width'].'px !important}';
}
/*
 * Main theme color
 */

if (($options["main_site_color"]) && ($options["main_site_color"] != "#ff6565")){ ?>

	.tabs dd a, .tabs li a {
	border-right: 1px solid #ffffff;
	}

    article.post h3.entry-title a:hover,
    .share-icons a:hover,
    #comments h3 span,
    .pages-nav a,
    .entry-thumb a.link:before,
    .tabs.horisontal.no-styling dd.active a,
    .pricing-table .title .icon,
    .post-carousel-item .icon-format,
    .featured-news h3.entry-title a:hover,
    article.mini-news .box-name a:hover,
    .skills_widget .start-label, .skills_widget .finish-label,
    .folio-item .box-name:first-letter,
    .folio-item .box-name a:first-letter,
    .folio-item .box-name a .animated,
    .testimonials_item .box-name:first-letter,
    .instagram-autor .box-name:first-letter,
    .recent-posts-list .entry-title:first-letter,
    .recent-posts-list .entry-title .animated,
    .tags-widget a:hover,
    ul.products li.product .amount,
    .widget_shopping_cart .amount,
    .woocommerce p.stars a:hover:before, .woocommerce-page p.stars a:hover:before, .woocommerce p.stars a:focus:before, .woocommerce-page p.stars a:focus:before,
    .woocommerce p.stars a.active:before, .woocommerce-page p.stars a.active:before,
    a:hover, a:focus,
    .crumina-slider-wrap .item-content .icon-format,
    .crumina-slider-wrap .entry-title a:hover,
	.news-row .entry-thumb .mini-comm-count:before,
	.hover-box .more-link:before,
	.hover-box .zoom-link:before,
	.hover-box .like:before

    {
    color: <?php echo $options["main_site_color"] ?>;
    }

    #top-panel .login-header .avatar,
    article .entry-thumb .comments-link:hover,
    article.post .link-read-more,
    .light,
    .lang-sel ul > li:hover a,
    .breadcrumbs,
    .back-to-top,
    .filter li a:after,
    #wp-submit.button-primary, #commentform #submit,
    .pricetable-featured .pricing-table .title,
    .folio-dopinfo i,
    .team_member_box .text:before,
    article.mini-news .mini-comm-count,
    .feature-box .back,
    .recent-block .tabs.horisontal dd a:after,
    .timelime .timeline-item .timeline-title:after,
    div.progress .meter,
    .highlight,
    .quantity .plus, #content .quantity .plus,
    .quantity .minus, #content .quantity .minus:hover,
    .pricing-table .cta-button .button.red,
    .crumina-slider-wrap .active .click-section,
	.tabs.vertical dd.active a,
	.tabs.vertical dd a .icon,
	.tabs.vertical dd.active .icon,
	.top-menu-button.active
    {
    background-color: <?php echo $options["main_site_color"] ?>;
    }

	article .entry-thumb .comments-link:hover:before {
    border-color: <?php echo $options["main_site_color"] ?> transparent transparent transparent;
    }

    article .entry-thumb .comments-link
	{
    background: <?php echo $options["main_site_color"] ?>;
    background: rgba(<?php echo cr_hex2rgb($options["main_site_color"]); ?>, 0.7);
    }

    .crumina-slider-wrap .cat-name
	{
    background: <?php echo $options["main_site_color"] ?>;
    background: rgba(<?php echo cr_hex2rgb($options["main_site_color"]); ?>, 0.6);
    }

    .crumina-slider-wrap .cat-name:hover {
    background: <?php echo $options["main_site_color"] ?>;
    background: rgba(<?php echo cr_hex2rgb($options["main_site_color"]); ?>, 1);
    }

	article .entry-thumb .comments-link:before {
    border-color: <?php echo $options["main_site_color"]?> transparent transparent transparent;
    border-color: rgba(<?php echo cr_hex2rgb($options["main_site_color"]); ?>, 0.7) transparent transparent transparent;
    }

	article .entry-thumb .comments-link:hover:before {
	border-color: <?php echo $options["main_site_color"]?> transparent transparent transparent;
	border-color: rgba(<?php echo cr_hex2rgb($options["main_site_color"]); ?>, 0.7) transparent transparent transparent;
	}

    #crum-slider .item .item-content-metro {
    background: <?php echo $options["main_site_color"] ?>;
    background: rgba(<?php echo cr_hex2rgb($options["main_site_color"]); ?>, 0.87);
    }

    .author-photo img {
    border-bottom: 3px solid <?php echo $options["main_site_color"] ?>; }

    #footer .soc-icons a:hover,
    .charts-box .percent
    {
    border-bottom: 2px solid <?php echo $options["main_site_color"] ?>; }

    #wp-submit.button-primary, #commentform #submit {box-shadow:none !important;}

    .feature-block-image .picture:before {
    border-color: transparent transparent transparent <?php echo $options["main_site_color"] ?>;
    }

    div.bbp-template-notice
    {border-left: 3px solid <?php echo $options["main_site_color"] ?> !important;}

    .woocommerce-info {
    border-top: 3px solid <?php echo $options["main_site_color"] ?>
    }

    .pricing-table .cta-button .button.red {box-shadow:none !important;}

<?php }

if (($options["secondary_site_color"]) && ($options["secondary_site_color"] != "#36bae2")){ ?>

    .twitter-row .icon,
    .page-numbers li:hover a,
    .page-numbers li a:focus,
    .page-numbers li.current a,
    .page-numbers li.current a:hover, .page-numbers li.current a:focus,
    .page-numbers li span:hover a,
    .page-numbers li span a:focus,
    .page-numbers li span.current,
    .tabs.horisontal dd a,
    .tabs.horisontal li a,
    .tabs.vertical dd a,
    .tabs.vertical li a,
    .button, #wp-submit, #commentform #submit,
    .map-holder .box-text,
    .accodion_module .title,
    .contacts-widget,
    .tweet-list,
    .twitter-row .icon,
    .products  .product .button:before,
    ul.products li.product del .amount,
    .quantity .plus, #content .quantity .plus:hover,
    .quantity .minus, #content .quantity .minus


    {background-color:<?php echo $options["secondary_site_color"] ?>;}


    .bbp-topic-meta a,
    td.product-remove a:hover,
    .product-ordering a:hover,
    .summary .price,
    a
    {color:<?php echo $options["secondary_site_color"] ?>;}

    .pricing-table:hover
    {border: 2px solid <?php echo $options["secondary_site_color"] ?> }

    .pricing-table:hover::before {border-color: transparent <?php echo $options["secondary_site_color"] ?> transparent transparent;}

    #bbpress-forums ul.bbp-forums,#bbpress-forums ul.bbp-topics, #bbpress-forums ul.bbp-replies {
    border-top: 3px solid <?php echo $options["secondary_site_color"] ?>;
    }
    div.bbp-template-notice.info

    {border-left: 3px solid <?php echo $options["secondary_site_color"] ?> !important;}


    #crum-slider .item.even .item-content-metro {
    background: <?php echo $options["secondary_site_color"] ?>;
    background: rgba(<?php echo cr_hex2rgb($options["secondary_site_color"]); ?>, 0.87);

    }

    .button, #wp-submit, #commentform #submit, .pricing-table .cta-button .button.red {box-shadow:none !important;}


<?php }
if ($options["font_site_color"]){ ?>

    article.post h3.entry-title,
    .author-description > h4 span,
    .comment-author .dop-link a,
    .tabs dd.active a,
    .tabs li.active a,
    .pricing-table .title,
    .pricing-table .bullet-item,
    .folio-dopinfo,
    .to-action-block .description,
    .news-row .box-name,
    .featured-news h3.entry-title,
    .skills_widget .skill-item .item-title .title,
    .list-box .feature-box.al-left li,
    .recent-block .tabs.horisontal dd a:hover,
    .recent-block .tabs.horisontal dd.active a,
    body,
    h1, h2, h3, h4, h5, h6,
    .block-title,
    .box-name,
    .dopinfo, .dopinfo a,
    .dopinfo a:hover, .entry-meta .author a,
    code, pre,
    table thead tr th, table tfoot tr td,
    table tbody tr td,
    abbr, acronym,
    ul.products li.product h3,
    ul.products li.product .prod-cat,
    ul.products li.product .prod-details,
    ul.products li.product .prod-details i,
    ul.products li.product .button,
    .woocommerce-message, .woocommerce-error, .woocommerce-info,
    .woocommerce .star-rating span:before, .woocommerce-page .star-rating span:before,
    ul.cart_list li a, ul.product_list_widget li a
    {color:<?php echo $options["font_site_color"]; ?>}

<?php }


echo $options["custom_css"];


?>









