<?php

$fruits_farming_custom_css = "";

	$fruits_farming_theme_pagination_options_alignment = get_theme_mod('fruits_farming_theme_pagination_options_alignment', 'Center');
	if ($fruits_farming_theme_pagination_options_alignment == 'Center') {
		$fruits_farming_custom_css .= '.navigation.pagination,.navigation.posts-navigation .nav-links{';
		$fruits_farming_custom_css .= 'justify-content: center;margin: 0 auto;';
		$fruits_farming_custom_css .= '}';
	} else if ($fruits_farming_theme_pagination_options_alignment == 'Right') {
		$fruits_farming_custom_css .= '.navigation.pagination,.navigation.posts-navigation .nav-links{';
		$fruits_farming_custom_css .= 'justify-content: right;margin: 0 0 0 auto;';
		$fruits_farming_custom_css .= '}';
	} else if ($fruits_farming_theme_pagination_options_alignment == 'Left') {
		$fruits_farming_custom_css .= '.navigation.pagination,.navigation.posts-navigation .nav-links{';
		$fruits_farming_custom_css .= 'justify-content: left;margin: 0 auto 0 0;';
		$fruits_farming_custom_css .= '}';
	}

	$fruits_farming_theme_breadcrumb_enable = get_theme_mod('fruits_farming_theme_breadcrumb_enable',true);
    if($fruits_farming_theme_breadcrumb_enable != true){
        $fruits_farming_custom_css .='nav.breadcrumb-trail.breadcrumbs,nav.woocommerce-breadcrumb{';
            $fruits_farming_custom_css .='display: none;';
        $fruits_farming_custom_css .='}';
    }

	$fruits_farming_theme_breadcrumb_options_alignment = get_theme_mod('fruits_farming_theme_breadcrumb_options_alignment', 'Left');
	if ($fruits_farming_theme_breadcrumb_options_alignment == 'Center') {
	    $fruits_farming_custom_css .= '.breadcrumbs ul,nav.woocommerce-breadcrumb{';
	    $fruits_farming_custom_css .= 'text-align: center !important;';
	    $fruits_farming_custom_css .= '}';
	} else if ($fruits_farming_theme_breadcrumb_options_alignment == 'Right') {
	    $fruits_farming_custom_css .= '.breadcrumbs ul,nav.woocommerce-breadcrumb{';
	    $fruits_farming_custom_css .= 'text-align: Right !important;';
	    $fruits_farming_custom_css .= '}';
	} else if ($fruits_farming_theme_breadcrumb_options_alignment == 'Left') {
	    $fruits_farming_custom_css .= '.breadcrumbs ul,nav.woocommerce-breadcrumb{';
	    $fruits_farming_custom_css .= 'text-align: Left !important;';
	    $fruits_farming_custom_css .= '}';
	}

	$fruits_farming_menu_text_transform = get_theme_mod('fruits_farming_menu_text_transform', 'Capitalize');
	if ($fruits_farming_menu_text_transform == 'Capitalize') {
	    $fruits_farming_custom_css .= '.site-navigation .primary-menu > li a{';
	    $fruits_farming_custom_css .= 'text-transform: Capitalize !important;';
	    $fruits_farming_custom_css .= '}';
	} else if ($fruits_farming_menu_text_transform == 'uppercase') {
	    $fruits_farming_custom_css .= '.site-navigation .primary-menu > li a{';
	    $fruits_farming_custom_css .= 'text-transform: uppercase !important;';
	    $fruits_farming_custom_css .= '}';
	} else if ($fruits_farming_menu_text_transform == 'lowercase') {
	    $fruits_farming_custom_css .= '.site-navigation .primary-menu > li a{';
	    $fruits_farming_custom_css .= 'text-transform: lowercase !important;';
	    $fruits_farming_custom_css .= '}';
	}

	$fruits_farming_single_page_content_alignment = get_theme_mod('fruits_farming_single_page_content_alignment', 'left');
	if ($fruits_farming_single_page_content_alignment == 'left') {
	    $fruits_farming_custom_css .= '#single-page .type-page,section.theme-custom-block.theme-error-sectiontheme-error-section.error-block-middle,section.theme-custom-block.theme-error-section.error-block-heading .theme-area-header{';
	    $fruits_farming_custom_css .= 'text-align: left !important;';
	    $fruits_farming_custom_css .= '}';
	} else if ($fruits_farming_single_page_content_alignment == 'center') {
	    $fruits_farming_custom_css .= '#single-page .type-page,section.theme-custom-block.theme-error-sectiontheme-error-section.error-block-middle,section.theme-custom-block.theme-error-section.error-block-heading .theme-area-header{';
	    $fruits_farming_custom_css .= 'text-align: center !important;';
	    $fruits_farming_custom_css .= '}';
	} else if ($fruits_farming_single_page_content_alignment == 'right') {
	    $fruits_farming_custom_css .= '#single-page .type-page,section.theme-custom-block.theme-error-sectiontheme-error-section.error-block-middle,section.theme-custom-block.theme-error-section.error-block-heading .theme-area-header{';
	    $fruits_farming_custom_css .= 'text-align: right !important;';
	    $fruits_farming_custom_css .= '}';
	}

	$fruits_farming_single_post_content_alignment = get_theme_mod('fruits_farming_single_post_content_alignment', 'left');
	if ($fruits_farming_single_post_content_alignment == 'left') {
	    $fruits_farming_custom_css .= '#single-page .type-post,#single-page .type-post .entry-meta,#single-page .type-post .is-layout-flex{';
	    $fruits_farming_custom_css .= 'text-align: left !important;justify-content: left;';
	    $fruits_farming_custom_css .= '}';
	} else if ($fruits_farming_single_post_content_alignment == 'center') {
	    $fruits_farming_custom_css .= '#single-page .type-post,#single-page .type-post .entry-meta,#single-page .type-post .is-layout-flex{';
	    $fruits_farming_custom_css .= 'text-align: center !important;justify-content: center;';
	    $fruits_farming_custom_css .= '}';
	} else if ($fruits_farming_single_post_content_alignment == 'right') {
	    $fruits_farming_custom_css .= '#single-page .type-post,#single-page .type-post .entry-meta,#single-page .type-post .is-layout-flex{';
	    $fruits_farming_custom_css .= 'text-align: right !important;justify-content: right;';
	    $fruits_farming_custom_css .= '}';
	}

	$fruits_farming_footer_widget_title_alignment = get_theme_mod('fruits_farming_footer_widget_title_alignment', 'left');
	if ($fruits_farming_footer_widget_title_alignment == 'left') {
	    $fruits_farming_custom_css .= 'h2.widget-title{';
	    $fruits_farming_custom_css .= 'text-align: left !important;';
	    $fruits_farming_custom_css .= '}';
	} else if ($fruits_farming_footer_widget_title_alignment == 'center') {
	    $fruits_farming_custom_css .= 'h2.widget-title{';
	    $fruits_farming_custom_css .= 'text-align: center !important;';
	    $fruits_farming_custom_css .= '}';
	} else if ($fruits_farming_footer_widget_title_alignment == 'right') {
	    $fruits_farming_custom_css .= 'h2.widget-title{';
	    $fruits_farming_custom_css .= 'text-align: right !important;';
	    $fruits_farming_custom_css .= '}';
	}

	$fruits_farming_show_hide_related_product = get_theme_mod('fruits_farming_show_hide_related_product',true);
    if($fruits_farming_show_hide_related_product != true){
        $fruits_farming_custom_css .='.related.products{';
            $fruits_farming_custom_css .='display: none;';
        $fruits_farming_custom_css .='}';
    }

    /*-------------------- Global First Color -------------------*/

	$fruits_farming_global_color = get_theme_mod('fruits_farming_global_color', '#5DB75B'); // Add a fallback if the color isn't set

	if ($fruits_farming_global_color) {
		$fruits_farming_custom_css .= ':root {';
		$fruits_farming_custom_css .= '--global-color: ' . esc_attr($fruits_farming_global_color) . ';';
		$fruits_farming_custom_css .= '}';
	}
	
	/*-------------------- Content Font -------------------*/

	$fruits_farming_content_typography_font = get_theme_mod('fruits_farming_content_typography_font', 'Poppins'); // Add a fallback if the color isn't set

	if ($fruits_farming_content_typography_font) {
		$fruits_farming_custom_css .= ':root {';
		$fruits_farming_custom_css .= '--font-main: ' . esc_attr($fruits_farming_content_typography_font) . ';';
		$fruits_farming_custom_css .= '}';
	}

	/*-------------------- Heading Font -------------------*/

	$fruits_farming_heading_typography_font = get_theme_mod('fruits_farming_heading_typography_font', 'NotoSans'); // Add a fallback if the color isn't set

	if ($fruits_farming_heading_typography_font) {
		$fruits_farming_custom_css .= ':root {';
		$fruits_farming_custom_css .= '--font-head: ' . esc_attr($fruits_farming_heading_typography_font) . ';';
		$fruits_farming_custom_css .= '}';
	}
							
	$fruits_farming_columns = get_theme_mod('fruits_farming_posts_per_columns', 3);
	$fruits_farming_columns = absint($fruits_farming_columns);
	if ( $fruits_farming_columns < 1 || $fruits_farming_columns > 6 ) {
		$fruits_farming_columns = 3;
	}
	$fruits_farming_custom_css .= "
		.site-content .article-wraper-archive {
			grid-template-columns: repeat({$fruits_farming_columns}, 1fr);
		}
	";

	$fruits_farming_copyright_alignment = get_theme_mod( 'fruits_farming_copyright_alignment', 'Default' );
	if ( $fruits_farming_copyright_alignment === 'Reverse' ) {
		$fruits_farming_custom_css .= '.site-info .column-row { flex-direction: row-reverse; }';
		$fruits_farming_custom_css .= '.footer-credits { justify-content: flex-end; }';
		$fruits_farming_custom_css .= '.footer-copyright { text-align: right; }';
		$fruits_farming_custom_css .= '.site-info .column.column-3 { text-align: left; }';
	} elseif ( $fruits_farming_copyright_alignment === 'Center' ) {
		$fruits_farming_custom_css .= '.site-info .column-row { flex-direction: column; align-items: center; gap: 15px; }';
		$fruits_farming_custom_css .= '.footer-credits { justify-content: center; }';
		$fruits_farming_custom_css .= '.footer-copyright { text-align: center; }';
		$fruits_farming_custom_css .= '.site-info .column.column-3 { text-align: center; }';
	}

	$fruits_farming_footer_widget_background_color = get_theme_mod('fruits_farming_footer_widget_background_color');
	if ($fruits_farming_footer_widget_background_color) {

		$fruits_farming_custom_css .= "
			.footer-widgetarea {
				background-color: ". esc_attr($fruits_farming_footer_widget_background_color) .";
			}
		";
	}

	$fruits_farming_footer_widget_background_image = get_theme_mod('fruits_farming_footer_widget_background_image');
	if ($fruits_farming_footer_widget_background_image) {
		$fruits_farming_custom_css .= "
			.footer-widgetarea {
				background-image: url(" . esc_url($fruits_farming_footer_widget_background_image) . ");
			}
		";
	}

	$fruits_farming_copyright_font_size = get_theme_mod('fruits_farming_copyright_font_size');
	if ($fruits_farming_copyright_font_size) {

		$fruits_farming_custom_css .= "
			.footer-copyright {
				font-size: ". esc_attr($fruits_farming_copyright_font_size) ."px;
			}
		";
	}

	/*-------------------- Menu Color CSS -------------------*/

	$fruits_farming_header_menus_color = get_theme_mod('fruits_farming_header_menus_color');
	if($fruits_farming_header_menus_color != false){
		$fruits_farming_custom_css .='.site-navigation .primary-menu a{';
			$fruits_farming_custom_css .='color: '.esc_attr($fruits_farming_header_menus_color).'!important;';
		$fruits_farming_custom_css .='}';
	}

	$fruits_farming_header_menus_hover_color = get_theme_mod('fruits_farming_header_menus_hover_color');
	if($fruits_farming_header_menus_hover_color != false){
		$fruits_farming_custom_css .='.site-navigation .primary-menu a:hover{';
			$fruits_farming_custom_css .='color: '.esc_attr($fruits_farming_header_menus_hover_color).'!important;';
		$fruits_farming_custom_css .='}';
	}

	$fruits_farming_header_submenus_color = get_theme_mod('fruits_farming_header_submenus_color');
	if($fruits_farming_header_submenus_color != false){
		$fruits_farming_custom_css .='.site-navigation .primary-menu ul.sub-menu li a,.site-navigation .primary-menu li ul li a{';
			$fruits_farming_custom_css .='color: '.esc_attr($fruits_farming_header_submenus_color).'!important;';
		$fruits_farming_custom_css .='}';
	}

	$fruits_farming_header_submenus_hover_color = get_theme_mod('fruits_farming_header_submenus_hover_color');
	if($fruits_farming_header_submenus_hover_color != false){
		$fruits_farming_custom_css .='.site-navigation .primary-menu > li ul.sub-menu a:hover,.site-navigation .primary-menu li ul li a:hover{';
			$fruits_farming_custom_css .='color: '.esc_attr($fruits_farming_header_submenus_hover_color).'!important;';
		$fruits_farming_custom_css .='}';
	}