<?php if (!defined('ABSPATH')) die('Direct access forbidden.');
/**
 * dynamic css, generated by customizer options
 */

if ( defined( 'FW' ) ) {
    $typography = vinkmag_option( 'typography' );
    $body_bg = vinkmag_option( 'style_body_bg', '#f0f1f4' );
    $style_primary = vinkmag_option( 'style_primary');
    $style_primary_dark = vinkmag_option( 'style_primary_dark');
    $title_color = vinkmag_option( 'title_color');

    $body_bg_img = vinkmag_option('body_bg_img');
    $body_bg_url = '';
    if(isset($body_bg_img) && is_array($body_bg_img)){
        $body_bg_url = $body_bg_img['url'];
    }
    

// for dark theme start
    $style_theme_setting_options  = vinkmag_option('style_theme_setting_options');
    $box_bg_color  = $style_theme_setting_options['dark']['box_bg_color'];
    $body_text_color  = $style_theme_setting_options['dark']['body_text_color'];
    $title_text_color  = $style_theme_setting_options['dark']['title_text_color'];
   
    if($box_bg_color==''){
        $box_bg_color  ='#1f1f1f';
    }

    if($body_text_color==''){
        $body_text_color  ='#a9a9a9';
    }
    if($title_text_color==''){
        $title_text_color  ='#fff';
    }

    
// for dark theme end

    $global_body_font = vinkmag_option( 'body_font' );
    if ( $global_body_font[ 'family' ] != 'Arimo' ) {
        Vinkmag_Unyson_Google_Fonts::add_typography( vinkmag_option( 'body_font' ) );
    }
    $body_font = vinkmag_advanced_font_styles( vinkmag_option( 'body_font' ), 'font-family' );
    $cat_font = vinkmag_advanced_font_styles( vinkmag_option( 'heading_font' ), 'font-family' );

    $heading_font = vinkmag_option( 'heading_font' );
    if ( $heading_font[ 'family' ] != 'Heebo' ) {
        Vinkmag_Unyson_Google_Fonts::add_typography( vinkmag_option( 'heading_font' ) );
    }
    $global_heading_font = vinkmag_advanced_font_styles( vinkmag_option( 'heading_font' ) );

    $custom_css	 = vinkmag_option( 'custom_css' );
    $output		 = 
        $custom_css."
        body{ $body_font }
        h1,h2,h3,h4,h5 { 
            $global_heading_font 
        }

        .nav-menu li a,.post-cat,.post-list-item .nav-tabs li a,.ts-social-list li b,
        .widgets.ts-social-list-item ul li a b,.footer-social li a,.ts-cat-title span,
        .view-link-btn span { 
            $cat_font
        }
        .body-inner-content{
          background-color:$body_bg;
          background-image: url($body_bg_url);
          background-repeat: no-repeat;
          background-position: top center;
          background-size: cover;
        }

        /* primary background color*/
        .top-bar .top-social li.ts-date,
        .view-link-btn,
        .logo,
        .navbar-style1.navbar-container .navbar .nav-item a.active, 
        .navbar-style1.navbar-container .navbar .nav-item a:hover, 
        .navbar-style1.navbar-container .navbar .nav-item a:focus,
        .navbar-style1.navbar-container .nav-search-button,
        .ts-title .title-before,
        .owl-dots .owl-dot span,
        #breaking_slider .owl-nav .owl-prev:hover, #breaking_slider .owl-nav .owl-next:hover,
        .navbar-container.navbar-style5 .nav-item a.active:before, 
        .navbar-container.navbar-style5 .nav-item a:hover:before,
         .navbar-container.navbar-style5 .nav-item a:focus:before,
        .ts-newslatter .newsletter-form .ts-submit-btn .btn:hover,
        .top-bar .ts-date-item,
        .header-middle.v2,
        .video-slider .post-video .ts-play-btn,
        .top-social li.ts-subscribe,
        .ts-title.title-bg .title-text,
        .ts-title.title-bg .title-after,
        .ts-widget-newsletter,
        .ts-widget-newsletter .newsletter-form .btn:hover,
        .header-standerd,
        .navbar-container.navbar-style2,
        .navbar-container.navbar-style2 .navbar,
        .navbar-style2.navbar-container .nav-search-button,
        .navbar-container.navbar-style3.navbar-dark .nav-item a.active, .navbar-container.navbar-style3.navbar-dark .nav-item a:hover,
        .navbar-container.navbar-style3.navbar-dark .nav-item a:focus,
        .navbar-standerd.navbar-darks .navbar-style5 .xs-navbar .main-menu > li:hover > a, .navbar-standerd.navbar-darks .navbar-style5 .xs-navbar .main-menu > li.active > a,
        .navbar-standerd.navbar-darks .navbar-style5 .xs-navbar .main-menu > li:before,
        .single-post-wrapper .post-meta-info li.share-post a i,
        .widget-title:before,
        .tagcloud a:hover,
         blockquote cite:after,
        .error-page .error-body a,
        .accordion-post-style .card .btn,
        .navbar-container.navbar-style1 .navbar-nav > .current-menu-parent,
        .widgets-newsletter-form .btn.btn-primary,
        .pagination li.active a, .pagination li:hover a,
        .blog-navbar .navbar-container .navbar .main-menu .nav-item > a.active,
        .blog-navbar .navbar-container.navbar-style5 .main-menu > li.current-menu-item > a:before,
        .blog-navbar .navbar-container .navbar .main-menu .nav-item > a:hover,
        .btn.btn-primary,
        .navbar-standerd.nav-bg-white .navbar-style5 .navbar .main-menu .nav-item > a.active,
        .navbar-standerd.nav-bg-white .navbar-style5 .navbar .main-menu > .nav-item > a:hover,
        .post-content-loading a:hover,
        .instagram-area .follow-btn-area .btn:hover,
        .post-list-item .nav-tabs li a::before,
        .ts-search-form .vinkmag-serach:before,
        .xs-review-overview-list.custom-rat .xs-overview-percentage .data-rat .xs-percentange .percentange_check,
        .view-review-list .xs-review-rattting.xs-percentange .percentange_check,
        .public-xs-review-box .xs-save-button button,
        .featured-tab-item .featured-tab-post > li a.active .post-content,
        .featured-tab-item .featured-tab-post > li a.active:before,
        .woocommerce ul.products li.product .button,.woocommerce ul.products li.product .added_to_cart,
        .post-meta-info .share-post,
        .woocommerce nav.woocommerce-pagination ul li a:focus, .woocommerce nav.woocommerce-pagination ul li a:hover, .woocommerce nav.woocommerce-pagination ul li span.current,
        .woocommerce #respond input#submit.alt, .woocommerce a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt,.sponsor-web-link a:hover i, .woocommerce .widget_price_filter .ui-slider .ui-slider-range, .woocommerce span.onsale{
            background-color: $style_primary;
        }

        /* primary color*/
        .breaking-title,
        .ts-top-nav li a:hover,
        .post-title a:hover,
        .owl-next,
        .owl-prev,
        .watch-post .post-list-box .post-title:hover,
        a:hover,
        .single-post a,
        .navbar-container .navbar .nav-item .dropdown-menu .dropdown-item.active, .navbar-container .navbar .nav-item .dropdown-menu .dropdown-item:hover, .navbar-container .navbar .nav-item .dropdown-menu .dropdown-item:focus,
        .ts-overlay-style .overlay-post-content .post-meta-info li.active,
        .navbar-container.navbar-style5 .nav-item a.active, .navbar-container.navbar-style5 .nav-item a:hover, .navbar-container.navbar-style5 .nav-item a:focus,
        .post-meta-info li.active, .post-video .post-video-content .post-meta-info li.active, .navbar-container.navbar-style3 .nav-item a.active, .navbar-container.navbar-style3 .nav-item a:hover, .navbar-container.navbar-style3 .nav-item a:focus, .post-navigation .post-previous:hover span, .post-navigation .post-next:hover span, .breadcrumb li, 
         .woocommerce ul.products li.product .price, .woocommerce ul.products li.product .woocommerce-loop-product__title,
         .single-post a,
         .navbar-container .navbar .main-menu .nav-item .dropdown-menu > li > .dropdown-item:hover{
           color: $style_primary;
        }

        /* primary dark color*/
        .top-bar.v2,
        .ts-widget-newsletter .newsletter-form .btn,.navbar-container.navbar-style2 .nav-item a.active, .navbar-container.navbar-style2 .nav-item a:hover,
         .navbar-container.navbar-style2 .nav-item a:focus,.widgets-newsletter-form .btn.btn-primary:hover, 
         .woocommerce ul.products li.product .added_to_cart:hover, .woocommerce #respond input#submit.alt:hover, .woocommerce a.button.alt:hover, .woocommerce button.button.alt:hover, .woocommerce input.button.alt:hover,.woocommerce .widget_price_filter .ui-slider .ui-slider-handle{
           background-color: $style_primary_dark;
        }
        .woocommerce ul.products li.product .woocommerce-loop-product__title:hover{
                   color: $style_primary_dark;

        }
        .menu-toggler{
            background-color: $style_primary_dark !important;

        }
        /* border color*/
        .tagcloud a:hover{
           border-color:$style_primary;
        }


        /*--------------- title color----------------*/
        .post-title,
        .post-title a,
        .entry-title,
        .entry-title a,
        .elementor-widget-wp-widget-archives ul li a,
        .recent-posts-widget ul li .post-info,
        .ts-title,
        .widget-title,
        body.single-post .post-title a,
        .post-navigation a span,
        h1, h2, h3, h4, h5, h6,{
            color: $title_color;
        }

        /*--------------- for dark theme ----------------*/
    
        .dark-themes .ts-grid-box, .dark-themes .archive .category-layout-1 .ts-grid-box.ts-grid-content,
         .dark-themes.archive .category-layout-2 .ts-grid-box.ts-grid-content, 
         .dark-themes.archive .category-layout-3 .ts-grid-box.ts-grid-content, 
         .dark-themes .vinkmag-masonary-grid .card-columns .card, .dark-themes .post-list-item,
          .dark-themes .breadcrumb, .dark-themes .post-content-box .post-content, 
        .dark-themes .featured-tab-item .featured-tab-post .post-content,
        .dark-themes .ts-breaking-news,
        .dark-themes .navbar-style1.navbar-container .navbar,
        .dark-themes .ts-tranding-post .slider-indicators .post-content,
        .dark-themes .ts-newslatter,
        .dark-themes .ts-footer-social-list,
        .dark-themes .top-bar,
        .dark-themes .input-group-append,
        .dark-themes .ts-grid-item-2.ts-grid-content,
        .dark-themes .navbar-standerd.navbar-darks .navbar-style5 .xs-navbar{
            background: $box_bg_color;
        }
        .dark-themes .post-title, .dark-themes .post-title a,
        .dark-themes .entry-title, .dark-themes .entry-title a,
        .dark-themes .elementor-widget-wp-widget-archives ul li a, 
        .dark-themes .recent-posts-widget ul li .post-info, .dark-themes .ts-title, 
        .dark-themes .widget-title, .dark-themes h1, .dark-themes h2, .dark-themes h3,
        .dark-themes h4, .dark-themes h5, .dark-themes h6,
        .dark-themes .post-list-item .nav-tabs li a.active,
        .dark-themes body.single-post .post-title a,
        .dark-themes .post-navigation a span,
        .dark-themes .recent-posts-widget ul li .post-info .entry-title a{
            color: $title_text_color;
        }
        .dark-themes .single-post-wrapper p, .dark-themes body,
         .dark-themes p, .dark-themes span, 
         .dark-themes .widgets ul li a,
          .dark-themes .apsc-theme-2 .apsc-each-profile a .apsc-inner-block .apsc-count,
           .dark-themes .entry-content ul li, .dark-themes .post-meta-info li.author a,
            .dark-themes .breadcrumb li a, .dark-themes .post-content p, 
        .dark-themes .tagcloud strong,
        .dark-themes .post-meta-info li,
        .dark-themes .ts-breaking-news p a{
            color: $body_text_color;
        }
       
    
        ";

    if(is_category()){
        $category = get_category( get_query_var( 'cat' ) );
        $body_bg = vinkmag_term_option($category->cat_ID, 'block_style_body_bg', '#f0f1f4');
        $output .= "
        .archive.body-inner-content{
            background-color: $body_bg;
        }";
    }

    wp_add_inline_style( 'vinkmag-style', $output );
}