Text here....<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>

<!-- Текст и кнопка закрытия -->
<div id="top-sale-banner" class="sale-banner-fluid" style="display: none;">
    <div class="sale-banner-content">
        🔥 <span class="sale-text">Мега-распродажа! Скидки от 30% до 60% на весь ассортимент!</span> 
        <a href="/catalog/sale/" class="sale-banner-btn">Смотреть товары</a>
    </div>
    <button class="sale-banner-close" onclick="closeSaleBanner()">&times;</button>
</div>

<!-- Стили баннера -->
<style>
.sale-banner-fluid {
    width: 100%;
    background: linear-gradient(90deg, #ff416c, #ff4b2b); /* Яркий градиент */
    color: #ffffff;
    text-align: center;
    padding: 12px 45px 12px 15px;
    position: relative;
    z-index: 99999; /* Поверх всех элементов сайта */
    box-sizing: border-box;
    font-family: Arial, sans-serif;
    font-size: 15px;
    line-height: 1.4;
}
.sale-banner-content {
    display: inline-block;
}
.sale-banner-btn {
    display: inline-block;
    background: #ffffff;
    color: #ff4b2b !important;
    padding: 4px 12px;
    border-radius: 4px;
    margin-left: 12px;
    text-decoration: none !important;
    font-weight: bold;
    font-size: 13px;
    transition: background 0.2s ease;
}
.sale-banner-btn:hover {
    background: #f0f0f0;
}
.sale-banner-close {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #ffffff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.8;
    padding: 0;
}
.sale-banner-close:hover { 
    opacity: 1; 
}
/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .sale-banner-fluid { font-size: 13px; padding-right: 35px; }
    .sale-banner-btn { display: block; margin: 8px auto 0 auto; width: max-content; }
}
</style>

<!-- Логика сессии (JS) -->
<script>
document.addEventListener("DOMContentLoaded", function() {
    var banner = document.getElementById("top-sale-banner");
    
    // Если в этой сессии баннер ещё НЕ закрывали — показываем его
    if (sessionStorage.getItem("sale_banner_skipped") !== "true") {
        if (banner) {
            banner.style.display = "block";
            // Сдвигаем body вниз, чтобы баннер не перекрывал шапку (опционально)
            document.body.style.marginTop = "0px"; 
        }
    }
});

function closeSaleBanner() {
    var banner = document.getElementById("top-sale-banner");
    if (banner) {
        banner.style.display = "none";
    }
    // Записываем в sessionStorage. При закрытии вкладки запись сотрется.
    sessionStorage.setItem("sale_banner_skipped", "true");
}
</script>