<?php

$film_maker_lite_tp_theme_css = '';

//theme color
$film_maker_lite_tp_color_option = get_theme_mod('film_maker_lite_tp_color_option');

// Get the primary color (1st color) from the theme customizer, with a fallback
$film_maker_lite_tp_color_option = get_theme_mod('film_maker_lite_tp_color_option', '#fb7893'); // Default primary color

// Get the secondary color (2nd color) from the theme customizer, with a fallback
$film_maker_lite_tp_color_sec = get_theme_mod('film_maker_lite_tp_color_sec', '#6e0af7 '); // Default secondary color

// Fallbacks if colors are not set
if (empty($film_maker_lite_tp_color_option)) {
    $film_maker_lite_tp_color_option = '#fb7893'; // Default primary color
}

if (empty($film_maker_lite_tp_color_sec)) {
    $film_maker_lite_tp_color_sec = '#6e0af7  '; // Default secondary color
}

// Generate the CSS for the primary and secondary colors (1st and 2nd color)
$film_maker_lite_tp_theme_css .= ':root {';
$film_maker_lite_tp_theme_css .= '--color-primary1: ' . esc_attr($film_maker_lite_tp_color_option) . ';'; // Primary color
$film_maker_lite_tp_theme_css .= '--color-secondary1: ' . esc_attr($film_maker_lite_tp_color_sec) . ';'; // Secondary color
$film_maker_lite_tp_theme_css .= '}';

// Generate the linear gradient CSS for specific elements
$film_maker_lite_tp_theme_css .= '.wc-block-checkout__actions_row .wc-block-components-checkout-place-order-button, .woocommerce ul.products li.product .onsale, .woocommerce span.onsale, .wc-block-cart__submit-container a, #theme-sidebar button[type="submit"], .error-404 [type="submit"], #footer button[type="submit"], .prev.page-numbers, .next.page-numbers, .page-numbers, .woocommerce #respond input#submit, .woocommerce a.button, .woocommerce button.button, .woocommerce input.button, .woocommerce #respond input#submit.alt, .woocommerce a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt, #comments input[type="submit"], span.meta-nav, .more-btn a, #our_project i, .search-box i, .readmore-btn a, a.added_to_cart.wc-forward, .toggle-nav button, .book-tkt-btn a, #slider .carousel-control-prev-icon, #slider .carousel-control-next-icon, #slider .inner_carousel p, .inner_searchbox button[type="submit"], button[type="submit"], .wp-block-file .wp-block-file__button, .wp-block-button .wp-block-button__link, .box:before, .box:after, .site-info, .top-header, #latest-release .owl-nav i:hover{';

// Apply the linear gradient background using the two colors
$film_maker_lite_tp_theme_css .= 'background-image: linear-gradient(to right, ' 
    . esc_attr($film_maker_lite_tp_color_sec) . ', ' 
    . esc_attr($film_maker_lite_tp_color_option) . ') !important;';

$film_maker_lite_tp_theme_css .= '}'; // Close the CSS block

// Output the generated CSS within a <style> tag
echo '<style>' . $film_maker_lite_tp_theme_css . '</style>';

//preloader

$film_maker_lite_tp_preloader_color1_option = get_theme_mod('film_maker_lite_tp_preloader_color1_option');
$film_maker_lite_tp_preloader_color2_option = get_theme_mod('film_maker_lite_tp_preloader_color2_option');
$film_maker_lite_tp_preloader_bg_color_option = get_theme_mod('film_maker_lite_tp_preloader_bg_color_option');

if($film_maker_lite_tp_preloader_color1_option != false){
$film_maker_lite_tp_theme_css .='.center1{';
	$film_maker_lite_tp_theme_css .='border-color: '.esc_attr($film_maker_lite_tp_preloader_color1_option).' !important;';
$film_maker_lite_tp_theme_css .='}';
}
if($film_maker_lite_tp_preloader_color1_option != false){
$film_maker_lite_tp_theme_css .='.center1 .ring::before{';
	$film_maker_lite_tp_theme_css .='background: '.esc_attr($film_maker_lite_tp_preloader_color1_option).' !important;';
$film_maker_lite_tp_theme_css .='}';
}
if($film_maker_lite_tp_preloader_color2_option != false){
$film_maker_lite_tp_theme_css .='.center2{';
	$film_maker_lite_tp_theme_css .='border-color: '.esc_attr($film_maker_lite_tp_preloader_color2_option).' !important;';
$film_maker_lite_tp_theme_css .='}';
}
if($film_maker_lite_tp_preloader_color2_option != false){
$film_maker_lite_tp_theme_css .='.center2 .ring::before{';
	$film_maker_lite_tp_theme_css .='background: '.esc_attr($film_maker_lite_tp_preloader_color2_option).' !important;';
$film_maker_lite_tp_theme_css .='}';
}
if($film_maker_lite_tp_preloader_bg_color_option != false){
$film_maker_lite_tp_theme_css .='.loader{';
	$film_maker_lite_tp_theme_css .='background: '.esc_attr($film_maker_lite_tp_preloader_bg_color_option).';';
$film_maker_lite_tp_theme_css .='}';
}

// footer-bg-color
$film_maker_lite_tp_footer_bg_color_option = get_theme_mod('film_maker_lite_tp_footer_bg_color_option');

if($film_maker_lite_tp_footer_bg_color_option != false){
$film_maker_lite_tp_theme_css .='#footer{';
	$film_maker_lite_tp_theme_css .='background: '.esc_attr($film_maker_lite_tp_footer_bg_color_option).' !important;';
$film_maker_lite_tp_theme_css .='}';
}

//footer image
$film_maker_lite_footer_widget_image = get_theme_mod('film_maker_lite_footer_widget_image');
if($film_maker_lite_footer_widget_image != false){
$film_maker_lite_tp_theme_css .='#footer{';
	$film_maker_lite_tp_theme_css .='background: url('.esc_attr($film_maker_lite_footer_widget_image).');';
$film_maker_lite_tp_theme_css .='}';
}

//Font Weight
$film_maker_lite_menu_font_weight = get_theme_mod( 'film_maker_lite_menu_font_weight','600');
if($film_maker_lite_menu_font_weight == '100'){
$film_maker_lite_tp_theme_css .='.main-navigation a{';
    $film_maker_lite_tp_theme_css .='font-weight: 100;';
$film_maker_lite_tp_theme_css .='}';
}else if($film_maker_lite_menu_font_weight == '200'){
$film_maker_lite_tp_theme_css .='.main-navigation a{';
    $film_maker_lite_tp_theme_css .='font-weight: 200;';
$film_maker_lite_tp_theme_css .='}';
}else if($film_maker_lite_menu_font_weight == '300'){
$film_maker_lite_tp_theme_css .='.main-navigation a{';
    $film_maker_lite_tp_theme_css .='font-weight: 300;';
$film_maker_lite_tp_theme_css .='}';
}else if($film_maker_lite_menu_font_weight == '400'){
$film_maker_lite_tp_theme_css .='.main-navigation a{';
    $film_maker_lite_tp_theme_css .='font-weight: 400;';
$film_maker_lite_tp_theme_css .='}';
}else if($film_maker_lite_menu_font_weight == '500'){
$film_maker_lite_tp_theme_css .='.main-navigation a{';
    $film_maker_lite_tp_theme_css .='font-weight: 500;';
$film_maker_lite_tp_theme_css .='}';
}else if($film_maker_lite_menu_font_weight == '600'){
$film_maker_lite_tp_theme_css .='.main-navigation a{';
    $film_maker_lite_tp_theme_css .='font-weight: 600;';
$film_maker_lite_tp_theme_css .='}';
}else if($film_maker_lite_menu_font_weight == '700'){
$film_maker_lite_tp_theme_css .='.main-navigation a{';
    $film_maker_lite_tp_theme_css .='font-weight: 700;';
$film_maker_lite_tp_theme_css .='}';
}else if($film_maker_lite_menu_font_weight == '800'){
$film_maker_lite_tp_theme_css .='.main-navigation a{';
    $film_maker_lite_tp_theme_css .='font-weight: 800;';
$film_maker_lite_tp_theme_css .='}';
}else if($film_maker_lite_menu_font_weight == '900'){
$film_maker_lite_tp_theme_css .='.main-navigation a{';
    $film_maker_lite_tp_theme_css .='font-weight: 900;';
$film_maker_lite_tp_theme_css .='}';
}

/*------------------ Slider CSS -------------------*/
    $film_maker_lite_slider_opacity_setting = get_theme_mod('film_maker_lite_slider_opacity_setting', true);
    $film_maker_lite_image_opacity_color    = get_theme_mod('film_maker_lite_image_opacity_color', '');
    $film_maker_lite_slider_opacity         = get_theme_mod('film_maker_lite_slider_opacity', '1');

    if ($film_maker_lite_slider_opacity_setting) {
        // Apply opacity value to slider image
        if ($film_maker_lite_slider_opacity !== '') {
            $film_maker_lite_tp_theme_css .= '#slider img {';
            $film_maker_lite_tp_theme_css .= 'opacity: ' . esc_attr($film_maker_lite_slider_opacity) . ';';
            $film_maker_lite_tp_theme_css .= '}';
        }

        // Apply background color to slider if defined
        if ($film_maker_lite_image_opacity_color !== '') {
            $film_maker_lite_tp_theme_css .= '#slider {';
            $film_maker_lite_tp_theme_css .= 'background-color: ' . esc_attr($film_maker_lite_image_opacity_color) . ';';
            $film_maker_lite_tp_theme_css .= '}';
        }
    } else {
        // If setting is disabled, force full opacity
        $film_maker_lite_tp_theme_css .= '#slider img {';
        $film_maker_lite_tp_theme_css .= 'opacity: 1;';
        $film_maker_lite_tp_theme_css .= '}';
    }

    // Slider Height
    $film_maker_lite_slider_img_height      = get_theme_mod('film_maker_lite_slider_img_height');
    $film_maker_lite_slider_img_height_resp = get_theme_mod('film_maker_lite_slider_img_height_responsive');

    // Desktop height
    $film_maker_lite_tp_theme_css .= '@media screen and (min-width: 768px) {';
    $film_maker_lite_tp_theme_css .= '#slider img {';
    if ( $film_maker_lite_slider_img_height ) {
        $film_maker_lite_tp_theme_css .= 'height: ' . esc_attr( $film_maker_lite_slider_img_height ) . ';';
    }
    $film_maker_lite_tp_theme_css .= 'width: 100%; object-fit: cover;';
    $film_maker_lite_tp_theme_css .= '}';
    $film_maker_lite_tp_theme_css .= '}';

    // Mobile height
    $film_maker_lite_tp_theme_css .= '@media screen and (max-width: 767px) {';
    $film_maker_lite_tp_theme_css .= '#slider img {';
    if ( $film_maker_lite_slider_img_height_resp ) {
        $film_maker_lite_tp_theme_css .= 'height: ' . esc_attr( $film_maker_lite_slider_img_height_resp ) . ' !important;';
    }
    $film_maker_lite_tp_theme_css .= 'width: 100%; object-fit: cover;';
    $film_maker_lite_tp_theme_css .= '}';
    $film_maker_lite_tp_theme_css .= '}';