<?php
$srpnt_arr_typography = array(
    "body" => "serpentsoft_typography_general_body",
    ".breaking-news-widget > .row-fluid > .title > h3" => "serpentsoft_typography_general_breakingNewsTitle",
    ".breaking-news-widget > .row-fluid > .content .ticker-content a" => "serpentsoft_typography_general_breakingNewsPost",
    ".widget .widget-title h4" => "serpentsoft_typography_general_widgetTitle",
    ".twitter-ticker-widget .widget-inner > .title h4" => "serpentsoft_typography_general_latestTweetsTitle",
    ".tweet_list li a" => "serpentsoft_typography_general_latestTweetsLink",
    ".modern-footer .f-widget > .f-widget-title h4" => "serpentsoft_typography_general_footerWidgetTitle",
    
    ".top-menu-2 .about-company .title > h3" => "serpentsoft_typography_topMenu_widgetTitle",
    
    ".site-title" => "serpentsoft_typography_header_siteTitle",
    ".site-description" => "serpentsoft_typography_header_siteDesc",
    
    ".navbar-main .navbar .nav > li > a" => "serpentsoft_typography_mainMenu",
    ".navbar-main .dropdown-menu > li > a" => "serpentsoft_typography_mainMenu_dropdown",
    
    ".flexslider.large .fold-item .description > .title h3" => "serpentsoft_typography_hp_sliderTitle",
    ".flexslider.large .fold-item .description > .text" => "serpentsoft_typography_hp_sliderDesc",
    ".cat-widget .cat-widget-title h3, .author-bio .cat-widget-title h3, .author-bio .cat-widget-title h3 a" => "serpentsoft_typography_hp_cat_widgetTitle",
    
    ".blog-item h4" => "serpentsoft_typography_archive_postTitle",
    ".blog-item .post-meta ul li a, .blog-item .post-meta ul li span, .blog-item .post-meta" => "serpentsoft_typography_archive_postMeta",
    ".blog-item .media .blog-desc, .blog-item .media .media .blog-desc" => "serpentsoft_typography_archive_postDesc",
    
    ".article-content h1" => "serpentsoft_typography_post_postTitle",
    ".article-content .post-info .post-meta a, .article-content .post-info .post-meta" => "serpentsoft_typography_post_postMeta",
    ".article-content .post-entry" => "serpentsoft_typography_post_postEntry",
);

/* ==================================================== */
// Grab User Fonts Settings and Register it
/* ==================================================== */
function serpentsoft_typography_enqueue_user_font ($user_font = '') {
    if( !is_admin() ){

        if ( !empty($user_font) ):

            $char_set = '&subset=latin';
            if(serpentsoft_get_data('serpentsoft_switch_latin_ext')) { $char_set .= ',latin-ext'; }
            if(serpentsoft_get_data('serpentsoft_switch_cyrillic')) { $char_set .= ',cyrillic'; }
            if(serpentsoft_get_data('serpentsoft_switch_cyrillic_ext')) { $char_set .= ',cyrillic-ext'; }
            if(serpentsoft_get_data('serpentsoft_switch_greek')) { $char_set .= ',greek'; }
            if(serpentsoft_get_data('serpentsoft_switch_greek_ext')) { $char_set .= ',greek-ext'; }
            if(serpentsoft_get_data('serpentsoft_switch_vietnamese')) { $char_set .= ',vietnamese'; }

            try{
                $font_features = explode("##", $user_font);

                $font_url = $font_features[0];
                $font_variants = $font_features[1];

                if( $font_variants == 'non-google' ){ }

                elseif( $font_variants == 'early-google'){
                    $font_name = str_replace ('+', ' ' , $font_url);
                    $protocol = is_ssl() ? 'https' : 'http';
                    wp_enqueue_style( $font_name, esc_url_raw( $protocol . '://fonts.googleapis.com/earlyaccess/' . str_replace('+', '' , $font_url) ) );
                }

                else{
                    $font_name = str_replace (' ', '+', $font_url );
                    $protocol = is_ssl() ? 'https' : 'http';
                    wp_enqueue_style( $font_name, esc_url_raw( $protocol . '://fonts.googleapis.com/css?family=' . $font_url . $font_variants . $char_set ) );
                }
            }
            catch (Exception $ex){
                $protocol = is_ssl() ? 'https' : 'http';
                wp_enqueue_style( 'srpnt_opensans', esc_url_raw( $protocol . '://fonts.googleapis.com/css?family=Open+Sans:400,300,600' ) );
            }
        else:
            $protocol = is_ssl() ? 'https' : 'http';
            wp_enqueue_style( 'srpnt_opensans', esc_url_raw( $protocol . '://fonts.googleapis.com/css?family=Open+Sans:400,300,600' ) );
        endif;
    }
}

/* =============================================================================== */
// Get Font Family to Use it in the style sheet
/* =============================================================================== */
function serpentsoft_typography_get_font_family($user_font){
    if ($user_font):
        $output_font_family = '';
    
        try{
            $font_features = explode("##", $user_font);

            $font_url = $font_features[0];
            $font_variants = $font_features[1];

            if( $font_variants == 'non-google' ){
                $output_font_family = '"' . str_replace('+', ' ', $font_url) . '"';
            }
            
            else{
                $output_font_family = '"' . str_replace('+', ' ', $font_url) . '"';
            }
            
        }
        catch(EXCEPTION $ex){
        }
        
        if(!empty($output_font_family)) { return $output_font_family; }
    endif;
}

/* =============================================================================== */
// Register User Selected Fonts || Register 'Open Sans' Font as Default Font
/* =============================================================================== */
add_action('wp_enqueue_scripts', 'serpentsoft_typography_get_settings');
function serpentsoft_typography_get_settings(){
    global $srpnt_arr_typography;

    foreach( $srpnt_arr_typography as $css_classes => $value){
        $font_group = serpentsoft_get_data($value);

        //echo print_r($font_group['face']);
        
        if( !empty($font_group['face'])){
            serpentsoft_typography_enqueue_user_font($font_group['face']) ;
        }
        else{
            $protocol = is_ssl() ? 'https' : 'http';
            wp_enqueue_style( 'srpnt_opensans', $protocol . '://fonts.googleapis.com/css?family=Open+Sans:400,300,600' );
        }
    }
}

/* =============================================================================== */
// Apply Typography Styles
/* =============================================================================== */
add_action('wp_enqueue_scripts', 'serpentsoft_typography_styling_css');
function serpentsoft_typography_styling_css(){
    $output = '';
    global $srpnt_arr_typography;

    foreach( $srpnt_arr_typography as $css_classes => $value){
        $font_group = serpentsoft_get_data($value);
        $font_style = '';
        
        if( !empty($font_group['face']) ) { $font_style .= sprintf('font-family: %1$s;', serpentsoft_typography_get_font_family( $font_group['face']) ); }
        if( $font_group['size'] != 0) { $font_style .= sprintf('font-size: %1$s;', $font_group['size']); }
        if( $font_group['style'] != 0) { $font_style .= sprintf('font-weight: %1$s;', $font_group['style']); }
        if( $font_group['height'] != 0) { $font_style .= sprintf('line-height: %1$s;', $font_group['height']); }
        if( !empty($font_group['color']) ) { $font_style .= sprintf('color: %1$s;', $font_group['color']); }

        if( !empty($font_style) ){
            $output .= sprintf('%1$s { %2$s }', $css_classes, $font_style);
        }
    }
    
    if(!empty($output)) { wp_add_inline_style('serpentsoft_custom_style', $output); }
}

/* ============================= End Of Typography ===================================== */


/* =================================================================================== */
// ------------------------------- Theme Coloring Style --------------------------------
/* =================================================================================== */
function serpentsoft_get_theme_main_color(){
    $color = serpentsoft_get_data('serpentsoft_theme_main_color');
    if(!empty($color)) { return $color; }
    else { return '#2c98e0'; }
}

/* =================================================================================== */
// ------------------------------- Main Theme Color ------------------------------------
/* =================================================================================== */
function serpentsoft_style_main_theme_color(){
    $output = '';
    $background_color = serpentsoft_get_theme_main_color();
    
    if( !empty($background_color) ):
    
    $arr_style = array(
        'background'    => '::-webkit-scrollbar-thumb, .breaking-news-widget > .row-fluid > .title, .widget-title > h3:after, .cat-widget-title h3:after, .widget-title > h4:after, .f-widget-title > h4:after, .btn-theme, form-submit #submit, ul.modern-tabs .btn-theme:hover, ul.modern-tabs .btn-theme.active, .widget .widget-content ul.tabs-header > li.btn-theme.active > a, .modern-accordion-container > .accordion > .accordion-group > .accordion-heading > .btn-theme:hover, .article-content .social-share-footer .figure, .article-content .blog .social-share-footer .pagination ul > li > a:hover, .article-content .blog .social-share-footer .pagination ul > li > a:focus, .carousel-nav .carousel-indicators .active, .flexslider .flex-direction-nav > li:hover, .article-content .blog .paging-footer .pagination ul > .active a, .article-content .blog .paging-footer .pagination ul > .active > a:hover, .article-content .blog .paging-footer .pagination ul > .active > span:hover, .navbar-main .navbar .nav li.dropdown.open > .dropdown-toggle, .navbar-main .navbar .nav li.dropdown.open > .dropdown-toggle:hover, .navbar-main .navbar .nav li.dropdown.open > .dropdown-menu li a:hover, .navbar-main .navbar .nav li.dropdown.active > .dropdown-toggle, .navbar-main .navbar .nav li.dropdown.open.active > .dropdown-toggle, .navbar-main .navbar .nav li.current-menu-ancestor.dropdown > a, .navbar-main .navbar .nav li.open.current-menu-ancestor.dropdown > a, .navbar-main .navbar .nav li.current-menu-ancestor.dropdown:hover > a, .navbar-main .navbar .nav li.open.current-menu-ancestor.dropdown:hover > a,

.navbar-main .navbar .nav > li > a:hover,
.navbar-main .navbar .nav > li.current-menu-item > a,
.navbar-main .navbar .nav > li.dropdown.active > a,
::selection
',
        
        'background-color' => '.breaking-news-widget > .row-fluid > .title, .widget-title > h3:after, .cat-widget-title h3:after, .widget-title > h4:after, .f-widget-title > h4:after, .btn-theme, form-submit #submit, ul.modern-tabs .btn-theme:hover, ul.modern-tabs .btn-theme.active, .widget .widget-content ul.tabs-header > li.btn-theme.active > a, .modern-accordion-container > .accordion > .accordion-group > .accordion-heading > .btn-theme:hover, .article-content .social-share-footer .figure, .article-content .blog .social-share-footer .pagination ul > li > a:hover, .article-content .blog .social-share-footer .pagination ul > li > a:focus, .carousel-nav .carousel-indicators .active, .flexslider .flex-direction-nav > li:hover, .article-content .blog .paging-footer .pagination ul > .active a, .article-content .blog .paging-footer .pagination ul > .active > a:hover, .article-content .blog .paging-footer .pagination ul > .active > span:hover, .navbar-main .navbar .nav li.dropdown.open > .dropdown-toggle, .navbar-main .navbar .nav li.dropdown.open > .dropdown-toggle:hover, .navbar-main .navbar .nav li.dropdown.open > .dropdown-menu li a:hover, .navbar-main .navbar .nav li.dropdown.active > .dropdown-toggle, .navbar-main .navbar .nav li.dropdown.open.active > .dropdown-toggle, .navbar-main .navbar .nav li.current-menu-ancestor.dropdown > a, .navbar-main .navbar .nav li.open.current-menu-ancestor.dropdown > a, .navbar-main .navbar .nav li.current-menu-ancestor.dropdown:hover > a, .navbar-main .navbar .nav li.open.current-menu-ancestor.dropdown:hover > a,
.navbar-main .navbar .nav > li.current-menu-item > a, .navbar-main .navbar .nav > li.dropdown.active > a,
.tags-cloud a.btn-theme:hover, .twitter-ticker-widget, .twitter-ticker-widget .widget-inner, .twitter-ticker-widget .widget-inner > .title, #divLatestTweets, .tweet_list, .tweet_list li, .tweet_list .tweet_even, .blog-item .blog-date .date-meta .post-date, .article-content > .timeline-page > .row-fluid > .dl-horizontal dt > .badge, #commentform .form-submit #submit, #divGoToTop, .article-content .post-review .total-score .result, .page-link a:hover',
        
        'color'     => 'a:hover, a:focus, i:hover, i:focus, .widget a:hover, .widget-300 a:hover, .cat-widget a:hover, .posts-in-thumbs .media-list a:hover, .posts-in-scrolling-box .media-list a:hover, .posts-in-thumbs .media-list li:hover a, .posts-in-scrolling-box .media-list li:hover a, .widget .widget-content .tabs-body-style .media-list li:hover a, .article-content .post-info .post-meta a:hover, .article-content .post-info .breadcrumb a:hover, .article-content .post-info .post-meta a:hover > i, .article-content .post-info .breadcrumb a:hover > i, .comments-box .cat-widget-content .media-body .media ul > li > a:hover, .comments-box .cat-widget-content .media-body .media ul > li > a:hover > i, .comments-box .cat-widget-content .media-body .media .media-body .media ul > li > a:hover, .comments-box .cat-widget-content .media-body .media .media-body .media ul > li > a:hover > i, .post-navigation a:hover, .posts-in-thumbs .media-list .post-meta a:hover, .posts-in-scrolling-box .media-list .post-meta a:hover, .widget .widget-content .tabs-body-style .media-list .post-meta a:hover, .post-navigation div a:hover > span, .post-navigation div a:hover > i, .blog-item .post-meta ul li a:hover, .blog-item .post-meta ul li a:hover > i, .posts-in-widget .carousel-nav > .arrow:hover > i, .posts-in-widget .comments .leave-comment a, .da-slide h3, .input-append .add-on, .input-prepend .add-on, .article-content .social-share-footer .share-icon, .modern-footer .f-copyright a:hover, .modern-footer .f-copyright a:focus, .modern-footer .f-copyright i:hover, .modern-footer .f-copyright i:focus, .tm-widget.widget_calendar tbody td a, #respond #reply-title:before, .widget-content ul.tweet_list li a:hover',
        
        'border-color'      => '.breaking-news-widget, .top-menu-2 .btn-theme:hover, .modern-footer .widget_tag_cloud .tagcloud > a:hover',
        'border-bottom-color'           => '.navbar-main.navbar-fixed-top, .top-menu-2 .navbar-inner .brand:after, .top-menu-2 .about-company .title > h3:after',
        'border-top-color'      => '.top-menu-2 ul.nav > .dropdown > .dropdown-menu > li:first-child, .top-menu-2 .dropdown-submenu > .dropdown-menu > li:first-child, .modern-footer',
    );    
    
    foreach ($arr_style as $key => $value) {
        $output .= sprintf('%1$s { %2$s: %3$s; }', $value, $key, $background_color);
    }
    
    $arr_rgba = hex2rgb($background_color);
    
    $output .= '.modern-items-list .fold-item .description, .cat-review .review .img-container .img-meta .post-result .percent {';
    $output .= sprintf('background: rgba(%1$s, %2$s, %3$s, 0.87);', $arr_rgba[0], $arr_rgba[1], $arr_rgba[2]);
    $output .= ' }';
    
    $output .= '.thumb-effect:hover .mask {';
    $output .= sprintf('background-color: rgba(%1$s, %2$s, %3$s, 0.90) !important;', $arr_rgba[0], $arr_rgba[1], $arr_rgba[2]);
    $output .= ' }';
    
    $output .= '.flex-control-nav {';
    $output .= sprintf('border-color: rgba(%1$s, %2$s, %3$s, 0.27);', $arr_rgba[0], $arr_rgba[1], $arr_rgba[2]);
    $output .= ' }';
    
    $output .= '.widget.widget_tag_cloud .tagcloud > a:hover {';
    $output .= sprintf('background-color: %1$s;', $background_color);
    $output .= ' }';
    
    $output .= '.modern-footer .widget_tag_cloud .tagcloud > a:hover {';
    $output .= sprintf('border-color: %1$s;', $background_color);
    $output .= ' }';
    
    $output .= '.modern-footer .tags-cloud a.btn-theme:hover {';
    $output .= sprintf('border-color: %1$s;', $background_color);
    $output .= ' }';
    
    endif;
    
    /* Fix btn-theme in firefox */
    $output .= '.tags-cloud a.btn-theme:hover { color: #fff; }';
    
    /* Mouse Hover Animations (Slider) */
    $hover_animation_slider = serpentsoft_get_data('serpentsoft_switch_slide_hoverEffects_slider');
    
    if( isset($hover_animation_slider) && $hover_animation_slider ){
        $output .= '.modern-items-list .flexslider.large .fold-item:hover .description { bottom: 0 !important }';
    }
    
    /* Mouse Hover Animations (Widgets & Home Catgories) */
    $hover_animation_widgets = serpentsoft_get_data('serpentsoft_switch_slide_hoverEffects_widgets');
    
    if( isset($hover_animation_widgets) && $hover_animation_widgets ){
        $output .= '.cat-horiz .related-posts .modern-items-list .fold-item:hover .description { bottom: 0 !important }';
        $output .= '.cat-vertical .related-posts .modern-items-list .fold-item:hover .description { bottom: 0 !important }';
        $output .= '.cat-related-news .modern-items-list .fold-item:hover .description { bottom: 0 !important }';
        $output .= '.posts-in-widget .modern-items-list .fold-item:hover .description { bottom: -30px !important }';
    }
    
    /* 2D / 3D Main Menu Style */
    $mainMenu_2d3d_style = serpentsoft_get_data('serpentsoft_switch_mainMenu_2d3d');
    
    /* Menu Colors */
    $mainMenu_color1 = serpentsoft_get_data('serpentsoft_mainmenu_backcolor_1');
    $mainMenu_color2 = serpentsoft_get_data('serpentsoft_mainmenu_backcolor_2');
    $mainMenu_color3 = serpentsoft_get_data('serpentsoft_mainmenu_backcolor_3');
    $mainMenu_color4 = serpentsoft_get_data('serpentsoft_mainmenu_backcolor_4');
    
    $mainMenu_fontcolor = serpentsoft_get_data('serpentsoft_mainmenu_fontcolor');
    $mainMenu_fontcolor_hover = serpentsoft_get_data('serpentsoft_mainmenu_fontcolor_hover');
    
    $mainMenu_vertDivider_borderLeftColor = serpentsoft_get_data('serpentsoft_mainmenu_vert_divider_leftcolor');
    $mainMenu_vertDivider_borderRightColor = serpentsoft_get_data('serpentsoft_mainmenu_vert_divider_rightcolor');
    
    $mainMenu_dropdown_color = serpentsoft_get_data('serpentsoft_mainmenu_dropdown_backcolor');
    $mainMenu_dropdown_bordercolor = serpentsoft_get_data('serpentsoft_mainmenu_dropdown_bordercolor');
    $mainMenu_dropdown_li_bordercolor = serpentsoft_get_data('serpentsoft_mainmenu_dropdown_li_bordercolor');
    
    $output .= '.navbar-main .navbar .nav > li > a, .navbar-main .navbar .nav > li > i, .navbar-main .navbar .brand, .navbar-main .navbar .nav > li > a [class^="icon-"], .navbar-main .navbar .nav > li > a [class*="icon-"], .navbar-main .dropdown-menu > li > a, .navbar-main .navbar .nav > .active > a:focus .navbar-main .navbar .nav.pull-right > li > a [class^="icon-"], .navbar-main .navbar .nav.pull-right > li > a [class*="icon-"] { color: ' . $mainMenu_fontcolor . '; }';
    
    $output .= '.navbar-main .navbar .nav li.dropdown > .dropdown-toggle .caret{ border-top-color: ' . $mainMenu_fontcolor . '; border-bottom: ' . $mainMenu_fontcolor . '; }';
    
    $output .= '.dropdown-submenu>a:after { border-left-color: ' . $mainMenu_fontcolor . '; }';
    
    $output .= '.navbar-main .dropdown-menu > li:hover > a, .navbar-main .dropdown-menu > li:hover > a, .navbar-main .dropdown-submenu:hover > a{ color: ' . $mainMenu_fontcolor . ' }';
    
    $output .= '.navbar-main .navbar .nav li.dropdown.open > .dropdown-toggle .caret, .navbar-main .navbar .nav li.dropdown.active > .dropdown-toggle .caret, .navbar-main .navbar .nav li.dropdown.open.active > .dropdown-toggle .caret{ border-top-color: ' . $mainMenu_fontcolor_hover . '; border-bottom: ' . $mainMenu_fontcolor_hover . '; }';
    
    $output .= '.navbar-main .navbar .nav li.dropdown.open > .dropdown-toggle, .navbar-main .navbar .nav li.dropdown.active > .dropdown-toggle, .navbar-main .navbar .nav li.dropdown.open.active > .dropdown-toggle, .navbar-main .navbar .nav > li.dropdown.active [class^="icon-"], .navbar-main .navbar .nav > li.dropdown.open.active [class^="icon-"], .navbar-main .navbar .nav > li.dropdown.active [class*="icon-"], .navbar-main .navbar .nav > li.dropdown.open.active [class*="icon-"], .navbar-main .navbar .nav > li > a:focus, .navbar-main .navbar .nav > li > a:hover, .navbar-main .navbar .nav > li > a:focus [class^="icon-"], .navbar-main .navbar .nav > li > a:hover [class^="icon-"], .navbar-main .navbar .nav > li > a:focus [class*="icon-"], .navbar-main .navbar .nav > li > a:hover [class*="icon-"], .navbar-main .navbar .nav > li > i:focus, .navbar-main .navbar .nav > li > i:hover, .navbar-main .navbar .dropdown .caret:hover, .navbar-main .navbar .nav > .active > a, .navbar-main .navbar .nav > .active > a:hover, .navbar-main .navbar .nav > .active > a:focus, .navbar-main .dropdown-menu > li > a:hover, .navbar-main .dropdown-menu > li > a:focus, .navbar-main .dropdown-submenu:hover > a, .navbar-main .dropdown-submenu:focus > a, .navbar-main .dropdown-menu > li > a:before, .navbar-main .dropdown-submenu > li > a:before{ color: ' . $mainMenu_fontcolor_hover . '}';
    
    $output .= '.dropdown-submenu:hover>a:after { border-left-color: ' . $mainMenu_fontcolor_hover . '; }';
    
    if( !$mainMenu_2d3d_style ){
        $output .= '.navbar-main .navbar .navbar-inner { background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzU0NTQ1NCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjUwJSIgc3RvcC1jb2xvcj0iIzQ5NDk0OSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjUxJSIgc3RvcC1jb2xvcj0iIzNkM2QzZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiMyODI4MjgiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);

background: -moz-linear-gradient(top, ' . $mainMenu_color1 . ' 0%, ' . $mainMenu_color2 . ' 50%, ' . $mainMenu_color3 . ' 51%, ' . $mainMenu_color4 . ' 100%); 
            
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, ' . $mainMenu_color1 . '), color-stop(50%, ' . $mainMenu_color2 . '), color-stop(51%, ' . $mainMenu_color3 . '), color-stop(100%, ' . $mainMenu_color4 . ')); 

background: -webkit-linear-gradient(top, ' . $mainMenu_color1 . ' 0%, ' . $mainMenu_color2 . ' 50%, ' . $mainMenu_color3 . ' 51%, ' . $mainMenu_color4 . ' 100%); 

background: -o-linear-gradient(top, ' . $mainMenu_color1 . ' 0%, ' . $mainMenu_color2 . ' 50%, ' . $mainMenu_color3 . ' 51%, ' . $mainMenu_color4 . ' 100%); 

background: -ms-linear-gradient(top, ' . $mainMenu_color1 . ' 0%, ' . $mainMenu_color2 . ' 50%, ' . $mainMenu_color3 . ' 51%, ' . $mainMenu_color4 . ' 100%);

background: linear-gradient(to bottom, ' . $mainMenu_color1 . ' 0%, ' . $mainMenu_color2 . ' 50%, ' . $mainMenu_color3 . ' 51%, ' . $mainMenu_color4 . ' 100%); 

filter: progid:DXImageTransform.Microsoft.gradient( startColorstr="' . $mainMenu_color1 . '", endColorstr="' . $mainMenu_color2 . '",GradientType=0 ); }';
        
        $output .= '.navbar-main .navbar .nav li.dropdown.open > .dropdown-toggle, .navbar-main .navbar .nav li.dropdown.open > .dropdown-toggle:hover, .navbar-main .navbar .nav li.dropdown.open > .dropdown-menu li a:hover, .navbar-main .dropdown-menu, .navbar-main .navbar .nav > .active > a, .navbar-main .navbar .nav > li > a:focus, .navbar-main .navbar .nav > li > a:hover, .navbar-main .navbar .nav > li > i:focus, .navbar-main .navbar .nav > li > i:hover, .navbar-main .navbar .dropdown .caret:hover, .navbar-main .navbar .nav > .active > a, .navbar-main .navbar .nav > .active > a:hover, .navbar-main .navbar .nav > .active > a:focus, .navbar-main .dropdown-menu > li > a:hover, .navbar-main .dropdown-menu > li > a:focus, .navbar-main .dropdown-menu > li:hover > a, .navbar-main .dropdown-menu > li:hover > a, .navbar-main .dropdown-submenu:hover > a, .navbar-main .dropdown-submenu:focus > a, .navbar-main .navbar .nav li.current-menu-item > a, .navbar-main .navbar .nav li.open.current-menu-item > a, .navbar-main .navbar .nav li.dropdown.active > .dropdown-toggle, .navbar-main .navbar .nav li.dropdown.open.active > .dropdown-toggle, .navbar-main .navbar .nav li.current-menu-ancestor.dropdown > a, .navbar-main .navbar .nav li.open.current-menu-ancestor.dropdown > a, .navbar-main .navbar .nav li.current-menu-ancestor.dropdown:hover > a, .navbar-main .navbar .nav li.open.current-menu-ancestor.dropdown:hover > a { box-shadow: inset 0px 0px 10px rgba(0,0,0,0.5); -moz-box-shadow: inset 0px 0px 10px rgba(0,0,0,0.5); -webkit-box-shadow: inset 0px 0px 10px rgba(0,0,0,0.5); }';
    }
    else{
        $output .= '.navbar-main .navbar .navbar-inner { background: ' . $mainMenu_color1 . '; background-color: ' . $mainMenu_color1 . '; }';
    }
    
    $output .= '.navbar-main .dropdown-menu { background-color: ' . $mainMenu_dropdown_color . '; }';
    $output .= '.navbar-main .dropdown-menu { border-color: ' . $mainMenu_dropdown_bordercolor . '; }';
    $output .= '.navbar-main .navbar .divider-vertical { border-left-color: ' . $mainMenu_vertDivider_borderLeftColor . '; border-right-color: ' . $mainMenu_vertDivider_borderRightColor . '; }';
    $output .= '.navbar-main .dropdown-menu > li{ border-bottom-color: ' . $mainMenu_dropdown_li_bordercolor . ' }';
    
    wp_add_inline_style('serpentsoft_custom_style', $output);
}
add_action( 'wp_enqueue_scripts', 'serpentsoft_style_main_theme_color' );
/* =============================== End Of Main Theme Color ====================================*/

/*  */
function serpentsoft_style_full_width_custom_content($marginBottom = 40){
    $output = '';
    if(serpentsoft_get_data('serpentsoft_switch_fullWidth_content') ){
        $marginBottom = serpentsoft_get_data('serpentsoft_fullWidth_custom_content_marginBottom');
        $content_alignment = serpentsoft_get_data('rdo_serpentsoft_fullWidth_custom_conten_alignment');
        
        //Full Width Custom Content
        if( !is_numeric($marginBottom) || $marginBottom < 0 ){ $marginBottom = 40; }

        $output .= '.full-width-custom-content{ margin-bottom: ' . $marginBottom . 'px;';
        $output .= 'text-align: ' . $content_alignment . ';';
        $output .= '}';
        wp_add_inline_style('serpentsoft_custom_style', $output);
    }
}
add_action( 'wp_enqueue_scripts', 'serpentsoft_style_full_width_custom_content' );

/* =================================================================================== */
// ----------------------------- Whole Site Background ----------------------------------
/* =================================================================================== */
function serpentsoft_style_background(){
    if( serpentsoft_get_data('serpentsoft_switch_fixed_layout') ):
        
        $output = 'html {';
        $background_position = '';
        $background_style = serpentsoft_get_data('rdo_serpentsoft_body_background_styles');

        switch ($background_style) {
            case 'none':
                $output .= 'background-color: #ffffff; ';
                break;

            case 'pattern':
                if( serpentsoft_get_data('serpentsoft_body_background_pattern_images') != (get_template_directory_uri() . '/images/bg/bg0.png') ){
                    $output .= 'background-image: url(' . serpentsoft_get_data('serpentsoft_body_background_pattern_images') . '); ';
                }
                if( serpentsoft_get_data('serpentsoft_body_background_pattern_color') ){
                    $color = serpentsoft_get_data('serpentsoft_body_background_pattern_color');
                    $output .= 'background-color: ' . $color . '; ';
                }
            break;

            case 'custom':
                if( serpentsoft_get_data('serpentsoft_switch_body_background_image_style') ){
                    $output .= '-webkit-background-size: cover;-moz-background-size: cover;-o-background-size: cover;background-size: cover;';
                }

                if( serpentsoft_get_data('serpentsoft_body_background_image_upload') ){
                    $output .= 'background-image: url(' . serpentsoft_get_data('serpentsoft_body_background_image_upload') . '); ';
                }
                else{ $output .= 'background-image: none; '; }

                if( serpentsoft_get_data('serpentsoft_body_background_image_color') ){
                    $output .= 'background-color: ' . serpentsoft_get_data('serpentsoft_body_background_image_color') . '; ';
                }
                if( serpentsoft_get_data('serpentsoft_select_body_background_image_repeat') != 'default' ){
                    $output .= 'background-repeat: ' . serpentsoft_get_data('serpentsoft_select_body_background_image_repeat') . '; ';
                }
                if( serpentsoft_get_data('serpentsoft_select_body_background_image_attachment') != 'default' ){
                    $output .= 'background-attachment: ' . serpentsoft_get_data('serpentsoft_select_body_background_image_attachment') . '; ';
                }
                if( serpentsoft_get_data('serpentsoft_select_body_background_image_position_horiz') != 'default' ){
                    $background_position .= serpentsoft_get_data('serpentsoft_select_body_background_image_position_horiz');
                }
                if( serpentsoft_get_data('serpentsoft_select_body_background_image_position_vert') != 'default' ){
                    $background_position .= ' ' . serpentsoft_get_data('serpentsoft_select_body_background_image_position_vert');
                }
                if( isset($background_position) && !empty($background_position) ){
                    $output .= 'background-position: ' . trim($background_position) . '; ';
                }
                break;

            default:
                break;
        }
        $output .= '}';
        
        //Note: serpentsoft_custom_style is the same name of enqueue script (custom_styles.css)
        wp_add_inline_style('serpentsoft_custom_style', $output);
    endif;
}
add_action( 'wp_enqueue_scripts', 'serpentsoft_style_background' );
/* =============================== End Of Whole Site Background ====================================*/

/* =================================================================================== */
// -------------------------------- Body Style ---------------------------------------
/* =================================================================================== */
function serpentsoft_style_body(){
    $output = '';
    $background_position = '';
    
    $body_layout = serpentsoft_get_data('serpentsoft_switch_fixed_layout');
    /* $body_background_color = serpentsoft_get_data('serpentsoft_body_background_color'); */
    
    if( $body_layout ){
        $output .= 'body { ';
        if( $body_layout ) { $output .= 'max-width: 1280px; '; } else{ $output .= 'max-width: 100%; '; }
        $output .= '} /* body style end */';
    }
    
    $background_color = serpentsoft_get_data('serpentsoft_body_main_background_color');
    $background_image = serpentsoft_get_data('serpentsoft_body_main_background_image_upload');
    $background_repeat = serpentsoft_get_data('serpentsoft_select_body_main_background_image_repeat');
    $background_attachement = serpentsoft_get_data('serpentsoft_select_body_main_background_image_attachment');
    $background_position_horiz = serpentsoft_get_data('serpentsoft_select_body_main_background_image_position_horiz');
    $background_position_vert = serpentsoft_get_data('serpentsoft_select_body_main_background_image_position_vert');
    
    if( !empty($background_image) ){
        $output .= 'body.custom-background{ ';
        
        if( !empty($background_color) ) { $output .= sprintf('background-color: %1$s; ', '#fff'); }
        if( !empty($background_image) ) { $output .= sprintf('background-image: url("%1$s"); ', $background_image); }
        if( $background_repeat != 'default' ) { $output .= sprintf('background-repeat: %1$s; ', $background_repeat); }
        if( $background_attachement != 'default' ) { $output .= sprintf('background-attachment: %1$s; ', $background_attachement); }
        if( $background_position_horiz != 'default' ) { $background_position .= $background_position_horiz; }
        if( $background_position_vert != 'default' ) { $background_position .= ' ' . $background_position_vert;  }
        
        if( isset($background_position) && !empty($background_position) ){ $output .= sprintf('background-position: %1$s; ', trim($background_position)); }
        
        $output .= ' }';
    }
    elseif( empty($background_image) && !empty($background_color) ){
        $output .= 'body.custom-background{ ';
        $output .= sprintf('background-color: %1$s; ', $background_color);
        $output .= '}';
    }
    
    $lnk_body_deco = serpentsoft_get_data('serpentsoft_body_link_decoration');
    $lnk_body_deco_hover = serpentsoft_get_data('serpentsoft_body_link_decoration_onhover');
    $lnk_body_color = serpentsoft_get_data('serpentsoft_body_link_color');
    $lnk_body_color_hover = serpentsoft_get_data('serpentsoft_body_link_color_onhover');
    
    /* Anchor (Body) Style */
    $output .= 'a { ';
    if( $lnk_body_deco != 'default' ) { $output .= sprintf('text-decoration: %1$s ; ', $lnk_body_deco); }
    if( !empty($lnk_body_color) ) { $output .= sprintf('color: %1$s ; ', $lnk_body_color); }
    $output .= '} /* anchor style end */';
    
    /* Anchor On Hover (Body) Style */
    $output .= 'a:hover { ';
    if( $lnk_body_deco_hover != 'default' ) { $output .= sprintf('text-decoration: %1$s ; ', $lnk_body_deco_hover); }
    if( !empty($lnk_body_color_hover) ) { $output .= sprintf('color: %1$s ; ', $lnk_body_color_hover); }
    $output .= '} /* anchor onhover style end */';
    
    //Note: (serpentsoft_custom_style) is the same name of enqueue script (custom_styles.css)
    wp_add_inline_style('serpentsoft_custom_style', $output);
}
add_action( 'wp_enqueue_scripts', 'serpentsoft_style_body' );
/* =============================== End Of Body Style ====================================*/

/* =================================================================================== */
// ------------------------------- Top Menu Style ------------------------------------
/* =================================================================================== */
function serpentsoft_style_top_menu(){
    $output = '';
    $background_position = '';
    
    $background_color = serpentsoft_get_data('serpentsoft_topmenu_background_color');
    
    $background_image = serpentsoft_get_data('serpentsoft_topmenu_background_image_upload');
    $background_repeat = serpentsoft_get_data('serpentsoft_select_topmenu_background_image_repeat');
    $background_attachement = serpentsoft_get_data('serpentsoft_select_topmenu_background_image_attachment');
    $background_position_horiz = serpentsoft_get_data('serpentsoft_select_topmenu_background_image_position_horiz');
    $background_position_vert = serpentsoft_get_data('serpentsoft_select_topmenu_background_image_position_vert');
    
    $lnk_deco = serpentsoft_get_data('serpentsoft_topmenu_link_decoration');
    $lnk_deco_hover = serpentsoft_get_data('serpentsoft_topmenu_link_decoration_onhover');
    $lnk_color = serpentsoft_get_data('serpentsoft_topmenu_link_color');
    $lnk_color_hover = serpentsoft_get_data('serpentsoft_topmenu_link_color_onhover');
    
    if( !empty($background_color) || !empty($background_image) || $background_repeat != 'default' || $background_attachement != 'default'
            || $background_position_horiz != 'default' || $background_position_vert != 'default' ){
        $output .= '.top-menu-2 .navbar-inner, .top-menu-2 ul.nav > .dropdown > .dropdown-menu, .top-menu-2 .dropdown-submenu > .dropdown-menu{ ';
        
        if( !empty($background_color) ) { $output .= sprintf('background-color: %1$s; ', $background_color); }
        if( !empty($background_image) ) { $output .= sprintf('background-image: url("%1$s"); ', $background_image); }
        if( $background_repeat != 'default' ) { $output .= sprintf('background-repeat: %1$s; ', $background_repeat); }
        if( $background_attachement != 'default' ) { $output .= sprintf('background-attachment: %1$s; ', $background_attachement); }
        if( $background_position_horiz != 'default' ) { $background_position .= $background_position_horiz; }
        if( $background_position_vert != 'default' ) { $background_position .= ' ' . $background_position_vert;  }
        
        if( isset($background_position) && !empty($background_position) ){ $output .= sprintf('background-position: %1$s; ', trim($background_position)); }
        
        $output .= ' }';
    }
    
    if( $lnk_deco != 'default' || !empty($lnk_color) ){
        $output .= '.top-menu-2 a, .top-menu-2 .navbar .nav > li > a, .top-menu-2 .dropdown-menu > li a{ ';
        if( $lnk_deco != 'default' ) { $output .= sprintf('text-decoration: %1$s; ', $lnk_deco); }
        if( !empty($lnk_color) ) { $output .= sprintf('color: %1$s; ', $lnk_color); }
        $output .= ' }';
    }
    
    if( $lnk_deco_hover != 'default' || !empty($lnk_color_hover) ){
        $output .= '.top-menu-2 a:hover, .top-menu-2 .navbar .nav > li:hover > a, .top-menu-2 i:hover, .top-menu-2 .dropdown-menu > li a:hover, .navbar-inverse .nav li.dropdown.open>.dropdown-toggle, .navbar-inverse .nav li.dropdown.active>.dropdown-toggle, .navbar-inverse .nav li.dropdown.open.active>.dropdown-toggle{ ';
        
        if( $lnk_deco_hover != 'default' ) { $output .= sprintf('text-decoration: %1$s; ', $lnk_deco_hover); }
        if( !empty($lnk_color_hover) ) { $output .= sprintf('color: %1$s; ', $lnk_color_hover); }
        $output .= ' }';
    }
    
    wp_add_inline_style('serpentsoft_custom_style', $output);
}
add_action( 'wp_enqueue_scripts', 'serpentsoft_style_top_menu' );
/* =============================== End Of Top Menu ====================================*/


/* =================================================================================== */
// -------------------------------- Footer Style ---------------------------------------
/* =================================================================================== */
function serpentsoft_style_footer(){
    $output = '';
    $background_position = '';
    
    $background_color = serpentsoft_get_data('serpentsoft_footer_background_color');
    $background_image = serpentsoft_get_data('serpentsoft_footer_background_image_upload');
    $background_repeat = serpentsoft_get_data('serpentsoft_select_footer_background_image_repeat');
    $background_attachement = serpentsoft_get_data('serpentsoft_select_footer_background_image_attachment');
    $background_position_horiz = serpentsoft_get_data('serpentsoft_select_footer_background_image_position_horiz');
    $background_position_vert = serpentsoft_get_data('serpentsoft_select_footer_background_image_position_vert');
    
    if( !empty($background_image) ){
        $output .= '.modern-footer{ ';
        
        if( !empty($background_color) ) { $output .= sprintf('background-color: %1$s; ', '#333'); }
        if( !empty($background_image) ) { $output .= sprintf('background-image: url("%1$s"); ', $background_image); }
        if( $background_repeat != 'default' ) { $output .= sprintf('background-repeat: %1$s; ', $background_repeat); }
        if( $background_attachement != 'default' ) { $output .= sprintf('background-attachment: %1$s; ', $background_attachement); }
        if( $background_position_horiz != 'default' ) { $background_position .= $background_position_horiz; }
        if( $background_position_vert != 'default' ) { $background_position .= ' ' . $background_position_vert;  }
        
        if( isset($background_position) && !empty($background_position) ){ $output .= sprintf('background-position: %1$s; ', trim($background_position)); }
        
        $output .= ' }';
    }
    elseif( empty($background_image) && !empty($background_color) ){
        $output .= '.modern-footer{ ';
        $output .= sprintf('background-color: %1$s; ', $background_color);
        $output .= '}';
    }
    
    $lnk_body_deco = serpentsoft_get_data('serpentsoft_footer_link_decoration');
    $lnk_body_deco_hover = serpentsoft_get_data('serpentsoft_footer_link_decoration_onhover');
    $lnk_body_color = serpentsoft_get_data('serpentsoft_footer_link_color');
    $lnk_body_color_hover = serpentsoft_get_data('serpentsoft_footer_link_color_onhover');
    
    /* Anchor (Body) Style */
    $output .= '.modern-footer a { ';
    if( $lnk_body_deco != 'default' ) { $output .= sprintf('text-decoration: %1$s ; ', $lnk_body_deco); }
    if( !empty($lnk_body_color) ) { $output .= sprintf('color: %1$s ; ', $lnk_body_color); }
    $output .= '} /* anchor style end */';
    
    /* Anchor On Hover (Body) Style */
    $output .= '.modern-footer a:hover { ';
    if( $lnk_body_deco_hover != 'default' ) { $output .= sprintf('text-decoration: %1$s ; ', $lnk_body_deco_hover); }
    if( !empty($lnk_body_color_hover) ) { $output .= sprintf('color: %1$s ; ', $lnk_body_color_hover); }
    $output .= '} /* anchor onhover style end */';
    
    //Note: (serpentsoft_custom_style) is the same name of enqueue script (custom_styles.css)
    wp_add_inline_style('serpentsoft_custom_style', $output);
}
add_action( 'wp_enqueue_scripts', 'serpentsoft_style_footer' );
/* =============================== End Of Footer Style ====================================*/


/* =================================================================================== */
// ----------------------- Social Icons Background Colors Style -------------------------
/* =================================================================================== */
function serpentsoft_style_social_icons_color(){
    $output = '';
    $color_body = serpentsoft_get_data('serpentsoft_social_color_body');
    $color_top_menu = serpentsoft_get_data('serpentsoft_social_color_top_menu');
    $color_footer = serpentsoft_get_data('serpentsoft_social_color_footer');
    
    $output .= sprintf('ul.social-networks > li { background-color: %1$s; }', empty($color_body) ? 'transparent' : $color_body);
    $output .= sprintf('.top-menu-2 .w-social-icons ul.social-networks > li { background-color: %1$s; }', empty($color_top_menu) ? 'transparent' : $color_top_menu);
    $output .= sprintf('.modern-footer ul.social-networks > li { background-color: %1$s; }', empty($color_footer) ? 'transparent' : $color_footer);
    
    wp_add_inline_style('serpentsoft_custom_style', $output);
}
add_action( 'wp_enqueue_scripts', 'serpentsoft_style_social_icons_color' );
/* =============================== End Of Social Icons Background ====================================*/

/* =================================================================================== */
// ---------------------------------- CUSTOM CSS Styles --------------------------------
/* =================================================================================== */
function serpentsoft_style_custom_css(){
    $output = '';
    
    $css_global = serpentsoft_get_data('serpentsoft_styling_css_custom_global');
    $css_large_display = serpentsoft_get_data('serpentsoft_styling_css_custom_LargeDisplay');
    $css_tablet = serpentsoft_get_data('serpentsoft_styling_css_custom_Tablet');
    $css_portrait_tablet = serpentsoft_get_data('serpentsoft_styling_css_custom_PortraitTablet');
    $css_landscape_phone = serpentsoft_get_data('serpentsoft_styling_css_custom_LandscapePhone');
    $css_landscape_phone_down = serpentsoft_get_data('serpentsoft_styling_css_custom_LandscapePhoneAndDown');
    
    if( !empty($css_global) ) { $output .= $css_global; }
    if( !empty($css_large_display) ) { $output .= sprintf('@media only screen and ( max-width: 1230px ) { %1$s }', $css_large_display); }
    if( !empty($css_tablet) ) { $output .= sprintf('@media only screen and ( max-width: 1050px ) { %1$s }', $css_tablet); }
    if( !empty($css_portrait_tablet) ) { $output .= sprintf('@media (min-width: 768px) and (max-width: 979px) { %1$s }', $css_portrait_tablet); }
    if( !empty($css_landscape_phone) ) { $output .= sprintf('@media (max-width: 767px) { %1$s }', $css_landscape_phone); }
    if( !empty($css_landscape_phone_down) ) { $output .= sprintf('@media (max-width: 480px) { %1$s }', $css_landscape_phone_down); }
    
    wp_add_inline_style('serpentsoft_custom_style', $output);
}
add_action( 'wp_enqueue_scripts', 'serpentsoft_style_custom_css' );
?>