<?php

$spa_parlor_custom_css = "";

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

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

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

	$spa_parlor_single_page_content_alignment = get_theme_mod('spa_parlor_single_page_content_alignment', 'left');
	if ($spa_parlor_single_page_content_alignment == 'left') {
	    $spa_parlor_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{';
	    $spa_parlor_custom_css .= 'text-align: left !important;';
	    $spa_parlor_custom_css .= '}';
	} else if ($spa_parlor_single_page_content_alignment == 'center') {
	    $spa_parlor_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{';
	    $spa_parlor_custom_css .= 'text-align: center !important;';
	    $spa_parlor_custom_css .= '}';
	} else if ($spa_parlor_single_page_content_alignment == 'right') {
	    $spa_parlor_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{';
	    $spa_parlor_custom_css .= 'text-align: right !important;';
	    $spa_parlor_custom_css .= '}';
	}

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

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

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

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

	$spa_parlor_sticky_sidebar = get_theme_mod('spa_parlor_sticky_sidebar',true);
    if($spa_parlor_sticky_sidebar != true){
        $spa_parlor_custom_css .='.widget-area-wrapper{';
            $spa_parlor_custom_css .='position: relative !important;';
        $spa_parlor_custom_css .='}';
    }

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

	$spa_parlor_global_color = get_theme_mod('spa_parlor_global_color', '#454B40 '); // Add a fallback if the color isn't set

	if ($spa_parlor_global_color) {
		$spa_parlor_custom_css .= ':root {';
		$spa_parlor_custom_css .= '--global-color: ' . esc_attr($spa_parlor_global_color) . ';';
		$spa_parlor_custom_css .= '}';
	}

	$spa_parlor_global_secondary_color = get_theme_mod('spa_parlor_global_secondary_color', '#1a1a1a'); // Add a fallback if the color isn't set

	if ($spa_parlor_global_secondary_color) {
		$spa_parlor_custom_css .= ':root {';
		$spa_parlor_custom_css .= '--secondary-color: ' . esc_attr($spa_parlor_global_secondary_color) . ';';
		$spa_parlor_custom_css .= '}';
	}
	
	/*-------------------- Content Font -------------------*/

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

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

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

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

	if ($spa_parlor_heading_typography_font) {
		$spa_parlor_custom_css .= ':root {';
		$spa_parlor_custom_css .= '--font-head: ' . esc_attr($spa_parlor_heading_typography_font) . ';';
		$spa_parlor_custom_css .= '}';
	}

	/*-------------------- FOOTER -------------------*/

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

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

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

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

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

	$spa_parlor_columns = get_theme_mod('spa_parlor_posts_per_columns', 3);
    $spa_parlor_columns = absint($spa_parlor_columns);
    if ( $spa_parlor_columns < 1 || $spa_parlor_columns > 6 ) {
        $spa_parlor_columns = 3;
    }
    $spa_parlor_custom_css .= "
        .site-content .article-wraper-archive {
            grid-template-columns: repeat({$spa_parlor_columns}, 1fr);
        }
    ";

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