<?php
global $gdprc_section_consent_theme_rendered;

if ((\gdprc_user_is_logged_in() || empty($this->getSetting('gdpr_consent_maintenance_mode'))) && $this->getSetting('gdprc_section_consent_theme_enable') && !$gdprc_section_consent_theme_rendered):
    \ob_start();
    $inherit = null; // We must disabled it because 'inherit' will break Style inheritance
    ?>
	<style type="text/css">
		<?php echo \apply_filters('gdprc_stylesheet_before', '');?>

        #gdprc_settings,
        #gdprc_bar,
        #gdprc_settings .gdprc_items {
			<?php echo \preg_match('~rgba\(\d+,\s*\d+,\s*\d+,\s*0\)~i',$this->getSetting('gdprc_consent_theme_border')) ? 'border: none' : 'border-color: '.$this->getSetting('gdprc_consent_theme_border'); ?>;
			<?php echo \apply_filters('gdprc_stylesheet_border', '');?>
        }

        #gdprc_bar,
        #gdprc_settings .gdprc_header,
        #gdprc_settings .gdprc_actions {
            background: <?php echo $this->getSetting('gdprc_consent_theme_background');?>;
			<?php echo \apply_filters('gdprc_stylesheet_background', '');?>
        }

        #gdprc_settings,
        #gdprc_bar,
        #gdprc_settings .gdprc_header,
        #gdprc_settings .gdprc_actions {
            color: <?php echo $this->getSetting('gdprc_consent_theme_text');?>;
            font-family: <?php echo $this->getSetting('gdprc_consent_theme_textfont', $inherit);?>;
            font-size: <?php echo $this->getSetting('gdprc_consent_theme_textsize', $inherit);?>;
        }

        #gdprc_settings .gdprc_header__title,
        #gdprc_bar .gdprc_content__title {
            color: <?php echo $this->getSetting('gdprc_consent_theme_title');?>;
        }

        #gdprc_settings .gdprc_header__title,
        #gdprc_bar .gdprc_content__title {
            font-family: <?php echo $this->getSetting('gdprc_consent_theme_titlefont', $inherit);?>;
            font-size: <?php echo $this->getSetting('gdprc_consent_theme_titlesize', $inherit);?>;
        }

        #gdprc_settings .gdprc_item,
        #gdprc_settings .gdprc_item .gdprc_item__label {
            color: <?php echo $this->getSetting('gdprc_consent_theme_consent');?>;
        }

        #gdprc_settings .gdprc_item .gdprc_item__label {
            font-size: <?php echo $this->getSetting('gdprc_consent_theme_consent_textsize', $inherit);?>;
            font-family: <?php echo $this->getSetting('gdprc_consent_theme_consent_textfont', $inherit);?>;
        }

        #gdprc_settings .gdprc_item__desc {
            color: <?php echo $this->getSetting('gdprc_consent_theme_consent_text');?>;
        }

        #gdprc_settings .gdprc_item__checkbox__wrapper input[type=checkbox]:checked:not(:disabled) + label,
        #gdprc_settings .gdprc_item__toggle__wrapper input[type=checkbox]:checked:not(:disabled) + label {
            background: <?php echo $this->getSetting('gdprc_consent_theme_consent_checker');?>;
            border-color: <?php echo $this->getSetting('gdprc_consent_theme_consent_checker');?>;
        }

        #gdprc_settings .gdprc_item__checkbox__wrapper input[type=checkbox]:checked + label:after,
        #gdprc_settings .gdprc_item__toggle__wrapper input[type=checkbox]:checked + label:after {
            color: <?php echo $this->getSetting('gdprc_consent_theme_button_text');?>;
        }

        #gdprc_settings.gdprc_embed_widget .gdprc_items {
            border-color: <?php echo $this->getSetting('gdprc_consent_theme_button');?>;
        }

        #gdprc_bar .gdprc_button,
        #gdprc_settings .gdprc_button {
            background: <?php echo $this->getSetting('gdprc_consent_theme_button');?>;
            color: <?php echo $this->getSetting('gdprc_consent_theme_button_text');?>;
        }

        #gdprc_bar .gdprc_button:active,
        #gdprc_bar .gdprc_button:hover,
        #gdprc_settings .gdprc_button:active,
        #gdprc_settings .gdprc_button:hover {
            background: <?php echo $this->getSetting('gdprc_consent_theme_button_active');?>;
            color: <?php echo $this->getSetting('gdprc_consent_theme_button_text_active');?>;
        }

        #gdprc_bar .gdprc_content__desc a[href],
        #gdprc_settings .gdprc_item__desc a[href],
        #gdprc_settings .gdprc_header__subtitle a[href],
        #gdprc_bar .gdprc_link,
        #gdprc_settings .gdprc_link {
            color: <?php echo $this->getSetting('gdprc_consent_theme_link');?>;
        }

        #gdprc_bar .gdprc_content__desc a[href]:active,
        #gdprc_bar .gdprc_content__desc a[href]:hover,
        #gdprc_settings .gdprc_item__desc a[href]:active,
        #gdprc_settings .gdprc_item__desc a[href]:hover,
        #gdprc_settings .gdprc_header__subtitle a[href]:active,
        #gdprc_settings .gdprc_header__subtitle a[href]:hover,
        #gdprc_bar .gdprc_link:active,
        #gdprc_bar .gdprc_link:hover,
        #gdprc_settings .gdprc_link:not(.gdprc_item__link):active,
        #gdprc_settings .gdprc_link:not(.gdprc_item__link):hover {
            color: <?php echo $this->getSetting('gdprc_consent_theme_link_hover');?>;
        }

        #gdprc_bar .container_gdprc_bar__settings > #gdprc_settings {
			<?php echo \apply_filters('gdprc_stylesheet_bar_settings', '');?>
        }

        #gdprc_settings .gdprc_embed_widget {
			<?php echo \apply_filters('gdprc_stylesheet_embed', '');?>
        }

        [id*="gdprc_consent_embed_popup"].gdprc_consent_interface_embed_popup {
			<?php echo \apply_filters('gdprc_stylesheet_embed_popup', '');?>
        }

		<?php if(($shadow = $this->getUnitsSetting('gdprc_consent_theme_shadow_size', ['x', 'y', 'blur', 'size'], '0')) !== '0 0 0 0'):?>
        #gdprc_settings.shadows {
            box-shadow: <?php echo $shadow; ?> rgba(0, 0, 0, 0.15);
        }

		<?php endif; ?>

		<?php if(($corners = $this->getUnitsSetting('gdprc_consent_theme_corner_size', ['size'], '0')) !== '0'):?>
        #gdprc_settings.corners {
            border-radius: <?php echo $corners; ?>;
        }

		<?php endif; ?>

        #gdprc_settings .gdprc_header {
            padding: <?php echo $this->getUnitsSetting('gdprc_consent_theme_header_padding');?>;
        }

        #gdprc_settings .gdprc_items {
            padding: <?php echo $this->getUnitsSetting('gdprc_consent_theme_consent_padding');?>;
        }

        #gdprc_settings .gdprc_items .gdprc_item__desc {
            padding: <?php echo $this->getUnitsSetting('gdprc_consent_theme_consent_text_padding');?>;
        }

        #gdprc_settings .gdprc_actions {
            padding: <?php echo $this->getUnitsSetting('gdprc_consent_theme_footer_padding');?>;
        }

        #gdprc_settings .gdprc_item__label,
        #gdprc_settings .gdprc_link,
        #gdprc_settings .gdprc_button {
            padding: <?php echo $this->getUnitsSetting('gdprc_consent_theme_button_padding');?>;
        }

		<?php echo \apply_filters('gdprc_stylesheet_after', '');?>
	</style>
    <?php
    $styles = \ob_get_contents();
    \ob_end_clean();

    echo preg_replace('~[\s]+~', ' ', $styles);

    $gdprc_section_consent_theme_rendered = true;
    ?>
<?php endif; ?>