<?php
/**
 * Dynamic css
 *
 * @since Education Base 1.0.0
 *
 * @param null
 * @return null
 *
 */
if ( ! function_exists( 'education_base_dynamic_css' ) ) :

    function education_base_dynamic_css() {

        global $education_base_customizer_all_values;
        /*Color options */
        $education_base_primary_color = $education_base_customizer_all_values['education-base-primary-color'];
        $education_base_header_top_color = $education_base_customizer_all_values['education-base-header-top-color'];
        $education_base_footer_color = $education_base_customizer_all_values['education-base-footer-color'];
        $education_base_footer_bottom_color = $education_base_customizer_all_values['education-base-footer-bottom-color'];
        $custom_css = '';

        /*background*/
        if( get_header_image() ){
            $bg_image_url = get_header_image();
        }
        else{
            $bg_image_url =   get_template_directory_uri()."/assets/img/university.jpg";
        }
        $custom_css .= "
              .inner-main-title {
                background-image:url('{$bg_image_url}');
                background-repeat:no-repeat;
                background-size:cover;
                background-attachment:fixed;
                background-position: center; 
            }";
        /*color*/
        $custom_css .= "
            .top-header,
            article.post .entry-header .year,
            .wpcf7-form input.wpcf7-submit ::before ,
            .btn-primary::before {
                background-color: {$education_base_header_top_color};
            }";
        $custom_css .= "
            .site-footer{
                background-color: {$education_base_footer_color};
            }";
        $custom_css .= "
            .copy-right{
                background-color: {$education_base_footer_bottom_color};
            }";
        $custom_css .= "
            a:hover,
            a:active,
            a:focus,
            .widget li a:hover,
            .posted-on a:hover,
            .author.vcard a:hover,
            .cat-links a:hover,
            .comments-link a:hover,
            .edit-link a:hover,
            .tags-links a:hover,
            .byline a:hover,
            .main-navigation .acme-normal-page .current_page_item a,
            .main-navigation .acme-normal-page .current-menu-item a,
            .main-navigation .active a,
            .main-navigation .navbar-nav >li a:hover,
            .team-item h3 a:hover,
            .news-notice-content .news-content a:hover{
                color: {$education_base_primary_color};
            }";

        /*background color*/
        $custom_css .= "
            .navbar .navbar-toggle:hover,
            .main-navigation .current_page_ancestor > a:before,
            .comment-form .form-submit input,
            .btn-primary,
            .line > span,
            .wpcf7-form input.wpcf7-submit,
            .wpcf7-form input.wpcf7-submit:hover,
            .owl-buttons > div i:hover,
            article.post .entry-header,
            .sm-up-container,
            .read-more,
            .testimonial-content{
                background-color: {$education_base_primary_color};
            }";

        /*borders*/
        $custom_css .= "
            .blog article.sticky,
            .top-header .read-more{
                border: 2px solid {$education_base_primary_color};
            }";

        /*custom css*/
        $education_base_custom_css = wp_strip_all_tags ( $education_base_customizer_all_values['education-base-custom-css'] );
        if ( ! empty( $education_base_custom_css ) ) {
            $custom_css .= $education_base_custom_css;
        }
        wp_add_inline_style( 'education-base-style', $custom_css );
    }
endif;
add_action( 'wp_enqueue_scripts', 'education_base_dynamic_css', 99 );