<?php
/**
 * Event cancellation notice component - Minimal Style
 */
if (!defined('ABSPATH')) exit;

// Get cancellation settings
$em_event_cancelled = $event_settings['em_event_cancelled'] ?? 'no';
$em_cancellation_message = $event_settings['em_cancellation_message'] ?? '';
$em_cancellation_bg_color = $event_settings['em_cancellation_bg_color'] ?? '#FEF2F2';
$em_cancellation_text_color = $event_settings['em_cancellation_text_color'] ?? '#DC2626';
$em_cancellation_border_color = $event_settings['em_cancellation_border_color'] ?? '#FECACA';

// Only show if event is marked as cancelled
if ($em_event_cancelled !== 'yes') {
    return;
}

// Default cancellation message if none provided
if (empty($em_cancellation_message)) {
    $em_cancellation_message = __('This event has been cancelled. We apologize for any inconvenience caused.', 'event-monster');
}
?>

<div class="em-cancellation-notice em-mb-4"
     style="background-color: <?php echo esc_attr($em_cancellation_bg_color); ?>;">

    <div class="em-max-w-4xl em-mx-auto">
        <div class="em-flex em-items-start em-gap-3 em-p-4 em-rounded-lg em-border"
             style="border-color: <?php echo esc_attr($em_cancellation_border_color); ?>; background-color: <?php echo esc_attr($em_cancellation_bg_color); ?>;">

            <!-- Warning Icon -->
            <div class="em-flex-shrink-0 em-mt-0.5">
                <svg class="em-w-5 em-h-5" style="color: <?php echo esc_attr($em_cancellation_text_color); ?>;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"></path>
                </svg>
            </div>

            <!-- Content -->
            <div class="em-flex-1 em-min-w-0">
                <div class="em-flex em-items-center em-gap-2 em-mb-2">
                    <h3 class="em-text-sm em-font-semibold em-uppercase em-tracking-wide" style="color: <?php echo esc_attr($em_cancellation_text_color); ?>;">
                        <?php _e('Event Cancelled', 'event-monster'); ?>
                    </h3>
                    <span class="em-px-2 em-py-0.5 em-bg-red-100 em-text-red-800 em-text-xs em-font-medium em-rounded em-uppercase">
                        <?php _e('Cancelled', 'event-monster'); ?>
                    </span>
                </div>

                <div class="em-text-sm em-leading-relaxed" style="color: <?php echo esc_attr($em_cancellation_text_color); ?>;">
                    <?php echo wp_kses_post(wpautop($em_cancellation_message)); ?>
                </div>
            </div>
        </div>
    </div>
</div>
