{# styles/infozone/template/overall_footer.html #}

			{% EVENT overall_footer_content_after %}
		</div> {# /#page-body #}
	</div> {# /#content-forum #}
</div> {# /.iz-container.iz-content (opened in overall_header.html) #}
</div> {# /#wrap .iz-wrap #}

{% EVENT overall_footer_page_body_after %}

{# Recent Topics Section (optional) #}
{% if (not S_USER_LOGGED_IN) and (not S_IS_BOT) and (S_DISPLAY_ON_INDEX|default(false)) %}
	{% include 'addons/recent_topics_body.html' %}
{% endif %}

{# Call to Action Section (optional) #}
{# Pre-Footer / About Section #}
<section class="iz-prefooter" aria-label="About InfoZone Forum">
	<div class="iz-container">
		<div class="iz-grid iz-grid--2">
			<div class="iz-prefooter__block">
				<h3 class="iz-h3">About InfoZone Forum</h3>
				<p class="iz-text">
					Welcome to InfoZone Forum – a vibrant community at infozonelive.com where members discuss,
					share knowledge, and connect. Join us to explore ideas, ask questions, and engage in meaningful conversations.
				</p>
				<a class="iz-btn iz-btn--primary" href="{{ U_INDEX }}">Explore the Forum</a>
			</div>

			<div class="iz-prefooter__block">
				<h3 class="iz-h3">Stay Connected</h3>
				<p class="iz-text">Follow us on social media and never miss an update from the InfoZone community.</p>

				<nav class="iz-social" aria-label="Social links">
  <a class="iz-social__link" href="https://www.facebook.com/infozonelive" rel="noopener" target="_blank" aria-label="Facebook">Facebook</a>
  <a class="iz-social__link" href="https://www.instagram.com/infozonelive" rel="noopener" target="_blank" aria-label="Instagram">Instagram</a>
  <a class="iz-social__link" href="https://www.threads.net/@infozonelive" rel="noopener" target="_blank" aria-label="Threads">Threads</a>
  <a class="iz-social__link" href="https://x.com/infozonelive" rel="noopener" target="_blank" aria-label="X">X</a>
  <a class="iz-social__link" href="https://www.tiktok.com/@infozonelive" rel="noopener" target="_blank" aria-label="TikTok">TikTok</a>
</nav>

			</div>
		</div>
	</div>
</section>

{# Main Footer #}
<footer class="iz-footer" aria-label="Site footer">
	<div class="iz-container">
		<div class="iz-footer__row">
			<nav class="iz-footer__nav" aria-label="Footer navigation">
				<ul class="iz-footer__links" role="list">
					<li class="iz-footer__item"><a class="iz-footer__link" href="{{ U_PRIVACY }}">{{ L_PRIVACY }}</a></li>
					<li class="iz-footer__item"><a class="iz-footer__link" href="{{ U_TERMS_USE }}">{{ L_TERMS }}</a></li>

					{% if U_CONTACT_US %}
						<li class="iz-footer__item"><a class="iz-footer__link" href="{{ U_CONTACT_US }}">{{ L_CONTACT_US }}</a></li>
					{% endif %}

					<li class="iz-footer__item"><a class="iz-footer__link" href="{{ U_INDEX }}">Home</a></li>
				</ul>
			</nav>

			<div class="iz-footer__meta">
				{# CURRENT_YEAR is not always provided by phpBB; fall back to "now"|date('Y') #}
				&copy; {{ CURRENT_YEAR|default("now"|date("Y")) }} {{ SITENAME }}<br><small class=\"iz-disclaimer\">User Liability Clause: InfoZone members accept full sole responsibility for any and all material they post or upload to the forum.</small>
			</div>
		</div>
	</div>
</footer>

{# Back to Top Button #}
<button id="totop" class="iz-totop" type="button" style="display:none;" aria-label="Back to top">
	<span aria-hidden="true">↑</span>
</button>

{# Hidden Cron Task #}
<div class="iz-hidden">
	{% if not S_IS_BOT %}
		{{ RUN_CRON_TASK }}
	{% endif %}
</div>

{# phpBB Core Overlays (keep IDs for phpBB JS) #}
<div id="page-footer">
	<div id="darkenwrapper"
		data-ajax-error-title="{{ L_AJAX_ERROR_TITLE }}"
		data-ajax-error-text="{{ L_AJAX_ERROR_TEXT }}"
		data-ajax-error-text-abort="{{ L_AJAX_ERROR_TEXT_ABORT }}"
		data-ajax-error-text-timeout="{{ L_AJAX_ERROR_TEXT_TIMEOUT }}"
		data-ajax-error-text-parsererror="{{ L_AJAX_ERROR_TEXT_PARSERERROR }}">
		<div id="darken">&nbsp;</div>
	</div>

	<div id="phpbb_alert" class="phpbb_alert"
		data-l-err="{{ L_ERROR }}"
		data-l-ttimeout-processing-req="{{ L_TIMEOUT_PROCESSING_REQ }}">
		<button type="button" class="iz-alert__close" data-dismiss="alert" aria-label="Close">×</button>
		<h3 class="alert_title">&nbsp;</h3>
		<p class="alert_text"></p>
	</div>

	<div id="phpbb_confirm" class="phpbb_alert">
		<button type="button" class="iz-alert__close" data-dismiss="alert" aria-label="Close">×</button>
		<div class="alert_text"></div>
	</div>
</div>

{# Breadcrumb Map (mobile) #}
{% if S_USER_LOGGED_IN and (SCRIPT_NAME == 'viewforum' or SCRIPT_NAME == 'viewtopic') %}
	<div id="BreadcrumbMap" class="iz-modal" hidden>
		<div class="iz-modal__backdrop" data-iz-modal-close="1"></div>
		<div class="iz-modal__dialog" role="dialog" aria-modal="true" aria-labelledby="BreadcrumbsLabel">
			<header class="iz-modal__header">
				<h3 class="iz-modal__title" id="BreadcrumbsLabel">{{ L_NAVIGATION }}</h3>
				<button type="button" class="iz-modal__close" data-iz-modal-close="1" aria-label="Close">×</button>
			</header>
			<div class="iz-modal__body">
				<ul class="iz-list" role="list">{% for navlink in navlinks %}
						{% if loop.index > 1 %}
						<li class="iz-list__item">
							{% if navlink.U_BREADCRUMB %}
								<a href="{{ navlink.U_BREADCRUMB }}">{{ navlink.BREADCRUMB_NAME }}</a>
							{% else %}
								<a href="{{ navlink.U_VIEW_FORUM }}">{{ navlink.FORUM_NAME }}</a>
							{% endif %}
						</li>
											{% endif %}
					{% endfor %}
				</ul>
			</div>
		</div>
	</div>
{% endif %}

<script>
/* Polyfills (lightweight) */
(function(){
	if (!Element.prototype.matches) {
		Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
	}
	if (!Element.prototype.closest) {
		Element.prototype.closest = function(s) {
			var el = this;
			while (el && el.nodeType === 1) {
				if (el.matches(s)) return el;
				el = el.parentElement || el.parentNode;
			}
			return null;
		};
	}
})();

/* Back to top + header/nav/search + BreadcrumbMap + dropdown menus (no dependencies) */
document.addEventListener('DOMContentLoaded', function () {
	/* -----------------------------
	 * Back to top
	 * ----------------------------- */
	var totop = document.getElementById('totop');
	if (totop) {
		window.addEventListener('scroll', function () {
			totop.style.display = (window.scrollY > 600) ? 'block' : 'none';
		});
		totop.addEventListener('click', function (e) {
			e.preventDefault();
			window.scrollTo({ top: 0, behavior: 'smooth' });
		});
	}

	/* -----------------------------
	 * Helpers: menu close
	 * ----------------------------- */
	function closeAllMenus(exceptGroup) {
		var groups = document.querySelectorAll('[data-iz-menu]');
		for (var i = 0; i < groups.length; i++) {
			var g = groups[i];
			if (exceptGroup && g == exceptGroup) continue;

			var btn = g.querySelector('[data-iz-menu-button]');
			var panel = g.querySelector('[data-iz-menu-panel]');

			if (btn) btn.setAttribute('aria-expanded', 'false');
			if (panel) panel.hidden = true;
		}
	}

	/* -----------------------------
	 * Dropdown menus (navigation.html)
	 * data-iz-menu, data-iz-menu-button, data-iz-menu-panel
	 * ----------------------------- */
	document.addEventListener('click', function (e) {
		var btn = e.target.closest ? e.target.closest('[data-iz-menu-button]') : null;

		// Clicked a menu button: toggle its panel and close others
		if (btn) {
			e.preventDefault();

			var group = btn.closest('[data-iz-menu]');
			if (!group) return;

			var panel = group.querySelector('[data-iz-menu-panel]');
			if (!panel) return;

			var expanded = btn.getAttribute('aria-expanded') == 'true';

			// Only one open at a time
			closeAllMenus(group);

			btn.setAttribute('aria-expanded', expanded ? 'false' : 'true');
			panel.hidden = expanded ? true : false;
			return;
		}

		// Click outside any menu group => close all menus
		var insideMenu = e.target.closest ? e.target.closest('[data-iz-menu]') : null;
		if (!insideMenu) {
			closeAllMenus();
		}
	
	/* -----------------------------
	 * Dropdown hover support (desktop)
	 * ----------------------------- */
	(function(){
		var canHover = window.matchMedia && window.matchMedia('(hover: hover) and (pointer: fine)').matches;
		if (!canHover) return;

		var groups = document.querySelectorAll('[data-iz-menu]');
		for (var i=0;i<groups.length;i++){
			(function(group){
				var btn = group.querySelector('[data-iz-menu-button]');
				var panel = group.querySelector('[data-iz-menu-panel]');
				if (!btn || !panel) return;

				var t = null;
				group.addEventListener('mouseenter', function(){
					if (t) { clearTimeout(t); t=null; }
					closeAllMenus(group);
					btn.setAttribute('aria-expanded','true');
					panel.hidden = false;
				});
				group.addEventListener('mouseleave', function(){
					if (t) clearTimeout(t);
					t = setTimeout(function(){
						btn.setAttribute('aria-expanded','false');
						panel.hidden = true;
					}, 160);
				});
			})(groups[i]);
		}
	})();
});

	/* -----------------------------
	 * Header mobile nav toggle
	 * (.iz-navtoggle -> #iz-site-nav)
	 * ----------------------------- */
	var toggle = document.querySelector('.iz-navtoggle');
	var nav = document.getElementById('iz-site-nav');

	if (toggle && nav) {
		toggle.addEventListener('click', function () {
			var expanded = toggle.getAttribute('aria-expanded') == 'true';
			toggle.setAttribute('aria-expanded', expanded ? 'false' : 'true');

			// Use a single class on the container for CSS
			nav.classList.toggle('iz-nav--open', !expanded);

			// When opening nav, close dropdowns first (clean state)
			if (!expanded) closeAllMenus();
		});
	}

	/* -----------------------------
	 * Search overlay
	 * (#iz-search-open -> #iz-search)
	 * ----------------------------- */
	var searchOpen = document.getElementById('iz-search-open');
	var searchWrap = document.getElementById('iz-search');
	var searchClose = document.getElementById('iz-search-close');
	var keywords = document.getElementById('keywords');

	function openSearch(e) {
		if (e) e.preventDefault();
		if (!searchWrap) return;

		// Close menus + mobile nav to avoid stacking UI
		closeAllMenus();
		if (toggle && nav && toggle.getAttribute('aria-expanded') == 'true') {
			toggle.setAttribute('aria-expanded', 'false');
			nav.classList.remove('iz-nav--open');
		}

		searchWrap.hidden = false;
		document.documentElement.classList.add('iz-modal-open');

		// Focus input after paint
		if (keywords) setTimeout(function () { keywords.focus(); }, 0);
	}

	function closeSearch() {
		if (!searchWrap) return;
		searchWrap.hidden = true;
		document.documentElement.classList.remove('iz-modal-open');
	}

	if (searchOpen && searchWrap) searchOpen.addEventListener('click', openSearch);
	if (searchClose && searchWrap) searchClose.addEventListener('click', closeSearch);

	if (searchWrap) {
		searchWrap.addEventListener('click', function (e) {
			// Clicking backdrop closes
			if (e.target == searchWrap) closeSearch();
		});
	}

	/* -----------------------------
	 * Breadcrumb Map modal
	 * ([data-iz-open-breadcrumbmap="1"] -> #BreadcrumbMap)
	 * ----------------------------- */
	var breadcrumbBtn = document.querySelector('[data-iz-open-breadcrumbmap="1"]');
	var modal = document.getElementById('BreadcrumbMap');

	function openModal(e) {
		if (e) e.preventDefault();
		if (!modal) return;

		// Close other UI layers
		closeAllMenus();
		if (searchWrap && !searchWrap.hidden) closeSearch();

		modal.hidden = false;
		document.documentElement.classList.add('iz-modal-open');
	}

	function closeModal() {
		if (!modal) return;
		modal.hidden = true;
		document.documentElement.classList.remove('iz-modal-open');
	}

	if (breadcrumbBtn && modal) {
		breadcrumbBtn.addEventListener('click', openModal);
	}

	if (modal) {
		modal.addEventListener('click', function (e) {
			if (e.target && e.target.getAttribute('data-iz-modal-close') == '1') {
				closeModal();
			}
		});
	}

	/* -----------------------------
	 * Rotating ads (auto-detect)
	 * - If an ad box contains multiple images (or linked images), rotate them.
	 * - Rotation respects the number of images the admin placed in the slot.
	 * ----------------------------- */
	(function initAdRotators(){
		var adBoxes = document.querySelectorAll('.iz-adslot');
		if (!adBoxes || !adBoxes.length) return;

		function uniquePush(arr, el){
			for (var i=0;i<arr.length;i++){ if (arr[i] === el) return; }
			arr.push(el);
		}

		for (var b=0; b<adBoxes.length; b++) {
			var box = adBoxes[b];
			// Collect slides as either <a> wrappers containing an <img>, or standalone <img>
			var imgs = box.querySelectorAll('a img, img');
			var slides = [];
			for (var i=0; i<imgs.length; i++) {
				var img = imgs[i];
				// Skip placeholder icons / tiny tracking pixels
				if (img.naturalWidth && img.naturalWidth < 10 && img.naturalHeight && img.naturalHeight < 10) continue;
				var wrap = (img.parentElement && img.parentElement.tagName === 'A') ? img.parentElement : img;
				uniquePush(slides, wrap);
			}

			// Nothing to rotate
			if (!slides || slides.length <= 1) continue;

			// Hide all but first
			for (var s=0; s<slides.length; s++) {
				if (s === 0) {
					slides[s].classList.remove('iz-ad-hidden');
					slides[s].setAttribute('aria-hidden', 'false');
				} else {
					slides[s].classList.add('iz-ad-hidden');
					slides[s].setAttribute('aria-hidden', 'true');
				}
			}

			(function(slidesForBox){
				var idx = 0;
				var intervalMs = 6000;
				window.setInterval(function(){
					if (!slidesForBox || slidesForBox.length <= 1) return;
					slidesForBox[idx].classList.add('iz-ad-hidden');
					slidesForBox[idx].setAttribute('aria-hidden', 'true');
					idx = (idx + 1) % slidesForBox.length;
					slidesForBox[idx].classList.remove('iz-ad-hidden');
					slidesForBox[idx].setAttribute('aria-hidden', 'false');
				}, intervalMs);
			})(slides);
		}
	})();

	/* -----------------------------
	 * Global ESC handler
	 * closes: BreadcrumbMap > Search > Menus > Mobile nav
	 * ----------------------------- */
	document.addEventListener('keydown', function (e) {
		if (e.key != 'Escape') return;

		if (modal && !modal.hidden) {
			closeModal();
			return;
		}

		if (searchWrap && !searchWrap.hidden) {
			closeSearch();
			return;
		}

		// Close dropdown menus
		closeAllMenus();

		// Close mobile nav
		if (toggle && nav && toggle.getAttribute('aria-expanded') == 'true') {
			toggle.setAttribute('aria-expanded', 'false');
			nav.classList.remove('iz-nav--open');
		}
	});
});
</script>

{{ SCRIPTS }}

{% if S_PLUPLOAD %}
	{% include 'plupload.html' %}
{% endif %}

{{ GOOGLE_ANALYTICS|default('') }}

</body>
</html>
