<?php

function anps_get_custom_styles() {
    // Try to get from cache

    $styles = get_transient( 'anps_theme_options_styles' );
    if ( $styles !== false ) {
        return $styles;
    }

    $styles = array();
    /**
     * Get font family styles from theme options
     */
    // Set default font styles
    $styles['font_1']        = 'PT Serif';
    $styles['font_1_source'] = 'Google fonts';

    $styles['font_2']        = 'PT Sans';
    $styles['font_2_source'] = 'Google fonts';

    $styles['font_3']        = 'Montserrat';
    $styles['font_3_source'] = 'Google fonts';

    $styles['logo_font']        = 'Arial, sans-serif';
    $styles['logo_font_source'] = 'System fonts';

    // Adjust default font families based on theme options
    $valid_font_sources = array( 'System fonts', 'Custom fonts', 'Google fonts' );

    $font_1_source = get_option( 'font_source_1' );
    if ( in_array( $font_1_source, $valid_font_sources ) ) {
        $styles['font_1']        = urldecode( get_option( 'font_type_1' ) );
        $styles['font_1_source'] = $font_1_source;
    }

    $font_2_source = get_option( 'font_source_2' );
    if ( in_array( $font_2_source, $valid_font_sources ) ) {
        $styles['font_2']        = urldecode( get_option( 'font_type_2' ) );
        $styles['font_2_source'] = $font_2_source;
    }

    $font_3_source = get_option( 'font_source_navigation' );
    if ( in_array( $font_3_source, $valid_font_sources ) ) {
        $styles['font_3']        = urldecode( get_option( 'font_type_navigation' ) );
        $styles['font_3_source'] = $font_3_source;
    }

    // Adjust logo font based on theme options
    $logo_font_option = explode( '|', get_option( 'anps_text_logo_font', '' ) );
    if ( isset( $logo_font_option[1] ) ) {
        $styles['logo_font']        = urldecode( $logo_font_option[0] );
        $styles['logo_font_source'] = $logo_font_option[1];
    }

    /**
     * Get font size styles from theme options
     */
    $styles['body_font_size']            = get_option( 'body_font_size', '14' );
    $styles['menu_font_size']            = get_option( 'menu_font_size', '14' );
    $styles['h1_font_size']              = get_option( 'h1_font_size', '31' );
    $styles['h2_font_size']              = get_option( 'h2_font_size', '24' );
    $styles['h3_font_size']              = get_option( 'h3_font_size', '21' );
    $styles['h4_font_size']              = get_option( 'h4_font_size', '18' );
    $styles['h5_font_size']              = get_option( 'h5_font_size', '16' );
    $styles['page_heading_h1_font_size'] = get_option( 'page_heading_h1_font_size', '24' );
    $styles['blog_heading_h1_font_size'] = get_option( 'blog_heading_h1_font_size', '28' );
    $styles['menu_text_style']           = get_option( 'anps_menu_text_style', 'uppercase' );

    /**
     * Get all colors from theme options
     */
    $styles['text_color']                          = get_option( 'text_color', '#727272' );
    $styles['primary_color']                       = get_option( 'primary_color', '#26507a' );
    $styles['hovers_color']                        = get_option( 'hovers_color', '#3178bf' );
    $styles['menu_text_color']                     = get_option( 'menu_text_color', '#000000' );
    $styles['headings_color']                      = get_option( 'headings_color', '#000000' );
    $styles['top_bar_color']                       = get_option( 'top_bar_color', '#c1c1c1' );
    $styles['top_bar_bg_color']                    = get_option( 'top_bar_bg_color', '#f9f9f9' );
    $styles['footer_bg_color']                     = get_option( 'footer_bg_color', '#0f0f0f' );
    $styles['copyright_footer_text_color']         = get_option( 'copyright_footer_text_color', '' );
    $styles['copyright_footer_bg_color']           = get_option( 'copyright_footer_bg_color', '#242424' );
    $styles['footer_text_color']                   = get_option( 'footer_text_color', '#c4c4c4' );
    $styles['footer_divider_color']                = get_option( 'footer_divider_color', '#c4c4c4' );
    $styles['main_footer_divider']                 = get_option( 'anps_main_footer_divider', '0' );
    $styles['nav_background_color']                = get_option( 'nav_background_color', '#fff' );
    $styles['submenu_background_color']            = get_option( 'submenu_background_color', '#fff' );
    $styles['submenu_text_color']                  = get_option( 'submenu_text_color', '#000' );
    $styles['side_submenu_background_color']       = get_option( 'side_submenu_background_color', '#fff' );
    $styles['side_submenu_text_color']             = get_option( 'side_submenu_text_color', '#000' );
    $styles['side_submenu_text_hover_color']       = get_option( 'side_submenu_text_hover_color', '#1874c1' );
    $styles['anps_woo_cart_items_number_bg_color'] = get_option( 'anps_woo_cart_items_number_bg_color', '#26507a' );
    $styles['anps_woo_cart_items_number_color']    = get_option( 'anps_woo_cart_items_number_color', '#fff' );
    $styles['main_divider_color']                  = get_option( 'main_divider_color', '' );
    $styles['anps_front_text_color']               = get_option( 'anps_front_text_color' );
    $styles['anps_front_text_hover_color']         = get_option( 'anps_front_text_hover_color' );
    $styles['anps_front_bg_color']                 = get_option( 'anps_front_bg_color' );
    $styles['anps_front_topbar_color']             = get_option( 'anps_front_topbar_color', '#fff' );
    $styles['anps_front_topbar_bg_color']          = get_option( 'anps_front_topbar_bg_color', '' );
    $styles['anps_front_topbar_hover_color']       = get_option( 'anps_front_topbar_hover_color', '#1874c1' );

    if ( $styles['anps_front_text_color'] ) {
        $styles['anps_front_text_color'] = $styles['menu_text_color'];
    }

    if ( $styles['anps_front_text_hover_color'] ) {
        $styles['anps_front_text_hover_color'] = $styles['hovers_color'];
    }

    if ( is_front_page() && get_option( 'anps_front_topbar_bg_color', '' ) != '' && get_option( 'anps_menu_type', '2' ) == 1 ) {
        $styles['top_bar_bg_color'] = get_option( 'anps_front_topbar_bg_color', '' );
    }

    if ( is_front_page() && get_option( 'anps_front_topbar_color', '' ) != '' ) {
        $styles['top_bar_color'] = get_option( 'anps_front_topbar_color', '' );
    }

    /**
     * Get any other styles from theme options
     */
    $styles['container_width']   = intval(get_option( 'anps_container_width', '1170' ));
    $styles['menu_height']       = get_option( 'anps_menu_height', '' );
    $styles['anps_menu_opacity'] = '100';

    if ( is_front_page() ) {
        $styles['anps_menu_opacity'] = get_option( 'anps_menu_opacity', '100' );
    }

    // Cache results
    set_transient( 'anps_theme_options_styles', $styles );

    // Return all styles in array format
    return $styles;
}

function anps_custom_styles() {
     // Try cache because compiling and formatting this css string is expensive
    $css = get_transient( 'anps_theme_options_styles_css' );
    if ( $css !== false && ! empty( $css ) ) {
        return $css;
    }

    $styles = anps_get_custom_styles();

    // Collect all CSS into a variable so we can cache it
    ob_start();

    // Print @font-face styles for custom (uploaded) fonts
    if ( $styles['font_1_source'] === 'Custom fonts' ) {
        echo anps_custom_font( $styles['font_1'] );
    }
    if ( $styles['font_2_source'] === 'Custom fonts' ) {
        echo anps_custom_font( $styles['font_2'] );
    }
    if ( $styles['font_3_source'] === 'Custom fonts' ) {
        echo anps_custom_font( $styles['font_3'] );
    }
    if ( $styles['logo_font_source'] === 'Custom fonts' ) {
        echo anps_custom_font( $styles['logo_font'] );
    }

    $menu_type           = get_option( 'anps_menu_type', '2' ) ?: '2';
    $is_menu_type_1_or_3 = $menu_type === '1' || $menu_type === '3';
    ?>

    <?php if ( $styles['primary_color'] ) : ?>
    ::selection { background-color: <?php echo esc_attr( $styles['primary_color'] ); ?>; color: #fff; }
    <?php endif; if ( $styles['menu_text_style'] ) : ?>
    .site-navigation {
        text-transform: <?php echo esc_attr( $styles['menu_text_style'] ); ?>;
    }
    <?php endif; if ( $styles['text_color'] ) : ?>
    body,
    ol.list > li > *,
    .sidebar .product-categories a:not(:hover):not(:focus) {
        color: <?php echo esc_attr( $styles['text_color'] ); ?>;
    }
    <?php endif; if ( $styles['container_width'] ) : ?>
    @media (min-width: <?php echo esc_attr( $styles['container_width'] + 30 ); ?>px) {
        .container {
            width: <?php echo esc_attr( $styles['container_width'] ); ?>px;
        }
    }
    <?php endif; ?>
    <?php if ( $styles['menu_text_color'] ) : ?>
    .site-navigation a:not(.btn),
    .woo-header-cart .cart-contents > i,
    .social-nav a,
    .home .site-header-sticky-active .site-navigation .menu-item-depth-0:not(.current_page_item) > a,
    .paralax-header .site-header-style-transparent.site-header-sticky-active .site-navigation .menu-item-depth-0 >
    a:not(:hover):not(:focus) {
        color: <?php echo esc_attr( $styles['menu_text_color'] ); ?>;
    }
    <?php endif; if ( $styles['nav_background_color'] && $styles['anps_menu_opacity'] ) : ?>
    .site-header-style-normal .nav-wrap::before {
        background-color: <?php echo esc_attr( $styles['nav_background_color'] ); ?>;
        opacity: <?php echo esc_attr( $styles['anps_menu_opacity'] / 100 ); ?>
    }
    <?php endif; if ( $styles['anps_menu_opacity'] != 100 ) : ?>
    .site-header-sticky-active.site-header-style-normal .nav-wrap {
        background: none;
    }
    <?php endif; ?>

    @media(min-width: 992px) {
        <?php if ( $styles['submenu_background_color'] ) : ?>
        .site-navigation .sub-menu {
            background-color: <?php echo esc_attr( $styles['submenu_background_color'] ); ?>;
        }
        <?php endif; if ( $styles['submenu_text_color'] ) : ?>
        .site-navigation .sub-menu a {
            color: <?php echo esc_attr( $styles['submenu_text_color'] ); ?>;
        }
        <?php endif; ?>
    }

    <?php if ( isset( $styles['main_divider_color'] ) && $styles['main_divider_color'] !== '' ) : ?>
    .heading-left.divider-sm span:before,
    .heading-middle.divider-sm span:before,
    .recent-blog__divider {
        background-color: <?php echo esc_attr( $styles['main_divider_color'] ); ?>;
    }
    <?php endif; ?>

    <?php if ( isset( $styles['hovers_color'] ) && $styles['hovers_color'] !== '' ) : ?>
    .site-navigation a:not(.btn):hover, .site-navigation a:not(.btn):focus,
    .social-nav a:hover, .social-nav a:focus,
    .site-navigation .current-menu-item > a {
        color: <?php echo esc_attr( $styles['hovers_color'] ); ?>;
    }
    <?php endif; if ( isset( $styles['hovers_color'] ) && $styles['hovers_color'] !== '' ) : ?>
    @media(min-width: 992px) {
        .site-search-toggle:hover, .site-search-toggle:focus {
            color: <?php echo esc_attr( $styles['hovers_color'] ); ?>;
        }
    }
    <?php endif; ?>

    @media(max-width: 991px) {
        <?php if ( isset( $styles['hovers_color'] ) && $styles['hovers_color'] !== '' ) : ?>
        .site-search-toggle:hover, .site-search-toggle:focus,
        .navbar-toggle:hover, .navbar-toggle:focus {
            background-color: <?php echo esc_attr( $styles['hovers_color'] ); ?>;
        }
        <?php endif; if ( isset( $styles['primary_color'] ) && $styles['primary_color'] !== '' ) : ?>
        .site-search-toggle,
        .navbar-toggle {
            background-color: <?php echo esc_attr( $styles['primary_color'] ); ?>;
        }
        <?php endif; ?>
    }

    <?php if ( get_option( 'anps_menu_type', '2' ) == 1 || get_option( 'anps_menu_type', '2' ) == 3 ) : ?>
    @media(min-width: 992px) {
        .home .site-navigation .menu-item-depth-0 > a,
        .home .social-nav a {
            <?php if ( $styles['anps_front_text_color'] ) : ?>
            color: <?php echo esc_attr( $styles['anps_front_text_color'] ); ?>;
            <?php endif; ?>
        }
    }
    .home .site-navigation .menu-item-depth-0 > a:hover,
    .home .site-navigation .menu-item-depth-0 > a:focus,
    .home .social-nav a:hover,
    .home .social-nav a:focus,
    .home .site-navigation .menu-item-depth-0.current-menu-item > a {
        <?php if ( $styles['anps_front_text_hover_color'] ) : ?>
        color: <?php echo esc_attr( $styles['anps_front_text_hover_color'] ); ?>;
        <?php endif; ?>
    }
    <?php else : ?>
    .site-header-style-normal .nav-wrap::before {
        <?php if ( isset( $styles['anps_front_bg_color'] ) && $styles['anps_front_bg_color'] !== '' ) : ?>
        background-color: <?php echo esc_attr( $styles['anps_front_bg_color'] ); ?>;
        <?php endif; if ( $styles['anps_front_text_hover_color'] ) : ?>
        opacity: <?php echo esc_attr( $styles['anps_menu_opacity'] / 100 ); ?>
        <?php endif; ?>
    }

    @media(min-width: 992px) {
        .site-header-style-full-width .header-wrap::after,
        .site-header-style-full-width .nav-bar-wrapper::after {
            <?php if ( isset( $styles['anps_front_bg_color'] ) && $styles['anps_front_bg_color'] !== '' ) : ?>
            background-color: <?php echo esc_attr( $styles['anps_front_bg_color'] ); ?>;
            <?php endif; if ( $styles['anps_menu_opacity'] ) : ?>
            opacity: <?php echo esc_attr( $styles['anps_menu_opacity'] / 100 ); ?>
            <?php endif; ?>
        }

        <?php if ( isset( $styles['anps_front_text_color'] ) && $styles['anps_front_text_color'] !== '' ) : ?>
        .home .menu-item-depth-0 > a,
        .site-header-style-full-width .site-search-toggle,
        .social-nav a {
            color: <?php echo esc_attr( $styles['anps_front_text_color'] ); ?>;
        }
        <?php endif; ?>
    }


        <?php if ( isset( $styles['anps_front_text_hover_color'] ) && $styles['anps_front_text_hover_color'] !== '' ) : ?>
    .site-navigation a:not(.btn):hover,
    .site-navigation a:not(.btn):focus,
    .social-nav a:hover,
    .social-nav a:focus,
    .site-navigation .current-menu-item > a {
        color: <?php echo esc_attr( $styles['anps_front_text_hover_color'] ); ?>;
    }
    <?php endif; ?>

    @media(min-width: 992px) {
        <?php if ( isset( $styles['anps_front_text_color'] ) && $styles['anps_front_text_color'] !== '' ) : ?>
        .home .woo-header-cart .cart-contents > i,
        .home .site-search-toggle {
            color: <?php echo esc_attr( $styles['anps_front_text_color'] ); ?>;
        }
        <?php endif; if ( isset( $styles['anps_front_text_hover_color'] ) && $styles['anps_front_text_hover_color'] !== '' ) : ?>
        .home .site-search-toggle:focus,
        .home .site-search-toggle:hover {
            color: <?php echo esc_attr( $styles['anps_front_text_hover_color'] ); ?>;
        }
        <?php endif; ?>
    }

        <?php if ( $styles['top_bar_color'] ) : ?>
    .top-bar {
        color: <?php echo esc_attr( $styles['top_bar_color'] ); ?>;
    }
    <?php endif; if ( $styles['top_bar_bg_color'] && $styles['anps_menu_opacity'] ) : ?>
    .top-bar::before {
        background-color: <?php echo esc_attr( $styles['top_bar_bg_color'] ); ?>;
        opacity: <?php echo esc_attr( $styles['anps_menu_opacity'] / 100 ); ?>
    }
    <?php endif; if ( is_front_page() && $styles['anps_front_topbar_hover_color'] != '' ) : ?>
    .top-bar a:hover,
    .top-bar a:focus {
        color: <?php echo esc_attr( $styles['anps_front_topbar_hover_color'] ); ?> !important;
    }
    <?php endif; ?>

        <?php if ( $styles['primary_color'] ) : ?>
    a,
    .btn-link,
    .error-404 h2,
    .page-heading,
    .statement .style-3,
    .dropcaps.style-2:first-letter,
    .list li:before,
    ol.list,
    .post.style-2 header > span,
    .post.style-2 header .fa,
    .page-numbers span,
    .team .socialize a,
    blockquote.style-2:before,
    .panel-group.style-2 .panel-title a:before,
    .contact-info i,
    blockquote.style-1:before,
    .comment-list .comment header h1,
    .faq .panel-title a.collapsed:before,
    .faq .panel-title a:after,
    .faq .panel-title a,
    .filter button.selected,
    .filter:before,
    .primary,
    .search-posts i,
    .counter .counter-number,
    #wp-calendar th,
    #wp-calendar caption,
    .testimonials blockquote p:before,
    .testimonials blockquote p:after,
    .tab-pane .commentlist .meta strong,
    .widget_recent_comments .recentcomments a,
    .wpcf7-form-control-wrap[class*="date-"]:after,
    .anps-select-wrap:after,
    .get-quote h2,
    footer.site-footer.style-3 .working-hours th,
    .testimonials-style-2 .testimonial-footer,
    h4.testimonial-user,
    .testimonials-style-3 + .owlprev:hover, .testimonials-style-3 + .owlprev + .owlnext:hover,
    .timeline-year,
    .sidebar .menu .sub-menu .current-menu-item > a {
        color: <?php echo esc_attr( $styles['primary_color'] ); ?>;
    }
    input#place_order, .lost_reset_password p.form-row .button,
    body .is-selected .pika-button, body .pika-button:hover,
    .heading-middle span:before,
    .heading-left span:before,
    .testimonials-style-2.carousel .carousel-control,
    .timeline-item:before,
    .vc_tta.vc_tta-accordion.vc_tta-style-anps-as-2 .vc_tta-panel.vc_active .vc_tta-panel-heading,
    .recent-blog--style-3,
    .woocommerce-product-gallery__trigger {
        background-color: <?php echo esc_attr( $styles['primary_color'] ); ?>;
    }
    <?php endif; if ( $styles['footer_text_color'] ) : ?>
    .site-footer, .site-footer .copyright-footer,
    .site-footer.style-4 .widget_anpstext .important {
        color: <?php echo esc_attr( $styles['footer_text_color'] ); ?>;
    }
    <?php endif; if ( $styles['primary_color'] ) : ?>
    .counter .wrapbox {
    b   order-color:<?php echo esc_attr( $styles['primary_color'] ); ?>;
    }
    .nav .open > a:focus,
    body .tp-bullets.simplebullets.round .bullet.selected {
        border-color: <?php echo esc_attr( $styles['primary_color'] ); ?>;
    }
    .icon i,
    .posts div a,
    .progress-bar,
    .nav-tabs > li.active:after,
    .vc_tta-style-anps_tabs .vc_tta-tabs-list > li.vc_active:after,
    .sidebar .menu .current-menu-item > a,
    .sidebar .menu .current-menu-ancestor > a,
    .pricing-table header,
    .table thead th,
    .mark,
    .post .post-meta button,
    blockquote.style-2:after,
    .panel-title a:before,
    .carousel-indicators li,
    .carousel-indicators .active,
    .ls-michell .ls-bottom-slidebuttons a,
    .site-search,
    .twitter .carousel-indicators li,
    .twitter .carousel-indicators li.active,
    #wp-calendar td a,
    body .tp-bullets.simplebullets.round .bullet,
    .form-submit #submit,
    .testimonials blockquote header:before,
    mark {
        background-color: <?php echo esc_attr( $styles['primary_color'] ); ?>;
    }
    <?php endif; if ( $styles['headings_color'] ) : ?>
    h1, h2, h3, h4, h5, h6,
    .nav-tabs > li > a,
    .nav-tabs > li.active > a,
    .vc_tta-tabs-list > li > a span,
    .statement,
    .page-heading a,
    .page-heading a:after,
    p strong,
    .dropcaps:first-letter,
    .page-numbers a,
    .searchform,
    .searchform input[type="text"],
    .socialize a,
    .widget_rss .rss-date,
    .widget_rss cite,
    .panel-title,
    .panel-group.style-2 .panel-title a.collapsed:before,
    blockquote.style-1,
    .comment-list .comment header,
    .faq .panel-title a:before,
    .faq .panel-title a.collapsed,
    .filter button,
    .carousel .carousel-control,
    #wp-calendar #today,
    input.qty,
    .tab-pane .commentlist .meta,
    .headings-color,
    .widget_anpstext a:hover,
    .widget_anpstext a:focus,
    .testimonial-lg__content,
    .about-us__title,
    .about-us__desc,
    .timeline-h__year,
    .cta__title {
        color: <?php echo esc_attr( $styles['headings_color'] ); ?>;
    }
    <?php endif; ?>

    .ls-michell .ls-nav-next,
    .ls-michell .ls-nav-prev {
        color:#fff;
    }

        <?php if ( $styles['headings_color'] ) : ?>
    .contact-form input[type="text"]:focus,
    .contact-form textarea:focus {
        border-color: <?php echo esc_attr( $styles['headings_color'] ); ?> !important;
    }

    .pricing-table header h2,
    .mark.style-2,
    .btn.dark,
    .twitter .carousel-indicators li {
    background-color: <?php echo esc_attr( $styles['headings_color'] ); ?>;
    }
    <?php endif; ?>

    .price_slider_wrapper .ui-widget-content {
    background-color: #ececec;
    }

        <?php if ( $styles['font_2'] ) : ?>
    body,
    .alert .close,
    .post header {
        font-family: <?php echo anps_wrap_font( esc_attr( $styles['font_2'] ) ); ?>;
    }
    <?php endif; ?>

        <?php if ( $styles['logo_font'] ) : ?>
    .site-logo {
        font-family: <?php echo anps_wrap_font( esc_attr( $styles['logo_font'] ) ); ?>;
    }
    <?php endif; ?>

        <?php if ( $styles['font_1'] ) : ?>
    h1, h2, h3, h4, h5, h6,
    .btn,
    .page-heading,
    .team em,
    .team-single-subtitle,
    blockquote.style-1,
    .tab-pane .commentlist .meta,
    .wpcf7-submit,
    .testimonial-footer span.user,
    .font-1,
    .site-navigation,
    input.site-search-input,
    .recent-blog__info,
    .testimonial-lg__user,
    .testimonial-lg__position,
    .about-us__title,
    .about-us__subtitle,
    .timeline-h__year,
    .timeline-h__title,
    .cta__title,
    .cta__subtitle,
    .shipping-calculator-button,
    .wpcf7-form input, .wpcf7-form textarea, .wpcf7-select {
        font-family: <?php echo anps_wrap_font($styles['font_1']); ?>;
    }

    .wpcf7-form input::placeholder {
        font-family: <?php echo anps_wrap_font($styles['font_1']); ?>;
    }
    <?php endif; if ( $styles['font_3'] ) : ?>
    .nav-tabs > li > a,
    .vc_tta-tabs-list > li > a,
    .tp-arr-titleholder {
        font-family: <?php echo anps_wrap_font($styles['font_3']); ?>;
    }
    <?php endif; if ( $styles['font_1'] ) : ?>
    .pricing-table header h2,
    .pricing-table header .price,
    .pricing-table header .currency,
    .table thead,
    h1.style-3,
    h2.style-3,
    h3.style-3,
    h4.style-3,
    h5.style-3,
    h6.style-3,
    .page-numbers a,
    .page-numbers span,
    .alert,
    .comment-list .comment header {
        font-family: <?php echo anps_wrap_font($styles['font_1']); ?>;
    }
    <?php endif; ?>

    <?php endif; if ( $styles['footer_bg_color'] ) : ?>
    .site-footer {
        background: <?php echo esc_attr( $styles['footer_bg_color'] ); ?>;
    }
    <?php endif; ?>

    .site-footer .copyright-footer,
    .site-footer.style-2 .copyright-footer,
    .site-footer.style-3 .copyright-footer {
        <?php if ( $styles['copyright_footer_bg_color'] ) : ?>
        background: <?php echo esc_attr( $styles['copyright_footer_bg_color'] ); ?>;
        <?php endif; if ( $styles['copyright_footer_text_color'] ) : ?>
        color: <?php echo esc_attr( $styles['copyright_footer_text_color'] ); ?>;
        <?php endif; ?>
    }

    <?php if ( $styles['anps_woo_cart_items_number_color'] ) : ?>
    .woo-header-cart .cart-contents > span { color: <?php echo esc_attr( $styles['anps_woo_cart_items_number_color'] ); ?>;    }
    <?php endif; if ( $styles['anps_woo_cart_items_number_bg_color'] ) : ?>
    .woo-header-cart .cart-contents > span { background-color: <?php echo esc_attr( $styles['anps_woo_cart_items_number_bg_color'] ); ?>; }
    <?php endif; ?>

    <?php if ( $styles['footer_divider_color'] ) : ?>
    .site-footer.style-1 .copyright-footer,
    .site-footer.style-2 .copyright-footer,
    footer.site-footer.style-2 .widget_anpstext:before,
    footer.site-footer.style-2 .working-hours,
    .site-footer.style-4 .working-hours td,
    .site-footer.style-4 .working-hours th,
    .site-footer.style-4 .menu li,
    .site-footer.style-4 .widget_anpstext {
        border-color: <?php echo esc_attr( $styles['footer_divider_color'] ); ?>;
    }
    <?php endif; if ( $styles['main_footer_divider'] && $styles['footer_divider_color'] ) : ?>
    .site-footer.style-2,
    .site-footer:not(.style-2) > .container { border-top: <?php echo esc_attr( $styles['main_footer_divider'] ); ?>px solid <?php echo esc_attr( $styles['footer_divider_color'] ); ?>; }
    <?php endif; ?>

    <?php if ( $styles['hovers_color'] ) : ?>
    .a:hover, .a:focus,
    .icon a:hover h2, .icon a:focus h2,
    .nav-tabs > li > a:hover, .nav-tabs > li > a:focus,
    .page-heading a:hover, .page-heading a:focus,
    .menu a:hover, .menu a:focus,
    .menu .is-active a,
    .table tbody tr:hover td,
    .page-numbers a:hover, .page-numbers a:focus,
    .widget-categories a:hover, .widget-categories a:focus,
    .widget_archive a:hover, .widget_archive a:focus,
    .widget_categories a:hover, .widget_categories a:focus,
    .widget_recent_entries a:hover, .widget_recent_entries a:focus,
    .socialize a:hover, .socialize a:focus,
    .faq .panel-title a.collapsed:hover, .faq .panel-title a.collapsed:focus,
    .carousel .carousel-control:hover, .carousel .carousel-control:focus,
    a:hover h1, a:hover h2, a:hover h3, a:hover h4, a:hover h5,
    a:focus h1, a:focus h2, a:focus h3, a:focus h4, a:focus h5,
    .site-footer a:not(.btn):hover, .site-footer a:not(.btn):focus,
    .ls-michell .ls-nav-next:hover,
    .ls-michell .ls-nav-prev:hover,
    body .tp-leftarrow.default:hover,
    body .tp-leftarrow.default:focus,
    body .tp-rightarrow.default:hover,
    body .tp-rightarrow.default:focus,
    .icon.style-2 a:hover i, .icon.style-2 a:focus i,
    .team .socialize a:hover, .team .socialize a:focus,
    .recentblog header a:hover h2, .recentblog focus a:hover h2,
    .scrollup button:hover, .scrollup button:focus,
    .hovercolor, i.hovercolor, .post.style-2 header i.hovercolor.fa,
    article.post-sticky header::before,
    .wpb_content_element .widget a:hover, .wpb_content_element .widget a:focus,
    .star-rating,
    .menu .current_page_item > a,
    .icon.style-2 i,
    .cart-contents > i:hover, .cart-contents > i:focus,
    .mini-cart a:hover, .mini-cart a:focus,
    .product_meta .posted_in a,
    .woocommerce-tabs .description_tab a, .woocommerce-tabs .reviews_tab a, .woocommerce-tabs .additional_information_tab a,
    .comment-form-rating a, .continue-shopping, .product-name > a, .shipping-calculator-button,
    .about_paypal,
    footer.site-footer.style-2 .widget_anpstext > span.fa,
    footer.site-footer.style-2 .widget_recent_entries .post-date:before,
    footer.site-footer.style-2 .social a:hover,
    footer.site-footer.style-2 .social a:focus,
    .owl-navigation .owlprev:hover, .owl-navigation .owlprev:focus,
    .owl-navigation .owlnext:hover, .owl-navigation .owlnext:focus,
    .important,
    .site-footer.style-4 .widget_anpstext .fa,
    .widget_anpstext a,
    .page-numbers.current,
    .widget_layered_nav a:hover,
    .widget_layered_nav a:focus,
    .widget_layered_nav .chosen a,
    .widget_layered_nav_filters a:hover,
    .widget_layered_nav_filters a:focus,
    .widget_rating_filter .star-rating:hover,
    .widget_rating_filter .star-rating:focus,
    .searchform button[type="submit"]:hover,
    .searchform button[type="submit"]:focus,
    .recent-blog__info a,
    .recent-blog__info-icon,
    .testimonial-lg__position,
    .testimonials-lg--style-1 .testimonial-lg__quote,
    .about-us__subtitle,
    .timeline-h__title,
    .cta__subtitle {
        color: <?php echo esc_attr( $styles['hovers_color'] ); ?>;
    }
    .icon > a > i,
    .icon.style-1 .icon-svg,
    .tnp-widget .tnp-submit,
    footer.site-footer.style-3 .working-hours td, footer.site-footer.style-3 .working-hours th,
    .testimonials-style-2.carousel .carousel-control:hover,
    .testimonials-style-2.carousel .carousel-control:focus,
    .woocommerce-product-gallery__trigger:hover,
    .woocommerce-product-gallery__trigger:focus {
        background: <?php echo esc_attr( $styles['hovers_color'] ); ?>;
    }
    .filter button.selected {
        color: <?php echo esc_attr( $styles['hovers_color'] ); ?>!important;
    }
    .scrollup button:hover,
    .scrollup button:focus,
    .wpcf7-form input.wpcf7-text:focus,
    .wpcf7-form textarea:focus,
    .wpcf7-select:focus,
    .wpcf7-form input.wpcf7-date:focus {
    border-color: <?php echo esc_attr( $styles['hovers_color'] ); ?>;
    }
    <?php endif; if ( isset( $styles['menu_height'] ) && $styles['menu_height'] !== '' ) : ?>
    @media (min-width: 992px) {
        .site-header-style-normal,
        .site-header-style-normal .nav-wrap {
            height: <?php echo esc_attr( $styles['menu_height'] ); ?>px;
        }
    }
    <?php endif; if ( $styles['hovers_color'] ) : ?>
    .tagcloud a:hover,
    .twitter .carousel-indicators li:hover,
    .icon a:hover i,
    .posts div a:hover,
    #wp-calendar td a:hover,
    .plus:hover, .minus:hover,
    .widget_price_filter .price_slider_amount .button:hover,
    .form-submit #submit:hover,
    .onsale,
    form .quantity .plus:hover, form .quantity .minus:hover, #content .quantity .plus:hover, #content .quantity
    .minus:hover,
    .widget_price_filter .ui-slider-horizontal .ui-slider-range,
    .testimonials-lg--style-2 .testimonial-lg__divider,
    .site-footer.style-4 .widget-title::after {
        background-color: <?php echo esc_attr( $styles['hovers_color'] ); ?>;
    }
    <?php endif; if ( $styles['body_font_size'] ) : ?>
    body {
        font-size: <?php echo esc_attr( $styles['body_font_size'] ); ?>px;
    }
    <?php endif;  if ( $styles['menu_font_size'] ) : ?>
    .site-navigation {
        font-size: <?php echo esc_attr( $styles['menu_font_size'] ); ?>px;
    }
    <?php endif; if ( $styles['h1_font_size'] ) : ?>
    h1, .h1 { font-size: <?php echo esc_attr( $styles['h1_font_size'] ); ?>px; }
    <?php endif; if ( $styles['h2_font_size'] ) : ?>
    h2, .h2 { font-size: <?php echo esc_attr( $styles['h2_font_size'] ); ?>px; }
    <?php endif; if ( $styles['h3_font_size'] ) : ?>
    h3, .h3 { font-size: <?php echo esc_attr( $styles['h3_font_size'] ); ?>px; }
    <?php endif; if ( $styles['h4_font_size'] ) : ?>
    h4, .h4 { font-size: <?php echo esc_attr( $styles['h4_font_size'] ); ?>px; }
    <?php endif; if ( $styles['h5_font_size'] ) : ?>
    h5, .h5 { font-size: <?php echo esc_attr( $styles['h5_font_size'] ); ?>px; }
    <?php endif; ?>

    <?php if ( $styles['page_heading_h1_font_size'] ) : ?>
    .page-heading h1 {
        font-size: <?php echo esc_attr( $styles['page_heading_h1_font_size'] ); ?>px;
        line-height: 34px;
    }
    <?php endif; if ( $styles['hovers_color'] ) : ?>
    .triangle-topleft.hovercolor {
        border-top: 60px solid <?php echo esc_attr( $styles['hovers_color'] ); ?>;
    }
    <?php endif; if ( $styles['blog_heading_h1_font_size'] ) : ?>
    h1.single-blog, article.post h1.single-blog{
        font-size: <?php echo esc_attr( $styles['blog_heading_h1_font_size'] ); ?>px;
    }
    <?php endif; ?>

    .sidebar .menu .current-menu-item .sub-menu a,
    .sidebar .menu .current-menu-ancestor .sub-menu a {
        <?php if ( isset( $styles['side_submenu_background_color'] ) && $styles['side_submenu_background_color'] !== '' ) : ?>
        background: <?php echo esc_attr( $styles['side_submenu_background_color'] ); ?>;
        <?php endif; ?>
        <?php if ( isset( $styles['side_submenu_text_color'] ) && $styles['side_submenu_text_color'] !== '' ) : ?>
        color: <?php echo esc_attr( $styles['side_submenu_text_color'] ); ?>;
        <?php endif; ?>
    }

    <?php if ( isset( $styles['side_submenu_text_hover_color'] ) && $styles['side_submenu_text_hover_color'] !== '' ) : ?>
    .sidebar .menu .sub-menu a:hover,
    .sidebar .menu .sub-menu a:focus,
    .sidebar .menu .sub-menu .current_page_item > a,
    .sidebar .menu .sub-menu > .current_page_item > a {
        color: <?php echo esc_attr( $styles['side_submenu_text_hover_color'] ); ?>;
    }
        <?php
    endif;

    echo get_option( 'anps_custom_css', '' );

    // Done. Collect buffer, clean it up, cache and output
    $css_buffer = ob_get_clean();
    $css        = trim( preg_replace( '/\s+/', ' ', $css_buffer ) );

    set_transient( 'anps_theme_options_styles_css', $css );

    return $css;
}

/* Custom styles for buttons */

function anps_get_custom_styles_buttons() {
     // Try to get from cache
    $styles = get_transient( 'anps_theme_options_buttons' );
    if ( $styles !== false ) {
        return $styles;
    }

    $styles = array();

    /*buttons*/
    $styles['default_button_bg']          = get_option( 'default_button_bg', '#26507a' );
    $styles['default_button_color']       = get_option( 'default_button_color', '#fff' );
    $styles['default_button_hover_bg']    = get_option( 'default_button_hover_bg', '#3178bf' );
    $styles['default_button_hover_color'] = get_option( 'default_button_hover_color', '#fff' );

    $styles['style_1_button_bg']          = get_option( 'style_1_button_bg', '#26507a' );
    $styles['style_1_button_color']       = get_option( 'style_1_button_color', '#fff' );
    $styles['style_1_button_hover_bg']    = get_option( 'style_1_button_hover_bg', '#3178bf' );
    $styles['style_1_button_hover_color'] = get_option( 'style_1_button_hover_color', '#fff' );

    $styles['style_2_button_bg']          = get_option( 'style_2_button_bg', '#000000' );
    $styles['style_2_button_color']       = get_option( 'style_2_button_color', '#fff' );
    $styles['style_2_button_hover_bg']    = get_option( 'style_2_button_hover_bg', '#ffffff' );
    $styles['style_2_button_hover_color'] = get_option( 'style_2_button_hover_color', '#fff' );

    $styles['style_3_button_color']        = get_option( 'style_3_button_color', '#26507a' );
    $styles['style_3_button_hover_bg']     = get_option( 'style_3_button_hover_bg', '#26507a' );
    $styles['style_3_button_hover_color']  = get_option( 'style_3_button_hover_color', '#fff' );
    $styles['style_3_button_border_color'] = get_option( 'style_3_button_border_color', '#26507a' );

    $styles['style_4_button_color']       = get_option( 'style_4_button_color', '#26507a' );
    $styles['style_4_button_hover_color'] = get_option( 'style_4_button_hover_color', '#3178bf' );

    $styles['style_slider_button_bg']          = get_option( 'style_slider_button_bg', '#26507a' );
    $styles['style_slider_button_color']       = get_option( 'style_slider_button_color', '#fff' );
    $styles['style_slider_button_hover_bg']    = get_option( 'style_slider_button_hover_bg', '#3178bf' );
    $styles['style_slider_button_hover_color'] = get_option( 'style_slider_button_hover_color', '#fff' );

    $styles['style_5_button_bg']          = get_option( 'style_5_button_bg', '#c3c3c3' );
    $styles['style_5_button_color']       = get_option( 'style_5_button_color', '#fff' );
    $styles['style_5_button_hover_bg']    = get_option( 'style_5_button_hover_bg', '#737373' );
    $styles['style_5_button_hover_color'] = get_option( 'style_5_button_hover_color', '#fff' );

    $styles['style_6_button_bg_1']  = get_option( 'style_6_button_bg_1', '#33a4f2' );
    $styles['style_6_button_bg_2']  = get_option( 'style_6_button_bg_2', '#6ad5f9' );
    $styles['style_6_button_color'] = get_option( 'style_6_button_color', '#fff' );

    set_transient( 'anps_theme_options_buttons', $styles );
    return $styles;
}

function anps_custom_styles_buttons() {
    // Try cache because compiling and formatting this css string is expensive
    $css = get_transient( 'anps_theme_options_buttons_css' );
    if ( $css !== false && ! empty( $css ) ) {
        return $css;
    }

    // Collect all CSS into a variable so we can cache it
    $styles = anps_get_custom_styles_buttons();

    ob_start();
    ?>
    .btn, .button .wpcf7-submit, .button {
        -moz-user-select: none;
        background-image: none;
        border: 0;
        color: #fff;
        cursor: pointer;
        display: inline-block;
        font-weight: normal;
        line-height: 1.5;
        margin-bottom: 0;
        text-align: center;
        text-transform: uppercase;
        text-decoration:none;
        transition: background-color 0.2s ease 0s;
        vertical-align: middle;
        white-space: nowrap;
    }

    .btn.btn-sm, .wpcf7-submit {
        padding: 11px 17px;
        font-size: 14px;
    }

    <?php if ( $styles['default_button_bg'] && $styles['default_button_color'] ) : ?>
    .btn, .button,
    .site-footer .widget_price_filter .price_slider_amount .button,
    .site-footer .widget_price_filter .price_label,
    .site-footer .tagcloud a {
        border-radius: 0;
        border-radius: 4px;
        background: <?php echo esc_attr( $styles['default_button_bg'] ); ?>;
        color: <?php echo esc_attr( $styles['default_button_color'] ); ?>;
    }
    <?php endif; ?>

    <?php if ( $styles['default_button_hover_bg'] && $styles['default_button_hover_color'] ) : ?>
    .btn:hover, .btn:active, .btn:focus, .button:hover, .button:active, .button:focus,
    .site-footer .tagcloud a:hover, .site-footer .tagcloud a:focus {
        border-radius: 4px;
        background: <?php echo esc_attr( $styles['default_button_hover_bg'] ); ?>;
        color: <?php echo esc_attr( $styles['default_button_hover_color'] ); ?>;
    }
    <?php endif; if ( $styles['style_4_button_color'] ) : ?>
    .wpcf7-submit {
        color: <?php echo esc_attr( $styles['style_4_button_color'] ); ?>;
        background: transparent;
    }
    <?php endif; if ( $styles['default_button_hover_bg'] && $styles['default_button_hover_color'] ) : ?>
    .btn:hover, .btn:active, .btn:focus, .button:hover, .button:active, .button:focus {
        background-color: <?php echo esc_attr( $styles['default_button_hover_bg'] ); ?>;
        color: <?php echo esc_attr( $styles['default_button_hover_color'] ); ?>;
        border:0;
    }
    <?php endif; if ( $styles['style_4_button_hover_color'] ) : ?>
    .wpcf7-submit:hover, .wpcf7-submit:active, .wpcf7-submit:focus {
        color: <?php echo esc_attr( $styles['style_4_button_hover_color'] ); ?>;
        background: transparent;
        }
    <?php endif; if ( $styles['style_1_button_bg'] && $styles['style_1_button_color'] ) : ?>
    .btn.style-1, .vc_btn.style-1 {
        border-radius: 4px;
        background-color: <?php echo esc_attr( $styles['style_1_button_bg'] ); ?>;
        color: <?php echo esc_attr( $styles['style_1_button_color'] ); ?>!important;
    }
    <?php endif; if ( $styles['style_1_button_hover_bg'] && $styles['style_1_button_hover_color'] ) : ?>
    .btn.style-1:hover, .btn.style-1:active, .btn.style-1:focus, .vc_btn.style-1:hover, .vc_btn.style-1:active,
    .vc_btn.style-1:focus {
        background-color: <?php echo esc_attr( $styles['style_1_button_hover_bg'] ); ?>;
        color: <?php echo esc_attr( $styles['style_1_button_hover_color'] ); ?>!important;
    }
    <?php endif; if ( $styles['style_slider_button_bg'] && $styles['style_slider_button_color'] ) : ?>
    .btn.slider {
        border-radius: 4px;
        background-color: <?php echo esc_attr( $styles['style_slider_button_bg'] ); ?>;
        color: <?php echo esc_attr( $styles['style_slider_button_color'] ); ?>;
    }
    <?php endif; if ( $styles['style_slider_button_hover_bg'] && $styles['style_slider_button_hover_color'] ) : ?>
    .btn.slider:hover, .btn.slider:active, .btn.slider:focus {
        background-color: <?php echo esc_attr( $styles['style_slider_button_hover_bg'] ); ?>;
        color: <?php echo esc_attr( $styles['style_slider_button_hover_color'] ); ?>;
    }
    <?php endif; if ( $styles['style_2_button_bg'] && $styles['style_2_button_color'] ) : ?>
    .btn.style-2, .vc_btn.style-2 {
        border-radius: 4px;
        border: 2px solid <?php echo esc_attr( $styles['style_2_button_bg'] ); ?>;
        background-color: <?php echo esc_attr( $styles['style_2_button_bg'] ); ?>;
        color: <?php echo esc_attr( $styles['style_2_button_color'] ); ?>!important;
    }
    <?php endif; if ( $styles['style_2_button_hover_bg'] && $styles['style_2_button_hover_color'] && $styles['style_2_button_bg'] && $styles['style_2_button_bg'] ) : ?>
    .btn.style-2:hover, .btn.style-2:active, .btn.style-2:focus, .vc_btn.style-2:hover, .vc_btn.style-2:active,
    .vc_btn.style-2:focus {
        background-color: <?php echo esc_attr( $styles['style_2_button_hover_bg'] ); ?>;
        color: <?php echo esc_attr( $styles['style_2_button_hover_color'] ); ?>!important;
        border-color: <?php echo esc_attr( $styles['style_2_button_bg'] ); ?>;
        border: 2px solid <?php echo esc_attr( $styles['style_2_button_bg'] ); ?>;
    }
    <?php endif; if ( $styles['style_3_button_border_color'] && $styles['style_3_button_color'] ) : ?>
    .btn.style-3, .vc_btn.style-3 {
        border: 2px solid <?php echo esc_attr( $styles['style_3_button_border_color'] ); ?>;
        border-radius: 4px;
        background-color: transparent;
        color: <?php echo esc_attr( $styles['style_3_button_color'] ); ?>!important;
    }
    <?php endif; if ( $styles['style_3_button_border_color'] && $styles['style_3_button_hover_bg'] && $styles['style_3_button_hover_color'] ) : ?>
    .btn.style-3:hover, .btn.style-3:active, .btn.style-3:focus, .vc_btn.style-3:hover, .vc_btn.style-3:active,
    .vc_btn.style-3:focus {
        border: 2px solid <?php echo esc_attr( $styles['style_3_button_border_color'] ); ?>;
        background-color: <?php echo esc_attr( $styles['style_3_button_hover_bg'] ); ?>;
        color: <?php echo esc_attr( $styles['style_3_button_hover_color'] ); ?>!important;
    }
    <?php endif; if ( $styles['style_4_button_color'] ) : ?>
    .btn.style-4, .vc_btn.style-4 {
        padding-left: 0;
        background-color: transparent;
        color: <?php echo esc_attr( $styles['style_4_button_color'] ); ?>!important;
        border: none;
    }
    <?php endif; if ( $styles['style_4_button_hover_color'] ) : ?>
    .btn.style-4:hover, .btn.style-4:active, .btn.style-4:focus, .vc_btn.style-4:hover, .vc_btn.style-4:active,
    .vc_btn.style-4:focus {
        padding-left: 0;
        background: none;
        color: <?php echo esc_attr( $styles['style_4_button_hover_color'] ); ?>!important;
        border: none;
        border-color: transparent;
        outline: none;
    }
    <?php endif; if ( $styles['style_5_button_bg'] && $styles['style_5_button_color'] ) : ?>
    .btn.style-5, .vc_btn.style-5 {
        background-color: <?php echo esc_attr( $styles['style_5_button_bg'] ); ?>!important;
        color: <?php echo esc_attr( $styles['style_5_button_color'] ); ?>!important;
        border: none;
    }
    <?php endif; if ( $styles['style_5_button_hover_bg'] && $styles['style_5_button_hover_color'] ) : ?>
    .btn.style-5:hover, .btn.style-5:active, .btn.style-5:focus, .vc_btn.style-5:hover, .vc_btn.style-5:active,
    .vc_btn.style-5:focus {
        background-color: <?php echo esc_attr( $styles['style_5_button_hover_bg'] ); ?>!important;
        color: <?php echo esc_attr( $styles['style_5_button_hover_color'] ); ?>!important;
    }
    <?php endif; if ( $styles['style_1_button_color'] && $styles['style_1_button_bg'] ) : ?>
    .post-page-numbers {
        color: <?php echo esc_attr( $styles['style_1_button_color'] ); ?>;
        background: <?php echo esc_attr( $styles['style_1_button_bg'] ); ?>;
    }
    <?php endif; if ( $styles['style_1_button_hover_color'] && $styles['style_1_button_hover_bg'] ) : ?>
    .post-page-numbers:hover,
    .post-page-numbers:focus,
    .post-page-numbers.current {
        color: <?php echo esc_attr( $styles['style_1_button_hover_color'] ); ?>;
        background: <?php echo esc_attr( $styles['style_1_button_hover_bg'] ); ?>;
    }
    <?php endif; if ( $styles['style_6_button_bg_1'] && $styles['style_6_button_bg_1'] && $styles['style_6_button_bg_2'] && $styles['style_6_button_color'] ) : ?>
    .btn.style-6,
    .vc_btn.style-6 {
        background-color: <?php echo esc_attr( $styles['style_6_button_bg_1'] ); ?>!important;
        background: linear-gradient(90deg, <?php echo esc_attr( $styles['style_6_button_bg_1'] ); ?>,
        <?php echo esc_attr( $styles['style_6_button_bg_2'] ); ?>) !important;
        color: <?php echo esc_attr( $styles['style_6_button_color'] ); ?>!important;
        border: 0;
    }
        <?php
    endif;

    $css_buffer = ob_get_clean();
    $css        = trim( preg_replace( '/\s+/', ' ', $css_buffer ) );

    set_transient( 'anps_theme_options_buttons_css', $css );

    return $css;
}

/* Wrap font with quotes */
if ( ! function_exists( 'anps_wrap_font' ) ) {
    function anps_wrap_font( $font ) {
        $temp   = explode( ', ', $font );
        $return = '';

        if ( count( $temp ) > 1 ) {
            foreach ( $temp as $name ) {
                if ( $return === '' ) {
                    $return .= "'$name'";
                } else {
                    $return .= ", $name";
                }
            }
        } else {
            $return = "'$font'";
        }

        return $return;
    }
}

function anps_custom_block_editor_styles() {
    $styles = anps_get_custom_styles();
    ob_start();
    if ( $styles['font_1_source'] === 'Custom fonts' ) {
        echo anps_custom_font( $styles['font_1'] );
    }
    if ( $styles['font_2_source'] === 'Custom fonts' ) {
        echo anps_custom_font( $styles['font_2'] );
    }
    ?>
    .post-type-page .editor-styles-wrapper .editor-post-title__input {
        font-size: <?php echo esc_attr( $styles['page_heading_h1_font_size'] ); ?>px;
    }
    .post-type-post .editor-styles-wrapper .editor-post-title__input {
        font-size: <?php echo esc_attr( $styles['blog_heading_h1_font_size'] ); ?>px;
    }

    :root .editor-styles-wrapper {
        <?php if ( $styles['text_color'] ) : ?>
        color: <?php echo esc_attr( $styles['text_color'] ); ?> !important;
        <?php endif; if ( $styles['body_font_size'] ) : ?>
        font-size: <?php echo esc_attr( $styles['body_font_size'] ); ?>px !important;
        <?php endif; if ( $styles['font_2'] ) : ?>
        font-family: <?php echo anps_wrap_font( $styles['font_2'] ); ?> !important;
        <?php endif; ?>
    }

    <?php if ( $styles['h1_font_size'] ) : ?>
    :root .editor-styles-wrapper h1.wp-block { font-size: <?php echo esc_attr( $styles['h1_font_size'] ); ?>px; }
    <?php endif; if ( $styles['h2_font_size'] ) : ?>
    :root .editor-styles-wrapper h2.wp-block { font-size: <?php echo esc_attr( $styles['h2_font_size'] ); ?>px; }
    <?php endif; if ( $styles['h3_font_size'] ) : ?>
    :root .editor-styles-wrapper h3.wp-block { font-size: <?php echo esc_attr( $styles['h3_font_size'] ); ?>px; }
    <?php endif; if ( $styles['h4_font_size'] ) : ?>
    :root .editor-styles-wrapper h4.wp-block { font-size: <?php echo esc_attr( $styles['h4_font_size'] ); ?>px; }
    <?php endif; if ( $styles['h5_font_size'] ) : ?>
    :root .editor-styles-wrapper h5.wp-block { font-size: <?php echo esc_attr( $styles['h5_font_size'] ); ?>px; }
    <?php endif; if ( $styles['headings_color'] ) : ?>
    :root .editor-styles-wrapper .editor-post-title__input,
    :root .editor-styles-wrapper h1,
    :root .editor-styles-wrapper h2,
    :root .editor-styles-wrapper h3,
    :root .editor-styles-wrapper h4,
    :root .editor-styles-wrapper h5,
    :root .editor-styles-wrapper h6,
    :root .editor-styles-wrapper p strong { color: <?php echo esc_attr( $styles['headings_color'] ); ?>; }
    <?php endif; if ( $styles['font_1'] ) : ?>
    :root .editor-styles-wrapper .editor-post-title__input,
    :root .editor-styles-wrapper h1,
    :root .editor-styles-wrapper h2,
    :root .editor-styles-wrapper h3,
    :root .editor-styles-wrapper h4,
    :root .editor-styles-wrapper h5,
    :root .editor-styles-wrapper h6 {
        font-family: <?php echo anps_wrap_font( $styles['font_1'] ); ?>;
    }
    <?php endif; if ( $styles['primary_color'] ) : ?>
    :root .editor-styles-wrapper a,
    :root .editor-styles-wrapper b,
    :root .editor-styles-wrapper .wp-block-file__textlink { color: <?php echo esc_attr( $styles['primary_color'] ); ?>; }
    :root .editor-styles-wrapper mark:not(.has-background) {
        color: #fff !important;
        background-color: <?php echo esc_attr( $styles['primary_color'] ); ?> !important;
    }
    <?php endif; if ( $styles['hovers_color'] ) : ?>
    :root .editor-styles-wrapper a:hover,
    :root .editor-styles-wrapper .wp-block-file__textlink:hover {
        color: <?php echo esc_attr( $styles['hovers_color'] ); ?>;
    }
        <?php
    endif;

    return ob_get_clean();
}

/** Build Google font URI */
function anps_get_google_fonts_uri( $fonts_list = array() ) {
    if ( empty( $fonts_list ) ) {
        return false;
    }
    $uri = 'https://fonts.googleapis.com/css2?display=swap';
    foreach ( $fonts_list as $font ) {
        $uri .= '&family=' . urlencode( $font ) . ':ital,wght@0,300;0,400;0,500;0,600;0,700;1,400';
    }
    return $uri;
}
