<?php

define( '_JEXEC', 1 );
define('JPATH_BASE', '../../../');
require_once ( JPATH_BASE .'/includes/defines.php' );
require_once ( JPATH_BASE .'/includes/framework.php' );

$container = \Joomla\CMS\Factory::getContainer();
$container->alias(\Joomla\Session\SessionInterface::class, 'session.web.site');
$mainframe = $container->get(\Joomla\CMS\Application\SiteApplication::class);
$template = $mainframe->getTemplate(true);
$params = $template->params;

header("content-type: text/css");

// duration of cached content (1 hour)
$offset = 60 * 60 ;
// cache control to process
header("Cache-Control: must-revalidate, max-age=$offset, public");

// expiration header format
// $ExpStr = "Expires: " . gmdate("D, d M Y H:i:s",time() + $offset) . " GMT";
// send cache expiration header to broswer
// header($ExpStr);

$leftImageValue  = (empty($params['imgleft']) ? "none" : "url(\"" . JPATH_BASE. "/" . $params['imgleft'] . "\")") ; 
$rightImageValue = (empty($params['imgright']) ? "none" : "url(\"" . JPATH_BASE . "/" . $params['imgright'] . "\")") 

?>

<?php
if($params['titlepage'] === '1')
{
?>
#left-menu
{
	display: none;
}
<?php 
}
?>

body
{
	background-color: <?php echo $params['bgcolorside']; ?>;
}

a, a:hover, a:active, a:visited
{
	color: <?php echo $params['mainlicolor']; ?>;
}

#page-bg
{
	background-image: linear-gradient(to bottom, <?php echo $params['mainbgcolortop'] . ',' . $params['mainbgcolorbot']; ?>);
	color: <?php echo $params['mainfgcolor']; ?>;
}

#mobile-menu li > a {
	background-color: <?php echo $params['bgcolor2']; ?>;
    color: <?php echo $params['licolor2']; ?>;
}

#mobile-menu li.current > a {
	background-color: <?php echo $params['bgcolor3']; ?>;
    color: <?php echo $params['licolor3']; ?>;
}

ul.mod-menu {
	background-color: <?php echo $params['bgcolor1']; ?>;
	color: <?php echo $params['fgcolor1']; ?>;
}

#mobile-menu {
	background-color: <?php echo $params['bgcolor1']; ?>;
	color: <?php echo $params['fgcolor1']; ?>;
}

ul.mod-menu li.current > a,
ul.mod-menu li.current:hover > a
{
	background-color: <?php echo $params['bgcolor2']; ?>;
	color: <?php echo $params['licolor2']; ?>;
}

ul.nav > li > a:hover,
ul.nav > li > a:focus,
ul.mod-menu__sub > li > a:hover,
ul.mod-menu__sub > li > a:focus
{
	background-color: <?php echo $params['bgcolor3']; ?>;
	color: <?php echo $params['licolor3']; ?>;
}

#topmenu,
#topmenu > ul.mod-menu {
  background-color: <?php echo $params['topbgcolor1']; ?>;
  color: <?php echo $params['topfgcolor1']; ?>;
}

#topmenu .mod-menu__sub > li.current

{
  background-color: <?php echo $params['topbgcolor2']; ?>;
  color: <?php echo $params['topfgcolor2']; ?>;
}

#topmenu .mod-menu__sub {
  background-color: <?php echo $params['topbgcolor3']; ?>;
  color: <?php echo $params['topfgcolor3']; ?>;
}

#topmenu .nav > li:hover,
#topmenu .nav > li:focus,
#topmenu .nav > li.active,
#topmenu .mod-menu__sub > li:hover,
#topmenu .mod-menu__sub > li:focus
{
  background-color: <?php echo $params['topbgcolor2']; ?>;
  color: <?php echo $params['topfgcolor2']; ?>;
}

#left-side-image
{
	background-image: <?php echo $leftImageValue; ?>;
}

#right-side-image
{
	background-image: <?php echo $rightImageValue; ?>;
}

.list-striped li:nth-child(odd),
.row-striped .row-fluid:nth-child(odd),
.table-striped > tbody > tr:nth-child(odd)
{
	background-color: <?php echo $params['bgcolor2']; ?>;
	color: <?php echo $params['fgcolor2']; ?>;
}
.row-striped .row-fluid:nth-child(odd) a,
.table-striped > tbody > tr:nth-child(odd) a
{
	color: <?php echo $params['licolor2']; ?>;
}
.list-striped li:hover,
.row-striped .row-fluid:hover,
.table-striped > tbody > tr:hover
{
	background-color: <?php echo $params['bgcolor3']; ?>;
	color: <?php echo $params['fgcolor3']; ?>;
}
.row-striped .row-fluid:hover a,
.table-striped > tbody > tr:hover a
{
	color: <?php echo $params['licolor3']; ?>;
}
.table-striped > thead > tr
{
	background-color: <?php echo $params['bgcolor3']; ?>;
	color: <?php echo $params['fgcolor3']; ?>;
}

table.alternating tr:nth-child(even) {
	background-color: <?php echo $params['bgcolor2']; ?>;
	color: <?php echo $params['fgcolor2']; ?>;
}
table.alternating tr:nth-child(even) a
{
	color: <?php echo $params['licolor2']; ?>;
}
table.alternating tr:nth-child(1) {
	background-color: <?php echo $params['bgcolor3']; ?>;
	color: <?php echo $params['fgcolor3']; ?>;
}
table.alternating tr:nth-child(1) a {
	color: <?php echo $params['licolor3']; ?>;
}
.readmore > .btn
{
	color: <?php echo $params['fgcolor1'];?>;
	background-color: <?php echo $params['bgcolor1']; ?>;
}
.readmore > .btn:hover
{
	color: <?php echo $params['fgcolor3'];?>;
	background-color: <?php echo $params['bgcolor3']; ?>;
}
