<?php
/**
 * The dynamic CSS for Carousel layout.
 *
 * @package Smart_Post_Show_Pro
 * @subpackage Smart_Post_Show_Pro/Public/dynamic-css
 */

$thumbnail_style = isset( $layouts['pcp_thumb_style'] ) ? $layouts['pcp_thumb_style'] : 'bottom';
// Navigation options.
$_navigation_data      = isset( $view_options['pcp_navigation_data'] ) ? $view_options['pcp_navigation_data'] : array();
$_navigation           = isset( $_navigation_data['pcp_navigation'] ) ? $_navigation_data['pcp_navigation'] : true;
$_navigation_on_mobile = isset( $_navigation_data['nev_hide_on_mobile'] ) ? $_navigation_data['nev_hide_on_mobile'] : false;

if ( $_navigation && ! $_navigation_on_mobile ) {
	$pcp_navigation = 'show';
} elseif ( $_navigation && $_navigation_on_mobile ) {
	$pcp_navigation = 'hide_on_mobile';
} else {
	$pcp_navigation = 'hide';
}
	$carousel_mode                 = isset( $layouts['pcp_carousel_mode'] ) ? $layouts['pcp_carousel_mode'] : 'standard';
	$title_text                    = get_the_title( $pcp_id );
	$view_options['section_title'] = empty( $title_text ) ? false : $view_options['section_title'];
	$_nav_colors                   = SP_PCP_Functions::pcp_metabox_value(
		'pcp_nav_colors',
		$view_options,
		array(
			'color'       => '#aaa',
			'hover-color' => '#fff',
			'bg'          => '#fff',
			'hover-bg'    => '#e1624b',
		)
	);
	$_nav_border                   = SP_PCP_Functions::pcp_metabox_value(
		'pcp_nav_border',
		$view_options,
		array(
			'all'           => '1',
			'style'         => 'solid',
			'color'         => '#aaa',
			'hover_color'   => '#e1624b',
			'border_radius' => '0',
			'unit'          => 'px',
		)
	);
	$nav_color                     = SP_PCP_Functions::pcp_metabox_value( 'color', $_nav_colors );
	$nav_color_hover               = SP_PCP_Functions::pcp_metabox_value( 'hover-color', $_nav_colors );
	$nav_color_bg                  = SP_PCP_Functions::pcp_metabox_value( 'bg', $_nav_colors );
	$nav_color_bg_hover            = SP_PCP_Functions::pcp_metabox_value( 'hover-bg', $_nav_colors );
	$nav_icon_size                 = SP_PCP_Functions::pcp_metabox_value( 'pcp_nav_icon_size', $view_options, '18' );

	// Pagination options.
	$_pagination_data      = isset( $view_options['carousel_pagination_group'] ) ? $view_options['carousel_pagination_group'] : array();
	$_pagination           = isset( $_pagination_data['pcp_pagination'] ) ? $_pagination_data['pcp_pagination'] : true;
	$_pagination_on_mobile = isset( $_pagination_data['pagination_hide_on_mobile'] ) ? $_pagination_data['pagination_hide_on_mobile'] : false;
	if ( $_pagination && ! $_pagination_on_mobile ) {
		$pcp_pagination = 'show';
	} elseif ( $_pagination && $_pagination_on_mobile ) {
		$pcp_pagination = 'hide_on_mobile';
	} else {
		$pcp_pagination = 'hide';
	}

	$_pagination_color_set         = isset( $view_options['pcp_pagination_color_set'] ) ? $view_options['pcp_pagination_color_set'] : '';
	$_pagination_colors            = isset( $_pagination_color_set['pcp_pagination_color'] ) ? $_pagination_color_set['pcp_pagination_color'] : array(
		'color'        => '#cccccc',
		'active-color' => '#e1624b',
	);
	$pagination_color              = $_pagination_colors['color'];
	$pagination_color_active       = $_pagination_colors['active-color'];
	$_pagination_number_colors     = isset( $_pagination_color_set['pcp_pagination_number_color'] ) ? $_pagination_color_set['pcp_pagination_number_color'] : array(
		'color'       => '#ffffff',
		'hover-color' => '#ffffff',
		'bg'          => '#444444',
		'hover-bg'    => '#e1624b',
	);
	$pagination_number_color       = $_pagination_number_colors['color'];
	$pagination_number_hover_color = $_pagination_number_colors['hover-color'];
	$pagination_number_bg          = $_pagination_number_colors['bg'];
	$pagination_number_hover_bg    = $_pagination_number_colors['hover-bg'];

	$classes = get_body_class();
	if ( in_array( 'et_divi_builder', $classes, true ) ) {
		// DB Builder compatibility.
		if ( 'hide_on_mobile' === $pcp_navigation ) {
			$custom_css .= "@media (max-width: 480px) { #et-boc .et-l #pcp_wrapper-{$pcp_id} .pcp-button-prev, #et-boc .et-l #pcp_wrapper-{$pcp_id} .pcp-button-next { display: none; } }";
		} $custom_css .= "#et-boc .et-l #pcp_wrapper-{$pcp_id} .pcp-button-prev, #et-boc .et-l #pcp_wrapper-{$pcp_id} .pcp-button-next{ background-image: none; background-size: auto; background-color: {$nav_color_bg}; font-size: {$nav_icon_size}px; height: 33px; width: 33px; margin-top: 8px; border: {$_nav_border['all']}px {$_nav_border['style']} {$_nav_border['color']}; text-align: center; line-height: 30px; -webkit-transition: 0.3s; border-radius: {$_nav_border['border_radius']}{$_nav_border['unit']}; }";
		$custom_css   .= "#et-boc .et-l #pcp_wrapper-{$pcp_id} .pcp-button-prev:hover, #et-boc .et-l #pcp_wrapper-{$pcp_id} .pcp-button-next:hover{ background-color: {$nav_color_bg_hover}; border-color: {$_nav_border['hover_color']}; } #et-boc .et-l #pcp_wrapper-{$pcp_id} .pcp-button-prev i, #et-boc .et-l #pcp_wrapper-{$pcp_id} .pcp-button-next i{ color: {$nav_color}; } #et-boc .et-l #pcp_wrapper-{$pcp_id} .pcp-button-prev:hover i, #et-boc .et-l #pcp_wrapper-{$pcp_id} .pcp-button-next:hover i{ color: {$nav_color_hover}; } #et-boc .et-l #pcp_wrapper-{$pcp_id}.pcp-carousel-wrapper .sp-pcp-post{ margin-top: 0; } ";
		if ( 'hide' !== $pcp_navigation && ! $view_options['section_title'] && 'ticker' !== $carousel_mode ) {
			$custom_css .= "#et-boc .et-l #pcp_wrapper-{$pcp_id} .sp-pcp-carousel.top_right, #et-boc .et-l #pcp_wrapper-{$pcp_id} .sp-pcp-carousel.top_left, #et-boc .et-l #pcp_wrapper-{$pcp_id} .sp-pcp-carousel.top_center {padding-top: 60px;}";
		}
		if ( 'hide' !== $pcp_navigation && 'ticker' !== $carousel_mode ) {
			$custom_css .= "#et-boc .et-l #pcp_wrapper-{$pcp_id} .sp-pcp-carousel.bottom_left, #et-boc .et-l #pcp_wrapper-{$pcp_id} .sp-pcp-carousel.bottom_right, #et-boc .et-l #pcp_wrapper-{$pcp_id} .sp-pcp-carousel.bottom_center {padding-bottom: 60px;}";
		}
		if ( 'hide_on_mobile' === $pcp_pagination ) {
			$custom_css .= "@media (max-width: 480px) { #et-boc .et-l #pcp_wrapper-{$pcp_id} .pcp-pagination,#et-boc .et-l #pcp_wrapper-{$pcp_id} .pcp-pagination-scrollbar{ display: none; } }";
		} $custom_css .= "#et-boc .et-l #pcp_wrapper-{$pcp_id} .pcp-pagination:is(.dots,.dynamic,.strokes) .swiper-pagination-bullet{ background: {$pagination_color}; } #et-boc .et-l #pcp_wrapper-{$pcp_id} .pcp-pagination:is(.dots,.dynamic,.strokes) .swiper-pagination-bullet-active { background: {$pagination_color_active}; } #et-boc .et-l #pcp_wrapper-{$pcp_id} .number .swiper-pagination-bullet{ color: {$pagination_number_color}; background: {$pagination_number_bg}; } #et-boc .et-l #pcp_wrapper-{$pcp_id} .number .swiper-pagination-bullet-active, #et-boc .et-l #pcp_wrapper-{$pcp_id} .number .swiper-pagination-bullet:hover{ color: {$pagination_number_hover_color}; background: {$pagination_number_hover_bg}; } #et-boc .et-l #pcp_wrapper-{$pcp_id} .pcp-pagination{text-align:center;} #et-boc .et-l #pcp_wrapper-{$pcp_id} .pcp-pagination .swiper-pagination-bullet{ border-radius: 50%; margin: 0 4px;}";
		$custom_css   .= "#et-boc .et-l #pcp_wrapper-{$pcp_id} .sp-pcp-carousel .pcp-pagination-scrollbar{ background: {$pagination_color}; } #et-boc .et-l #pcp_wrapper-{$pcp_id} .sp-pcp-carousel .pcp-pagination-scrollbar .swiper-scrollbar-drag{ background: {$pagination_color_active}; }";

		$carousel_nav_position = SP_PCP_Functions::pcp_metabox_value( 'pcp_carousel_nav_position', $view_options, 'top_right' );
		if ( 'vertically_center_outer' === $carousel_nav_position ) {
			$custom_css .= "#et-boc .et-l .pcp-wrapper-{$pcp_id} .swiper-container:not(.thumbnails_slider.thumbnail-slider-top){ position: static; }";
		}
		if ( 'hide' !== $pcp_pagination && 'ticker' !== $carousel_mode ) {
			$custom_css .= "#et-boc .et-l #pcp_wrapper-{$pcp_id} .sp-pcp-carousel .sp-pcp-carousel:not(.slider_layout,.thumbnail-slider-top) {padding-bottom: 60px;}";
		}
	} else {
		$custom_css .= "#pcp_wrapper-{$pcp_id} .pcp-carousel-fade:not(.swiper-rtl)  .swiper-slide .sp-smart-pro-item:not(:last-child),  #pcp_wrapper-{$pcp_id} .swiper-cube:not(.swiper-rtl)  .swiper-slide [class~='sp-smart-pro-item'], #pcp_wrapper-{$pcp_id} .swiper-flip:not(.swiper-rtl)  .swiper-slide [class~='sp-smart-pro-item']{
		margin-right:{$margin_between_horizontal_post}px;
	}
	#pcp_wrapper-{$pcp_id} .pcp-carousel-fade.swiper-rtl  .swiper-slide .sp-smart-pro-item:not(:last-child),  #pcp_wrapper-{$pcp_id} .swipe-cube.swiper-rtl  .swiper-slide [class~='sp-smart-pro-item'], #pcp_wrapper-{$pcp_id} .swiper-flip.swiper-rtl  .swiper-slide [class~='sp-smart-pro-item']{
		margin-left:{$margin_between_horizontal_post}px;
	}
	";

		if ( 'hide_on_mobile' === $pcp_navigation ) {
			$custom_css .= "@media (max-width: 480px) { #pcp_wrapper-{$pcp_id} .pcp-button-prev, #pcp_wrapper-{$pcp_id} .pcp-button-next { display: none; } }";
		}
		$icon_height_width = (int) $nav_icon_size + 15;
		$custom_css       .= "#pcp_wrapper-{$pcp_id} .pcp-button-prev, #pcp_wrapper-{$pcp_id} .pcp-button-next{ background-image: none; background-size: auto; background-color: {$nav_color_bg}; font-size: {$nav_icon_size}px; height: {$icon_height_width}px; width: {$icon_height_width}px; margin-top: 8px; border: {$_nav_border['all']}px {$_nav_border['style']} {$_nav_border['color']}; text-align: center; line-height: 30px; -webkit-transition: 0.3s; border-radius: {$_nav_border['border_radius']}{$_nav_border['unit']}; }";
		$custom_css       .= "#pcp_wrapper-{$pcp_id} .pcp-button-prev:hover, #pcp_wrapper-{$pcp_id} .pcp-button-next:hover{ background-color: {$nav_color_bg_hover}; border-color: {$_nav_border['hover_color']}; } #pcp_wrapper-{$pcp_id} .pcp-button-prev i, #pcp_wrapper-{$pcp_id} .pcp-button-next i{ color: {$nav_color}; } #pcp_wrapper-{$pcp_id} .pcp-button-prev:hover i, #pcp_wrapper-{$pcp_id} .pcp-button-next:hover i{ color: {$nav_color_hover}; } #pcp_wrapper-{$pcp_id}.pcp-carousel-wrapper .sp-pcp-post{ margin-top: 0; } ";
		if ( 'hide' !== $pcp_navigation && ! $view_options['section_title'] && 'ticker' !== $carousel_mode ) {
			$custom_css .= "#pcp_wrapper-{$pcp_id} .sp-pcp-carousel.top_right, #pcp_wrapper-{$pcp_id} .sp-pcp-carousel.top_left, #pcp_wrapper-{$pcp_id} .sp-pcp-carousel.top_center {padding-top: 60px;}";
		}
		if ( 'hide' !== $pcp_navigation && 'ticker' !== $carousel_mode ) {
			$custom_css .= "#pcp_wrapper-{$pcp_id} .sp-pcp-carousel.bottom_left, #pcp_wrapper-{$pcp_id} .sp-pcp-carousel.bottom_right, #pcp_wrapper-{$pcp_id} .sp-pcp-carousel.bottom_center {padding-bottom: 60px;}";
		}
		if ( 'hide_on_mobile' === $pcp_pagination ) {
			$custom_css .= "@media (max-width: 480px) { #pcp_wrapper-{$pcp_id} .pcp-pagination,#pcp_wrapper-{$pcp_id} .pcp-pagination-scrollbar{ display: none; } }";
		} $custom_css .= "#pcp_wrapper-{$pcp_id} .pcp-pagination:is(.dots,.dynamic,.strokes) .swiper-pagination-bullet{ background: {$pagination_color}; } #pcp_wrapper-{$pcp_id} .pcp-pagination:is(.dots,.dynamic,.strokes) .swiper-pagination-bullet-active { background: {$pagination_color_active}; } #pcp_wrapper-{$pcp_id} .number .swiper-pagination-bullet{ color: {$pagination_number_color}; background: {$pagination_number_bg}; } #pcp_wrapper-{$pcp_id} .number .swiper-pagination-bullet-active, #pcp_wrapper-{$pcp_id} .number .swiper-pagination-bullet:hover{ color: {$pagination_number_hover_color}; background: {$pagination_number_hover_bg}; }";
		$custom_css   .= "#pcp_wrapper-{$pcp_id} .sp-pcp-carousel .pcp-pagination-scrollbar{ background: {$pagination_color}; }#pcp_wrapper-{$pcp_id} .sp-pcp-carousel .pcp-pagination-scrollbar .swiper-scrollbar-drag{ background: {$pagination_color_active}; }";

		$custom_css .= "#pcp_wrapper-{$pcp_id} .pcp-filter-bar ~ .sp-pcp-carousel.top_right, #pcp_wrapper-{$pcp_id} .pcp-filter-bar ~ .sp-pcp-carousel.top_center, #pcp_wrapper-{$pcp_id} .pcp-filter-bar ~ .sp-pcp-carousel.top_left {padding-top: 0px;}";

		$carousel_nav_position = SP_PCP_Functions::pcp_metabox_value( 'pcp_carousel_nav_position', $view_options, 'top_right' );
		if ( 'vertically_center_outer' === $carousel_nav_position ) {
			$dynamic_margin = (int) $nav_icon_size > 20 ? (int) $nav_icon_size + 25 : 45;
			$custom_css    .= ".pcp-wrapper-{$pcp_id} .swiper-container:not(.thumbnails_slider.thumbnail-slider-top){ position: static; }.pcp-wrapper-{$pcp_id} .swiper-container:not(.swiper-coverflow,.thumbnails_slider){ margin-left: {$dynamic_margin}px;margin-right: {$dynamic_margin}px; }";
			if ( 'hide_on_mobile' === $pcp_navigation ) {
				$custom_css .= "@media (max-width: 480px) { .pcp-wrapper-{$pcp_id} .swiper-container:not(.swiper-coverflow,.thumbnails_slider){ margin-left: 0px;margin-right: 0px; } }";
			}
		}
		if ( 'vertical_center' === $carousel_nav_position ) {
			$custom_css .= ".pcp-wrapper-{$pcp_id} .swiper-container:not(.thumbnails_slider.thumbnail-slider-top){ position: static; }.pcp-wrapper-{$pcp_id} .swiper-container:not(.swiper-coverflow,.thumbnails_slider){ margin-left: 25px;margin-right: 25px; }";
			if ( 'hide_on_mobile' === $pcp_navigation ) {
				$custom_css .= "@media (max-width: 480px) { .pcp-wrapper-{$pcp_id} .swiper-container:not(.swiper-coverflow,.thumbnails_slider){ margin-left: 0px;margin-right: 0px; } }";
			}
		}
		if ( 'hide' !== $pcp_pagination && 'ticker' !== $carousel_mode ) {
			$custom_css .= "#pcp_wrapper-{$pcp_id} .sp-pcp-carousel:not(.slider_layout,.thumbnail-slider-top,.thumbnails_slider) {padding-bottom: 60px;}";
		}
		if ( 'thumbnails_slider' === $pcp_layout_preset ) {
			$custom_css .= "#pcp_wrapper-{$pcp_id} .thumbnail-slider-bottom .sp-pcp-title a {font-size: 14px;text-align: left;font-weight:500;line-height: 1.5;}#pcp_wrapper-{$pcp_id} .thumbnail-slider-bottom .sp-pcp-post-details {padding: 0 15px;}#pcp_wrapper-{$pcp_id} .thumbnail-slider-bottom .sp-pcp-post-meta {text-align: left;}#pcp_wrapper-{$pcp_id} .thumbnail-slider-bottom .sp-pcp-post-meta li a,#pcp_wrapper-{$pcp_id} .thumbnail-slider-bottom .sp-pcp-post-meta li{ font-size: 12px;}";
			switch ( $thumbnail_style ) {
				case 'bottom':
					$custom_css .= "#pcp_wrapper-{$pcp_id} .thumbnail-slider-bottom:is(.top_right,.top_center,.top_left) {padding-top: 0px;}#pcp_wrapper-{$pcp_id} .sp-thumbnail-style-bottom .sp-pcp-carousel.thumbnail-slider-bottom {padding-top: {$margin_between_vertical_post}px;}#pcp_wrapper-{$pcp_id} .thumbnail-slider-bottom .pcp-category{display:none;}#pcp_wrapper-{$pcp_id} .sp-thumbnail-style-bottom .thumbnail-slider-bottom .sp-smart-pro-item .sp-pcp-post{border-top: 4px solid transparent;}#pcp_wrapper-{$pcp_id} .sp-thumbnail-style-bottom .thumbnail-slider-bottom .sp-smart-pro-item.swiper-slide-active .sp-pcp-post{border-top: 4px solid #e1624b;}#pcp_wrapper-{$pcp_id} .sp-thumbnail-style-bottom .thumbnail-slider-bottom .pcp-pagination{bottom: -30px}";
					break;
				case 'top':
					$custom_css .= "#pcp_wrapper-{$pcp_id} .thumbnail-slider-top:is(.top_right,.top_center,.top_left) {padding-top: 0px;}#pcp_wrapper-{$pcp_id} .sp-thumbnail-style-top .sp-pcp-carousel.thumbnail-slider-top {padding-top: {$margin_between_vertical_post}px;}#pcp_wrapper-{$pcp_id} .thumbnail-slider-bottom .pcp-category{display:none;}#pcp_wrapper-{$pcp_id} .sp-thumbnail-style-top .thumbnail-slider-bottom .sp-smart-pro-item .sp-pcp-post{border-bottom: 4px solid transparent;}#pcp_wrapper-{$pcp_id} .sp-thumbnail-style-top .thumbnail-slider-bottom .sp-smart-pro-item.swiper-slide-active .sp-pcp-post{border-bottom: 4px solid #e1624b;}";
					break;
				case 'left':
					$custom_css .= "#pcp_wrapper-{$pcp_id} .thumbnail-slider-top:is(.top_right,.top_center,.top_left) {padding-top: 0px;}#pcp_wrapper-{$pcp_id} .thumbnail-slider-bottom:is(.top_right,.top_center,.top_left) {padding-top: 0px;}#pcp_wrapper-{$pcp_id} .thumbnail-slider-bottom .pcp-category{display:none;}
					#pcp_wrapper-{$pcp_id} .swiper-container:not(.swiper-coverflow,.thumbnails_slider.thumbnail-slider-top) {margin-left:0;margin-right:{$margin_between_horizontal_post}px;}#pcp_wrapper-{$pcp_id} .sp-thumbnail-style-left .thumbnail-slider-bottom .sp-smart-pro-item .sp-pcp-post{border-right: 4px solid transparent;}#pcp_wrapper-{$pcp_id} .sp-thumbnail-style-left .thumbnail-slider-bottom .sp-smart-pro-item.swiper-slide-active .sp-pcp-post{border-right: 4px solid #e1624b;}#pcp_wrapper-{$pcp_id} .sp-thumbnail-style-left .thumbnail-slider-bottom .pcp-pagination{width: 70%;}";
					break;
				case 'right':
					$custom_css .= "#pcp_wrapper-{$pcp_id} .thumbnail-slider-top:is(.top_right,.top_center,.top_left) {padding-top: 0px;}#pcp_wrapper-{$pcp_id} .thumbnail-slider-bottom:is(.top_right,.top_center,.top_left) {padding-top: 0px;}#pcp_wrapper-{$pcp_id} .thumbnail-slider-bottom .pcp-category{display:none;}
					#pcp_wrapper-{$pcp_id} .swiper-container:not(.swiper-coverflow,.thumbnails_slider.thumbnail-slider-top) {margin-right:0;margin-left:{$margin_between_horizontal_post}px;}#pcp_wrapper-{$pcp_id} .sp-thumbnail-style-right .thumbnail-slider-bottom .sp-smart-pro-item .sp-pcp-post{border-left: 4px solid transparent;}#pcp_wrapper-{$pcp_id} .sp-thumbnail-style-right .thumbnail-slider-bottom .sp-smart-pro-item.swiper-slide-active .sp-pcp-post{border-left: 4px solid #e1624b;}#pcp_wrapper-{$pcp_id} .sp-thumbnail-style-right .thumbnail-slider-bottom .pcp-pagination{width: 70%; justify-content: start;}";
					break;
			}
		}
	}
