<?php

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}
$enabled      = get_theme_mod('pawfect_promo_banner_enabled', true);
if (!$enabled) return;

$title        = get_theme_mod('pawfect_promo_banner_title', __( 'SAVE UP TO 50%', 'pawfect' ));
$desc         = get_theme_mod('pawfect_promo_banner_description', __( 'Can’t wait to save? Shop our semi-annual sale now.', 'pawfect' ));
$btn_text     = get_theme_mod('pawfect_promo_banner_button_text', __( 'SHOP NOW', 'pawfect' ));
$btn_link     = get_theme_mod('pawfect_promo_banner_button_link', '#');
$btn_target   = get_theme_mod('pawfect_promo_banner_button_target', '_self');
$image        = get_theme_mod('pawfect_promo_banner_image', '');
if (empty($image)) {
    $image = PAWFECT_THEME_URL . '/assets/images/shop-now3.webp';
}
$container    = get_theme_mod('pawfect_promo_banner_container', 'pawfect-container');
$bg_color     = get_theme_mod('pawfect_promo_banner_background_color', '#fef9f5');
$title_color  = get_theme_mod('pawfect_promo_banner_title_color', '#ffffff');
$subtitle_color = get_theme_mod('pawfect_promo_banner_subtitle_color', '#F4A259');

// Background image style fallback handled by CSS variables
$section_style = "";
?>

<!-- Enhanced Save Up To 50% Section -->
<section class="pawfect-promo-banner pawfect-promo-banner-section pawfect-relative pawfect-py-20 lg:pawfect-py-28 pawfect-overflow-hidden pawfect-section-wrapper">

    

    <!-- Background Decorations -->
    <div class="pawfect-absolute pawfect-inset-0 pawfect-opacity-5">
        <div class="pawfect-absolute pawfect-w-96 pawfect-h-96 pawfect-bg-pawfect-primary pawfect-rounded-full pawfect-blur-3xl pawfect--top-48 pawfect--right-48 pawfect-animate-pulse"></div>
        <div class="pawfect-absolute pawfect-w-64 pawfect-h-64 pawfect-bg-gray-400 pawfect-rounded-full pawfect-blur-2xl pawfect--bottom-32 pawfect--left-32 pawfect-animate-pulse pawfect-animation-delay-2000"></div>
    </div>

    <div class="<?php echo esc_attr($container); ?> pawfect-relative pawfect-z-10">
        <!-- Enhanced Promo Card -->
        <div class="pawfect-feature-card pawfect-group pawfect-relative pawfect-grid pawfect-grid-cols-1 lg:pawfect-grid-cols-2 sm:pawfect-grid-cols-2 pawfect-items-center pawfect-rounded-xl pawfect-overflow-hidden pawfect-bg-white pawfect-border pawfect-border-gray-100 pawfect-transition-all pawfect-duration-300 hover:pawfect-border-gray-200 hover:pawfect-shadow-sm"
             <?php echo pawfect_get_aos_attrs('fade-up', 800, 100); ?>>

            <!-- Subtle Accent Line -->
            <div class="pawfect-absolute pawfect-top-0 pawfect-left-6 pawfect-right-6 pawfect-h-px pawfect-bg-gradient-to-r pawfect-from-transparent pawfect-via-pawfect-primary pawfect-to-transparent pawfect-opacity-0 pawfect-transition-opacity pawfect-duration-300 group-hover:pawfect-opacity-100"></div>

            <!-- Enhanced Image Section -->
            <?php if ($image): ?>
                <div class="pawfect-relative pawfect-w-full pawfect-h-full pawfect-min-h-[450px] pawfect-overflow-hidden">
                    <img src="<?php echo esc_url($image); ?>"
                         alt="<?php echo esc_attr($title); ?>"
                         class="pawfect-w-full pawfect-h-full pawfect-object-cover pawfect-object-center pawfect-transition-all pawfect-duration-700 group-hover:pawfect-scale-110">

                    <!-- Image Overlay -->
                    <div class="pawfect-absolute pawfect-inset-0 pawfect-bg-gradient-to-br pawfect-from-transparent pawfect-to-black pawfect-to-opacity-20 pawfect-opacity-0 pawfect-transition-opacity pawfect-duration-300 group-hover:pawfect-opacity-100"></div>

                    <!-- Consistent Sale Badge -->
                    <span class="pawfect-absolute pawfect-top-4 pawfect-left-4 pawfect-bg-red-500 pawfect-text-white pawfect-text-xs pawfect-font-bold pawfect-px-3 pawfect-py-1 pawfect-rounded-full pawfect-shadow-lg pawfect-z-20">
                        HOT SALE
                    </span>
                </div>
            <?php endif; ?>

            <!-- Enhanced Text Content -->
            <div class="pawfect-promo-banner-heading pawfect-relative pawfect-z-10 pawfect-py-12 pawfect-px-8 lg:pawfect-px-16">

                <!-- Consistent Section Badge -->
                <div class="pawfect-inline-flex pawfect-items-center pawfect-gap-2 pawfect-text-sm pawfect-font-medium pawfect-mb-4">
                    <div class="pawfect-w-6 pawfect-h-px pawfect-bg-primary pawfect-opacity-60"></div>
                    <span class="pawfect-uppercase pawfect-tracking-wider pawfect-text-primary"><?php echo esc_html__( 'Limited Offer', 'pawfect' ); ?></span>
                    <div class="pawfect-w-6 pawfect-h-px pawfect-bg-primary pawfect-opacity-60"></div>
                </div>

                <!-- Consistent Title -->
                <h2 class="pawfect-promo-banner-title pawfect-text-4xl md:pawfect-text-5xl pawfect-font-bold pawfect-mb-6">
                    <?php echo esc_html($title); ?>
                </h2>

                <!-- Consistent Description -->
                <?php if (!empty($desc)) : ?>
                    <p class="pawfect-promo-banner-subtitle pawfect-mb-8">
                        <?php echo esc_html($desc); ?>
                    </p>
                <?php endif; ?>

                <!-- Consistent Button -->
                <?php if (!empty($btn_text)): ?>
                    <a href="<?php echo esc_url($btn_link); ?>" target="<?php echo esc_attr($btn_target); ?>" class="pawfect-btn">
                        <span><?php echo esc_html($btn_text); ?></span>
                        <svg class="pawfect-w-5 pawfect-h-5 pawfect-ml-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 8l4 4m0 0l-4 4m4-4H3"></path>
                        </svg>
                    </a>
                <?php endif; ?>
            </div>
        </div>
    </div>
</section>
