# NexDirectory Event Page Info Dump

This file is a temporary, standalone reference dump for event page implementation details.
It is intentionally not wired to anything.

Generated from repo: `/Users/alexplayer/Documents/NEXDIRECTORY/NexDirectory-Alpha`

## Scope
- Single event page template
- Hero templates
- Body layout templates
- Design/layout settings UI and preset logic
- Style/design sanitizers and runtime token mapping
- Frontend CSS and event hero JS behavior

## Source Inventory
- `templates/frontend/single-event.php`
- `templates/frontend/hero/*.php`
- `templates/frontend/layout/*.php`
- `templates/admin/settings/sections/tab-design-maps.php`
- `templates/admin/settings/page.php`
- `includes/utilities/class-eep-media-helper.php`
- `includes/trait-eep-admin.php` (event/style relevant segments)
- `includes/trait-eep-content.php` (runtime style vars + frontend config segment)
- `includes/trait-eep-frontend.php` (single-event render segment)
- `assets/css/eep-frontend.css`
- `assets/js/eep-frontend.js` (hero/fallback/parallax segment)

---

## File: templates/frontend/single-event.php

```php
<?php
if (!defined('ABSPATH')) {
    exit;
}

// [PRESERVED DYNAMIC VARIABLES]
$hero_layout = in_array((string) ($hero_layout ?? 'cinematic'), ['cinematic', 'compact', 'split', 'minimal', 'immersive', 'spotlight'], true) ? (string) $hero_layout : 'cinematic';
$page_layout = sanitize_key((string) ($page_layout ?? 'modern'));
if (in_array($page_layout, ['balanced', 'compact-aside', 'cards-heavy'], true)) {
    $page_layout = 'fifty-fifty';
}
$page_layout = in_array($page_layout, ['modern', 'single-column', 'editorial', 'fifty-fifty', 'left-sidebar', 'zig-zag', 'full3', 'zen'], true) ? $page_layout : 'modern';
$hero_template_defaults = [
    'container' => 'transition-all duration-700 ease-out relative sm:rounded-2xl overflow-hidden mb-6 sm:mb-8 shadow-sm group bg-gray-900 flex flex-col justify-end min-h-[60vh] sm:min-h-[450px]',
    'image' => 'absolute inset-0 w-full h-full object-cover transition-transform duration-1000 sm:group-hover:scale-105 opacity-80 sm:opacity-100',
    'fallback' => 'absolute inset-0 w-full h-full bg-gradient-to-br from-gray-800 to-gray-950 transition-transform duration-1000 sm:group-hover:scale-105',
    'overlay' => 'absolute inset-0 bg-gradient-to-t from-gray-900 via-gray-900/60 to-transparent',
    'content' => 'relative z-10 p-5 sm:p-8 lg:p-12 w-full mt-auto',
    'kicker' => 'inline-flex items-center px-2.5 py-1 rounded-full bg-brand-500/20 text-white text-xs font-semibold uppercase tracking-wider backdrop-blur-sm border border-brand-500/30',
    'title' => 'text-3xl sm:text-4xl md:text-5xl lg:text-6xl font-bold text-white mb-3 sm:mb-4 leading-tight tracking-tight drop-shadow-md',
    'subtitle' => 'text-gray-300 text-base sm:text-lg max-w-2xl mb-6 leading-relaxed line-clamp-2 sm:line-clamp-none',
    'meta_wrap' => 'flex flex-col sm:flex-row gap-3 sm:gap-6 lg:gap-8 text-white',
    'meta_card' => 'flex items-center bg-white/10 backdrop-blur-md rounded-xl p-3 sm:p-4 border border-white/10 hover:bg-white/20 transition-colors duration-300 cursor-default',
    'meta_icon' => 'p-2.5 sm:p-3 bg-brand-500 rounded-lg mr-3 shadow-sm shrink-0',
    'meta_label' => 'text-[10px] sm:text-xs text-brand-100 font-semibold uppercase tracking-wider',
    'meta_value' => 'font-semibold text-base sm:text-lg',
];
$hero_template = [];
$hero_template_file = __DIR__ . '/hero/' . $hero_layout . '.php';
if (is_readable($hero_template_file)) {
    $hero_template_candidate = require $hero_template_file;
    if (is_array($hero_template_candidate)) {
        $hero_template = $hero_template_candidate;
    }
}
$hero_template = array_merge($hero_template_defaults, $hero_template);

$page_template_defaults = [
    'grid' => 'grid grid-cols-1 lg:grid-cols-3 gap-6 sm:gap-8 px-4 sm:px-0',
    'main' => 'lg:col-span-2 space-y-6 sm:space-y-8',
    'aside' => 'lg:col-span-1 space-y-6',
    'aside_inner' => 'sticky top-24 space-y-6',
];
$page_template = [];
$page_template_file = __DIR__ . '/layout/' . $page_layout . '.php';
if (is_readable($page_template_file)) {
    $page_template_candidate = require $page_template_file;
    if (is_array($page_template_candidate)) {
        $page_template = $page_template_candidate;
    }
}
$page_template = array_merge($page_template_defaults, $page_template);
$video_count = isset($video_cards) && is_array($video_cards) ? count($video_cards) : 0;
$event_gallery_type = isset($event_gallery_type) ? sanitize_key((string) $event_gallery_type) : 'default';
if (!in_array($event_gallery_type, ['default', 'carousel', 'wall'], true)) {
    $event_gallery_type = 'default';
}
$gallery_images_all = isset($gallery_images) && is_array($gallery_images) ? array_values(array_filter(array_map('esc_url', $gallery_images))) : [];
$gallery_images_visible = array_slice($gallery_images_all, 0, 3);
$gallery_hidden_count = max(0, count($gallery_images_all) - 3);
$gallery_items_json = esc_attr(wp_json_encode($gallery_images_all ?: []));
$show_event_overview = !isset($show_event_overview) || !empty($show_event_overview);
$ui_labels = isset($ui_labels) && is_array($ui_labels) ? $ui_labels : [];
$single_overview_heading = isset($single_overview_heading) ? (string) $single_overview_heading : (string) ($ui_labels['single_overview_heading'] ?? __('Overview', 'nexdirectory'));
$single_timeline_heading = isset($single_timeline_heading) ? (string) $single_timeline_heading : (string) ($ui_labels['single_timeline_heading'] ?? __('Timeline', 'nexdirectory'));
$single_key_speakers_heading = isset($single_key_speakers_heading) ? (string) $single_key_speakers_heading : (string) ($ui_labels['single_key_speakers_heading'] ?? __('Key Speakers', 'nexdirectory'));
$single_gallery_heading = isset($single_gallery_heading) ? (string) $single_gallery_heading : (string) ($ui_labels['single_gallery_heading'] ?? __('Gallery', 'nexdirectory'));
$single_videos_heading = isset($single_videos_heading) ? (string) $single_videos_heading : (string) ($ui_labels['single_videos_heading'] ?? __('Videos', 'nexdirectory'));
$single_cta_heading = isset($single_cta_heading) ? (string) $single_cta_heading : (string) ($ui_labels['single_cta_heading'] ?? __('Get Tickets', 'nexdirectory'));
$single_cta_copy = isset($single_cta_copy) ? (string) $single_cta_copy : (string) ($ui_labels['single_cta_copy'] ?? __('Secure your spot before they sell out.', 'nexdirectory'));
$single_visit_site_cta = isset($single_visit_site_cta) ? (string) $single_visit_site_cta : (string) ($ui_labels['single_visit_site_cta'] ?? __('Visit Website', 'nexdirectory'));
$single_report_cta = isset($single_report_cta) ? (string) $single_report_cta : (string) ($ui_labels['single_report_cta'] ?? __('Report Listing', 'nexdirectory'));
$single_report_placeholder = isset($single_report_placeholder) ? (string) $single_report_placeholder : (string) ($ui_labels['single_report_placeholder'] ?? __('Tell us what is wrong with this listing.', 'nexdirectory'));
$single_contact_login = isset($single_contact_login) ? (string) $single_contact_login : (string) ($ui_labels['single_contact_login'] ?? __('Please log in to contact the listing holder.', 'nexdirectory'));
$single_owner_items_cta = isset($single_owner_items_cta) ? (string) $single_owner_items_cta : (string) ($ui_labels['single_owner_items_cta'] ?? __('View all user listings', 'nexdirectory'));
$single_login_rsvp = isset($single_login_rsvp) ? (string) $single_login_rsvp : (string) ($ui_labels['single_login_rsvp'] ?? __('Log In', 'nexdirectory'));
$single_edit_cta = isset($single_edit_cta) ? (string) $single_edit_cta : (string) ($ui_labels['single_edit_cta'] ?? __('Edit Listing', 'nexdirectory'));
$single_calendar_download_cta = isset($single_calendar_download_cta) ? (string) $single_calendar_download_cta : (string) ($ui_labels['single_calendar_download_cta'] ?? __('Download ICS', 'nexdirectory'));
$single_google_calendar_cta = isset($single_google_calendar_cta) ? (string) $single_google_calendar_cta : (string) ($ui_labels['single_google_calendar_cta'] ?? __('Google Calendar', 'nexdirectory'));
$single_status_label = isset($single_status_label) ? (string) $single_status_label : (string) ($ui_labels['single_status_label'] ?? __('Status', 'nexdirectory'));
$single_contact_section_heading = isset($single_contact_section_heading) ? (string) $single_contact_section_heading : (string) ($ui_labels['single_contact_section_heading'] ?? __('Direct Message', 'nexdirectory'));
$single_documents_heading = isset($single_documents_heading) ? (string) $single_documents_heading : (string) ($ui_labels['single_documents_heading'] ?? __('Documents', 'nexdirectory'));
$single_additional_heading = isset($single_additional_heading) ? (string) $single_additional_heading : (string) ($ui_labels['single_additional_heading'] ?? __('Additional Information', 'nexdirectory'));
$single_location_heading = isset($single_location_heading) ? (string) $single_location_heading : (string) ($ui_labels['single_location_heading'] ?? __('Location', 'nexdirectory'));
$single_date_meta_label = isset($single_date_meta_label) ? (string) $single_date_meta_label : (string) ($ui_labels['single_date_meta_label'] ?? __('Date', 'nexdirectory'));
$single_location_meta_label = isset($single_location_meta_label) ? (string) $single_location_meta_label : (string) ($ui_labels['single_location_meta_label'] ?? __('Location', 'nexdirectory'));
$single_open_map_cta = isset($single_open_map_cta) ? (string) $single_open_map_cta : (string) ($ui_labels['single_open_map_cta'] ?? __('Open Map', 'nexdirectory'));
$single_email_inline_label = isset($single_email_inline_label) ? (string) $single_email_inline_label : (string) ($ui_labels['single_email_inline_label'] ?? __('Contact Email', 'nexdirectory'));
$single_phone_inline_label = isset($single_phone_inline_label) ? (string) $single_phone_inline_label : (string) ($ui_labels['single_phone_inline_label'] ?? __('Phone', 'nexdirectory'));
$owner_heading = sanitize_text_field((string) ($ui_labels['owner_singular'] ?? __('Organizer', 'nexdirectory')));
$singular_label = sanitize_text_field((string) ($ui_labels['singular'] ?? __('Listing', 'nexdirectory')));
$plural_label = sanitize_text_field((string) ($ui_labels['plural'] ?? __('Events', 'nexdirectory')));
$market_accept_offers = isset($market_accept_offers) ? (bool) $market_accept_offers : true;
$organizer_id = isset($organizer_id) ? absint((int) $organizer_id) : absint((int) get_post_field('post_author', (int) $post_id));
$can_contact_owner = $organizer_id > 0;
$organizer_member_since = isset($organizer_member_since) ? sanitize_text_field((string) $organizer_member_since) : '';
$organizer_listing_count = isset($organizer_listing_count) ? absint((int) $organizer_listing_count) : 0;
$is_events_profile = isset($is_events_profile) ? (bool) $is_events_profile : ((string) ($ui_labels['is_events_profile'] ?? '1') === '1');
$is_job_profile = isset($is_job_profile) ? (bool) $is_job_profile : ((string) ($ui_labels['is_job_profile'] ?? '0') === '1');
$is_directory_profile = isset($is_directory_profile) ? (bool) $is_directory_profile : ((string) ($ui_labels['is_directory_profile'] ?? '0') === '1');
$is_marketplace_profile = isset($is_marketplace_profile) ? (bool) $is_marketplace_profile : ((string) ($ui_labels['is_marketplace_profile'] ?? '0') === '1');
$owner_event_messages_enabled = !isset($owner_event_messages_enabled) || !empty($owner_event_messages_enabled);
$show_hero_date_card = isset($show_hero_date_card) ? (bool) $show_hero_date_card : !$is_marketplace_profile;
$viewer_logged_in = isset($viewer_logged_in) ? (bool) $viewer_logged_in : is_user_logged_in();
$viewer_user_id = $viewer_logged_in ? get_current_user_id() : 0;
$itinerary_storage_scope = $viewer_user_id > 0 ? ('u' . (string) $viewer_user_id) : 'guest';
$show_rsvp_actions = isset($show_rsvp_actions) ? (bool) $show_rsvp_actions : $is_events_profile;
$show_calendar_actions = isset($show_calendar_actions) ? (bool) $show_calendar_actions : $is_events_profile;
$single_org_mode = !empty($single_org_mode);
$show_organizer_card = !isset($show_organizer_card) || !empty($show_organizer_card);
$show_ticket_cta = !empty($show_ticket_cta);
$ticket_checkout_url = esc_url((string) ($ticket_checkout_url ?? admin_url('admin-post.php')));
$ticket_checkout_nonce_html = isset($ticket_checkout_nonce_html) ? (string) $ticket_checkout_nonce_html : '';
$ticket_default_gateway = sanitize_key((string) ($ticket_default_gateway ?? ''));
$ticket_gateway_stripe_enabled = !empty($ticket_gateway_stripe_enabled);
$ticket_gateway_paypal_enabled = !empty($ticket_gateway_paypal_enabled);
$ticket_test_free_enabled = !empty($ticket_test_free_enabled);
$ticket_button_label = sanitize_text_field((string) ($ticket_button_label ?? __('Buy Now', 'nexdirectory')));
$ticket_price_display = sanitize_text_field((string) ($ticket_price_display ?? ''));
$ticket_is_paid = !empty($ticket_is_paid);
$login_url = esc_url((string) ($login_url ?? wp_login_url(get_permalink((int) $post_id))));
$signup_url = esc_url((string) ($signup_url ?? $login_url));
$ticket_gateway_options = [];
if ($ticket_gateway_stripe_enabled) {
    $ticket_gateway_options[] = ['value' => 'stripe', 'label' => 'Stripe'];
}
if ($ticket_gateway_paypal_enabled) {
    $ticket_gateway_options[] = ['value' => 'paypal', 'label' => 'PayPal'];
}
if ($ticket_default_gateway === '' && !empty($ticket_gateway_options)) {
    $ticket_default_gateway = (string) ($ticket_gateway_options[0]['value'] ?? '');
}
$show_ticket_gateway_select = $ticket_is_paid && !$ticket_test_free_enabled && count($ticket_gateway_options) > 1;
$ticket_checkout_submit_label = ($ticket_is_paid && !$ticket_test_free_enabled)
    ? __('Continue to Payment', 'nexdirectory')
    : __('Confirm Ticket', 'nexdirectory');
$ticket_checkout_subtext = ($ticket_is_paid && !$ticket_test_free_enabled)
    ? __('Secure checkout opens next with your selected gateway.', 'nexdirectory')
    : __('Reservation is confirmed instantly and sent by email.', 'nexdirectory');
if (!$viewer_logged_in) {
    $ticket_checkout_subtext = __('Sign in, create an account, or continue as guest via email verification.', 'nexdirectory');
}
$show_countdown = isset($show_countdown) ? (bool) $show_countdown : (!empty($countdown_target) && $is_events_profile);
$show_autogenerated_disclaimer = !empty($show_autogenerated_disclaimer);
$autogenerated_disclaimer_text = eep_sanitize_textarea((string) ($autogenerated_disclaimer_text ?? ''));
$autogenerated_source_url = esc_url((string) ($autogenerated_source_url ?? ''));
$sessions = isset($sessions) && is_array($sessions) ? array_values($sessions) : [];
$key_speakers = isset($key_speakers) && is_array($key_speakers) ? array_values($key_speakers) : [];
$show_timeline = isset($show_timeline) ? (bool) $show_timeline : (($is_events_profile || $is_job_profile) && !empty($sessions));
$show_key_speakers = isset($show_key_speakers) ? (bool) $show_key_speakers : ($is_events_profile && !empty($key_speakers));
$timeline_preview_limit = 3;
$sessions_grouped = [];
$session_group_order = 0;
foreach ($sessions as $session_index => $session_row) {
    if (!is_array($session_row)) {
        continue;
    }
    // Session-level notes are treated as personal itinerary notes; do not expose globally.
    $session_row['notes'] = '';
    $session_key = sanitize_key((string) ($session_row['session_key'] ?? ''));
    if ($session_key === '') {
        $session_key = sanitize_key('s' . substr(md5((string) $post_id . '|' . (string) $session_index . '|' . (string) ($session_row['title'] ?? '') . '|' . (string) ($session_row['start_raw'] ?? '') . '|' . (string) ($session_row['end_raw'] ?? '')), 0, 24));
    }
    $session_row['session_uid'] = sanitize_key('e' . (string) $post_id . '-' . $session_key);
    $day_label = sanitize_text_field((string) ($session_row['day_label'] ?? ''));
    $day_key = sanitize_text_field((string) ($session_row['day_key'] ?? ''));
    if ($day_key === '' && $day_label !== '' && preg_match('/^\d{4}\-\d{2}\-\d{2}$/', $day_label)) {
        $day_key = $day_label;
    }
    if ($day_label === '' && $day_key !== '' && preg_match('/^\d{4}\-\d{2}\-\d{2}$/', $day_key)) {
        $day_ts = strtotime($day_key . ' 00:00:00');
        if ($day_ts) {
            $day_label = wp_date(get_option('date_format'), (int) $day_ts);
        }
    }
    if ($day_label === '') {
        $day_label = __('General Schedule', 'nexdirectory');
    }
    if ($day_key === '') {
        $day_key = 'day-' . ((int) $session_index + 1);
    }
    if (!isset($sessions_grouped[$day_key])) {
        $sessions_grouped[$day_key] = [
            'day_key' => $day_key,
            'day_label' => $day_label,
            'group_order' => $session_group_order,
            'sessions' => [],
        ];
        $session_group_order++;
    }
    $sessions_grouped[$day_key]['sessions'][] = $session_row;
}
$sessions_grouped = array_values($sessions_grouped);
usort($sessions_grouped, static function ($a, $b) {
    $a_ts = isset($a['day_key']) && preg_match('/^\d{4}\-\d{2}\-\d{2}$/', (string) $a['day_key']) ? strtotime((string) $a['day_key'] . ' 00:00:00') : false;
    $b_ts = isset($b['day_key']) && preg_match('/^\d{4}\-\d{2}\-\d{2}$/', (string) $b['day_key']) ? strtotime((string) $b['day_key'] . ' 00:00:00') : false;
    if ($a_ts && $b_ts) {
        return $a_ts <=> $b_ts;
    }
    if ($a_ts) {
        return -1;
    }
    if ($b_ts) {
        return 1;
    }
    return ((int) ($a['group_order'] ?? 0)) <=> ((int) ($b['group_order'] ?? 0));
});
$key_speakers_visible = array_slice($key_speakers, 0, 3);
$has_more_key_speakers = count($key_speakers) > 3;
$default_timeline_heading = $is_events_profile ? __('Event Itinerary', 'nexdirectory') : __('Timeline', 'nexdirectory');
if ($is_events_profile && $single_timeline_heading === __('Timeline', 'nexdirectory')) {
    $single_timeline_heading = $default_timeline_heading;
}
$job_application_deadline = isset($job_application_deadline) ? sanitize_text_field((string) $job_application_deadline) : '';
$share_permalink = (string) get_permalink((int) $post_id);
$share_encoded_url = $share_permalink !== '' ? rawurlencode($share_permalink) : '';
$share_encoded_title = rawurlencode((string) $event_title);
$share_facebook_url = $share_encoded_url !== '' ? 'https://www.facebook.com/sharer/sharer.php?u=' . $share_encoded_url : '';
$share_x_url = $share_encoded_url !== '' ? 'https://twitter.com/intent/tweet?text=' . $share_encoded_title . '&url=' . $share_encoded_url : '';
$share_linkedin_url = $share_encoded_url !== '' ? 'https://www.linkedin.com/sharing/share-offsite/?url=' . $share_encoded_url : '';
$share_whatsapp_url = $share_permalink !== '' ? 'https://wa.me/?text=' . rawurlencode((string) $event_title . ' ' . $share_permalink) : '';
$primary_action_url = esc_url((string) ($primary_action_url ?? ''));
$primary_action_label = sanitize_text_field((string) ($primary_action_label ?? ''));
$primary_action_metric = sanitize_key((string) ($primary_action_metric ?? ''));
$edit_event_url = esc_url((string) ($edit_event_url ?? ''));
$edit_event_is_duplicate = !empty($edit_event_is_duplicate);
$calendar_url = esc_url((string) ($calendar_url ?? ''));
$google_url = esc_url((string) ($google_url ?? ''));
$directory_appointment_url = esc_url((string) ($directory_appointment_url ?? ''));
$directory_whatsapp_url = esc_url((string) ($directory_whatsapp_url ?? ''));
$directory_contact_person = sanitize_text_field((string) ($directory_contact_person ?? ''));
$whos_attending_url = esc_url((string) ($whos_attending_url ?? ''));
$event_webapp_url = esc_url((string) ($event_webapp_url ?? ''));
$event_webapp_enabled = !empty($event_webapp_enabled) && $event_webapp_url !== '';
$single_open_event_app_cta = isset($single_open_event_app_cta) ? (string) $single_open_event_app_cta : (string) ($ui_labels['single_open_event_app_cta'] ?? __('Download App', 'nexdirectory'));
$event_webapp_download_visible = false; // Hidden for MVP; web app entry points will return in a later release.
$directory_book_cta = sanitize_text_field((string) ($ui_labels['single_directory_book_cta'] ?? __('Book Appointment', 'nexdirectory')));
$directory_whatsapp_cta = sanitize_text_field((string) ($ui_labels['single_directory_whatsapp_cta'] ?? __('Message on WhatsApp', 'nexdirectory')));
$map_link = esc_url((string) ($map_link ?? ''));
$map_embed_url = esc_url((string) ($map_embed_url ?? ''));
$has_primary_action = $primary_action_url !== '' && $primary_action_label !== '';
$has_calendar_actions = !empty($show_calendar_actions) && ($calendar_url !== '' || $google_url !== '');
$calendar_primary_url = $google_url !== '' ? $google_url : $calendar_url;
$calendar_primary_label = $google_url !== '' ? $single_google_calendar_cta : $single_calendar_download_cta;
$calendar_secondary_url = '';
$calendar_secondary_label = '';
if ($google_url !== '' && $calendar_url !== '') {
    $calendar_secondary_url = $calendar_url;
    $calendar_secondary_label = $single_calendar_download_cta;
}
$hero_calendar_interactive = $has_calendar_actions && $calendar_primary_url !== '';
$hero_map_interactive = $map_link !== '' && $map_embed_url !== '';
$has_share_actions = $share_facebook_url !== '' || $share_x_url !== '' || $share_linkedin_url !== '' || $share_whatsapp_url !== '';
$owner_display_name = $directory_contact_person !== '' ? $directory_contact_person : sanitize_text_field((string) ($organizer_name ?? ''));

$rsvp_count = isset($rsvp_count) ? absint((int) $rsvp_count) : 0; 

if ($is_job_profile) {
    $owner_heading = __('Posted by', 'nexdirectory');
} elseif ($is_directory_profile) {
    $owner_heading = __('Owner', 'nexdirectory');
} elseif ($is_marketplace_profile) {
    $owner_heading = __('Seller', 'nexdirectory');
}

$home_url = esc_url(home_url('/'));
$events_nav_url = esc_url($this->get_platform_page_url('eep_page_events_url', $this->get_profile_route_slugs('events'), $this->get_profile_route_default_url('events')));
$workspace_nav_url = esc_url($this->get_platform_page_url('eep_page_my_events_url', $this->get_profile_route_slugs('my_items'), $this->get_profile_route_default_url('my_items')));
$submit_nav_url = esc_url($this->get_platform_page_url('eep_page_submit_event_url', $this->get_profile_route_slugs('submit'), $this->get_profile_route_default_url('submit')));
$account_nav_url = esc_url($this->get_platform_page_url('eep_page_account_url', $this->get_profile_route_slugs('account'), $this->get_profile_route_default_url('account')));
$logout_nav_url = esc_url(wp_logout_url($events_nav_url !== '' ? $events_nav_url : $home_url));
$messages_nav_url = $account_nav_url !== '' ? esc_url(eep_add_query_arg(['tab' => 'messages'], $account_nav_url)) : '';
$login_url = isset($login_url) ? esc_url((string) $login_url) : '';
if ($login_url === '') {
    $login_url = esc_url(wp_login_url((string) get_permalink((int) $post_id)));
}
$hero_image_url = esc_url((string) ($hero_image ?? ''));
if ($hero_image_url === '') {
    $hero_image_url = esc_url($this->get_default_image_url('hero', (int) $post_id));
}
$hero_image_style_attr = $hero_layout === 'immersive'
    ? ' style="display:block;width:100%;height:100%;object-fit:cover;"'
    : '';

// Extract tags
$clickable_badges = [];
$overview_chip_labels = [];
if (!empty($overview_chips) && is_array($overview_chips)) {
    foreach ($overview_chips as $chip) {
        $chip_label = sanitize_text_field((string) ($chip['label'] ?? ''));
        $chip_url = esc_url((string) ($chip['url'] ?? ''));
        if ($chip_label !== '') {
            $overview_chip_labels[] = $chip_label;
            if (!isset($clickable_badges[$chip_label])) {
                $clickable_badges[$chip_label] = $chip_url;
            }
        }
    }
}
$overview_chip_labels = array_values(array_unique($overview_chip_labels));
$overview_badges = array_slice($overview_chip_labels, 0, 5);
$clickable_badges = array_slice($clickable_badges, 0, 5, true);

$listed_on_label = get_the_date('M j, Y', (int) $post_id);
$updated_on_label = get_the_modified_date('M j, Y', (int) $post_id);
$owner_initials_source = trim((string) ($owner_display_name !== '' ? $owner_display_name : $owner_heading));
$owner_initials_parts = preg_split('/\s+/u', $owner_initials_source) ?: [];
$owner_initials = '';
foreach ($owner_initials_parts as $part) {
    if ($part === '') continue;
    $owner_initials .= strtoupper((string) substr($part, 0, 1));
    if (strlen($owner_initials) >= 2) break;
}
if ($owner_initials === '') $owner_initials = 'OW';
$phone_href = preg_replace('/[^0-9\+]/', '', (string) $contact_phone);
$external_url_full = trim((string) $external_url);
$external_url_display = $external_url_full;
if ($external_url_display !== '') {
    if (function_exists('mb_strlen') && function_exists('mb_substr')) {
        if (mb_strlen($external_url_display) > 50) {
            $external_url_display = mb_substr($external_url_display, 0, 47) . '...';
        }
    } elseif (strlen($external_url_display) > 50) {
        $external_url_display = substr($external_url_display, 0, 47) . '...';
    }
}
$current_user_id = get_current_user_id();
$can_message_owner = $viewer_logged_in && $organizer_id > 0 && $current_user_id > 0 && $organizer_id !== $current_user_id;
$is_listing_owner = $viewer_logged_in && $organizer_id > 0 && $current_user_id > 0 && $organizer_id === $current_user_id;
$message_targets_admin = $viewer_logged_in && $is_events_profile;
$message_default_subject = sprintf(__('Message about %s', 'nexdirectory'), (string) $event_title);
$waitlist_count = isset($waitlist_count) ? absint((int) $waitlist_count) : 0;
$message_button_mode = 'none';
$message_button_url = '';
$message_button_label = __('Message', 'nexdirectory');
$message_button_target = '';
$message_button_rel = '';
$claimable = !empty($claimable);
$claim_status = sanitize_key((string) ($claim_status ?? ''));
$claim_url = esc_url((string) ($claim_url ?? ''));
if ($claim_status === '' || !in_array($claim_status, ['pending', 'approved', 'rejected'], true)) {
    $claim_status = '';
}
if ($is_events_profile && !$owner_event_messages_enabled) {
    $message_button_mode = 'none';
} elseif ($message_targets_admin) {
    $message_button_mode = 'modal';
    $message_button_label = __('Message Admin', 'nexdirectory');
} elseif ($can_message_owner) {
    $message_button_mode = 'modal';
} elseif (!$viewer_logged_in && $login_url !== '') {
    $message_button_mode = 'link';
    $message_button_url = esc_url((string) $login_url);
    $message_button_label = __('Log In to Message', 'nexdirectory');
} elseif ($directory_whatsapp_url !== '' && !$is_events_profile) {
    $message_button_mode = 'link';
    $message_button_url = $directory_whatsapp_url;
    $message_button_label = $directory_whatsapp_cta !== '' ? $directory_whatsapp_cta : __('Message on WhatsApp', 'nexdirectory');
    $message_button_target = '_blank';
    $message_button_rel = 'noopener noreferrer nofollow ugc';
} elseif (is_email((string) $contact_email) && !$is_events_profile) {
    $message_button_mode = 'link';
    $message_button_url = 'mailto:' . sanitize_email((string) $contact_email) . '?subject=' . rawurlencode($message_default_subject);
}
$has_message_button = $message_button_mode === 'modal' || ($message_button_mode === 'link' && $message_button_url !== '');
$show_edit_event_button = $edit_event_url !== '' && ($edit_event_is_duplicate || $is_listing_owner || current_user_can('edit_post', (int) $post_id));
$edit_event_button_label = $edit_event_is_duplicate
    ? __('Create Editable Copy', 'nexdirectory')
    : ($is_events_profile ? __('Edit Event', 'nexdirectory') : $single_edit_cta);
$primary_cta_text = $single_visit_site_cta;
if ($show_rsvp_actions && $viewer_logged_in) {
    $primary_cta_text = (string) ($rsvp_button_label ?? __('RSVP', 'nexdirectory'));
} elseif ($show_rsvp_actions && !$viewer_logged_in) {
    $primary_cta_text = $single_login_rsvp;
} elseif ($has_primary_action && $primary_action_label !== '') {
    $primary_cta_text = $primary_action_label;
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo esc_html($event_title); ?> Preview</title>
    
    <script src="https://cdn.tailwindcss.com"></script>
    <script defer src="https://cdn.jsdelivr.net/npm/@alpinejs/intersect@3.x.x/dist/cdn.min.js"></script>
    <script defer src="https://cdn.jsdelivr.net/npm/@alpinejs/collapse@3.x.x/dist/cdn.min.js"></script>
    <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
    
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    fontFamily: { sans: ['Inter', 'sans-serif'] },
                    colors: {
                        brand: {
                            50: 'color-mix(in srgb, var(--eep-primary) 8%, #ffffff)',
                            100: 'color-mix(in srgb, var(--eep-primary) 14%, #ffffff)',
                            300: 'color-mix(in srgb, var(--eep-primary) 36%, #ffffff)',
                            500: 'var(--eep-primary)',
                            600: 'var(--eep-primary-hover)',
                            700: 'color-mix(in srgb, var(--eep-primary-hover) 80%, #000000)',
                            800: 'color-mix(in srgb, var(--eep-primary-hover) 64%, #000000)',
                            900: 'color-mix(in srgb, var(--eep-primary-hover) 48%, #000000)',
                        }
                    }
                }
            },
            plugins: [
                function ({ addUtilities }) {
                    addUtilities({
                        '.scrollbar-hide': {
                            '-ms-overflow-style': 'none',
                            'scrollbar-width': 'none',
                            '&::-webkit-scrollbar': { display: 'none' }
                        }
                    })
                }
            ]
        }
    </script>
</head>
<body class="bg-gray-50 text-gray-800 font-sans antialiased selection:bg-brand-100 selection:text-brand-700 pb-44 md:pb-8 min-h-screen"
      data-eep-hero-layout="<?php echo esc_attr($hero_layout); ?>"
      data-eep-page-layout="<?php echo esc_attr($page_layout); ?>"
      x-data="{
        showMapModal: false,
        showCalendarModal: false,
        showItineraryModal: false,
        itineraryModalDay: '',
        showSpeakersModal: false,
        messageModalOpen: false,
        ticketCheckoutModalOpen: false,
        itineraryNoteModalOpen: false,
        itineraryActiveSessionId: '',
        itineraryNoteText: '',
        itinerarySavedItems: [],
        itineraryNotesMap: {},
        viewerLoggedIn: <?php echo $viewer_logged_in ? 'true' : 'false'; ?>,
        itineraryListStorageKey: 'eep_itinerary_list_<?php echo esc_js((string) $post_id . '_' . $itinerary_storage_scope); ?>',
        itineraryNotesStorageKey: 'eep_itinerary_notes_<?php echo esc_js((string) $post_id . '_' . $itinerary_storage_scope); ?>',
        init() {
          if (!this.viewerLoggedIn) {
            this.itinerarySavedItems = [];
            this.itineraryNotesMap = {};
            return;
          }
          try {
            const savedItemsRaw = window.localStorage.getItem(this.itineraryListStorageKey) || '[]';
            const parsedSavedItems = JSON.parse(savedItemsRaw);
            this.itinerarySavedItems = Array.isArray(parsedSavedItems)
              ? Array.from(new Set(parsedSavedItems.map((item) => String(item || '').trim()).filter((item) => item !== '')))
              : [];
          } catch (_err) {
            this.itinerarySavedItems = [];
          }
          try {
            const notesRaw = window.localStorage.getItem(this.itineraryNotesStorageKey) || '{}';
            const parsedNotes = JSON.parse(notesRaw);
            this.itineraryNotesMap = parsedNotes && typeof parsedNotes === 'object' ? parsedNotes : {};
          } catch (_err) {
            this.itineraryNotesMap = {};
          }
        },
        persistItineraryState() {
          if (!this.viewerLoggedIn) {
            return;
          }
          try {
            window.localStorage.setItem(this.itineraryListStorageKey, JSON.stringify(this.itinerarySavedItems || []));
            window.localStorage.setItem(this.itineraryNotesStorageKey, JSON.stringify(this.itineraryNotesMap || {}));
          } catch (_err) {
            // ignore storage errors
          }
        },
        toggleItinerarySave(sessionId) {
          const key = String(sessionId || '').trim();
          if (!key) {
            return;
          }
          if (!this.viewerLoggedIn) {
            return;
          }
          const currentItems = Array.isArray(this.itinerarySavedItems) ? this.itinerarySavedItems : [];
          if (currentItems.includes(key)) {
            this.itinerarySavedItems = currentItems.filter((item) => item !== key);
          } else {
            this.itinerarySavedItems = [...currentItems, key];
          }
          this.persistItineraryState();
        },
        isItinerarySaved(sessionId) {
          const key = String(sessionId || '').trim();
          return this.viewerLoggedIn && key !== '' && this.itinerarySavedItems.includes(key);
        },
        getItineraryNote(sessionId) {
          const key = String(sessionId || '').trim();
          if (!this.viewerLoggedIn || !key || !this.itineraryNotesMap || typeof this.itineraryNotesMap !== 'object') {
            return '';
          }
          return String(this.itineraryNotesMap[key] || '');
        },
        hasItineraryNote(sessionId) {
          return this.getItineraryNote(sessionId).trim() !== '';
        },
        openItineraryNoteModal(sessionId) {
          const key = String(sessionId || '').trim();
          if (!this.viewerLoggedIn || !key) {
            return;
          }
          this.itineraryActiveSessionId = key;
          this.itineraryNoteText = this.getItineraryNote(key);
          this.itineraryNoteModalOpen = true;
        },
        closeItineraryNoteModal() {
          this.itineraryNoteModalOpen = false;
          this.itineraryActiveSessionId = '';
          this.itineraryNoteText = '';
        },
        saveItineraryNote() {
          if (!this.viewerLoggedIn) {
            this.closeItineraryNoteModal();
            return;
          }
          const key = String(this.itineraryActiveSessionId || '').trim();
          if (!key) {
            this.closeItineraryNoteModal();
            return;
          }
          const cleanText = String(this.itineraryNoteText || '').trim();
          if (cleanText === '') {
            if (this.itineraryNotesMap && typeof this.itineraryNotesMap === 'object') {
              delete this.itineraryNotesMap[key];
            }
          } else {
            this.itineraryNotesMap[key] = cleanText;
          }
          this.persistItineraryState();
          this.closeItineraryNoteModal();
        }
      }">

    <main class="max-w-7xl mx-auto px-0 sm:px-6 lg:px-8 py-0 sm:py-8 pb-24 md:pb-8">
        <?php if ($show_edit_event_button) : ?>
            <div class="sticky top-0 z-50 md:hidden px-4 pt-3 pb-2 bg-white/90 backdrop-blur-xl border-b border-gray-200/70 shadow-sm">
                <a href="<?php echo esc_url((string) $edit_event_url); ?>" class="w-full flex items-center justify-center gap-2 bg-brand-600 hover:bg-brand-700 active:bg-brand-800 active:scale-95 text-white text-sm font-bold rounded-xl py-3 transition-all duration-200 shadow-sm">
                    <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L12.828 14H9v-3.828l8.586-8.586z"></path></svg>
                    <span><?php echo esc_html((string) $edit_event_button_label); ?></span>
                </a>
            </div>
        <?php endif; ?>
        
        <?php
        echo $this->render_platform_breadcrumbs(
            (string) $event_title,
            $plural_label,
            $events_nav_url !== '' ? $events_nav_url : home_url('/events/')
        ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
        ?>

        <?php if ($show_autogenerated_disclaimer && $autogenerated_disclaimer_text !== '') : ?>
            <section
                data-eep-autogenerated-disclaimer="1"
                data-eep-event-id="<?php echo esc_attr((string) $post_id); ?>"
                data-eep-disclaimer-message="<?php echo esc_attr((string) $autogenerated_disclaimer_text); ?>"
                data-eep-disclaimer-source-url="<?php echo esc_url($autogenerated_source_url); ?>"
                hidden
                aria-hidden="true"
            >
                <noscript>
                    <div class="mx-4 sm:mx-0 mb-5 sm:mb-6 rounded-xl border border-amber-200 bg-amber-50/90 text-amber-900 shadow-sm px-4 py-3 sm:px-5 sm:py-4">
                        <p class="text-xs font-semibold uppercase tracking-wide text-amber-700"><?php esc_html_e('Imported Listing Notice', 'nexdirectory'); ?></p>
                        <p class="mt-1 text-sm leading-relaxed"><?php echo esc_html($autogenerated_disclaimer_text); ?></p>
                        <?php if ($autogenerated_source_url !== '') : ?>
                            <p class="mt-2 text-xs sm:text-sm">
                                <a
                                    href="<?php echo esc_url($autogenerated_source_url); ?>"
                                    target="_blank"
                                    rel="noopener noreferrer nofollow ugc"
                                    class="font-medium underline decoration-amber-400 underline-offset-2 hover:text-amber-800"
                                >
                                    <?php esc_html_e('Source', 'nexdirectory'); ?>
                                </a>
                            </p>
                        <?php endif; ?>
                    </div>
                </noscript>
            </section>
        <?php endif; ?>

        <div x-data="{ shown: false }" x-intersect.once="shown = true" :class="shown ? 'opacity-100 scale-100' : 'opacity-0 scale-[0.98]'" class="<?php echo esc_attr((string) $hero_template['container']); ?>">
            <?php if ($hero_image_url !== '') : ?>
                <img src="<?php echo esc_url($hero_image_url); ?>" alt="<?php echo esc_attr((string) $event_title); ?>" class="<?php echo esc_attr((string) $hero_template['image']); ?>"<?php echo $hero_image_style_attr; ?>>
            <?php else : ?>
                <div class="<?php echo esc_attr((string) $hero_template['fallback']); ?>"></div>
            <?php endif; ?>
            
            <div class="<?php echo esc_attr((string) $hero_template['overlay']); ?>"></div>
            
            <div class="<?php echo esc_attr((string) $hero_template['content']); ?>">
                <div class="flex flex-wrap items-center gap-2 mb-3">
                    <span class="<?php echo esc_attr((string) $hero_template['kicker']); ?> eep-single-hero-kicker" style="color:#ffffff;">
                        <?php echo esc_html((string) ($hero_kicker_text ?? ($this->get_white_label_brand_name() . ' ' . $singular_label))); ?>
                    </span>
                    <?php if ($status_text !== '') : ?>
                        <span class="inline-flex sm:hidden items-center px-2.5 py-1 rounded-full bg-green-500/20 text-green-300 text-xs font-semibold uppercase tracking-wider backdrop-blur-sm border border-green-500/30">
                            <?php echo esc_html((string) $status_text); ?>
                        </span>
                    <?php endif; ?>
                </div>
                
                <h1 class="<?php echo esc_attr((string) $hero_template['title']); ?>">
                    <?php echo esc_html((string) $event_title); ?>
                </h1>
                
                <?php if ($event_subtitle !== '') : ?>
                    <p class="<?php echo esc_attr((string) $hero_template['subtitle']); ?>">
                        <?php echo esc_html((string) $event_subtitle); ?>
                    </p>
                <?php endif; ?>
                
                <div class="<?php echo esc_attr((string) $hero_template['meta_wrap']); ?>">
                    <?php if ($show_hero_date_card && !empty($hero_date_label)) : ?>
                        <?php if ($hero_calendar_interactive) : ?>
                            <button type="button" @click.prevent="showCalendarModal = true" class="<?php echo esc_attr((string) $hero_template['meta_card']); ?> focus:outline-none focus:ring-2 focus:ring-white/60">
                                <div class="<?php echo esc_attr((string) $hero_template['meta_icon']); ?>">
                                    <svg class="w-5 h-5 sm:w-6 sm:h-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path></svg>
                                </div>
                                <div class="text-left">
                                    <p class="<?php echo esc_attr((string) $hero_template['meta_label']); ?>"><?php echo esc_html($single_date_meta_label); ?></p>
                                    <p class="<?php echo esc_attr((string) $hero_template['meta_value']); ?>"><?php echo esc_html((string) $hero_date_label); ?></p>
                                </div>
                            </button>
                        <?php else : ?>
                            <div class="<?php echo esc_attr((string) $hero_template['meta_card']); ?>">
                                <div class="<?php echo esc_attr((string) $hero_template['meta_icon']); ?>">
                                    <svg class="w-5 h-5 sm:w-6 sm:h-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path></svg>
                                </div>
                                <div>
                                    <p class="<?php echo esc_attr((string) $hero_template['meta_label']); ?>"><?php echo esc_html($single_date_meta_label); ?></p>
                                    <p class="<?php echo esc_attr((string) $hero_template['meta_value']); ?>"><?php echo esc_html((string) $hero_date_label); ?></p>
                                </div>
                            </div>
                        <?php endif; ?>
                    <?php endif; ?>
                    
                    <?php if (!empty($hero_location_label)) : ?>
                        <?php if ($hero_map_interactive) : ?>
                            <button type="button" @click.prevent="showMapModal = true" class="<?php echo esc_attr((string) $hero_template['meta_card']); ?> focus:outline-none focus:ring-2 focus:ring-white/60">
                                <div class="<?php echo esc_attr((string) $hero_template['meta_icon']); ?>">
                                    <svg class="w-5 h-5 sm:w-6 sm:h-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"></path><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z"></path></svg>
                                </div>
                                <div class="truncate text-left">
                                    <p class="<?php echo esc_attr((string) $hero_template['meta_label']); ?>"><?php echo esc_html($single_location_meta_label); ?></p>
                                    <p class="<?php echo esc_attr((string) $hero_template['meta_value'] . ' truncate'); ?>"><?php echo esc_html((string) $hero_location_label); ?></p>
                                </div>
                            </button>
                        <?php else : ?>
                            <div class="<?php echo esc_attr((string) $hero_template['meta_card']); ?>">
                                <div class="<?php echo esc_attr((string) $hero_template['meta_icon']); ?>">
                                    <svg class="w-5 h-5 sm:w-6 sm:h-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"></path><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z"></path></svg>
                                </div>
                                <div class="truncate">
                                    <p class="<?php echo esc_attr((string) $hero_template['meta_label']); ?>"><?php echo esc_html($single_location_meta_label); ?></p>
                                    <p class="<?php echo esc_attr((string) $hero_template['meta_value'] . ' truncate'); ?>"><?php echo esc_html((string) $hero_location_label); ?></p>
                                </div>
                            </div>
                        <?php endif; ?>
                    <?php endif; ?>
                </div>
            </div>
        </div>

        <div class="<?php echo esc_attr((string) $page_template['grid']); ?>">
            
            <div class="<?php echo esc_attr((string) $page_template['main']); ?>">
                
                <?php if ($show_event_overview) : ?>
                    <section x-data="{ shown: false }" x-intersect.once="shown = true" :class="shown ? 'opacity-100 translate-y-0' : 'opacity-0 translate-y-8'" class="transition-all duration-700 ease-out delay-100 bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden">
                        <div class="border-b border-gray-100 px-5 sm:px-6 py-4 sm:py-5 bg-gray-50/50 flex items-center justify-between">
                            <h2 class="text-lg sm:text-xl font-bold text-gray-900 flex items-center gap-2">
                                <svg class="w-5 h-5 text-brand-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
                                <?php echo esc_html($single_overview_heading); ?>
                            </h2>
                            <div class="hidden sm:flex gap-2">
                                <?php if ($status_text !== '') : ?>
                                    <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800 border border-green-200"><?php echo esc_html((string) $status_text); ?></span>
                                <?php endif; ?>
                                <?php if (!empty($overview_badges[0])) : ?>
                                    <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-brand-100 text-brand-800 border border-brand-200"><?php echo esc_html((string) $overview_badges[0]); ?></span>
                                <?php endif; ?>
                            </div>
                        </div>
                        <div class="p-5 sm:p-6">
                            <div class="text-gray-600 text-sm sm:text-base leading-relaxed mb-6 prose max-w-none">
                                <?php echo wp_kses_post((string) $content_html); ?>
                            </div>
                            
                            <?php if (!empty($clickable_badges)) : ?>
                                <div class="flex overflow-x-auto scrollbar-hide gap-2 mb-8 -mx-5 px-5 sm:mx-0 sm:px-0 sm:flex-wrap">
                                    <?php foreach ($clickable_badges as $badge_label => $badge_url) : ?>
                                        <?php if ($badge_url !== '') : ?>
                                            <a href="<?php echo esc_url($badge_url); ?>" class="shrink-0 px-3 py-1.5 sm:py-1 bg-brand-50 text-brand-700 hover:bg-brand-100 active:scale-95 text-xs font-medium rounded-full border border-brand-100 transition-all duration-200"><?php echo esc_html($badge_label); ?></a>
                                        <?php else : ?>
                                            <span class="shrink-0 px-3 py-1.5 sm:py-1 bg-brand-50 text-brand-700 text-xs font-medium rounded-full border border-brand-100"><?php echo esc_html($badge_label); ?></span>
                                        <?php endif; ?>
                                    <?php endforeach; ?>
                                </div>
                            <?php endif; ?>

                            <div class="grid grid-cols-2 md:grid-cols-4 gap-y-6 gap-x-4 sm:gap-x-8 text-sm bg-gray-50 rounded-xl p-4 sm:p-5 border border-gray-100 mb-6 sm:mb-0 hover:border-brand-200 transition-colors duration-300 cursor-default">
                                <div>
                                    <p class="text-gray-500 font-medium text-[10px] sm:text-xs uppercase tracking-wider mb-1"><?php esc_html_e('Listing ID', 'nexdirectory'); ?></p>
                                    <p class="font-semibold text-gray-900">#<?php echo esc_html((string) $post_id); ?></p>
                                </div>
                                <div>
                                    <p class="text-gray-500 font-medium text-[10px] sm:text-xs uppercase tracking-wider mb-1"><?php esc_html_e('Listed On', 'nexdirectory'); ?></p>
                                    <p class="font-semibold text-gray-900"><?php echo esc_html((string) $listed_on_label); ?></p>
                                </div>
                                <div>
                                    <p class="text-gray-500 font-medium text-[10px] sm:text-xs uppercase tracking-wider mb-1"><?php esc_html_e('Updated', 'nexdirectory'); ?></p>
                                    <p class="font-semibold text-gray-900"><?php echo esc_html((string) $updated_on_label); ?></p>
                                </div>
                                <div>
                                    <p class="text-gray-500 font-medium text-[10px] sm:text-xs uppercase tracking-wider mb-1"><?php esc_html_e('Categories', 'nexdirectory'); ?></p>
                                    <p class="font-semibold text-gray-900 truncate"><?php echo esc_html(!empty($overview_badges) ? implode(', ', $overview_badges) : __('General', 'nexdirectory')); ?></p>
                                </div>
                            </div>
                            
                            <?php if ($contact_email !== '' || $contact_phone !== '' || $external_url !== '') : ?>
                                <div class="pt-0 sm:pt-6 sm:border-t border-gray-100 grid grid-cols-1 sm:grid-cols-2 gap-4 mt-6">
                                    <?php if ($contact_phone !== '') : ?>
                                        <div class="flex items-start gap-3 bg-white border sm:border-0 border-gray-100 p-3 sm:p-0 rounded-xl sm:rounded-none shadow-sm sm:shadow-none hover:bg-gray-50 transition-colors sm:hover:bg-transparent duration-200">
                                            <div class="p-2 bg-brand-50 sm:bg-gray-50 rounded-lg text-brand-500 sm:text-gray-400 shrink-0">
                                                <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z"></path></svg>
                                            </div>
                                            <div x-data="{ show: false }" class="flex-1">
                                                <p class="text-gray-400 font-medium text-xs uppercase tracking-wider mb-0.5"><?php echo esc_html($single_phone_inline_label); ?></p>
                                                <button @click="show = true" x-show="!show" class="text-brand-600 font-medium hover:text-brand-700 transition-colors text-sm sm:text-base py-1 active:scale-95 origin-left">Reveal Number</button>
                                                <?php if ($phone_href !== '') : ?>
                                                    <a x-show="show" x-cloak href="<?php echo esc_url('tel:' . (string) $phone_href); ?>" class="font-medium text-gray-900 hover:text-brand-600 transition-colors block text-sm sm:text-base py-1"><?php echo esc_html((string) $contact_phone); ?></a>
                                                <?php else: ?>
                                                    <span x-show="show" x-cloak class="font-medium text-gray-900 block text-sm sm:text-base py-1"><?php echo esc_html((string) $contact_phone); ?></span>
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                    <?php endif; ?>
                                    
                                    <?php if ($contact_email !== '') : ?>
                                        <div class="flex items-start gap-3 bg-white border sm:border-0 border-gray-100 p-3 sm:p-0 rounded-xl sm:rounded-none shadow-sm sm:shadow-none hover:bg-gray-50 transition-colors sm:hover:bg-transparent duration-200">
                                            <div class="p-2 bg-brand-50 sm:bg-gray-50 rounded-lg text-brand-500 sm:text-gray-400 shrink-0">
                                                <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"></path></svg>
                                            </div>
                                            <div class="flex-1 overflow-hidden">
                                                <p class="text-gray-400 font-medium text-xs uppercase tracking-wider mb-0.5"><?php echo esc_html($single_email_inline_label); ?></p>
                                                <?php if (is_email((string) $contact_email)) : ?>
                                                    <a href="mailto:<?php echo esc_attr(sanitize_email((string) $contact_email)); ?>" class="font-medium text-brand-600 hover:text-brand-700 transition-colors truncate block text-sm sm:text-base py-1"><?php echo esc_html((string) $contact_email); ?></a>
                                                <?php else : ?>
                                                    <p class="font-medium text-gray-900 block text-sm sm:text-base py-1"><?php echo esc_html((string) $contact_email); ?></p>
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                    <?php endif; ?>
                                    
                                    <?php if ($external_url !== '') : ?>
                                        <div class="sm:col-span-2 flex items-start gap-3 bg-white border sm:border-0 border-gray-100 p-3 sm:p-0 rounded-xl sm:rounded-none shadow-sm sm:shadow-none hover:bg-gray-50 transition-colors sm:hover:bg-transparent duration-200">
                                            <div class="p-2 bg-brand-50 sm:bg-gray-50 rounded-lg text-brand-500 sm:text-gray-400 shrink-0">
                                                <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"></path></svg>
                                            </div>
                                            <div class="flex-1 overflow-hidden">
                                                <p class="text-gray-400 font-medium text-xs uppercase tracking-wider mb-0.5"><?php esc_html_e('Website', 'nexdirectory'); ?></p>
                                                <a href="<?php echo esc_url((string) $external_url_full); ?>" target="_blank" rel="noopener noreferrer nofollow ugc" title="<?php echo esc_attr((string) $external_url_full); ?>" class="font-medium text-brand-600 hover:text-brand-700 transition-colors truncate block text-sm sm:text-base py-1"><?php echo esc_html((string) $external_url_display); ?></a>
                                            </div>
                                        </div>
                                    <?php endif; ?>
                                </div>
                            <?php endif; ?>
                        </div>
                    </section>
                <?php endif; ?>

                <?php if (!empty($custom_fields_display)) : ?>
                    <section x-data="{ shown: false, expanded: true }" x-intersect.once="shown = true" :class="shown ? 'opacity-100 translate-y-0' : 'opacity-0 translate-y-8'" class="transition-all duration-700 ease-out delay-150 bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden">
                        <button @click="expanded = !expanded" class="w-full border-b border-gray-100 px-5 sm:px-6 py-4 sm:py-5 bg-gray-50/50 flex items-center justify-between transition-colors hover:bg-gray-100/50 focus:outline-none">
                            <h2 class="text-lg sm:text-xl font-bold text-gray-900 flex items-center gap-2">
                                <svg class="w-5 h-5 text-brand-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path></svg>
                                <?php echo esc_html($single_additional_heading); ?>
                            </h2>
                            <svg class="w-5 h-5 text-gray-400 transform transition-transform duration-300" :class="expanded ? 'rotate-180' : ''" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg>
                        </button>
                        <div x-show="expanded" x-collapse class="p-5 sm:p-6">
                            <div class="space-y-3 sm:space-y-4">
                                <?php foreach ($custom_fields_display as $index => $row) : ?>
                                    <?php
                                    $render_type = sanitize_key((string) ($row['render_type'] ?? 'text'));
                                    $label = sanitize_text_field((string) ($row['label'] ?? ''));
                                    ?>
                                    <div class="flex flex-col sm:flex-row sm:items-center justify-between p-3 sm:p-4 bg-gray-50 rounded-xl border border-gray-100 hover:border-brand-200 transition-colors duration-200">
                                        <span class="text-xs sm:text-sm font-medium text-gray-500 mb-1 sm:mb-0"><?php echo esc_html((string) $label); ?></span>
                                        
                                        <?php if ($render_type === 'html') : ?>
                                            <span class="text-sm font-semibold text-gray-900 text-right"><?php echo wp_kses_post((string) ($row['value'] ?? '')); ?></span>
                                        <?php elseif ($render_type === 'link') : ?>
                                            <a target="_blank" rel="noopener noreferrer nofollow ugc" href="<?php echo esc_url((string) ($row['url'] ?? '')); ?>" class="text-sm font-medium text-brand-600 hover:text-brand-700 truncate"><?php echo esc_html((string) ($row['value'] ?? '')); ?></a>
                                        <?php elseif ($render_type === 'image') : ?>
                                            <img src="<?php echo esc_url((string) ($row['value'] ?? '')); ?>" alt="<?php echo esc_attr((string) $label); ?>" class="max-h-16 object-cover rounded-lg shadow-sm">
                                        <?php elseif ($render_type === 'gallery') : ?>
                                            <div class="flex gap-2 justify-end overflow-x-auto scrollbar-hide">
                                                <?php foreach ((array) ($row['gallery'] ?? []) as $gallery_item) : ?>
                                                    <img src="<?php echo esc_url((string) $gallery_item); ?>" alt="<?php echo esc_attr((string) $label); ?>" class="h-10 w-10 object-cover rounded-md shadow-sm border border-gray-200 shrink-0">
                                                <?php endforeach; ?>
                                            </div>
                                        <?php else : ?>
                                            <span class="text-sm font-semibold text-gray-900"><?php echo esc_html((string) ($row['value'] ?? '')); ?></span>
                                        <?php endif; ?>
                                    </div>
                                <?php endforeach; ?>
                            </div>
                        </div>
                    </section>
                <?php endif; ?>

                <?php if ($show_timeline && !empty($sessions_grouped)) : ?>
                    <section x-data="{ shown: false }" x-intersect.once="shown = true" :class="shown ? 'opacity-100 translate-y-0' : 'opacity-0 translate-y-8'" class="transition-all duration-700 ease-out delay-200 bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden">
                        <div class="border-b border-gray-100 px-5 sm:px-6 py-4 sm:py-5 bg-gray-50/50">
                            <h2 class="text-lg sm:text-xl font-bold text-gray-900 flex items-center gap-2">
                                <svg class="w-5 h-5 text-brand-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg>
                                <?php echo esc_html($single_timeline_heading); ?>
                            </h2>
                        </div>
                        <div class="p-5 sm:p-6">
                            <div class="space-y-6">
                                <?php foreach ($sessions_grouped as $day_group_index => $day_group) : ?>
                                    <?php
                                    $day_key = sanitize_text_field((string) ($day_group['day_key'] ?? ('day-' . ((int) $day_group_index + 1))));
                                    $day_label = sanitize_text_field((string) ($day_group['day_label'] ?? __('Schedule', 'nexdirectory')));
                                    $day_sessions = isset($day_group['sessions']) && is_array($day_group['sessions']) ? array_values($day_group['sessions']) : [];
                                    $preview_sessions = array_slice($day_sessions, 0, $timeline_preview_limit);
                                    $has_more_day_sessions = count($day_sessions) > $timeline_preview_limit;
                                    ?>
                                    <article class="border border-gray-100 rounded-2xl p-4 sm:p-5 bg-gray-50/40">
                                        <div class="flex items-center justify-between gap-3 mb-4">
                                            <h3 class="text-sm sm:text-base font-bold text-gray-900"><?php echo esc_html($day_label); ?></h3>
                                            <span class="inline-flex items-center px-2.5 py-1 rounded-full text-xs font-semibold bg-brand-50 text-brand-700 border border-brand-100"><?php echo esc_html((string) count($day_sessions)); ?> <?php esc_html_e('sessions', 'nexdirectory'); ?></span>
                                        </div>

                                        <div class="relative">
                                            <?php if (count($preview_sessions) > 1) : ?>
                                                <span class="pointer-events-none absolute left-[9px] top-8 bottom-8 w-px bg-gradient-to-b from-brand-300 via-brand-200 to-brand-100"></span>
                                            <?php endif; ?>
                                            <?php foreach ($preview_sessions as $session_index => $session_row) : ?>
                                                <?php
                                                $session_title = sanitize_text_field((string) ($session_row['title'] ?? ''));
                                                if ($session_title === '') {
                                                    $session_title = sprintf(__('Session %d', 'nexdirectory'), ((int) $session_index) + 1);
                                                }
                                                $session_uid = sanitize_key((string) ($session_row['session_uid'] ?? ''));
                                                $session_time = sanitize_text_field((string) ($session_row['time'] ?? ''));
                                                $session_location = sanitize_text_field((string) ($session_row['location'] ?? ''));
                                                $session_speaker = sanitize_text_field((string) ($session_row['speaker'] ?? ''));
                                                $session_attachments = isset($session_row['attachments']) && is_array($session_row['attachments']) ? array_values(array_filter(array_map('esc_url', $session_row['attachments']))) : [];
                                                ?>
                                                <div class="relative pl-10 pb-6 last:pb-0">
                                                    <span class="absolute left-0 top-6 z-10 flex w-5 h-5 items-center justify-center rounded-full bg-brand-500 border-4 border-white shadow-sm"></span>
                                                    <div :class="isItinerarySaved('<?php echo esc_js($session_uid); ?>') ? 'border-l-4 border-l-green-500 border-green-100 bg-green-50/40' : 'border-gray-200 bg-white'" class="relative z-[1] rounded-xl border p-4 sm:p-5 shadow-sm hover:border-brand-200 hover:-translate-y-0.5 hover:shadow-md transition-all duration-300">
                                                        <div class="flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3">
                                                            <h4 class="text-base sm:text-lg font-bold text-gray-900"><?php echo esc_html($session_title); ?></h4>
                                                            <div class="flex flex-wrap items-center gap-2">
                                                                <?php if ($viewer_logged_in) : ?>
                                                                    <button type="button" @click.prevent.stop="toggleItinerarySave('<?php echo esc_js($session_uid); ?>')" :class="isItinerarySaved('<?php echo esc_js($session_uid); ?>') ? 'bg-green-50 text-green-700 border-green-200' : 'bg-white text-gray-700 border-gray-300'" class="inline-flex items-center gap-1 px-3 py-1.5 rounded-md text-xs font-semibold border transition-colors">
                                                                        <span x-show="!isItinerarySaved('<?php echo esc_js($session_uid); ?>')"><?php esc_html_e('Add to list', 'nexdirectory'); ?></span>
                                                                        <span x-show="isItinerarySaved('<?php echo esc_js($session_uid); ?>')" style="display:none;"><?php esc_html_e('Saved', 'nexdirectory'); ?></span>
                                                                    </button>
                                                                    <button type="button" @click="openItineraryNoteModal('<?php echo esc_js($session_uid); ?>')" :class="hasItineraryNote('<?php echo esc_js($session_uid); ?>') ? 'bg-amber-50 text-amber-700 border-amber-200' : 'bg-white text-gray-700 border-gray-300'" class="inline-flex items-center gap-1 px-3 py-1.5 rounded-md text-xs font-semibold border transition-colors">
                                                                        <span x-show="!hasItineraryNote('<?php echo esc_js($session_uid); ?>')"><?php esc_html_e('Add note', 'nexdirectory'); ?></span>
                                                                        <span x-show="hasItineraryNote('<?php echo esc_js($session_uid); ?>')" style="display:none;"><?php esc_html_e('Edit note', 'nexdirectory'); ?></span>
                                                                    </button>
                                                                <?php else : ?>
                                                                    <a href="<?php echo esc_url($login_url); ?>" class="inline-flex items-center gap-1 px-3 py-1.5 rounded-md text-xs font-semibold border border-brand-200 bg-brand-50 text-brand-700 hover:bg-brand-100 transition-colors">
                                                                        <?php esc_html_e('Sign in to save itinerary', 'nexdirectory'); ?>
                                                                    </a>
                                                                <?php endif; ?>
                                                            </div>
                                                        </div>
                                                        <div class="mt-3 space-y-2 text-sm text-gray-600">
                                                            <?php if ($session_time !== '') : ?>
                                                                <p><span class="font-semibold text-gray-900"><?php esc_html_e('Time:', 'nexdirectory'); ?></span> <?php echo esc_html($session_time); ?></p>
                                                            <?php endif; ?>
                                                            <?php if ($session_location !== '') : ?>
                                                                <p><span class="font-semibold text-gray-900"><?php esc_html_e('Location:', 'nexdirectory'); ?></span> <?php echo esc_html($session_location); ?></p>
                                                            <?php endif; ?>
                                                            <?php if ($session_speaker !== '') : ?>
                                                                <p><span class="font-semibold text-gray-900"><?php esc_html_e('Speaker:', 'nexdirectory'); ?></span> <?php echo esc_html($session_speaker); ?></p>
                                                            <?php endif; ?>
                                                        </div>

                                                        <template x-if="viewerLoggedIn && hasItineraryNote('<?php echo esc_js($session_uid); ?>')">
                                                            <div class="mt-3 p-3 rounded-lg border border-yellow-200 bg-yellow-50/80 text-sm text-yellow-900 whitespace-pre-wrap" x-text="getItineraryNote('<?php echo esc_js($session_uid); ?>')"></div>
                                                        </template>

                                                        <?php if (!empty($session_attachments)) : ?>
                                                            <div class="mt-3 flex flex-wrap gap-2" data-eep-custom-gallery="session-<?php echo esc_attr($day_key . '-' . $session_index); ?>">
                                                                <?php foreach ($session_attachments as $attachment_index => $attachment_url) : ?>
                                                                    <?php
                                                                    $attachment_path = strtolower((string) wp_parse_url($attachment_url, PHP_URL_PATH));
                                                                    $attachment_ext = strtolower((string) pathinfo($attachment_path, PATHINFO_EXTENSION));
                                                                    $attachment_name = sanitize_text_field((string) basename($attachment_path));
                                                                    if ($attachment_name === '') {
                                                                        $attachment_name = sprintf(__('Attachment %d', 'nexdirectory'), $attachment_index + 1);
                                                                    }
                                                                    $is_image_attachment = in_array($attachment_ext, ['jpg', 'jpeg', 'png', 'gif', 'webp', 'bmp', 'avif', 'svg'], true);
                                                                    $is_video_attachment = in_array($attachment_ext, ['mp4', 'webm', 'ogg', 'mov', 'm4v'], true) || preg_match('/(youtube\.com|youtu\.be|vimeo\.com)/i', (string) $attachment_url);
                                                                    $is_pdf_attachment = $attachment_ext === 'pdf';
                                                                    ?>
                                                                    <?php if ($is_image_attachment) : ?>
                                                                        <button type="button" class="eep-gallery-item inline-flex items-center px-3 py-1.5 rounded-lg border border-gray-200 bg-gray-50 text-xs font-medium text-gray-700 hover:bg-gray-100 transition-colors" data-eep-lightbox="<?php echo esc_url($attachment_url); ?>">
                                                                            <?php echo esc_html($attachment_name); ?>
                                                                        </button>
                                                                    <?php elseif ($is_video_attachment) : ?>
                                                                        <button type="button" class="inline-flex items-center px-3 py-1.5 rounded-lg border border-gray-200 bg-gray-50 text-xs font-medium text-gray-700 hover:bg-gray-100 transition-colors" data-eep-video-url="<?php echo esc_url($attachment_url); ?>">
                                                                            <?php echo esc_html($attachment_name); ?>
                                                                        </button>
                                                                    <?php else : ?>
                                                                        <button type="button" class="inline-flex items-center px-3 py-1.5 rounded-lg border border-gray-200 bg-gray-50 text-xs font-medium text-gray-700 hover:bg-gray-100 transition-colors" data-eep-doc-url="<?php echo esc_url($attachment_url); ?>" data-eep-doc-title="<?php echo esc_attr($attachment_name); ?>" data-eep-doc-embed="<?php echo $is_pdf_attachment ? esc_url($attachment_url) : ''; ?>">
                                                                            <?php echo esc_html($attachment_name); ?>
                                                                        </button>
                                                                    <?php endif; ?>
                                                                <?php endforeach; ?>
                                                            </div>
                                                        <?php endif; ?>
                                                    </div>
                                                </div>
                                            <?php endforeach; ?>
                                        </div>

                                        <?php if ($has_more_day_sessions) : ?>
                                            <div class="mt-2 pl-10">
                                                <button type="button" @click="itineraryModalDay = '<?php echo esc_js($day_key); ?>'; showItineraryModal = true" class="inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-brand-50 text-brand-700 border border-brand-100 text-sm font-semibold hover:bg-brand-100 transition-colors">
                                                    <?php esc_html_e('View Full Day Itinerary', 'nexdirectory'); ?>
                                                    <span class="text-xs">(+<?php echo esc_html((string) (count($day_sessions) - $timeline_preview_limit)); ?>)</span>
                                                </button>
                                            </div>
                                        <?php endif; ?>
                                    </article>
                                <?php endforeach; ?>
                            </div>
                        </div>
                    </section>
                <?php endif; ?>

                <?php if ($show_key_speakers && !empty($key_speakers)) : ?>
                    <section x-data="{ shown: false }" x-intersect.once="shown = true" :class="shown ? 'opacity-100 translate-y-0' : 'opacity-0 translate-y-8'" class="transition-all duration-700 ease-out delay-200 bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden">
                        <div class="border-b border-gray-100 px-5 sm:px-6 py-4 sm:py-5 bg-gray-50/50">
                            <h2 class="text-lg sm:text-xl font-bold text-gray-900 flex items-center gap-2">
                                <svg class="w-5 h-5 text-brand-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"></path></svg>
                                <?php echo esc_html($single_key_speakers_heading); ?>
                            </h2>
                        </div>
                        <div class="p-5 sm:p-6">
                            <div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
                                <?php foreach ($key_speakers_visible as $speaker_row) : ?>
                                    <?php
                                    $speaker_name = sanitize_text_field((string) ($speaker_row['name'] ?? ''));
                                    $speaker_profession = sanitize_text_field((string) ($speaker_row['profession'] ?? ''));
                                    $speaker_subject = sanitize_text_field((string) ($speaker_row['subject'] ?? ''));
                                    $speaker_details = eep_sanitize_textarea((string) ($speaker_row['details'] ?? ''));
                                    $speaker_image = esc_url((string) ($speaker_row['image'] ?? ''));
                                    if ($speaker_name === '' && $speaker_profession === '' && $speaker_subject === '' && $speaker_details === '' && $speaker_image === '') {
                                        continue;
                                    }
                                    ?>
                                    <article class="rounded-xl border border-gray-200 bg-gray-50/60 p-4 sm:p-5 shadow-sm hover:border-brand-200 hover:-translate-y-0.5 hover:shadow-md transition-all duration-300">
                                        <div class="flex items-start gap-3">
                                            <?php if ($speaker_image !== '') : ?>
                                                <img src="<?php echo esc_url($speaker_image); ?>" alt="<?php echo esc_attr($speaker_name !== '' ? $speaker_name : __('Speaker', 'nexdirectory')); ?>" class="w-14 h-14 rounded-xl object-cover border border-gray-200 shadow-sm shrink-0">
                                            <?php else : ?>
                                                <div class="w-14 h-14 rounded-xl bg-brand-50 text-brand-600 border border-brand-100 shadow-sm shrink-0 flex items-center justify-center">
                                                    <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"></path></svg>
                                                </div>
                                            <?php endif; ?>
                                            <div class="min-w-0 flex-1">
                                                <?php if ($speaker_name !== '') : ?>
                                                    <h3 class="text-base font-bold text-gray-900 leading-tight"><?php echo esc_html($speaker_name); ?></h3>
                                                <?php endif; ?>
                                                <?php if ($speaker_profession !== '') : ?>
                                                    <p class="text-sm text-gray-500 mt-1"><?php echo esc_html($speaker_profession); ?></p>
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                        <?php if ($speaker_subject !== '') : ?>
                                            <p class="mt-3 inline-flex items-center px-2.5 py-1 rounded-full text-xs font-semibold text-brand-700 bg-brand-50 border border-brand-100"><?php echo esc_html($speaker_subject); ?></p>
                                        <?php endif; ?>
                                        <?php if ($speaker_details !== '') : ?>
                                            <p class="mt-3 text-sm text-gray-600 leading-relaxed"><?php echo esc_html($speaker_details); ?></p>
                                        <?php endif; ?>
                                    </article>
                                <?php endforeach; ?>
                            </div>
                            <?php if ($has_more_key_speakers) : ?>
                                <div class="mt-4">
                                    <button type="button" @click="showSpeakersModal = true" class="inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-brand-50 text-brand-700 border border-brand-100 text-sm font-semibold hover:bg-brand-100 transition-colors">
                                        <?php esc_html_e('View All Speakers', 'nexdirectory'); ?>
                                        <span class="text-xs">(+<?php echo esc_html((string) (count($key_speakers) - count($key_speakers_visible))); ?>)</span>
                                    </button>
                                </div>
                            <?php endif; ?>
                        </div>
                    </section>
                <?php endif; ?>

                <?php if (!empty($gallery_images_all) && !$is_job_profile) : ?>
                    <section x-data="{ shown: false }" x-intersect.once="shown = true" :class="shown ? 'opacity-100 translate-y-0' : 'opacity-0 translate-y-8'" class="transition-all duration-700 ease-out delay-200 bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden">
                        <div class="border-b border-gray-100 px-5 sm:px-6 py-4 sm:py-5 bg-gray-50/50 flex justify-between items-center">
                            <h2 class="text-lg sm:text-xl font-bold text-gray-900 flex items-center gap-2">
                                <svg class="w-5 h-5 text-brand-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"></path></svg>
                                <?php echo esc_html($single_gallery_heading); ?>
                            </h2>
                            <?php if ($event_gallery_type === 'carousel') : ?>
                                <span class="text-xs font-semibold text-brand-600 bg-brand-50 px-2.5 py-1 rounded-full"><?php esc_html_e('Carousel', 'nexdirectory'); ?></span>
                            <?php elseif ($event_gallery_type === 'wall') : ?>
                                <span class="text-xs font-semibold text-brand-600 bg-brand-50 px-2.5 py-1 rounded-full"><?php esc_html_e('Wall', 'nexdirectory'); ?></span>
                            <?php else : ?>
                                <span class="text-xs font-semibold text-brand-600 bg-brand-50 px-2.5 py-1 rounded-full md:hidden"><?php esc_html_e('Swipe', 'nexdirectory'); ?></span>
                            <?php endif; ?>
                        </div>
                        <?php if ($event_gallery_type === 'carousel') : ?>
                            <div class="p-5 sm:p-6 eep-event-gallery-grid" data-eep-gallery-grid="1" data-eep-gallery-items="<?php echo $gallery_items_json; ?>">
                                <?php if (count($gallery_images_all) > 1) : ?>
                                    <div class="hidden sm:flex justify-end gap-2 mb-3">
                                        <button type="button" @click="$refs.galleryCarousel.scrollBy({ left: -Math.max(280, $refs.galleryCarousel.clientWidth * 0.75), behavior: 'smooth' })" class="inline-flex items-center justify-center w-9 h-9 rounded-full border border-gray-200 bg-white text-gray-600 hover:bg-gray-50 transition-colors">
                                            <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"></path></svg>
                                        </button>
                                        <button type="button" @click="$refs.galleryCarousel.scrollBy({ left: Math.max(280, $refs.galleryCarousel.clientWidth * 0.75), behavior: 'smooth' })" class="inline-flex items-center justify-center w-9 h-9 rounded-full border border-gray-200 bg-white text-gray-600 hover:bg-gray-50 transition-colors">
                                            <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg>
                                        </button>
                                    </div>
                                <?php endif; ?>
                                <div class="flex overflow-x-auto snap-x snap-mandatory scrollbar-hide gap-4 pb-2 -mx-5 px-5 sm:mx-0 sm:px-0" x-ref="galleryCarousel">
                                    <?php foreach ($gallery_images_all as $i => $img) : ?>
                                        <button type="button" class="eep-gallery-item snap-start shrink-0 w-[84vw] sm:w-[520px] lg:w-[620px] relative rounded-xl overflow-hidden aspect-[16/10] bg-gray-100 border border-gray-200 outline-none shadow-sm hover:shadow-md transition-shadow" data-eep-lightbox="<?php echo esc_url((string) $img); ?>" data-eep-gallery-index="<?php echo esc_attr((string) $i); ?>">
                                            <img src="<?php echo esc_url((string) $img); ?>" loading="lazy" class="w-full h-full object-cover block">
                                        </button>
                                    <?php endforeach; ?>
                                    <div class="snap-start shrink-0 w-[1px] opacity-0 pointer-events-none" aria-hidden="true"></div>
                                </div>
                            </div>
                        <?php elseif ($event_gallery_type === 'wall') : ?>
                            <div class="p-5 sm:p-6 eep-event-gallery-grid" data-eep-gallery-grid="1" data-eep-gallery-items="<?php echo $gallery_items_json; ?>">
                                <div class="columns-1 sm:columns-2 lg:columns-3 gap-4">
                                    <?php foreach ($gallery_images_all as $i => $img) : ?>
                                        <button type="button" class="eep-gallery-item mb-4 block w-full break-inside-avoid rounded-xl overflow-hidden bg-gray-100 border border-gray-200 outline-none shadow-sm hover:shadow-md transition-shadow" data-eep-lightbox="<?php echo esc_url((string) $img); ?>" data-eep-gallery-index="<?php echo esc_attr((string) $i); ?>">
                                            <img src="<?php echo esc_url((string) $img); ?>" loading="lazy" class="w-full h-auto block">
                                        </button>
                                    <?php endforeach; ?>
                                </div>
                            </div>
                        <?php else : ?>
                            <div class="hidden md:block p-5 sm:p-6" data-eep-gallery-grid="1" data-eep-gallery-items="<?php echo $gallery_items_json; ?>">
                                <div class="grid grid-cols-3 gap-4 auto-rows-min">
                                    <?php if (isset($gallery_images_visible[0])): ?>
                                        <button type="button" class="eep-gallery-item col-span-2 row-span-2 group relative rounded-xl overflow-hidden aspect-auto h-full min-h-[400px] bg-gray-100 border border-gray-200 flex outline-none cursor-pointer focus:ring-2 focus:ring-brand-500 shadow-sm hover:shadow-md transition-shadow" data-eep-lightbox="<?php echo esc_url((string) $gallery_images_visible[0]); ?>" data-eep-gallery-index="0">
                                            <img src="<?php echo esc_url((string) $gallery_images_visible[0]); ?>" loading="lazy" class="w-full h-full object-cover transition-transform duration-500 md:group-hover:scale-105 block">
                                            <div class="absolute inset-0 bg-black/0 md:group-hover:bg-black/10 transition-colors flex items-center justify-center">
                                                <svg class="w-10 h-10 text-white opacity-0 md:group-hover:opacity-100 transition-opacity transform scale-50 md:group-hover:scale-100 duration-300 drop-shadow-md" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0zM10 7v3m0 0v3m0-3h3m-3 0H7"></path></svg>
                                            </div>
                                        </button>
                                    <?php endif; ?>
                                    <?php if (isset($gallery_images_visible[1])): ?>
                                        <button type="button" class="eep-gallery-item col-span-1 group relative rounded-xl overflow-hidden aspect-[4/3] bg-gray-100 border border-gray-200 flex outline-none cursor-pointer focus:ring-2 focus:ring-brand-500 shadow-sm hover:shadow-md transition-shadow" data-eep-lightbox="<?php echo esc_url((string) $gallery_images_visible[1]); ?>" data-eep-gallery-index="1">
                                            <img src="<?php echo esc_url((string) $gallery_images_visible[1]); ?>" loading="lazy" class="w-full h-full object-cover transition-transform duration-500 md:group-hover:scale-105 block">
                                            <div class="absolute inset-0 bg-black/0 md:group-hover:bg-black/10 transition-colors flex items-center justify-center">
                                                <svg class="w-8 h-8 text-white opacity-0 md:group-hover:opacity-100 transition-opacity transform scale-50 md:group-hover:scale-100 duration-300 drop-shadow-md" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0zM10 7v3m0 0v3m0-3h3m-3 0H7"></path></svg>
                                            </div>
                                        </button>
                                    <?php endif; ?>
                                    <?php if (isset($gallery_images_visible[2])): ?>
                                        <button type="button" class="eep-gallery-item col-span-1 group relative rounded-xl overflow-hidden aspect-[4/3] bg-gray-100 border border-gray-200 flex outline-none cursor-pointer focus:ring-2 focus:ring-brand-500 shadow-sm hover:shadow-md transition-shadow" data-eep-lightbox="<?php echo esc_url((string) $gallery_images_visible[2]); ?>" data-eep-gallery-index="2">
                                            <img src="<?php echo esc_url((string) $gallery_images_visible[2]); ?>" loading="lazy" class="w-full h-full object-cover transition-transform duration-500 md:group-hover:scale-105 block">
                                            <div class="absolute inset-0 bg-black/0 md:group-hover:bg-black/10 transition-colors flex items-center justify-center">
                                                <svg class="w-8 h-8 text-white opacity-0 md:group-hover:opacity-100 transition-opacity transform scale-50 md:group-hover:scale-100 duration-300 drop-shadow-md" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0zM10 7v3m0 0v3m0-3h3m-3 0H7"></path></svg>
                                            </div>
                                        </button>
                                    <?php endif; ?>
                                    <?php if ($gallery_hidden_count > 0): ?>
                                        <button type="button" class="eep-gallery-item col-span-1 group relative rounded-xl overflow-hidden aspect-[4/3] border border-gray-200 flex flex-col items-center justify-center bg-gray-50 md:hover:bg-gray-100 transition-colors cursor-pointer outline-none focus:ring-2 focus:ring-brand-500 shadow-sm" data-eep-lightbox="<?php echo isset($gallery_images_all[3]) ? esc_url((string) $gallery_images_all[3]) : '#'; ?>" data-eep-gallery-index="3">
                                            <div class="w-10 h-10 rounded-full bg-brand-100 text-brand-600 flex items-center justify-center mb-2 md:group-hover:scale-110 transition-transform duration-300 shadow-sm">
                                                <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path></svg>
                                            </div>
                                            <span class="text-gray-600 font-semibold text-sm"><?php echo esc_html($gallery_hidden_count); ?> <?php esc_html_e('More', 'nexdirectory'); ?></span>
                                        </button>
                                    <?php endif; ?>
                                </div>
                            </div>
                            <div class="md:hidden flex overflow-x-auto snap-x snap-mandatory scrollbar-hide gap-4 pb-4 -mx-5 px-5" x-ref="mobSlider" @scroll.debounce.150ms="if ($refs.mobSlider.scrollLeft >= ($refs.mobSlider.scrollWidth - $refs.mobSlider.clientWidth - 10)) { setTimeout(() => { $refs.mobSlider.scrollTo({left: 0, behavior: 'smooth'}) }, 400); }" data-eep-gallery-items="<?php echo $gallery_items_json; ?>">
                                <?php foreach ($gallery_images_visible as $i => $img): ?>
                                    <button type="button" class="eep-gallery-item snap-center shrink-0 w-[85vw] relative rounded-xl overflow-hidden aspect-[4/3] bg-gray-100 border border-gray-200 outline-none shadow-sm" data-eep-lightbox="<?php echo esc_url((string) $img); ?>" data-eep-gallery-index="<?php echo $i; ?>">
                                        <img src="<?php echo esc_url((string) $img); ?>" loading="lazy" class="w-full h-full object-cover block">
                                    </button>
                                <?php endforeach; ?>
                                <?php if ($gallery_hidden_count > 0): ?>
                                    <button type="button" class="eep-gallery-item snap-center shrink-0 w-[85vw] relative rounded-xl overflow-hidden aspect-[4/3] border border-gray-200 flex flex-col items-center justify-center bg-gray-50 outline-none shadow-sm" data-eep-lightbox="<?php echo isset($gallery_images_all[3]) ? esc_url((string) $gallery_images_all[3]) : '#'; ?>" data-eep-gallery-index="3">
                                        <div class="w-12 h-12 rounded-full bg-brand-100 text-brand-600 flex items-center justify-center mb-2 shadow-sm">
                                            <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path></svg>
                                        </div>
                                        <span class="text-gray-600 font-semibold text-base"><?php echo esc_html($gallery_hidden_count); ?> <?php esc_html_e('More Images', 'nexdirectory'); ?></span>
                                    </button>
                                <?php endif; ?>
                                <div class="snap-center shrink-0 w-[1vw] opacity-0 pointer-events-none"></div>
                            </div>
                        <?php endif; ?>
                    </section>
                <?php endif; ?>
                
                <?php if (!empty($video_cards) && !$is_job_profile) : ?>
                    <section x-data="{ shown: false }" x-intersect.once="shown = true" :class="shown ? 'opacity-100 translate-y-0' : 'opacity-0 translate-y-8'" class="transition-all duration-700 ease-out delay-200 flex overflow-x-auto snap-x snap-mandatory scrollbar-hide gap-4 pb-2 sm:pb-0 sm:flex-col sm:gap-4 -mx-4 px-4 sm:mx-0 sm:px-0">
                        <?php foreach ($video_cards as $index => $video) : ?>
                            <?php
                            $embed_url = esc_url((string) ($video['embed_url'] ?? ''));
                            $video_url = esc_url((string) ($video['url'] ?? ''));
                            $thumb_url = esc_url((string) ($video['thumb'] ?? ''));
                            $video_title = sanitize_text_field((string) ($video['title'] ?? 'Video'));
                            ?>
                            <?php if ($embed_url !== '' || $video_url !== '') : ?>
                                <button type="button" class="snap-center shrink-0 w-[85vw] sm:w-full group cursor-pointer active:scale-[0.98] hover:shadow-md transition-all duration-300 text-left block p-0 bg-transparent border-none appearance-none outline-none focus:ring-2 focus:ring-brand-500 rounded-2xl" data-eep-video-embed="<?php echo esc_url($embed_url); ?>" data-eep-video-url="<?php echo esc_url($video_url); ?>" data-eep-video-title="<?php echo esc_attr($video_title); ?>" data-eep-video-index="<?php echo esc_attr((string) $index); ?>">
                                    <div class="relative w-full rounded-2xl overflow-hidden shadow-sm aspect-video bg-gray-900 flex border border-gray-100">
                                        <?php if ($thumb_url !== '') : ?>
                                            <img src="<?php echo esc_url($thumb_url); ?>" alt="<?php echo esc_attr($video_title); ?>" loading="lazy" class="w-full h-full object-cover opacity-80 transition-opacity md:group-hover:opacity-100 block">
                                        <?php else : ?>
                                            <div class="w-full h-full bg-gradient-to-br from-gray-700 to-gray-900 flex-1"></div>
                                        <?php endif; ?>
                                        <div class="absolute inset-0 flex items-center justify-center pointer-events-none">
                                            <div class="w-14 h-14 sm:w-16 sm:h-16 bg-brand-500/90 backdrop-blur-sm text-white rounded-full flex items-center justify-center shadow-lg transform transition-transform duration-300 md:group-hover:scale-110">
                                                <svg class="w-6 h-6 sm:w-8 sm:h-8 ml-1" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM9.555 7.168A1 1 0 008 8v4a1 1 0 001.555.832l3-2a1 1 0 000-1.664l-3-2z" clip-rule="evenodd"></path></svg>
                                            </div>
                                        </div>
                                        <div class="absolute top-3 left-3 sm:top-4 sm:left-4 pointer-events-none z-10">
                                            <span class="px-2.5 py-1 bg-black/60 text-white text-[10px] sm:text-xs font-bold uppercase tracking-wider rounded backdrop-blur-md"><?php echo esc_html('VIDEO ' . (string) ($index + 1)); ?></span>
                                        </div>
                                    </div>
                                </button>
                            <?php endif; ?>
                        <?php endforeach; ?>
                    </section>
                <?php endif; ?>

                <?php if (!empty($supporting_documents)) : ?>
                    <section x-data="{ shown: false, docExpanded: true }" x-intersect.once="shown = true" :class="shown ? 'opacity-100 translate-y-0' : 'opacity-0 translate-y-8'" class="transition-all duration-700 ease-out delay-200 bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden">
                        <button @click="docExpanded = !docExpanded" class="w-full border-b border-gray-100 px-5 sm:px-6 py-4 sm:py-5 bg-gray-50/50 flex items-center justify-between transition-colors hover:bg-gray-100/50 focus:outline-none">
                            <h2 class="text-lg sm:text-xl font-bold text-gray-900 flex items-center gap-2">
                                <svg class="w-5 h-5 text-brand-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
                                <?php echo esc_html($single_documents_heading); ?>
                            </h2>
                            <svg class="w-5 h-5 text-gray-400 transform transition-transform duration-300 md:hidden" :class="docExpanded ? 'rotate-180' : ''" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg>
                        </button>
                        <div x-show="docExpanded" x-collapse class="p-5 sm:p-6">
                            <div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
                                <?php foreach ((array) $supporting_documents as $doc_index => $doc) : ?>
                                    <?php 
                                    $doc_url_raw = (string) ($doc['url'] ?? '');
                                    $doc_url = esc_url($doc_url_raw);
                                    $doc_ext = strtoupper((string) ($doc['extension'] ?? 'FILE'));
                                    $badge_class = $doc_ext === 'PDF' ? 'bg-red-50 text-red-600' : 'bg-blue-50 text-blue-600';
                                    $doc_title = sanitize_text_field((string) ($doc['title'] ?? 'Document'));
                                    $doc_embed_url = esc_url((string) ($doc['embed_url'] ?? ''));
                                    if ($doc_embed_url === '' && $doc_url_raw !== '') {
                                        if (strtolower((string) $doc_ext) === 'pdf') {
                                            $doc_embed_url = esc_url($doc_url_raw);
                                        } else {
                                            $doc_embed_url = esc_url('https://docs.google.com/gview?embedded=1&url=' . rawurlencode($doc_url_raw));
                                        }
                                    }
                                    ?>
                                    <button type="button" class="border border-gray-200 rounded-xl p-4 flex flex-col justify-between active:scale-[0.98] active:bg-gray-50 md:hover:-translate-y-1 md:hover:shadow-md md:hover:border-brand-300 transition-all duration-300 group cursor-pointer bg-white text-left" data-eep-doc-url="<?php echo esc_url($doc_url); ?>" data-eep-doc-embed="<?php echo esc_url($doc_embed_url); ?>" data-eep-doc-title="<?php echo esc_attr($doc_title); ?>" data-eep-doc-index="<?php echo esc_attr((string) $doc_index); ?>">
                                        <div class="flex items-start justify-between mb-4">
                                            <div>
                                                <span class="inline-block px-2.5 py-1 <?php echo $badge_class; ?> text-[10px] font-bold uppercase tracking-wider rounded mb-2"><?php echo esc_html($doc_ext); ?></span>
                                                <h3 class="font-semibold text-gray-900 text-base"><?php echo esc_html($doc_title); ?></h3>
                                                <p class="text-xs text-gray-500 mt-0.5 truncate max-w-[150px]"><?php echo esc_html((string) ($doc['file_name'] ?? 'Document')); ?></p>
                                            </div>
                                            <div class="p-2.5 bg-gray-50 rounded-xl text-gray-400 md:group-hover:bg-brand-50 md:group-hover:text-brand-500 transition-colors">
                                                <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
                                            </div>
                                        </div>
                                        <span class="w-full py-2.5 px-4 bg-gray-50 md:hover:bg-brand-50 md:hover:text-brand-700 text-gray-700 text-sm font-medium rounded-lg transition-colors border border-gray-200 flex items-center justify-center gap-2">
                                            <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"></path></svg>
                                            <?php esc_html_e('Preview', 'nexdirectory'); ?>
                                        </span>
                                    </button>
                                <?php endforeach; ?>
                            </div>
                        </div>
                    </section>
                <?php endif; ?>

                <?php if ($map_link !== '') : ?>
                    <section x-data="{ shown: false }" x-intersect.once="shown = true" :class="shown ? 'opacity-100 translate-y-0' : 'opacity-0 translate-y-8'" class="transition-all duration-700 ease-out delay-300 bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden mb-6 sm:mb-0">
                        <div class="border-b border-gray-100 px-5 sm:px-6 py-4 sm:py-5 bg-gray-50/50">
                            <h2 class="text-lg sm:text-xl font-bold text-gray-900 flex items-center gap-2">
                                <svg class="w-5 h-5 text-brand-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"></path><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z"></path></svg>
                                <?php echo esc_html($single_location_heading); ?>
                            </h2>
                        </div>
                        <div class="p-5 sm:p-6">
                            <?php if (!empty($map_embed_url)) : ?>
                                <div class="rounded-xl overflow-hidden border border-gray-200 mb-5 relative h-48 sm:h-64 bg-gray-100 cursor-pointer flex group active:scale-[0.98] transition-transform duration-300" @click.prevent="showMapModal = true">
                                    <iframe loading="lazy" src="<?php echo esc_url((string) $map_embed_url); ?>" allowfullscreen class="w-full h-full border-0 pointer-events-none block group-hover:opacity-90 transition-opacity"></iframe>
                                    <div class="absolute inset-0 flex items-center justify-center pointer-events-none">
                                        <div class="bg-white/95 backdrop-blur text-gray-900 font-bold px-4 py-2 rounded-lg shadow-md text-sm transform transition-transform group-hover:scale-105">Click to expand</div>
                                    </div>
                                </div>
                            <?php endif; ?>
                            
                            <div class="flex flex-col sm:flex-row sm:items-center justify-between gap-4">
                                <div>
                                    <h3 class="font-bold text-gray-900 text-base sm:text-lg mb-1"><?php echo esc_html((string) $venue_label); ?></h3>
                                    <?php if ($location_full !== '') : ?>
                                        <p class="text-gray-500 text-sm"><?php echo esc_html((string) $location_full); ?></p>
                                    <?php endif; ?>
                                </div>
                                <button type="button" @click.prevent="showMapModal = true" class="w-full sm:w-auto px-6 py-3 sm:py-2.5 bg-gray-900 hover:bg-gray-800 active:scale-95 text-white text-sm font-medium rounded-xl sm:rounded-lg transition-all duration-200 shadow-sm hover:shadow whitespace-nowrap text-center">
                                    <?php echo esc_html($single_open_map_cta); ?>
                                </button>
                            </div>
                        </div>
                    </section>
                <?php endif; ?>
            </div>

            <div class="<?php echo esc_attr((string) $page_template['aside']); ?>">
                <div class="<?php echo esc_attr((string) $page_template['aside_inner']); ?>">
                    
                    <div x-data="{ shown: false }" x-intersect.once="shown = true" :class="shown ? 'opacity-100 translate-x-0' : 'opacity-0 translate-x-8'" class="hidden md:block bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden relative transition-all duration-700 ease-out">
                        <div class="h-2 w-full bg-brand-500"></div>
                        <div class="p-6">
                            <h3 class="text-xl font-bold text-gray-900 mb-2"><?php echo esc_html($single_cta_heading); ?></h3>
                            <p class="text-sm text-gray-500 mb-5"><?php echo esc_html($single_cta_copy); ?></p>
                            
                            <div class="space-y-3">
                                <?php if ($show_edit_event_button) : ?>
                                    <a href="<?php echo esc_url((string) $edit_event_url); ?>" class="w-full flex items-center justify-center gap-2 py-2.5 px-4 bg-brand-600 hover:bg-brand-700 active:bg-brand-800 active:scale-95 text-white text-sm font-semibold rounded-xl transition-all shadow-sm">
                                        <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L12.828 14H9v-3.828l8.586-8.586z"></path></svg>
                                        <?php echo esc_html((string) $edit_event_button_label); ?>
                                    </a>
                                <?php endif; ?>

                                <?php if ($show_ticket_cta) : ?>
                                    <div class="bg-gray-50 border border-gray-100 rounded-xl p-4 mb-1">
                                        <div class="flex items-center justify-between mb-3">
                                            <span class="font-bold text-gray-900 text-sm"><?php esc_html_e('Ticket Access', 'nexdirectory'); ?></span>
                                            <?php if ($ticket_price_display !== '') : ?>
                                                <span class="bg-brand-100 text-brand-700 text-[11px] font-bold px-2 py-1 rounded-full shadow-sm">
                                                    <?php echo esc_html($ticket_price_display); ?>
                                                </span>
                                            <?php endif; ?>
                                        </div>

                                        <?php if ($viewer_logged_in) : ?>
                                            <button type="button" @click.prevent.stop="ticketCheckoutModalOpen = true" class="w-full flex items-center justify-center gap-2 py-2.5 px-4 bg-brand-600 hover:bg-brand-700 active:bg-brand-800 active:scale-95 text-white text-sm font-semibold rounded-lg transition-all shadow-sm">
                                                <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"></path></svg>
                                                <span><?php echo esc_html((string) $ticket_button_label); ?></span>
                                            </button>
                                        <?php else : ?>
                                            <button type="button" @click.prevent.stop="ticketCheckoutModalOpen = true" class="w-full flex items-center justify-center gap-2 py-2.5 px-4 bg-brand-600 hover:bg-brand-700 active:bg-brand-800 active:scale-95 text-white text-sm font-semibold rounded-lg transition-all shadow-sm">
                                                <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"></path></svg>
                                                <span><?php echo esc_html((string) $ticket_button_label); ?></span>
                                            </button>
                                            <p class="text-[11px] text-gray-500 mt-2">
                                                <?php esc_html_e('Sign in, create an account, or continue as guest via email verification.', 'nexdirectory'); ?>
                                            </p>
                                        <?php endif; ?>
                                    </div>
                                <?php elseif ($show_rsvp_actions) : ?>
                                    <div class="bg-gray-50 border border-gray-100 rounded-xl p-4 mb-1">
                                        <div class="flex items-center justify-between mb-3">
                                            <span class="font-bold text-gray-900 text-sm">Attend this event</span>
                                            <span class="eep-rsvp-meta bg-brand-100 text-brand-700 text-[11px] font-bold px-2 py-1 rounded-full flex items-center gap-1 shadow-sm <?php echo ($rsvp_count <= 0 && $waitlist_count <= 0) ? 'hidden' : ''; ?>"
                                                  data-post-id="<?php echo esc_attr((string) $post_id); ?>"
                                                  data-primary-label="<?php echo esc_attr($is_events_profile ? __('RSVP', 'nexdirectory') : __('Saved', 'nexdirectory')); ?>"
                                                  data-secondary-label="<?php echo esc_attr($is_events_profile ? __('Waitlist', 'nexdirectory') : ''); ?>">
                                                    <svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"></path></svg>
                                                    <span>
                                                        <?php
                                                        if ($is_events_profile) {
                                                            echo esc_html(sprintf(__('RSVP: %1$d | Waitlist: %2$d', 'nexdirectory'), (int) $rsvp_count, (int) $waitlist_count));
                                                        } else {
                                                            echo esc_html(sprintf(__('Saved: %d', 'nexdirectory'), (int) $rsvp_count));
                                                        }
                                                        ?>
                                                    </span>
                                            </span>
                                        </div>
                                        
                                        <?php if ($viewer_logged_in) : ?>
                                            <form method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>" class="eep-rsvp-form" data-eep-rsvp-post-id="<?php echo esc_attr((string) $post_id); ?>">
                                                <input type="hidden" name="action" value="eep_rsvp_event">
                                                <input type="hidden" name="post_id" value="<?php echo esc_attr((string) $post_id); ?>">
                                                <input type="hidden" name="intent" value="<?php echo esc_attr((string) $rsvp_intent); ?>">
                                                <?php echo $rsvp_nonce_html; // phpcs:ignore ?>
                                                <button type="submit" class="w-full flex items-center justify-center gap-2 py-2.5 px-4 bg-brand-600 hover:bg-brand-700 active:bg-brand-800 active:scale-95 text-white text-sm font-semibold rounded-lg transition-all shadow-sm">
                                                    <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path></svg>
                                                    <span data-eep-rsvp-label="1"><?php echo esc_html((string) $rsvp_button_label); ?></span>
                                                </button>
                                            </form>
                                        <?php else : ?>
                                            <a href="<?php echo esc_url((string) $login_url); ?>" class="w-full flex items-center justify-center gap-2 py-2.5 px-4 bg-brand-600 hover:bg-brand-700 active:bg-brand-800 active:scale-95 text-white text-sm font-semibold rounded-lg transition-all shadow-sm">
                                                <?php echo esc_html($single_login_rsvp); ?>
                                            </a>
                                        <?php endif; ?>
                                    </div>
                                <?php endif; ?>

                                <?php if ($has_calendar_actions && $calendar_primary_url !== '') : ?>
                                    <a href="<?php echo esc_url($calendar_primary_url); ?>" target="_blank" rel="noopener noreferrer nofollow ugc" class="w-full flex items-center justify-center gap-2 py-2.5 px-4 bg-white hover:bg-gray-50 border border-gray-200 text-gray-700 active:scale-95 text-sm font-semibold rounded-xl transition-all shadow-sm">
                                        <svg class="w-5 h-5 text-gray-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path></svg>
                                        <?php esc_html_e('Add to Calendar', 'nexdirectory'); ?>
                                    </a>
                                <?php endif; ?>

                                <?php if ($event_webapp_download_visible) : ?>
                                    <a href="<?php echo esc_url((string) $event_webapp_url); ?>" class="w-full flex items-center justify-center gap-2 py-2.5 px-4 bg-brand-50 hover:bg-brand-100 border border-brand-200 text-brand-700 active:scale-95 text-sm font-semibold rounded-xl transition-all shadow-sm">
                                        <svg class="w-5 h-5 text-brand-600" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.75 3.75h4.5A2.25 2.25 0 0116.5 6v12a2.25 2.25 0 01-2.25 2.25h-4.5A2.25 2.25 0 017.5 18V6a2.25 2.25 0 012.25-2.25zM10 17h4"></path></svg>
                                        <?php echo esc_html($single_open_event_app_cta); ?>
                                    </a>
                                <?php endif; ?>

                                <div class="<?php echo $has_message_button ? 'grid grid-cols-2 gap-3' : 'grid grid-cols-1 gap-3'; ?>">
                                    <?php if ($has_primary_action || $external_url !== '') : ?>
                                        <a target="_blank" rel="noopener noreferrer nofollow ugc" href="<?php echo esc_url($has_primary_action ? $primary_action_url : $external_url); ?>" class="flex items-center justify-center gap-2 py-2.5 px-4 bg-gray-900 hover:bg-black active:scale-95 text-white text-sm font-semibold rounded-xl transition-all shadow-sm">
                                            <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"></path></svg>
                                            <?php echo esc_html($has_primary_action ? $primary_action_label : $single_visit_site_cta); ?>
                                        </a>
                                    <?php endif; ?>
                                    
                                    <?php if ($message_button_mode === 'modal') : ?>
                                        <button type="button" @click.prevent.stop="messageModalOpen = true" class="flex items-center justify-center gap-2 py-2.5 px-4 bg-white hover:bg-brand-50 hover:text-brand-700 hover:border-brand-200 border border-gray-200 text-gray-700 text-sm font-semibold rounded-xl active:scale-95 transition-all shadow-sm">
                                            <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"></path></svg>
                                            <?php echo esc_html((string) $message_button_label); ?>
                                        </button>
                                    <?php elseif ($message_button_mode === 'link' && $message_button_url !== '') : ?>
                                        <a href="<?php echo esc_url((string) $message_button_url); ?>" <?php if ($message_button_target !== '') : ?>target="<?php echo esc_attr((string) $message_button_target); ?>"<?php endif; ?> class="flex items-center justify-center gap-2 py-2.5 px-4 bg-white hover:bg-brand-50 hover:text-brand-700 hover:border-brand-200 border border-gray-200 text-gray-700 text-sm font-semibold rounded-xl active:scale-95 transition-all shadow-sm">
                                            <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"></path></svg>
                                            <?php echo esc_html((string) $message_button_label); ?>
                                        </a>
                                    <?php endif; ?>
                                </div>
                            </div>
                        </div>
                    </div>

                    <?php if ($show_organizer_card) : ?>
                    <div x-data="{ shown: false }" x-intersect.once="shown = true" :class="shown ? 'opacity-100 translate-x-0' : 'opacity-0 translate-x-8'" class="bg-white rounded-2xl shadow-sm border border-gray-100 p-5 sm:p-6 transition-all duration-700 ease-out delay-100">
                        <div class="flex items-center gap-4 mb-6 group cursor-pointer" onclick="window.location.href='<?php echo esc_url((string) $organizer_events_url); ?>'">
                            <div class="w-14 h-14 rounded-full border-2 border-brand-100 bg-brand-500 flex items-center justify-center text-white font-bold text-xl group-hover:scale-105 transition-transform duration-300 shadow-sm">
                                <?php echo esc_html((string) $owner_initials); ?>
                            </div>
                            <div>
                                <p class="text-[10px] sm:text-xs font-semibold text-brand-500 uppercase tracking-wider mb-0.5"><?php echo esc_html($owner_heading); ?></p>
                                <h4 class="text-base sm:text-lg font-bold text-gray-900 leading-tight group-hover:text-brand-600 transition-colors"><?php echo esc_html((string) ($owner_display_name !== '' ? $owner_display_name : __('Listing Owner', 'nexdirectory'))); ?></h4>
                                <span class="text-sm text-gray-500 group-hover:text-brand-600 transition-colors py-1 block"><?php echo esc_html($single_owner_items_cta); ?> →</span>
                            </div>
                        </div>

                        <?php if ($has_share_actions) : ?>
                            <div class="mb-5">
                                <p class="text-[11px] font-semibold uppercase tracking-wider text-gray-500 mb-3"><?php esc_html_e('Share & Connect', 'nexdirectory'); ?></p>
                                <div class="flex gap-3">
                                    <?php if ($share_facebook_url !== '') : ?>
                                        <a href="<?php echo esc_url($share_facebook_url); ?>" target="_blank" rel="noopener noreferrer nofollow ugc" class="w-10 h-10 flex items-center justify-center bg-gray-100 hover:bg-[#1877F2] text-gray-500 hover:text-white rounded-full transition-all duration-200 hover:scale-110 shadow-sm">
                                            <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"><path d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.469h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.469h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"/></svg>
                                        </a>
                                    <?php endif; ?>
                                    <?php if ($share_x_url !== '') : ?>
                                        <a href="<?php echo esc_url($share_x_url); ?>" target="_blank" rel="noopener noreferrer nofollow ugc" class="w-10 h-10 flex items-center justify-center bg-gray-100 hover:bg-black text-gray-500 hover:text-white rounded-full transition-all duration-200 hover:scale-110 shadow-sm">
                                            <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg>
                                        </a>
                                    <?php endif; ?>
                                    <?php if ($share_linkedin_url !== '') : ?>
                                        <a href="<?php echo esc_url($share_linkedin_url); ?>" target="_blank" rel="noopener noreferrer nofollow ugc" class="w-10 h-10 flex items-center justify-center bg-gray-100 hover:bg-[#0A66C2] text-gray-500 hover:text-white rounded-full transition-all duration-200 hover:scale-110 shadow-sm">
                                            <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"><path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"/></svg>
                                        </a>
                                    <?php endif; ?>
                                    <?php if ($share_whatsapp_url !== '') : ?>
                                        <a href="<?php echo esc_url($share_whatsapp_url); ?>" target="_blank" rel="noopener noreferrer nofollow ugc" class="w-10 h-10 flex items-center justify-center bg-gray-100 hover:bg-[#25D366] text-gray-500 hover:text-white rounded-full transition-all duration-200 hover:scale-110 shadow-sm">
                                            <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"><path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51a12.8 12.8 0 0 0-.57-.01c-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 0 1-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 0 1-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 0 1 2.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0 0 12.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 0 0 5.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 0 0-3.48-8.413Z"/></svg>
                                        </a>
                                    <?php endif; ?>
                                </div>
                            </div>
                        <?php endif; ?>

                        <?php if ($claimable && $claim_url !== '') : ?>
                            <div class="mb-4">
                                <?php if ($claim_status === 'pending') : ?>
                                    <span class="inline-flex w-full items-center justify-center gap-2 rounded-xl border border-amber-200 bg-amber-50 px-4 py-2.5 text-sm font-semibold text-amber-700">
                                        <svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
                                        <?php esc_html_e('Claim Pending Review', 'nexdirectory'); ?>
                                    </span>
                                <?php elseif ($claim_status === 'approved') : ?>
                                    <span class="inline-flex w-full items-center justify-center gap-2 rounded-xl border border-green-200 bg-green-50 px-4 py-2.5 text-sm font-semibold text-green-700">
                                        <svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path></svg>
                                        <?php esc_html_e('Claim Approved', 'nexdirectory'); ?>
                                    </span>
                                <?php else : ?>
                                    <a href="<?php echo esc_url($claim_url); ?>" class="inline-flex w-full items-center justify-center gap-2 rounded-xl border border-brand-200 bg-brand-50 px-4 py-2.5 text-sm font-semibold text-brand-700 hover:bg-brand-100 transition-colors">
                                        <svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7h8m-8 4h8m-8 4h5M5 4h14a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V6a2 2 0 012-2z"></path></svg>
                                        <?php esc_html_e('Claim Listing', 'nexdirectory'); ?>
                                    </a>
                                <?php endif; ?>
                            </div>
                        <?php endif; ?>
                        
                        <?php if (!empty($reporting_enabled)) : ?>
                            <div class="text-left" x-data="{ reportOpen: false }">
                                <button @click="reportOpen = !reportOpen" class="text-xs sm:text-sm font-medium text-gray-400 hover:text-red-500 transition-colors inline-flex items-center gap-1.5 py-2">
                                    <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 21v-4m0 0V5a2 2 0 012-2h6.5l1 1H21l-3 6 3 6h-8.5l-1-1H5a2 2 0 00-2 2zm9-13.5V9"></path></svg>
                                    <?php echo esc_html($single_report_cta); ?>
                                </button>
                                <div x-show="reportOpen" x-collapse class="pt-3">
                                    <?php if (is_user_logged_in()) : ?>
                                        <form method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>" class="space-y-3">
                                            <input type="hidden" name="action" value="eep_report_event">
                                            <input type="hidden" name="post_id" value="<?php echo esc_attr((string) $post_id); ?>">
                                            <?php echo $report_nonce_html; // phpcs:ignore ?>
                                            <textarea name="reason" rows="3" required placeholder="<?php echo esc_attr($single_report_placeholder); ?>" class="w-full px-4 py-3 sm:py-2.5 rounded-xl border border-gray-200 text-sm focus:ring-2 focus:ring-red-500 focus:border-red-500 outline-none"></textarea>
                                            <button type="submit" class="w-full py-2.5 px-4 bg-gray-900 hover:bg-red-600 active:scale-95 text-white text-sm font-semibold rounded-lg transition-all duration-200 shadow-sm"><?php esc_html_e('Send Report', 'nexdirectory'); ?></button>
                                        </form>
                                    <?php else : ?>
                                        <p class="text-sm font-medium text-gray-500 text-center"><a href="<?php echo esc_url((string) $login_url); ?>" class="text-brand-500 hover:text-brand-600 font-bold transition-colors"><?php echo esc_html(sprintf(__('Log in to report this %s.', 'nexdirectory'), strtolower((string) $singular_label))); ?></a></p>
                                    <?php endif; ?>
                                </div>
                            </div>
                        <?php endif; ?>
                    </div>
                    <?php endif; ?>

                    <?php if ($has_share_actions && !$show_organizer_card) : ?>
                    <div x-data="{ shown: false }" x-intersect.once="shown = true" :class="shown ? 'opacity-100 translate-x-0' : 'opacity-0 translate-x-8'" class="bg-white rounded-2xl shadow-sm border border-gray-100 p-5 sm:p-6 transition-all duration-700 ease-out delay-150">
                        <p class="text-[11px] font-semibold uppercase tracking-wider text-gray-500 mb-3"><?php esc_html_e('Share & Connect', 'nexdirectory'); ?></p>
                        <div class="flex gap-3">
                            <?php if ($share_facebook_url !== '') : ?>
                                <a href="<?php echo esc_url($share_facebook_url); ?>" target="_blank" rel="noopener noreferrer nofollow ugc" class="w-10 h-10 flex items-center justify-center bg-gray-100 hover:bg-[#1877F2] text-gray-500 hover:text-white rounded-full transition-all duration-200 hover:scale-110 shadow-sm">
                                    <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"><path d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.469h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.469h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"/></svg>
                                </a>
                            <?php endif; ?>
                            <?php if ($share_x_url !== '') : ?>
                                <a href="<?php echo esc_url($share_x_url); ?>" target="_blank" rel="noopener noreferrer nofollow ugc" class="w-10 h-10 flex items-center justify-center bg-gray-100 hover:bg-black text-gray-500 hover:text-white rounded-full transition-all duration-200 hover:scale-110 shadow-sm">
                                    <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg>
                                </a>
                            <?php endif; ?>
                            <?php if ($share_linkedin_url !== '') : ?>
                                <a href="<?php echo esc_url($share_linkedin_url); ?>" target="_blank" rel="noopener noreferrer nofollow ugc" class="w-10 h-10 flex items-center justify-center bg-gray-100 hover:bg-[#0A66C2] text-gray-500 hover:text-white rounded-full transition-all duration-200 hover:scale-110 shadow-sm">
                                    <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"><path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"/></svg>
                                </a>
                            <?php endif; ?>
                            <?php if ($share_whatsapp_url !== '') : ?>
                                <a href="<?php echo esc_url($share_whatsapp_url); ?>" target="_blank" rel="noopener noreferrer nofollow ugc" class="w-10 h-10 flex items-center justify-center bg-gray-100 hover:bg-[#25D366] text-gray-500 hover:text-white rounded-full transition-all duration-200 hover:scale-110 shadow-sm">
                                    <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"><path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51a12.8 12.8 0 0 0-.57-.01c-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 0 1-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 0 1-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 0 1 2.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0 0 12.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 0 0 5.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 0 0-3.48-8.413Z"/></svg>
                                </a>
                            <?php endif; ?>
                        </div>
                    </div>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </main>

    <div class="fixed bottom-0 left-0 right-0 bg-white/95 backdrop-blur-md border-t border-gray-200 p-3 sm:p-4 flex gap-2 z-40 md:hidden pb-safe shadow-[0_-4px_6px_-1px_rgba(0,0,0,0.05)] transition-transform">
        <?php if ($show_ticket_cta) : ?>
            <button type="button" @click.prevent.stop="ticketCheckoutModalOpen = true" class="flex-1 w-full flex items-center justify-center gap-1.5 bg-brand-600 active:bg-brand-700 active:scale-95 text-white font-bold text-sm rounded-xl py-3.5 transition-all duration-200 shadow-sm">
                <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"></path></svg>
                <span><?php echo esc_html((string) $ticket_button_label); ?></span>
            </button>
        <?php elseif ($show_rsvp_actions) : ?>
            <?php if ($viewer_logged_in) : ?>
                <form method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>" class="flex-1 m-0 eep-rsvp-form" data-eep-rsvp-post-id="<?php echo esc_attr((string) $post_id); ?>">
                    <input type="hidden" name="action" value="eep_rsvp_event">
                    <input type="hidden" name="post_id" value="<?php echo esc_attr((string) $post_id); ?>">
                    <input type="hidden" name="intent" value="<?php echo esc_attr((string) $rsvp_intent); ?>">
                    <?php echo $rsvp_nonce_html; // phpcs:ignore ?>
                    <button type="submit" class="w-full flex items-center justify-center gap-1.5 bg-brand-600 active:bg-brand-700 active:scale-95 text-white font-bold text-sm rounded-xl py-3.5 transition-all duration-200 shadow-sm">
                        <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path></svg>
                        <span data-eep-rsvp-label="1"><?php echo esc_html((string) $rsvp_button_label); ?></span>
                    </button>
                </form>
            <?php else : ?>
                <a href="<?php echo esc_url((string) $login_url); ?>" class="flex-1 flex items-center justify-center gap-1.5 bg-brand-600 active:bg-brand-700 active:scale-95 text-white font-bold text-sm rounded-xl py-3.5 transition-all duration-200 shadow-sm">
                    <?php echo esc_html($single_login_rsvp); ?>
                </a>
            <?php endif; ?>
        <?php endif; ?>

        <?php if ($event_webapp_download_visible) : ?>
            <a href="<?php echo esc_url((string) $event_webapp_url); ?>" class="flex items-center justify-center w-12 bg-brand-50 border border-brand-200 active:bg-brand-100 active:scale-95 text-brand-700 font-bold rounded-xl py-3.5 transition-all duration-200 shadow-sm" aria-label="<?php echo esc_attr($single_open_event_app_cta); ?>">
                <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.75 3.75h4.5A2.25 2.25 0 0116.5 6v12a2.25 2.25 0 01-2.25 2.25h-4.5A2.25 2.25 0 017.5 18V6a2.25 2.25 0 012.25-2.25zM10 17h4"></path></svg>
            </a>
        <?php endif; ?>

        <?php if ($message_button_mode === 'modal') : ?>
            <button type="button" @click.prevent.stop="messageModalOpen = true" class="flex items-center justify-center w-12 bg-gray-100 active:bg-gray-200 active:scale-95 text-gray-700 font-bold rounded-xl py-3.5 transition-all duration-200 shadow-sm">
                <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"></path></svg>
            </button>
        <?php elseif ($message_button_mode === 'link' && $message_button_url !== '') : ?>
            <a href="<?php echo esc_url((string) $message_button_url); ?>" <?php if ($message_button_target !== '') : ?>target="<?php echo esc_attr((string) $message_button_target); ?>"<?php endif; ?> class="flex items-center justify-center w-12 bg-gray-100 active:bg-gray-200 active:scale-95 text-gray-700 font-bold rounded-xl py-3.5 transition-all duration-200 shadow-sm">
                <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"></path></svg>
            </a>
        <?php endif; ?>

        <?php if ($has_primary_action || $external_url !== '') : ?>
            <a href="<?php echo esc_url($has_primary_action ? $primary_action_url : $external_url); ?>" target="_blank" rel="noopener noreferrer" class="<?php echo $has_message_button ? 'flex items-center justify-center w-12 bg-gray-900 active:bg-black active:scale-95 text-white font-bold rounded-xl py-3.5 transition-all duration-200 shadow-sm' : 'flex-1 flex items-center justify-center gap-2 bg-gray-900 active:bg-black active:scale-95 text-white font-bold rounded-xl py-3.5 px-4 transition-all duration-200 shadow-sm'; ?>">
                <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path></svg>
                <?php if (!$has_message_button) : ?>
                    <span><?php echo esc_html($has_primary_action ? $primary_action_label : $single_visit_site_cta); ?></span>
                <?php endif; ?>
            </a>
        <?php endif; ?>
    </div>

    <?php if ($hero_calendar_interactive) : ?>
    <div x-show="showCalendarModal" style="display: none;" class="fixed inset-0 z-[101] flex items-center justify-center p-4 sm:p-6">
        <div x-show="showCalendarModal" x-transition.opacity class="absolute inset-0 bg-gray-900/75 backdrop-blur-sm" @click="showCalendarModal = false"></div>
        <div x-show="showCalendarModal"
             x-transition:enter="transition ease-out duration-250"
             x-transition:enter-start="opacity-0 translate-y-4 scale-95"
             x-transition:enter-end="opacity-100 translate-y-0 scale-100"
             x-transition:leave="transition ease-in duration-200"
             x-transition:leave-start="opacity-100 translate-y-0 scale-100"
             x-transition:leave-end="opacity-0 translate-y-3 scale-95"
             class="relative w-full max-w-md bg-white rounded-2xl shadow-2xl border border-gray-100 overflow-hidden">
            <div class="flex items-center justify-between px-5 py-4 border-b border-gray-100 bg-gray-50">
                <h3 class="text-base sm:text-lg font-bold text-gray-900"><?php esc_html_e('Add to Calendar', 'nexdirectory'); ?></h3>
                <button type="button" @click="showCalendarModal = false" class="p-2 rounded-lg bg-white border border-gray-200 text-gray-500 hover:text-gray-900 hover:bg-gray-50 transition-colors">
                    <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg>
                </button>
            </div>
            <div class="p-5 space-y-3">
                <a href="<?php echo esc_url((string) $calendar_primary_url); ?>" target="_blank" rel="noopener noreferrer nofollow ugc" class="w-full flex items-center justify-center gap-2 py-3 px-4 bg-brand-600 hover:bg-brand-700 active:scale-95 text-white text-sm font-semibold rounded-xl transition-all shadow-sm">
                    <svg class="w-5 h-5 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path></svg>
                    <?php echo esc_html((string) $calendar_primary_label); ?>
                </a>
                <?php if ($calendar_secondary_url !== '') : ?>
                    <a href="<?php echo esc_url((string) $calendar_secondary_url); ?>" target="_blank" rel="noopener noreferrer nofollow ugc" class="w-full flex items-center justify-center gap-2 py-3 px-4 bg-white hover:bg-gray-50 border border-gray-200 text-gray-700 active:scale-95 text-sm font-semibold rounded-xl transition-all shadow-sm">
                        <svg class="w-5 h-5 text-gray-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path></svg>
                        <?php echo esc_html((string) $calendar_secondary_label); ?>
                    </a>
                <?php endif; ?>
            </div>
        </div>
    </div>
    <?php endif; ?>

    <?php if ($map_link !== '' && !empty($map_embed_url)) : ?>
    <div x-show="showMapModal" style="display: none;" class="fixed inset-0 z-[100] flex items-center justify-center p-4 sm:p-6">
        <div x-show="showMapModal" x-transition.opacity class="absolute inset-0 bg-gray-900/80 backdrop-blur-sm" @click="showMapModal = false"></div>
        <div x-show="showMapModal" 
             x-transition:enter="transition ease-out duration-300" 
             x-transition:enter-start="opacity-0 scale-95" 
             x-transition:enter-end="opacity-100 scale-100"
             x-transition:leave="transition ease-in duration-200"
             x-transition:leave-start="opacity-100 scale-100"
             x-transition:leave-end="opacity-0 scale-95"
             class="relative w-full max-w-4xl h-[70vh] bg-white rounded-2xl shadow-2xl overflow-hidden flex flex-col">
            
            <div class="flex items-center justify-between p-4 border-b border-gray-100 absolute top-0 left-0 right-0 bg-white/95 backdrop-blur z-10">
                <h3 class="text-base font-bold text-gray-900 px-2 truncate"><?php echo esc_html((string) $venue_label); ?></h3>
                <div class="flex items-center gap-3 shrink-0">
                    <a target="_blank" rel="noopener noreferrer nofollow ugc" href="<?php echo esc_url((string) $map_link); ?>" class="hidden sm:inline-block text-xs font-bold text-brand-600 hover:text-brand-700 bg-brand-50 hover:bg-brand-100 px-4 py-2 rounded-lg transition-colors">Open in Google Maps</a>
                    <button type="button" @click="showMapModal = false" class="text-gray-400 hover:text-gray-900 transition-colors p-2 bg-gray-100 hover:bg-gray-200 rounded-lg">
                        <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg>
                    </button>
                </div>
            </div>
            
            <iframe :src="showMapModal ? '<?php echo esc_url((string) $map_embed_url); ?>' : ''" class="w-full h-full border-0 pt-[60px] block"></iframe>
        </div>
    </div>
    <?php endif; ?>

    <?php if ($show_timeline && !empty($sessions_grouped)) : ?>
    <div x-show="showItineraryModal" style="display: none;" class="fixed inset-0 z-[106] flex items-center justify-center p-4 sm:p-6">
        <div x-show="showItineraryModal" x-transition.opacity class="absolute inset-0 bg-gray-900/80 backdrop-blur-sm" @click="showItineraryModal = false"></div>
        <div x-show="showItineraryModal"
             x-transition:enter="transition ease-out duration-300"
             x-transition:enter-start="opacity-0 translate-y-4 scale-95"
             x-transition:enter-end="opacity-100 translate-y-0 scale-100"
             x-transition:leave="transition ease-in duration-200"
             x-transition:leave-start="opacity-100 translate-y-0 scale-100"
             x-transition:leave-end="opacity-0 translate-y-3 scale-95"
             class="relative w-full max-w-4xl max-h-[85vh] bg-white rounded-2xl shadow-2xl border border-gray-100 overflow-hidden flex flex-col">
            <div class="flex items-center justify-between px-5 py-4 border-b border-gray-100 bg-gray-50">
                <h3 class="text-base sm:text-lg font-bold text-gray-900"><?php esc_html_e('Full Itinerary', 'nexdirectory'); ?></h3>
                <button type="button" @click="showItineraryModal = false" class="p-2 rounded-lg bg-white border border-gray-200 text-gray-500 hover:text-gray-900 hover:bg-gray-50 transition-colors">
                    <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg>
                </button>
            </div>
            <div class="p-5 sm:p-6 overflow-y-auto space-y-5">
                <?php foreach ($sessions_grouped as $day_group_index => $day_group) : ?>
                    <?php
                    $day_key = sanitize_text_field((string) ($day_group['day_key'] ?? ('day-' . ((int) $day_group_index + 1))));
                    $day_label = sanitize_text_field((string) ($day_group['day_label'] ?? __('Schedule', 'nexdirectory')));
                    $day_sessions = isset($day_group['sessions']) && is_array($day_group['sessions']) ? array_values($day_group['sessions']) : [];
                    ?>
                    <div x-show="itineraryModalDay === '<?php echo esc_js($day_key); ?>'" style="display: none;">
                        <h4 class="text-base sm:text-lg font-bold text-gray-900 mb-4"><?php echo esc_html($day_label); ?></h4>
                        <div class="space-y-4">
                            <?php foreach ($day_sessions as $session_index => $session_row) : ?>
                                <?php
                                $session_title = sanitize_text_field((string) ($session_row['title'] ?? ''));
                                if ($session_title === '') {
                                    $session_title = sprintf(__('Session %d', 'nexdirectory'), ((int) $session_index) + 1);
                                }
                                $session_uid = sanitize_key((string) ($session_row['session_uid'] ?? ''));
                                $session_time = sanitize_text_field((string) ($session_row['time'] ?? ''));
                                $session_location = sanitize_text_field((string) ($session_row['location'] ?? ''));
                                $session_speaker = sanitize_text_field((string) ($session_row['speaker'] ?? ''));
                                $session_attachments = isset($session_row['attachments']) && is_array($session_row['attachments']) ? array_values(array_filter(array_map('esc_url', $session_row['attachments']))) : [];
                                ?>
                                <article :class="isItinerarySaved('<?php echo esc_js($session_uid); ?>') ? 'border-l-4 border-l-green-500 border-green-100 bg-green-50/40' : 'border-gray-200 bg-gray-50/60'" class="rounded-xl border p-4 sm:p-5">
                                    <div class="flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3">
                                        <h5 class="text-base font-bold text-gray-900"><?php echo esc_html($session_title); ?></h5>
                                        <div class="flex flex-wrap items-center gap-2">
                                            <?php if ($viewer_logged_in) : ?>
                                                <button type="button" @click.prevent.stop="toggleItinerarySave('<?php echo esc_js($session_uid); ?>')" :class="isItinerarySaved('<?php echo esc_js($session_uid); ?>') ? 'bg-green-50 text-green-700 border-green-200' : 'bg-white text-gray-700 border-gray-300'" class="inline-flex items-center gap-1 px-3 py-1.5 rounded-md text-xs font-semibold border transition-colors">
                                                    <span x-show="!isItinerarySaved('<?php echo esc_js($session_uid); ?>')"><?php esc_html_e('Add to list', 'nexdirectory'); ?></span>
                                                    <span x-show="isItinerarySaved('<?php echo esc_js($session_uid); ?>')" style="display:none;"><?php esc_html_e('Saved', 'nexdirectory'); ?></span>
                                                </button>
                                                <button type="button" @click="openItineraryNoteModal('<?php echo esc_js($session_uid); ?>')" :class="hasItineraryNote('<?php echo esc_js($session_uid); ?>') ? 'bg-amber-50 text-amber-700 border-amber-200' : 'bg-white text-gray-700 border-gray-300'" class="inline-flex items-center gap-1 px-3 py-1.5 rounded-md text-xs font-semibold border transition-colors">
                                                    <span x-show="!hasItineraryNote('<?php echo esc_js($session_uid); ?>')"><?php esc_html_e('Add note', 'nexdirectory'); ?></span>
                                                    <span x-show="hasItineraryNote('<?php echo esc_js($session_uid); ?>')" style="display:none;"><?php esc_html_e('Edit note', 'nexdirectory'); ?></span>
                                                </button>
                                            <?php else : ?>
                                                <a href="<?php echo esc_url($login_url); ?>" class="inline-flex items-center gap-1 px-3 py-1.5 rounded-md text-xs font-semibold border border-brand-200 bg-brand-50 text-brand-700 hover:bg-brand-100 transition-colors">
                                                    <?php esc_html_e('Sign in to save itinerary', 'nexdirectory'); ?>
                                                </a>
                                            <?php endif; ?>
                                        </div>
                                    </div>
                                    <div class="mt-2 space-y-1.5 text-sm text-gray-600">
                                        <?php if ($session_time !== '') : ?>
                                            <p><span class="font-semibold text-gray-900"><?php esc_html_e('Time:', 'nexdirectory'); ?></span> <?php echo esc_html($session_time); ?></p>
                                        <?php endif; ?>
                                        <?php if ($session_location !== '') : ?>
                                            <p><span class="font-semibold text-gray-900"><?php esc_html_e('Location:', 'nexdirectory'); ?></span> <?php echo esc_html($session_location); ?></p>
                                        <?php endif; ?>
                                        <?php if ($session_speaker !== '') : ?>
                                            <p><span class="font-semibold text-gray-900"><?php esc_html_e('Speaker:', 'nexdirectory'); ?></span> <?php echo esc_html($session_speaker); ?></p>
                                        <?php endif; ?>
                                    </div>
                                    <template x-if="viewerLoggedIn && hasItineraryNote('<?php echo esc_js($session_uid); ?>')">
                                        <div class="mt-3 p-3 rounded-lg border border-yellow-200 bg-yellow-50/80 text-sm text-yellow-900 whitespace-pre-wrap" x-text="getItineraryNote('<?php echo esc_js($session_uid); ?>')"></div>
                                    </template>
                                    <?php if (!empty($session_attachments)) : ?>
                                        <div class="mt-3 flex flex-wrap gap-2" data-eep-custom-gallery="session-modal-<?php echo esc_attr($day_key . '-' . $session_index); ?>">
                                            <?php foreach ($session_attachments as $attachment_index => $attachment_url) : ?>
                                                <?php
                                                $attachment_path = strtolower((string) wp_parse_url($attachment_url, PHP_URL_PATH));
                                                $attachment_ext = strtolower((string) pathinfo($attachment_path, PATHINFO_EXTENSION));
                                                $attachment_name = sanitize_text_field((string) basename($attachment_path));
                                                if ($attachment_name === '') {
                                                    $attachment_name = sprintf(__('Attachment %d', 'nexdirectory'), $attachment_index + 1);
                                                }
                                                $is_image_attachment = in_array($attachment_ext, ['jpg', 'jpeg', 'png', 'gif', 'webp', 'bmp', 'avif', 'svg'], true);
                                                $is_video_attachment = in_array($attachment_ext, ['mp4', 'webm', 'ogg', 'mov', 'm4v'], true) || preg_match('/(youtube\.com|youtu\.be|vimeo\.com)/i', (string) $attachment_url);
                                                $is_pdf_attachment = $attachment_ext === 'pdf';
                                                ?>
                                                <?php if ($is_image_attachment) : ?>
                                                    <button type="button" class="eep-gallery-item inline-flex items-center px-3 py-1.5 rounded-lg border border-gray-200 bg-gray-50 text-xs font-medium text-gray-700 hover:bg-gray-100 transition-colors" data-eep-lightbox="<?php echo esc_url($attachment_url); ?>">
                                                        <?php echo esc_html($attachment_name); ?>
                                                    </button>
                                                <?php elseif ($is_video_attachment) : ?>
                                                    <button type="button" class="inline-flex items-center px-3 py-1.5 rounded-lg border border-gray-200 bg-gray-50 text-xs font-medium text-gray-700 hover:bg-gray-100 transition-colors" data-eep-video-url="<?php echo esc_url($attachment_url); ?>">
                                                        <?php echo esc_html($attachment_name); ?>
                                                    </button>
                                                <?php else : ?>
                                                    <button type="button" class="inline-flex items-center px-3 py-1.5 rounded-lg border border-gray-200 bg-gray-50 text-xs font-medium text-gray-700 hover:bg-gray-100 transition-colors" data-eep-doc-url="<?php echo esc_url($attachment_url); ?>" data-eep-doc-title="<?php echo esc_attr($attachment_name); ?>" data-eep-doc-embed="<?php echo $is_pdf_attachment ? esc_url($attachment_url) : ''; ?>">
                                                        <?php echo esc_html($attachment_name); ?>
                                                    </button>
                                                <?php endif; ?>
                                            <?php endforeach; ?>
                                        </div>
                                    <?php endif; ?>
                                </article>
                            <?php endforeach; ?>
                        </div>
                    </div>
                <?php endforeach; ?>
            </div>
        </div>
    </div>
    <?php endif; ?>

    <?php if ($show_timeline && !empty($sessions_grouped) && $viewer_logged_in) : ?>
    <div x-show="itineraryNoteModalOpen" style="display: none;" class="fixed inset-0 z-[107] flex items-center justify-center p-4 sm:p-6">
        <div x-show="itineraryNoteModalOpen" x-transition.opacity class="absolute inset-0 bg-gray-900/70 backdrop-blur-sm" @click="closeItineraryNoteModal()"></div>
        <div x-show="itineraryNoteModalOpen"
             x-transition:enter="transition ease-out duration-250"
             x-transition:enter-start="opacity-0 translate-y-3 scale-95"
             x-transition:enter-end="opacity-100 translate-y-0 scale-100"
             x-transition:leave="transition ease-in duration-180"
             x-transition:leave-start="opacity-100 translate-y-0 scale-100"
             x-transition:leave-end="opacity-0 translate-y-2 scale-95"
             class="relative w-full max-w-xl bg-white rounded-2xl shadow-2xl border border-gray-100 overflow-hidden">
            <div class="flex items-center justify-between px-5 py-4 border-b border-gray-100 bg-gray-50">
                <h3 class="text-base sm:text-lg font-bold text-gray-900"><?php esc_html_e('Session Note', 'nexdirectory'); ?></h3>
                <button type="button" @click="closeItineraryNoteModal()" class="p-2 rounded-lg bg-white border border-gray-200 text-gray-500 hover:text-gray-900 hover:bg-gray-50 transition-colors">
                    <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg>
                </button>
            </div>
            <div class="p-5">
                <textarea x-model="itineraryNoteText" rows="6" placeholder="<?php esc_attr_e('Write your note for this session...', 'nexdirectory'); ?>" class="w-full px-4 py-3 border border-gray-200 rounded-xl text-sm focus:ring-2 focus:ring-brand-500 focus:border-brand-500 outline-none resize-y"></textarea>
                <div class="mt-4 flex items-center justify-end gap-2">
                    <button type="button" @click="closeItineraryNoteModal()" class="inline-flex items-center justify-center px-4 py-2.5 bg-white border border-gray-200 text-gray-700 text-sm font-semibold rounded-xl hover:bg-gray-50 transition-colors">
                        <?php esc_html_e('Cancel', 'nexdirectory'); ?>
                    </button>
                    <button type="button" @click="saveItineraryNote()" class="inline-flex items-center justify-center px-4 py-2.5 bg-brand-600 border border-brand-600 text-white text-sm font-semibold rounded-xl hover:bg-brand-700 transition-colors">
                        <?php esc_html_e('Save Note', 'nexdirectory'); ?>
                    </button>
                </div>
            </div>
        </div>
    </div>
    <?php endif; ?>

    <?php if ($show_key_speakers && $has_more_key_speakers) : ?>
    <div x-show="showSpeakersModal" style="display: none;" class="fixed inset-0 z-[106] flex items-center justify-center p-4 sm:p-6">
        <div x-show="showSpeakersModal" x-transition.opacity class="absolute inset-0 bg-gray-900/80 backdrop-blur-sm" @click="showSpeakersModal = false"></div>
        <div x-show="showSpeakersModal"
             x-transition:enter="transition ease-out duration-300"
             x-transition:enter-start="opacity-0 translate-y-4 scale-95"
             x-transition:enter-end="opacity-100 translate-y-0 scale-100"
             x-transition:leave="transition ease-in duration-200"
             x-transition:leave-start="opacity-100 translate-y-0 scale-100"
             x-transition:leave-end="opacity-0 translate-y-3 scale-95"
             class="relative w-full max-w-4xl max-h-[85vh] bg-white rounded-2xl shadow-2xl border border-gray-100 overflow-hidden flex flex-col">
            <div class="flex items-center justify-between px-5 py-4 border-b border-gray-100 bg-gray-50">
                <h3 class="text-base sm:text-lg font-bold text-gray-900"><?php echo esc_html($single_key_speakers_heading); ?></h3>
                <button type="button" @click="showSpeakersModal = false" class="p-2 rounded-lg bg-white border border-gray-200 text-gray-500 hover:text-gray-900 hover:bg-gray-50 transition-colors">
                    <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg>
                </button>
            </div>
            <div class="p-5 sm:p-6 overflow-y-auto">
                <div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
                    <?php foreach ($key_speakers as $speaker_row) : ?>
                        <?php
                        $speaker_name = sanitize_text_field((string) ($speaker_row['name'] ?? ''));
                        $speaker_profession = sanitize_text_field((string) ($speaker_row['profession'] ?? ''));
                        $speaker_subject = sanitize_text_field((string) ($speaker_row['subject'] ?? ''));
                        $speaker_details = eep_sanitize_textarea((string) ($speaker_row['details'] ?? ''));
                        $speaker_image = esc_url((string) ($speaker_row['image'] ?? ''));
                        if ($speaker_name === '' && $speaker_profession === '' && $speaker_subject === '' && $speaker_details === '' && $speaker_image === '') {
                            continue;
                        }
                        ?>
                        <article class="rounded-xl border border-gray-200 bg-gray-50/60 p-4 sm:p-5 shadow-sm">
                            <div class="flex items-start gap-3">
                                <?php if ($speaker_image !== '') : ?>
                                    <img src="<?php echo esc_url($speaker_image); ?>" alt="<?php echo esc_attr($speaker_name !== '' ? $speaker_name : __('Speaker', 'nexdirectory')); ?>" class="w-14 h-14 rounded-xl object-cover border border-gray-200 shadow-sm shrink-0">
                                <?php else : ?>
                                    <div class="w-14 h-14 rounded-xl bg-brand-50 text-brand-600 border border-brand-100 shadow-sm shrink-0 flex items-center justify-center">
                                        <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"></path></svg>
                                    </div>
                                <?php endif; ?>
                                <div class="min-w-0 flex-1">
                                    <?php if ($speaker_name !== '') : ?>
                                        <h3 class="text-base font-bold text-gray-900 leading-tight"><?php echo esc_html($speaker_name); ?></h3>
                                    <?php endif; ?>
                                    <?php if ($speaker_profession !== '') : ?>
                                        <p class="text-sm text-gray-500 mt-1"><?php echo esc_html($speaker_profession); ?></p>
                                    <?php endif; ?>
                                </div>
                            </div>
                            <?php if ($speaker_subject !== '') : ?>
                                <p class="mt-3 inline-flex items-center px-2.5 py-1 rounded-full text-xs font-semibold text-brand-700 bg-brand-50 border border-brand-100"><?php echo esc_html($speaker_subject); ?></p>
                            <?php endif; ?>
                            <?php if ($speaker_details !== '') : ?>
                                <p class="mt-3 text-sm text-gray-600 leading-relaxed"><?php echo esc_html($speaker_details); ?></p>
                            <?php endif; ?>
                        </article>
                    <?php endforeach; ?>
                </div>
            </div>
        </div>
    </div>
    <?php endif; ?>

    <?php if ($show_ticket_cta) : ?>
    <div x-show="ticketCheckoutModalOpen" style="display: none;" class="fixed inset-0 z-[108] flex items-center justify-center p-4 sm:p-6">
        <div x-show="ticketCheckoutModalOpen" x-transition.opacity class="absolute inset-0 bg-gray-900/75 backdrop-blur-sm" @click="ticketCheckoutModalOpen = false"></div>
        <div x-show="ticketCheckoutModalOpen"
             x-transition:enter="transition ease-out duration-250"
             x-transition:enter-start="opacity-0 translate-y-4 scale-95"
             x-transition:enter-end="opacity-100 translate-y-0 scale-100"
             x-transition:leave="transition ease-in duration-200"
             x-transition:leave-start="opacity-100 translate-y-0 scale-100"
             x-transition:leave-end="opacity-0 translate-y-3 scale-95"
             class="relative w-full max-w-lg bg-white rounded-2xl shadow-2xl border border-gray-100 overflow-hidden">
            <div class="flex items-center justify-between px-5 py-4 border-b border-gray-100 bg-gray-50">
                <div>
                    <h3 class="text-base sm:text-lg font-bold text-gray-900"><?php esc_html_e('Ticket Checkout', 'nexdirectory'); ?></h3>
                    <p class="text-xs text-gray-500 mt-0.5"><?php echo esc_html($ticket_checkout_subtext); ?></p>
                </div>
                <button type="button" @click="ticketCheckoutModalOpen = false" class="p-2 rounded-lg bg-white border border-gray-200 text-gray-500 hover:text-gray-900 hover:bg-gray-50 transition-colors">
                    <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg>
                </button>
            </div>

            <form method="post" action="<?php echo esc_url($ticket_checkout_url); ?>" class="p-5 space-y-4" x-data="{ submitting: false }" @submit="submitting = true">
                <input type="hidden" name="action" value="eep_ticket_checkout">
                <input type="hidden" name="post_id" value="<?php echo esc_attr((string) $post_id); ?>">
                <?php echo $ticket_checkout_nonce_html; // phpcs:ignore ?>

                <div class="rounded-xl border border-gray-200 bg-gray-50 px-4 py-3 flex items-center justify-between gap-4">
                    <span class="text-sm font-semibold text-gray-700"><?php esc_html_e('Ticket Price', 'nexdirectory'); ?></span>
                    <span class="text-sm font-bold text-gray-900"><?php echo esc_html($ticket_price_display !== '' ? (string) $ticket_price_display : __('Free', 'nexdirectory')); ?></span>
                </div>

                <?php if (!$viewer_logged_in) : ?>
                    <div class="rounded-xl border border-gray-200 bg-white p-4 space-y-3">
                        <p class="text-xs text-gray-600"><?php esc_html_e('Choose one option:', 'nexdirectory'); ?></p>
                        <div class="flex flex-wrap gap-2">
                            <a href="<?php echo esc_url((string) $login_url); ?>" class="inline-flex items-center justify-center px-3 py-2 bg-gray-900 text-white text-xs font-semibold rounded-lg hover:bg-black transition-colors">
                                <?php esc_html_e('Sign In', 'nexdirectory'); ?>
                            </a>
                            <a href="<?php echo esc_url((string) $signup_url); ?>" class="inline-flex items-center justify-center px-3 py-2 bg-white border border-gray-300 text-gray-700 text-xs font-semibold rounded-lg hover:bg-gray-50 transition-colors">
                                <?php esc_html_e('Create Account', 'nexdirectory'); ?>
                            </a>
                        </div>
                        <p class="text-[11px] text-gray-500"><?php esc_html_e('Or continue as guest. We will email a verification link before checkout continues.', 'nexdirectory'); ?></p>
                        <input type="hidden" name="guest_checkout" value="1">
                        <div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
                            <div>
                                <label class="block text-xs font-semibold uppercase tracking-wider text-gray-500 mb-2"><?php esc_html_e('Full Name (optional)', 'nexdirectory'); ?></label>
                                <input type="text" name="guest_name" maxlength="80" class="w-full px-3 py-2.5 border border-gray-200 rounded-lg text-sm bg-white focus:ring-2 focus:ring-brand-500/20 focus:border-brand-500 outline-none" placeholder="<?php esc_attr_e('Your name', 'nexdirectory'); ?>">
                            </div>
                            <div>
                                <label class="block text-xs font-semibold uppercase tracking-wider text-gray-500 mb-2"><?php esc_html_e('Email Address', 'nexdirectory'); ?></label>
                                <input type="email" name="guest_email" required class="w-full px-3 py-2.5 border border-gray-200 rounded-lg text-sm bg-white focus:ring-2 focus:ring-brand-500/20 focus:border-brand-500 outline-none" placeholder="<?php esc_attr_e('you@example.com', 'nexdirectory'); ?>">
                            </div>
                        </div>
                    </div>
                <?php else : ?>
                    <input type="hidden" name="guest_checkout" value="0">
                <?php endif; ?>

                <?php if ($show_ticket_gateway_select) : ?>
                    <div>
                        <label class="block text-xs font-semibold uppercase tracking-wider text-gray-500 mb-2"><?php esc_html_e('Payment Method', 'nexdirectory'); ?></label>
                        <select name="gateway" class="w-full px-3 py-2.5 border border-gray-200 rounded-lg text-sm bg-white focus:ring-2 focus:ring-brand-500/20 focus:border-brand-500 outline-none">
                            <?php foreach ($ticket_gateway_options as $gateway_option) : ?>
                                <option value="<?php echo esc_attr((string) ($gateway_option['value'] ?? '')); ?>" <?php selected((string) ($gateway_option['value'] ?? ''), (string) $ticket_default_gateway); ?>>
                                    <?php echo esc_html((string) ($gateway_option['label'] ?? '')); ?>
                                </option>
                            <?php endforeach; ?>
                        </select>
                    </div>
                <?php else : ?>
                    <input type="hidden" name="gateway" value="<?php echo esc_attr($ticket_default_gateway !== '' ? (string) $ticket_default_gateway : 'test_free'); ?>">
                <?php endif; ?>

                <div class="flex items-center gap-3 pt-1">
                    <button type="submit" :disabled="submitting" class="inline-flex items-center justify-center gap-2 px-4 py-2.5 bg-brand-500 hover:bg-brand-600 disabled:opacity-70 text-white text-sm font-semibold rounded-xl transition-colors">
                        <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"></path></svg>
                        <span x-show="!submitting"><?php echo esc_html($viewer_logged_in ? $ticket_checkout_submit_label : __('Send Verification Link', 'nexdirectory')); ?></span>
                        <span x-show="submitting" style="display: none;"><?php esc_html_e('Processing...', 'nexdirectory'); ?></span>
                    </button>
                    <button type="button" @click="ticketCheckoutModalOpen = false" class="inline-flex items-center justify-center px-4 py-2.5 bg-white border border-gray-200 text-gray-700 text-sm font-semibold rounded-xl hover:bg-gray-50 transition-colors">
                        <?php esc_html_e('Cancel', 'nexdirectory'); ?>
                    </button>
                </div>
            </form>
        </div>
    </div>
    <?php endif; ?>

    <?php if ($message_button_mode === 'modal') : ?>
    <div x-show="messageModalOpen" style="display: none;" class="fixed inset-0 z-[105] flex items-center justify-center p-4 sm:p-6">
        <div x-show="messageModalOpen" x-transition.opacity class="absolute inset-0 bg-gray-900/70 backdrop-blur-sm" @click="messageModalOpen = false"></div>
        <div x-show="messageModalOpen"
             x-transition:enter="transition ease-out duration-250"
             x-transition:enter-start="opacity-0 translate-y-4 scale-95"
             x-transition:enter-end="opacity-100 translate-y-0 scale-100"
             x-transition:leave="transition ease-in duration-200"
             x-transition:leave-start="opacity-100 translate-y-0 scale-100"
             x-transition:leave-end="opacity-0 translate-y-3 scale-95"
             class="relative w-full max-w-lg bg-white rounded-2xl shadow-2xl border border-gray-100 overflow-hidden">
            <div class="flex items-center justify-between px-5 py-4 border-b border-gray-100 bg-gray-50">
                <div>
                    <h3 class="text-base sm:text-lg font-bold text-gray-900">
                        <?php
                        if ($message_targets_admin) {
                            esc_html_e('Message Admin Team', 'nexdirectory');
                        } else {
                            echo esc_html(sprintf(__('Message %s', 'nexdirectory'), $owner_heading));
                        }
                        ?>
                    </h3>
                    <p class="text-xs text-gray-500 mt-0.5">
                        <?php
                        if ($message_targets_admin) {
                            esc_html_e('Send a private message to the platform admin inbox.', 'nexdirectory');
                        } else {
                            echo esc_html(sprintf(
                                __('Directly contact %s', 'nexdirectory'),
                                (string) ($owner_display_name !== '' ? $owner_display_name : __('Listing Owner', 'nexdirectory'))
                            ));
                        }
                        ?>
                    </p>
                </div>
                <button type="button" @click="messageModalOpen = false" class="p-2 rounded-lg bg-white border border-gray-200 text-gray-500 hover:text-gray-900 hover:bg-gray-50 transition-colors">
                    <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg>
                </button>
            </div>
            <form method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>" class="p-5 space-y-4" x-data="{ sending: false }" @submit="sending = true">
                <input type="hidden" name="action" value="eep_contact_holder">
                <input type="hidden" name="post_id" value="<?php echo esc_attr((string) $post_id); ?>">
                <input type="hidden" name="eep_recaptcha_token" value="">
                <input type="hidden" name="eep_inbox_only" value="1">
                <input type="hidden" name="eep_contact_target" value="<?php echo $message_targets_admin ? 'admin' : 'owner'; ?>">
                <?php echo $contact_nonce_html; // phpcs:ignore ?>
                <div>
                    <label class="block text-xs font-semibold uppercase tracking-wider text-gray-500 mb-2" for="eep-contact-subject"><?php esc_html_e('Subject', 'nexdirectory'); ?></label>
                    <input id="eep-contact-subject" type="text" name="subject" maxlength="160" required value="<?php echo esc_attr((string) $message_default_subject); ?>" class="w-full px-4 py-2.5 rounded-xl border border-gray-200 text-sm focus:ring-2 focus:ring-brand-500/20 focus:border-brand-500 outline-none transition-colors">
                </div>
                <div>
                    <label class="block text-xs font-semibold uppercase tracking-wider text-gray-500 mb-2" for="eep-contact-message"><?php esc_html_e('Message', 'nexdirectory'); ?></label>
                    <textarea id="eep-contact-message" name="message" rows="5" required placeholder="<?php esc_attr_e('Write your message...', 'nexdirectory'); ?>" class="w-full px-4 py-3 rounded-xl border border-gray-200 text-sm focus:ring-2 focus:ring-brand-500/20 focus:border-brand-500 outline-none transition-colors"></textarea>
                </div>
                <div class="flex items-center gap-3 pt-1">
                    <button type="submit" :disabled="sending" class="inline-flex items-center justify-center gap-2 px-4 py-2.5 bg-brand-500 hover:bg-brand-600 disabled:opacity-70 text-white text-sm font-semibold rounded-xl transition-colors">
                        <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.214-3.64A7.952 7.952 0 013 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"></path></svg>
                        <span x-show="!sending"><?php esc_html_e('Send Message', 'nexdirectory'); ?></span>
                        <span x-show="sending" style="display: none;"><?php esc_html_e('Sending...', 'nexdirectory'); ?></span>
                    </button>
                    <button type="button" @click="messageModalOpen = false" class="inline-flex items-center justify-center px-4 py-2.5 bg-white border border-gray-200 text-gray-700 text-sm font-semibold rounded-xl hover:bg-gray-50 transition-colors">
                        <?php esc_html_e('Cancel', 'nexdirectory'); ?>
                    </button>
                </div>
            </form>
        </div>
    </div>
    <?php endif; ?>

    <div id="eep-doc-lightbox" class="eep-lightbox fixed inset-0 z-[110] flex items-center justify-center p-4 sm:p-6 md:p-10 bg-gray-900/80 backdrop-blur-sm" hidden>
        <div class="relative w-full max-w-5xl h-[85vh] bg-gray-50 rounded-2xl shadow-2xl overflow-hidden flex flex-col">
            <div class="flex items-center justify-between p-4 border-b border-gray-200 bg-white z-10 relative">
                <div class="flex items-center gap-3 px-2 min-w-0">
                    <div class="w-10 h-10 rounded-lg bg-brand-50 text-brand-600 flex items-center justify-center shrink-0">
                        <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path></svg>
                    </div>
                    <h3 id="eep-doc-lightbox-title" class="text-base font-bold text-gray-900 truncate max-w-[200px] sm:max-w-md">Document</h3>
                </div>
                <div class="flex items-center gap-3 shrink-0">
                    <button type="button" id="eep-doc-lightbox-prev" class="hidden sm:inline-flex items-center justify-center p-2 rounded-lg border border-gray-200 bg-white hover:bg-gray-50 text-gray-600" aria-label="<?php esc_attr_e('Previous document', 'nexdirectory'); ?>">
                        <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"></path></svg>
                    </button>
                    <button type="button" id="eep-doc-lightbox-next" class="hidden sm:inline-flex items-center justify-center p-2 rounded-lg border border-gray-200 bg-white hover:bg-gray-50 text-gray-600" aria-label="<?php esc_attr_e('Next document', 'nexdirectory'); ?>">
                        <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg>
                    </button>
                    <a id="eep-doc-lightbox-download" data-eep-doc-download="1" href="#" download target="_blank" rel="noopener noreferrer nofollow ugc" class="hidden sm:flex items-center gap-2 text-sm font-semibold text-gray-700 bg-gray-100 hover:bg-gray-200 active:scale-95 px-4 py-2 rounded-lg transition-all duration-200 border border-gray-200 shadow-sm hover:shadow">
                        <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"></path></svg>
                        Download
                    </a>
                    <button type="button" id="eep-doc-lightbox-close" class="text-gray-400 hover:text-gray-900 transition-colors p-2 bg-gray-100 hover:bg-gray-200 rounded-lg border border-gray-200" aria-label="<?php esc_attr_e('Close document preview', 'nexdirectory'); ?>">
                        <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg>
                    </button>
                </div>
            </div>
            <div class="flex-1 w-full bg-gray-200 relative overflow-hidden flex">
                <div class="absolute inset-0 flex items-center justify-center text-gray-400 pointer-events-none">
                    <svg class="animate-spin h-8 w-8" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg>
                </div>
                <iframe id="eep-doc-lightbox-iframe" src="" class="absolute inset-0 w-full h-full border-0 z-10 bg-transparent block"></iframe>
            </div>
            <div class="sm:hidden p-4 bg-white border-t border-gray-200 z-10 shadow-[0_-4px_6px_-1px_rgba(0,0,0,0.05)]">
                <a data-eep-doc-download="1" href="#" download target="_blank" rel="noopener noreferrer nofollow ugc" class="flex w-full items-center justify-center gap-2 text-sm font-semibold text-gray-700 bg-gray-50 hover:bg-gray-100 active:scale-95 px-5 py-3 rounded-xl transition-all duration-200 border border-gray-200 shadow-sm">
                    <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"></path></svg>
                    Download Document
                </a>
            </div>
        </div>
    </div>

    <div id="eep-video-lightbox" class="eep-lightbox fixed inset-0 z-[110] flex items-center justify-center p-4 sm:p-6 md:p-10 bg-gray-900/95 backdrop-blur-sm" hidden>
        <div class="relative w-full max-w-5xl aspect-video bg-black rounded-2xl shadow-2xl overflow-hidden flex flex-col">
            <button type="button" id="eep-video-lightbox-close" class="absolute top-4 right-4 z-20 text-white/70 hover:text-white bg-black/50 hover:bg-black/70 rounded-full p-2 transition-colors focus:outline-none" aria-label="<?php esc_attr_e('Close video', 'nexdirectory'); ?>">
                <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg>
            </button>
            <button type="button" id="eep-video-lightbox-prev" class="absolute left-3 top-1/2 -translate-y-1/2 z-20 text-white/70 hover:text-white bg-black/50 hover:bg-black/70 rounded-full p-2 transition-colors focus:outline-none" aria-label="<?php esc_attr_e('Previous video', 'nexdirectory'); ?>">
                <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"></path></svg>
            </button>
            <button type="button" id="eep-video-lightbox-next" class="absolute right-3 top-1/2 -translate-y-1/2 z-20 text-white/70 hover:text-white bg-black/50 hover:bg-black/70 rounded-full p-2 transition-colors focus:outline-none" aria-label="<?php esc_attr_e('Next video', 'nexdirectory'); ?>">
                <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg>
            </button>
            <div class="sm:hidden absolute inset-y-0 left-0 w-[34%] z-[15]" data-eep-video-swipe-zone="left" aria-hidden="true"></div>
            <div class="sm:hidden absolute inset-y-0 right-0 w-[34%] z-[15]" data-eep-video-swipe-zone="right" aria-hidden="true"></div>
            <iframe id="eep-video-lightbox-iframe" src="" class="w-full h-full border-0 absolute inset-0 z-10 bg-black block" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
        </div>
    </div>

    <div id="eep-lightbox" class="eep-lightbox fixed inset-0 z-[120] flex items-center justify-center bg-black/95 backdrop-blur-md p-4" hidden>
        <button type="button" id="eep-lightbox-close" class="absolute top-4 right-4 sm:top-6 sm:right-6 text-white/50 hover:text-white transition-colors z-20 focus:outline-none p-2 bg-white/5 hover:bg-white/10 rounded-full" aria-label="<?php esc_attr_e('Close image', 'nexdirectory'); ?>">
            <svg class="w-8 h-8" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg>
        </button>

        <button type="button" id="eep-lightbox-prev" class="absolute left-2 sm:left-6 top-1/2 -translate-y-1/2 text-white/50 hover:text-white transition-all z-20 focus:outline-none p-2 bg-black/20 hover:bg-black/40 rounded-full hover:scale-110 active:scale-95" aria-label="<?php esc_attr_e('Previous image', 'nexdirectory'); ?>">
            <svg class="w-8 h-8 sm:w-10 sm:h-10" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"></path></svg>
        </button>

        <button type="button" id="eep-lightbox-next" class="absolute right-2 sm:right-6 top-1/2 -translate-y-1/2 text-white/50 hover:text-white transition-all z-20 focus:outline-none p-2 bg-black/20 hover:bg-black/40 rounded-full hover:scale-110 active:scale-95" aria-label="<?php esc_attr_e('Next image', 'nexdirectory'); ?>">
            <svg class="w-8 h-8 sm:w-10 sm:h-10" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg>
        </button>

        <div class="relative w-full h-full flex items-center justify-center pointer-events-none">
            <img id="eep-lightbox-image" src="" class="max-w-full max-h-full object-contain shadow-2xl pointer-events-auto rounded-lg" alt="<?php esc_attr_e('Gallery image preview', 'nexdirectory'); ?>">
        </div>
    </div>

</body>
</html>

```

---

## File: templates/frontend/hero/cinematic.php

```php
<?php
if (!defined('ABSPATH')) {
    exit;
}

return [
    'container' => 'transition-all duration-700 ease-out relative sm:rounded-2xl overflow-hidden mb-6 sm:mb-8 shadow-sm group bg-gray-900 flex flex-col justify-end min-h-[60vh] sm:min-h-[450px]',
    'image' => 'absolute inset-0 w-full h-full object-cover transition-transform duration-1000 sm:group-hover:scale-105 opacity-80 sm:opacity-100',
    'fallback' => 'absolute inset-0 w-full h-full bg-gradient-to-br from-gray-800 to-gray-950 transition-transform duration-1000 sm:group-hover:scale-105',
    'overlay' => 'absolute inset-0 bg-gradient-to-t from-gray-900 via-gray-900/60 to-transparent',
    'content' => 'relative z-10 p-5 sm:p-8 lg:p-12 w-full mt-auto',
    'kicker' => 'inline-flex items-center px-2.5 py-1 rounded-full bg-brand-500/20 text-white text-xs font-semibold uppercase tracking-wider backdrop-blur-sm border border-brand-500/30',
    'title' => 'text-3xl sm:text-4xl md:text-5xl lg:text-6xl font-bold text-white mb-3 sm:mb-4 leading-tight tracking-tight drop-shadow-md',
    'subtitle' => 'text-gray-300 text-base sm:text-lg max-w-2xl mb-6 leading-relaxed line-clamp-2 sm:line-clamp-none',
    'meta_wrap' => 'flex flex-col sm:flex-row gap-3 sm:gap-6 lg:gap-8 text-white',
    'meta_card' => 'flex items-center bg-white/10 backdrop-blur-md rounded-xl p-3 sm:p-4 border border-white/10 hover:bg-white/20 transition-colors duration-300 cursor-default',
    'meta_icon' => 'p-2.5 sm:p-3 bg-brand-500 rounded-lg mr-3 shadow-sm shrink-0',
    'meta_label' => 'text-[10px] sm:text-xs text-brand-100 font-semibold uppercase tracking-wider',
    'meta_value' => 'font-semibold text-base sm:text-lg',
];

```

---

## File: templates/frontend/hero/compact.php

```php
<?php
if (!defined('ABSPATH')) {
    exit;
}

return [
    'container' => 'transition-all duration-700 ease-out relative sm:rounded-2xl overflow-hidden mb-6 sm:mb-8 shadow-sm group bg-gray-900 flex flex-col justify-end min-h-[42vh] sm:min-h-[340px]',
    'image' => 'absolute inset-0 w-full h-full object-cover transition-transform duration-700 sm:group-hover:scale-[1.03] opacity-75 sm:opacity-95',
    'fallback' => 'absolute inset-0 w-full h-full bg-gradient-to-br from-gray-800 to-gray-950 transition-transform duration-700 sm:group-hover:scale-[1.03]',
    'overlay' => 'absolute inset-0 bg-gradient-to-t from-gray-900/95 via-gray-900/50 to-transparent',
    'content' => 'relative z-10 p-4 sm:p-6 lg:p-8 w-full mt-auto',
    'kicker' => 'inline-flex items-center px-2.5 py-1 rounded-full bg-white/15 text-white text-[11px] font-semibold uppercase tracking-wider backdrop-blur-sm border border-white/25',
    'title' => 'text-2xl sm:text-3xl md:text-4xl font-bold text-white mb-2 sm:mb-3 leading-tight tracking-tight',
    'subtitle' => 'text-gray-200 text-sm sm:text-base max-w-2xl mb-4 sm:mb-5 leading-relaxed line-clamp-2',
    'meta_wrap' => 'flex flex-col sm:flex-row gap-2.5 sm:gap-4 text-white',
    'meta_card' => 'flex items-center bg-black/25 backdrop-blur-md rounded-lg p-2.5 sm:p-3 border border-white/10',
    'meta_icon' => 'p-2 bg-brand-500 rounded-lg mr-2.5 shadow-sm shrink-0',
    'meta_label' => 'text-[10px] text-gray-200 font-semibold uppercase tracking-wider',
    'meta_value' => 'font-semibold text-sm sm:text-base',
];

```

---

## File: templates/frontend/hero/immersive.php

```php
<?php
if (!defined('ABSPATH')) {
    exit;
}

return [
    'container' => 'transition-all duration-700 ease-out relative sm:rounded-2xl overflow-hidden mb-6 sm:mb-8 shadow-sm group bg-gray-900 flex flex-col justify-end min-h-[72vh] sm:min-h-[560px]',
    'image' => 'absolute inset-0 block !w-full !h-full object-cover transition-transform duration-[1200ms] sm:group-hover:scale-110 opacity-[0.85]',
    'fallback' => 'absolute inset-0 w-full h-full bg-gradient-to-br from-gray-800 to-black transition-transform duration-[1200ms] sm:group-hover:scale-110',
    'overlay' => 'absolute inset-0 bg-gradient-to-t from-black via-gray-950/65 to-gray-900/15',
    'content' => 'relative z-10 p-6 sm:p-10 lg:p-14 w-full mt-auto',
    'kicker' => 'inline-flex items-center px-3 py-1 rounded-full bg-brand-500/25 text-white text-xs font-semibold uppercase tracking-[0.15em] backdrop-blur-sm border border-brand-300/50',
    'title' => 'text-4xl sm:text-5xl md:text-6xl lg:text-7xl font-bold text-white mb-4 leading-[1.04] tracking-tight drop-shadow-lg',
    'subtitle' => 'text-gray-100 text-base sm:text-xl max-w-3xl mb-7 leading-relaxed',
    'meta_wrap' => 'grid grid-cols-1 md:grid-cols-2 gap-4 sm:gap-5 text-white',
    'meta_card' => 'flex items-center bg-black/35 backdrop-blur-md rounded-2xl p-3.5 sm:p-4 border border-white/10 shadow-lg',
    'meta_icon' => 'p-2.5 sm:p-3 bg-brand-500 rounded-xl mr-3.5 shadow-sm shrink-0',
    'meta_label' => 'text-[10px] sm:text-xs text-brand-100 font-semibold uppercase tracking-wider',
    'meta_value' => 'font-semibold text-base sm:text-lg',
];

```

---

## File: templates/frontend/hero/minimal.php

```php
<?php
if (!defined('ABSPATH')) {
    exit;
}

return [
    'container' => 'transition-all duration-700 ease-out relative sm:rounded-2xl overflow-hidden mb-6 sm:mb-8 shadow-sm group bg-gray-900 flex flex-col justify-end min-h-[48vh] sm:min-h-[360px]',
    'image' => 'absolute inset-0 w-full h-full object-cover transition-transform duration-700 sm:group-hover:scale-[1.02] opacity-70',
    'fallback' => 'absolute inset-0 w-full h-full bg-gradient-to-br from-slate-800 to-slate-950 transition-transform duration-700 sm:group-hover:scale-[1.02]',
    'overlay' => 'absolute inset-0 bg-gradient-to-t from-gray-950/92 via-gray-900/42 to-gray-900/10',
    'content' => 'relative z-10 p-5 sm:p-7 lg:p-9 w-full mt-auto',
    'kicker' => 'inline-flex items-center px-2 py-0.5 rounded-full bg-transparent text-white text-[11px] font-semibold uppercase tracking-[0.14em] border border-white/35',
    'title' => 'text-3xl sm:text-4xl md:text-5xl font-semibold text-white mb-3 leading-tight tracking-tight',
    'subtitle' => 'text-gray-200 text-sm sm:text-base max-w-2xl mb-5 leading-relaxed',
    'meta_wrap' => 'flex flex-wrap gap-3 sm:gap-4 text-white',
    'meta_card' => 'flex items-center bg-transparent rounded-lg p-2.5 sm:p-3 border border-white/20',
    'meta_icon' => 'p-2 bg-white/10 rounded-lg mr-2.5 shadow-sm shrink-0',
    'meta_label' => 'text-[10px] text-gray-200 font-semibold uppercase tracking-wider',
    'meta_value' => 'font-semibold text-sm sm:text-base',
];

```

---

## File: templates/frontend/hero/split.php

```php
<?php
if (!defined('ABSPATH')) {
    exit;
}

return [
    'container' => 'transition-all duration-700 ease-out relative sm:rounded-2xl overflow-hidden mb-6 sm:mb-8 shadow-sm group bg-gray-900 flex flex-col justify-end min-h-[56vh] sm:min-h-[420px]',
    'image' => 'absolute inset-0 w-full h-full object-cover transition-transform duration-900 sm:group-hover:scale-105 opacity-80',
    'fallback' => 'absolute inset-0 w-full h-full bg-gradient-to-br from-gray-800 to-gray-950 transition-transform duration-900 sm:group-hover:scale-105',
    'overlay' => 'absolute inset-0 bg-gradient-to-r from-gray-950/95 via-gray-900/65 to-gray-900/20',
    'content' => 'relative z-10 p-5 sm:p-8 lg:p-10 w-full lg:max-w-[62%] mt-auto',
    'kicker' => 'inline-flex items-center px-2.5 py-1 rounded-full bg-brand-500/25 text-white text-xs font-semibold uppercase tracking-wider backdrop-blur-sm border border-brand-400/40',
    'title' => 'text-3xl sm:text-4xl md:text-5xl font-bold text-white mb-3 leading-tight tracking-tight',
    'subtitle' => 'text-gray-100 text-base sm:text-lg max-w-xl mb-6 leading-relaxed',
    'meta_wrap' => 'grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4 text-white',
    'meta_card' => 'flex items-center bg-white/12 backdrop-blur-md rounded-xl p-3 sm:p-4 border border-white/15',
    'meta_icon' => 'p-2.5 sm:p-3 bg-brand-500 rounded-lg mr-3 shadow-sm shrink-0',
    'meta_label' => 'text-[10px] sm:text-xs text-brand-100 font-semibold uppercase tracking-wider',
    'meta_value' => 'font-semibold text-sm sm:text-base',
];

```

---

## File: templates/frontend/hero/spotlight.php

```php
<?php
if (!defined('ABSPATH')) {
    exit;
}

return [
    'container' => 'transition-all duration-700 ease-out relative sm:rounded-2xl overflow-hidden mb-6 sm:mb-8 shadow-sm group bg-gray-900 flex flex-col justify-center min-h-[58vh] sm:min-h-[460px]',
    'image' => 'absolute inset-0 w-full h-full object-cover transition-transform duration-1000 sm:group-hover:scale-105 opacity-80',
    'fallback' => 'absolute inset-0 w-full h-full bg-gradient-to-br from-gray-800 to-gray-950 transition-transform duration-1000 sm:group-hover:scale-105',
    'overlay' => 'absolute inset-0 bg-[radial-gradient(circle_at_center,rgba(var(--eep-primary-rgb),0.12),rgba(2,6,23,0.9)_58%)]',
    'content' => 'relative z-10 p-5 sm:p-8 lg:p-12 w-full max-w-4xl mx-auto text-center',
    'kicker' => 'inline-flex items-center px-3 py-1 rounded-full bg-white/15 text-white text-xs font-semibold uppercase tracking-[0.16em] backdrop-blur-sm border border-white/25',
    'title' => 'text-3xl sm:text-5xl lg:text-6xl font-bold text-white mb-3 sm:mb-4 leading-tight tracking-tight drop-shadow-lg',
    'subtitle' => 'text-gray-100 text-base sm:text-lg max-w-2xl mx-auto mb-6 leading-relaxed',
    'meta_wrap' => 'flex flex-col sm:flex-row justify-center gap-3 sm:gap-4 text-white',
    'meta_card' => 'flex items-center justify-center bg-white/10 backdrop-blur-md rounded-xl p-3 sm:p-4 border border-white/15',
    'meta_icon' => 'p-2.5 sm:p-3 bg-brand-500 rounded-lg mr-3 shadow-sm shrink-0',
    'meta_label' => 'text-[10px] sm:text-xs text-brand-100 font-semibold uppercase tracking-wider',
    'meta_value' => 'font-semibold text-sm sm:text-base',
];

```

---

## File: templates/frontend/layout/bento.php

```php
<?php
if (!defined('ABSPATH')) {
    exit;
}

return [
    // 12-column grid, but tightly packed gaps (gap-4/6) to create a cohesive 'bento box' feel.
    'grid' => 'grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-12 auto-rows-max gap-4 sm:gap-6 px-4 sm:px-0 relative w-full',
    
    // Main takes 8 columns and stretches across 2 rows for heavy visual weight.
    'main' => 'sm:col-span-2 lg:col-span-8 lg:row-span-2 space-y-4 flex flex-col min-w-0 order-1',
    
    // Aside takes 4 columns. We set it as an internal grid to stack its own widgets.
    'aside' => 'sm:col-span-2 lg:col-span-4 grid grid-cols-1 gap-4 sm:gap-6 order-2',
    
    // Keeps the inner widgets spaced tightly.
    'aside_inner' => 'space-y-4 w-full',
];
```

---

## File: templates/frontend/layout/editorial.php

```php
<?php
if (!defined('ABSPATH')) {
    exit;
}

return [
    // Added 'relative w-full' for stability. Standardized the gaps to scale 
    // smoothly from mobile (gap-6) to tablet (gap-8) to desktop (gap-10).
    'grid' => 'grid grid-cols-1 lg:grid-cols-12 gap-6 sm:gap-8 lg:gap-10 px-4 sm:px-0 relative w-full',
    
    // Preserved the critical ordering (order-2 on mobile, order-1 on desktop).
    // Added 'min-w-0' to prevent CSS grid overflow from long text/URLs.
    'main' => 'lg:col-span-8 space-y-6 sm:space-y-8 flex flex-col min-w-0 order-2 lg:order-1',
    
    // Preserved the ordering (order-1 on mobile, order-2 on desktop).
    // Synced the vertical rhythm (space-y) to match the main column.
    'aside' => 'lg:col-span-4 space-y-6 sm:space-y-8 order-1 lg:order-2',
    
    // Kept the 'lg:' prefix so it only sticks when side-by-side. 
    // Added smooth transitions, an 'xl' offset, and 'pb-8' to prevent footer collisions.
    'aside_inner' => 'lg:sticky lg:top-24 xl:top-28 space-y-6 sm:space-y-8 transition-transform duration-300 ease-in-out pb-8',
];
```

---

## File: templates/frontend/layout/fifty-fifty.php

```php
<?php
if (!defined('ABSPATH')) {
    exit;
}

return [
    'grid' => 'grid grid-cols-1 lg:grid-cols-2 gap-6 sm:gap-8 lg:gap-10 px-4 sm:px-0 relative w-full',
    'main' => 'space-y-6 sm:space-y-8 flex flex-col min-w-0',
    'aside' => 'space-y-6 sm:space-y-8',
    'aside_inner' => 'lg:sticky lg:top-24 xl:top-28 space-y-6 sm:space-y-8 transition-transform duration-300 ease-in-out pb-8',
];

```

---

## File: templates/frontend/layout/full3.php

```php
<?php
if (!defined('ABSPATH')) {
    exit;
}

return [
    // Simple vertical stack with large vertical spacing between sections.
    'grid' => 'flex flex-col gap-12 lg:gap-20 px-4 sm:px-0 relative w-full',
    
    // Full width layout. Perfect for a wide slider or panoramic narrative.
    'main' => 'w-full space-y-6 sm:space-y-10 flex flex-col min-w-0 order-1',
    
    // Morphs into a 3-column layout on desktop to handle the smaller, grouped details.
    'aside' => 'w-full grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 sm:gap-10 order-2',
    
    // Ensures all 3 columns stretch to the same height if cards/boxes are used inside.
    'aside_inner' => 'h-full flex flex-col',
];
```

---

## File: templates/frontend/layout/left-sidebar.php

```php
<?php
if (!defined('ABSPATH')) {
    exit;
}

return [
    // Standardized 12-col grid, but slightly wider gaps for editorial breathing room.
    'grid' => 'grid grid-cols-1 lg:grid-cols-12 gap-8 lg:gap-12 px-4 sm:px-0 relative w-full',
    
    // Wider 9-column span. Order 1 on mobile (content first), order 2 on desktop (right side).
    'main' => 'lg:col-span-9 space-y-6 sm:space-y-8 flex flex-col min-w-0 order-1 lg:order-2',
    
    // Narrow 3-column span. Order 2 on mobile (drops to bottom), order 1 on desktop (left side).
    'aside' => 'lg:col-span-3 space-y-6 sm:space-y-8 order-2 lg:order-1',
    
    // Maintained the sticky behavior, but adjusted top offset for a slightly higher anchor.
    'aside_inner' => 'lg:sticky lg:top-20 xl:top-24 space-y-6 sm:space-y-8 transition-transform duration-300 ease-in-out pb-8',
];
```

---

## File: templates/frontend/layout/modern.php

```php
<?php
if (!defined('ABSPATH')) {
    exit;
}

return [
    // Added 'relative w-full' for container stability.
    // Extended the gap scaling to include lg:gap-10 for breathing room on larger monitors.
    'grid' => 'grid grid-cols-1 lg:grid-cols-3 gap-6 sm:gap-8 lg:gap-10 px-4 sm:px-0 relative w-full',
    
    // Added 'min-w-0' to prevent CSS grid overflow from long text/URLs (critical for 
    // user-generated content) and 'flex flex-col' for inner alignment.
    'main' => 'lg:col-span-2 space-y-6 sm:space-y-8 flex flex-col min-w-0',
    
    // Synced the vertical rhythm to match the main column perfectly.
    'aside' => 'lg:col-span-1 space-y-6 sm:space-y-8',
    
    // Upgraded the sticky behavior with a responsive top offset (sm:top-28), 
    // smooth transitions, and bottom padding (pb-8) to avoid hard-stopping at the footer.
    'aside_inner' => 'sticky top-24 sm:top-28 space-y-6 sm:space-y-8 transition-transform duration-300 ease-in-out pb-8',
];
```

---

## File: templates/frontend/layout/single-column.php

```php
<?php
if (!defined('ABSPATH')) {
    exit;
}

return [
    // Added 'relative w-full' for stability and extended the gap scaling 
    // to lg:gap-10 to give distinct sections more breathing room on desktop.
    'grid' => 'grid grid-cols-1 gap-6 sm:gap-8 lg:gap-10 px-4 sm:px-0 relative w-full',
    
    // Added 'min-w-0' to prevent horizontal blowout from long text/URLs 
    // and 'flex flex-col' for consistent internal alignment.
    'main' => 'space-y-6 sm:space-y-8 flex flex-col min-w-0',
    
    // Synced the vertical spacing to match the main column perfectly.
    'aside' => 'space-y-6 sm:space-y-8',
    
    // Since this is a single-column layout, sticky positioning is completely removed 
    // to prevent weird scrolling behavior. Just matched the vertical rhythm.
    'aside_inner' => 'space-y-6 sm:space-y-8',
];
```

---

## File: templates/frontend/layout/zen.php

```php
<?php
if (!defined('ABSPATH')) {
    exit;
}

return [
    // Flexbox container centering everything.
    'grid' => 'flex flex-col items-center gap-12 lg:gap-16 px-4 sm:px-0 relative w-full',
    
    // Constrained width (max-w-4xl) for optimal reading line length.
    'main' => 'w-full max-w-4xl space-y-8 flex flex-col min-w-0 order-1',
    
    // The "aside" becomes a 2-column grid sitting beneath the main content area.
    'aside' => 'w-full max-w-4xl grid grid-cols-1 sm:grid-cols-2 gap-6 sm:gap-8 order-2',
    
    // Clean wrapper for the grid items inside the aside.
    'aside_inner' => 'h-full flex flex-col space-y-4',
];
```

---

## File: templates/frontend/layout/zig-zag.php

```php
<?php
if (!defined('ABSPATH')) {
    exit;
}

return [
    // Swapped to a strict 2-column grid. Added 'items-center' so short text centers alongside tall images.
    'grid' => 'grid grid-cols-1 lg:grid-cols-2 gap-8 lg:gap-16 px-4 sm:px-0 relative w-full items-center',
    
    // Takes up exactly half the screen. Removed flex-col if you want content to naturally flow.
    'main' => 'space-y-6 sm:space-y-8 min-w-0 order-1',
    
    // Takes the other half. Drops underneath on mobile.
    'aside' => 'space-y-6 sm:space-y-8 order-2 lg:order-2',
    
    // Dropped sticky behavior here as 50/50 splits usually scroll together.
    'aside_inner' => 'relative w-full h-full',
];
```

---

## File: templates/admin/settings/sections/tab-design-maps.php

```php
                <section class="eep-settings-panel" id="eep-tab-design" data-tab="design-maps" data-subtab="branding">
                    <h2><?php esc_html_e('Branding & Typography', 'nexdirectory'); ?></h2>
                    <p class="eep-settings-subheading"><?php esc_html_e('Tune accent colors, fallback visuals, and typography foundations used across archive, map, account, and listing pages.', 'nexdirectory'); ?></p>

                    <div class="eep-settings-grid">
                        <div class="eep-settings-field eep-full">
                            <h3 class="eep-settings-core-title"><span class="dashicons dashicons-art" aria-hidden="true"></span><?php esc_html_e('Brand Defaults', 'nexdirectory'); ?></h3>
                            <div class="eep-settings-field">
                                <label for="eep_company_brand_name"><?php esc_html_e('Company / Event / Brand Name', 'nexdirectory'); ?></label>
                                <input type="text" id="eep_company_brand_name" name="eep_company_brand_name" value="<?php echo esc_attr((string) get_option('eep_company_brand_name', '')); ?>" placeholder="<?php echo esc_attr((string) get_option('blogname', get_bloginfo('name'))); ?>">
                                <p class="description"><?php esc_html_e('Global source-of-truth brand name used in emails, navigation, previews, and platform labels when a specific override is not set.', 'nexdirectory'); ?></p>
                            </div>
                            <div class="eep-settings-toggle-item" style="margin-bottom: 10px;">
                                <input type="hidden" name="eep_style_use_theme_defaults" value="0">
                                <label><input type="checkbox" name="eep_style_use_theme_defaults" value="1" <?php checked((string) get_option('eep_style_use_theme_defaults', '0'), '1'); ?>> <?php esc_html_e('Use website typography defaults', 'nexdirectory'); ?></label>
                                <p class="description"><?php esc_html_e('When enabled, the directory inherits your main WordPress theme fonts instead of custom selections below.', 'nexdirectory'); ?></p>
                            </div>
                            <div class="eep-settings-grid">
                                <div class="eep-settings-field">
                                    <label for="eep_style_accent_color"><?php esc_html_e('Accent Color', 'nexdirectory'); ?></label>
                                    <div class="eep-settings-inline">
                                        <input type="color" id="eep_style_accent_color" name="eep_style_accent_color" value="<?php echo esc_attr((string) get_option('eep_style_accent_color', '#FF5E14')); ?>">
                                        <input type="text" readonly value="<?php echo esc_attr((string) get_option('eep_style_accent_color', '#FF5E14')); ?>">
                                    </div>
                                </div>
                                <div class="eep-settings-field">
                                    <label for="eep_style_accent_hover_color"><?php esc_html_e('Accent Hover Color', 'nexdirectory'); ?></label>
                                    <div class="eep-settings-inline">
                                        <input type="color" id="eep_style_accent_hover_color" name="eep_style_accent_hover_color" value="<?php echo esc_attr((string) get_option('eep_style_accent_hover_color', '#E04F0D')); ?>">
                                        <input type="text" readonly value="<?php echo esc_attr((string) get_option('eep_style_accent_hover_color', '#E04F0D')); ?>">
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="eep-settings-field">
                            <h3 class="eep-settings-core-title"><span class="dashicons dashicons-format-image" aria-hidden="true"></span><?php esc_html_e('Favicon', 'nexdirectory'); ?></h3>
                            <p class="description"><?php esc_html_e('Recommended square image, ideally 512x512 for crisp browser tabs.', 'nexdirectory'); ?></p>

                            <input type="hidden" id="eep_style_favicon_url" name="eep_style_favicon_url" value="<?php echo esc_attr($favicon_url); ?>">
                            <div class="eep-media-picker" data-eep-media-picker data-eep-media-target="#eep_style_favicon_url" data-eep-media-multiple="0" data-eep-upload-target="cover">
                                <button type="button" class="eep-media-dropzone" data-eep-media-open>
                                    <span class="dashicons dashicons-format-image" aria-hidden="true"></span>
                                    <strong><?php esc_html_e('Drag and drop favicon here', 'nexdirectory'); ?></strong>
                                    <span><?php esc_html_e('or click to choose from Media Library', 'nexdirectory'); ?></span>
                                </button>
                                <input type="file" accept="image/*" hidden data-eep-media-file-input>

                                <div class="eep-fallback-preview-single eep-media-gallery" id="eep-favicon-preview">
                                    <?php if ($favicon_url !== '') : ?>
                                        <div class="eep-media-tile" data-eep-media-url="<?php echo esc_attr($favicon_url); ?>">
                                            <img src="<?php echo esc_url($favicon_url); ?>" alt="<?php esc_attr_e('Favicon', 'nexdirectory'); ?>">
                                            <button type="button" class="eep-media-remove" data-eep-media-remove aria-label="<?php esc_attr_e('Remove image', 'nexdirectory'); ?>">&times;</button>
                                        </div>
                                    <?php endif; ?>
                                </div>
                                <p class="description eep-media-feedback" data-eep-media-feedback></p>
                            </div>
                        </div>

                        <div class="eep-settings-field">
                            <h3 class="eep-settings-core-title"><span class="dashicons dashicons-images-alt2" aria-hidden="true"></span><?php esc_html_e('Fallback Thumbnail Images', 'nexdirectory'); ?></h3>
                            <p class="description"><?php esc_html_e('If multiple are listed, fallback thumbnails rotate for variety.', 'nexdirectory'); ?></p>

                            <textarea id="eep_style_fallback_thumb_url" name="eep_style_fallback_thumb_url" rows="4" hidden><?php echo esc_textarea(implode("\n", $thumb_fallback_urls)); ?></textarea>
                            <div class="eep-media-picker eep-media-picker-multi" data-eep-media-picker data-eep-media-target="#eep_style_fallback_thumb_url" data-eep-media-multiple="1" data-eep-upload-target="gallery">
                                <button type="button" class="eep-media-dropzone" data-eep-media-open>
                                    <span class="dashicons dashicons-format-gallery" aria-hidden="true"></span>
                                    <strong><?php esc_html_e('Drag and drop images here', 'nexdirectory'); ?></strong>
                                    <span><?php esc_html_e('or click to choose from Media Library', 'nexdirectory'); ?></span>
                                </button>
                                <input type="file" accept="image/*" multiple hidden data-eep-media-file-input>

                                <div class="eep-fallback-preview-grid eep-media-gallery" id="eep-fallback-thumb-preview">
                                    <?php foreach ($thumb_fallback_urls as $thumb_url) : ?>
                                        <div class="eep-media-tile" data-eep-media-url="<?php echo esc_attr($thumb_url); ?>">
                                            <img src="<?php echo esc_url($thumb_url); ?>" alt="<?php esc_attr_e('Fallback thumbnail', 'nexdirectory'); ?>">
                                            <button type="button" class="eep-media-remove" data-eep-media-remove aria-label="<?php esc_attr_e('Remove image', 'nexdirectory'); ?>">&times;</button>
                                        </div>
                                    <?php endforeach; ?>
                                </div>
                                <p class="description eep-media-feedback" data-eep-media-feedback></p>
                            </div>
                        </div>

                        <div class="eep-settings-field eep-full">
                            <details class="eep-settings-accordion" open>
                                <summary><?php esc_html_e('Advanced Typography, Spacing, and Radius Controls', 'nexdirectory'); ?></summary>
                                <div class="eep-settings-grid">
                                    <?php
                                    $adv_fields = [
                                        ['id' => 'eep_style_font_family', 'label' => __('Body Font Family', 'nexdirectory'), 'presets' => $font_presets, 'preset_val' => $body_font_preset, 'val' => $body_font_value, 'ph' => __('Custom font-family stack', 'nexdirectory')],
                                        ['id' => 'eep_style_display_font_family', 'label' => __('Display Font Family', 'nexdirectory'), 'presets' => $display_font_presets, 'preset_val' => $display_font_preset, 'val' => $display_font_value, 'ph' => __('Custom display font stack', 'nexdirectory')],
                                        ['id' => 'eep_style_font_size_base', 'label' => __('Base Font Size', 'nexdirectory'), 'presets' => $font_size_presets, 'preset_val' => $base_font_size_preset, 'val' => $base_font_size_value, 'ph' => '18px'],
                                        ['id' => 'eep_style_h2_size', 'label' => __('H2 Size', 'nexdirectory'), 'presets' => $h2_size_presets, 'preset_val' => $h2_size_preset, 'val' => $h2_size_value, 'ph' => '1.75rem'],
                                        ['id' => 'eep_style_h3_size', 'label' => __('H3 Size', 'nexdirectory'), 'presets' => $h3_size_presets, 'preset_val' => $h3_size_preset, 'val' => $h3_size_value, 'ph' => '1.35rem'],
                                        ['id' => 'eep_style_font_weight_body', 'label' => __('Body Font Weight', 'nexdirectory'), 'presets' => $font_weight_presets, 'preset_val' => $body_weight_preset, 'val' => $body_weight_value, 'ph' => '400'],
                                        ['id' => 'eep_style_font_weight_heading', 'label' => __('Heading Font Weight', 'nexdirectory'), 'presets' => $font_weight_presets, 'preset_val' => $heading_weight_preset, 'val' => $heading_weight_value, 'ph' => '700'],
                                        ['id' => 'eep_style_spacing_unit', 'label' => __('Base Spacing Unit', 'nexdirectory'), 'presets' => $spacing_unit_presets, 'preset_val' => $spacing_unit_preset, 'val' => $spacing_unit_value, 'ph' => '16px'],
                                        ['id' => 'eep_style_spacing_scale', 'label' => __('Global Spacing Scale', 'nexdirectory'), 'presets' => $spacing_scale_presets, 'preset_val' => $spacing_scale_preset, 'val' => $spacing_scale_value, 'ph' => '1', 'desc' => __('Controls overall spacing density across listing, map, and dashboard layouts.', 'nexdirectory')],
                                        ['id' => 'eep_style_radius_md', 'label' => __('Corner Radius (Standard)', 'nexdirectory'), 'presets' => $radius_presets, 'preset_val' => $radius_md_preset, 'val' => $radius_md_value, 'ph' => '12px'],
                                        ['id' => 'eep_style_radius_lg', 'label' => __('Corner Radius (Large)', 'nexdirectory'), 'presets' => $radius_presets, 'preset_val' => $radius_lg_preset, 'val' => $radius_lg_value, 'ph' => '24px'],
                                    ];
                                    ?>
                                    <?php foreach ($adv_fields as $f) : ?>
                                        <div class="eep-settings-field">
                                            <label for="<?php echo esc_attr($f['id']); ?>"><?php echo esc_html((string) $f['label']); ?></label>
                                            <div class="eep-settings-select-helper">
                                                <select data-eep-preset-target="#<?php echo esc_attr($f['id']); ?>">
                                                    <?php
                                                    $is_assoc = array_keys($f['presets']) !== range(0, count($f['presets']) - 1);
                                                    foreach ($f['presets'] as $k => $v) :
                                                        $opt_val = $is_assoc ? $k : $v;
                                                        $opt_lbl = $v;
                                                        ?>
                                                        <option value="<?php echo esc_attr((string) $opt_val); ?>" <?php selected((string) $f['preset_val'], (string) $opt_val); ?>><?php echo esc_html((string) $opt_lbl); ?></option>
                                                    <?php endforeach; ?>
                                                    <option value="custom" <?php selected((string) $f['preset_val'], 'custom'); ?>><?php esc_html_e('Custom', 'nexdirectory'); ?></option>
                                                </select>
                                                <input type="text" id="<?php echo esc_attr($f['id']); ?>" name="<?php echo esc_attr($f['id']); ?>" value="<?php echo esc_attr((string) $f['val']); ?>" placeholder="<?php echo esc_attr((string) $f['ph']); ?>">
                                            </div>
                                            <?php if (!empty($f['desc'])) : ?>
                                                <p class="description"><?php echo esc_html((string) $f['desc']); ?></p>
                                            <?php endif; ?>
                                        </div>
                                    <?php endforeach; ?>
                                </div>
                            </details>
                        </div>
                    </div>
                </section>

                <section class="eep-settings-panel" id="eep-tab-heros" data-tab="design-maps" data-subtab="heros">
                    <h2><?php esc_html_e('Heroes', 'nexdirectory'); ?></h2>
                    <p class="eep-settings-subheading"><?php esc_html_e('Manage single listing hero defaults, motion behavior, and fallback hero imagery.', 'nexdirectory'); ?></p>

                    <div class="eep-settings-grid">
                        <div class="eep-settings-field">
                            <label for="eep_event_hero_kicker_text"><?php esc_html_e('Single Listing Hero Kicker Text', 'nexdirectory'); ?></label>
                            <p class="description"><?php esc_html_e('Small uppercase label shown above the listing title.', 'nexdirectory'); ?></p>
                            <input type="text" id="eep_event_hero_kicker_text" name="eep_event_hero_kicker_text" value="<?php echo esc_attr((string) get_option('eep_event_hero_kicker_text', $this->get_white_label_brand_name())); ?>">
                        </div>

                        <div class="eep-settings-field">
                            <input type="hidden" name="eep_enable_hero_parallax" value="0">
                            <label><input type="checkbox" name="eep_enable_hero_parallax" value="1" <?php checked((string) get_option('eep_enable_hero_parallax', '1'), '1'); ?>> <?php esc_html_e('Enable single-listing hero parallax motion', 'nexdirectory'); ?></label>
                            <p class="description"><?php esc_html_e('If disabled, hero images stay static on desktop and mobile.', 'nexdirectory'); ?></p>
                        </div>

                        <div class="eep-settings-field eep-full">
                            <label for="eep_event_hero_layout"><?php esc_html_e('Single Listing Hero Layout', 'nexdirectory'); ?></label>
                            <select id="eep_event_hero_layout" name="eep_event_hero_layout" data-eep-visual-select="hero-layout">
                                <option value="cinematic" <?php selected((string) get_option('eep_event_hero_layout', 'cinematic'), 'cinematic'); ?>><?php esc_html_e('Cinematic', 'nexdirectory'); ?></option>
                                <option value="compact" <?php selected((string) get_option('eep_event_hero_layout', 'cinematic'), 'compact'); ?>><?php esc_html_e('Compact', 'nexdirectory'); ?></option>
                                <option value="split" <?php selected((string) get_option('eep_event_hero_layout', 'cinematic'), 'split'); ?>><?php esc_html_e('Split Focus', 'nexdirectory'); ?></option>
                                <option value="minimal" <?php selected((string) get_option('eep_event_hero_layout', 'cinematic'), 'minimal'); ?>><?php esc_html_e('Minimal', 'nexdirectory'); ?></option>
                                <option value="immersive" <?php selected((string) get_option('eep_event_hero_layout', 'cinematic'), 'immersive'); ?>><?php esc_html_e('Immersive', 'nexdirectory'); ?></option>
                                <option value="spotlight" <?php selected((string) get_option('eep_event_hero_layout', 'cinematic'), 'spotlight'); ?>><?php esc_html_e('Spotlight', 'nexdirectory'); ?></option>
                            </select>
                        </div>

                        <div class="eep-settings-field eep-full">
                            <label for="eep_style_fallback_hero_url"><?php esc_html_e('Fallback Hero Image', 'nexdirectory'); ?></label>
                            <input type="hidden" id="eep_style_fallback_hero_url" name="eep_style_fallback_hero_url" value="<?php echo esc_attr($hero_fallback_url); ?>">
                            <div class="eep-media-picker" data-eep-media-picker data-eep-media-target="#eep_style_fallback_hero_url" data-eep-media-multiple="0" data-eep-upload-target="cover">
                                <button type="button" class="eep-media-dropzone" data-eep-media-open>
                                    <span class="dashicons dashicons-format-image" aria-hidden="true"></span>
                                    <strong><?php esc_html_e('Drag and drop hero image here', 'nexdirectory'); ?></strong>
                                    <span><?php esc_html_e('or click to choose from Media Library', 'nexdirectory'); ?></span>
                                </button>
                                <input type="file" accept="image/*" hidden data-eep-media-file-input>
                                <div class="eep-fallback-preview-single eep-media-gallery" id="eep-fallback-hero-preview">
                                    <?php if ($hero_fallback_url !== '') : ?>
                                        <div class="eep-media-tile" data-eep-media-url="<?php echo esc_attr($hero_fallback_url); ?>">
                                            <img src="<?php echo esc_url($hero_fallback_url); ?>" alt="<?php esc_attr_e('Fallback hero', 'nexdirectory'); ?>">
                                            <button type="button" class="eep-media-remove" data-eep-media-remove aria-label="<?php esc_attr_e('Remove image', 'nexdirectory'); ?>">&times;</button>
                                        </div>
                                    <?php endif; ?>
                                </div>
                                <p class="description eep-media-feedback" data-eep-media-feedback></p>
                            </div>
                        </div>
                    </div>
                </section>

                <section class="eep-settings-panel" id="eep-tab-layouts" data-tab="design-maps" data-subtab="layouts">
                    <h2><?php esc_html_e('Page Layouts', 'nexdirectory'); ?></h2>
                    <p class="eep-settings-subheading"><?php esc_html_e('Configure single page layouts and global page spacing.', 'nexdirectory'); ?></p>

                    <div class="eep-settings-grid">
                        <div class="eep-settings-field eep-full">
                            <label for="eep_design_preset_select"><?php esc_html_e('Visual Preset', 'nexdirectory'); ?></label>
                            <select id="eep_design_preset_select" data-eep-design-preset-select>
                                <option value=""><?php esc_html_e('Select a preset...', 'nexdirectory'); ?></option>
                                <option value="launchpad-modern"><?php esc_html_e('Launchpad Modern', 'nexdirectory'); ?></option>
                                <option value="minimal-focus"><?php esc_html_e('Minimal Focus', 'nexdirectory'); ?></option>
                                <option value="editorial-story"><?php esc_html_e('Editorial Story', 'nexdirectory'); ?></option>
                                <option value="executive-spotlight"><?php esc_html_e('Executive Spotlight', 'nexdirectory'); ?></option>
                                <option value="immersive-showcase"><?php esc_html_e('Immersive Showcase', 'nexdirectory'); ?></option>
                                <option value="compact-control"><?php esc_html_e('Compact Control', 'nexdirectory'); ?></option>
                                <option value="zen-clean"><?php esc_html_e('Zen Clean', 'nexdirectory'); ?></option>
                                <option value="bold-campaign"><?php esc_html_e('Bold Campaign', 'nexdirectory'); ?></option>
                                <option value="gallery-plus"><?php esc_html_e('Gallery Plus', 'nexdirectory'); ?></option>
                                <option value="professional-default"><?php esc_html_e('Professional Default', 'nexdirectory'); ?></option>
                            </select>
                            <p class="description"><?php esc_html_e('Applies Hero Template, Page Layout, and Design Token values in one step. You can still fine-tune fields after applying.', 'nexdirectory'); ?></p>
                            <div class="eep-settings-preset-bar">
                                <button type="button" class="button button-secondary" data-eep-design-preset-apply><?php esc_html_e('Apply Preset', 'nexdirectory'); ?></button>
                                <span class="eep-settings-preset-status" data-eep-design-preset-status aria-live="polite"></span>
                            </div>
                        </div>

                        <div class="eep-settings-field eep-full">
                            <label for="eep_event_page_layout"><?php esc_html_e('Single Listing Page Layout', 'nexdirectory'); ?></label>
                            <?php $single_page_layout_value = $this->sanitize_event_page_layout_option((string) get_option('eep_event_page_layout', 'modern')); ?>
                            <select id="eep_event_page_layout" name="eep_event_page_layout" data-eep-visual-select="single-layout">
                                <option value="modern" <?php selected($single_page_layout_value, 'modern'); ?>><?php esc_html_e('Modern (Default)', 'nexdirectory'); ?></option>
                                <option value="fifty-fifty" <?php selected($single_page_layout_value, 'fifty-fifty'); ?>><?php esc_html_e('50/50', 'nexdirectory'); ?></option>
                                <option value="single-column" <?php selected($single_page_layout_value, 'single-column'); ?>><?php esc_html_e('Single Column', 'nexdirectory'); ?></option>
                                <option value="editorial" <?php selected($single_page_layout_value, 'editorial'); ?>><?php esc_html_e('Editorial', 'nexdirectory'); ?></option>
                                <option value="left-sidebar" <?php selected($single_page_layout_value, 'left-sidebar'); ?>><?php esc_html_e('Left Sidebar', 'nexdirectory'); ?></option>
                                <option value="zig-zag" <?php selected($single_page_layout_value, 'zig-zag'); ?>><?php esc_html_e('Zig Zag', 'nexdirectory'); ?></option>
                                <option value="full3" <?php selected($single_page_layout_value, 'full3'); ?>><?php esc_html_e('Full 3', 'nexdirectory'); ?></option>
                                <option value="zen" <?php selected($single_page_layout_value, 'zen'); ?>><?php esc_html_e('Zen', 'nexdirectory'); ?></option>
                            </select>
                        </div>

                        <div class="eep-settings-field eep-full">
                            <label for="eep_event_gallery_type"><?php esc_html_e('Single Listing Gallery Style', 'nexdirectory'); ?></label>
                            <?php $single_gallery_type_value = $this->sanitize_event_gallery_type_option((string) get_option('eep_event_gallery_type', 'default')); ?>
                            <select id="eep_event_gallery_type" name="eep_event_gallery_type">
                                <option value="default" <?php selected($single_gallery_type_value, 'default'); ?>><?php esc_html_e('Default', 'nexdirectory'); ?></option>
                                <option value="carousel" <?php selected($single_gallery_type_value, 'carousel'); ?>><?php esc_html_e('Carousel', 'nexdirectory'); ?></option>
                                <option value="wall" <?php selected($single_gallery_type_value, 'wall'); ?>><?php esc_html_e('Wall (Masonry)', 'nexdirectory'); ?></option>
                            </select>
                            <p class="description"><?php esc_html_e('Controls the image gallery style on single listing pages.', 'nexdirectory'); ?></p>
                        </div>

                        <div class="eep-settings-field eep-full">
                            <h3 class="eep-settings-core-title"><span class="dashicons dashicons-art" aria-hidden="true"></span><?php esc_html_e('Design Tokens (Quick Styling)', 'nexdirectory'); ?></h3>
                            <p class="description"><?php esc_html_e('These controls affect card styling, buttons, fields, spacing density, and overall content width across frontend pages.', 'nexdirectory'); ?></p>
                            <div class="eep-settings-grid">
                                <div class="eep-settings-field">
                                    <label for="eep_style_box_style"><?php esc_html_e('Box / Card Style', 'nexdirectory'); ?></label>
                                    <select id="eep_style_box_style" name="eep_style_box_style">
                                        <option value="default" <?php selected($style_box_style_value, 'default'); ?>><?php esc_html_e('Default', 'nexdirectory'); ?></option>
                                        <option value="gradient" <?php selected($style_box_style_value, 'gradient'); ?>><?php esc_html_e('Gradient', 'nexdirectory'); ?></option>
                                        <option value="bold" <?php selected($style_box_style_value, 'bold'); ?>><?php esc_html_e('Bold Accent', 'nexdirectory'); ?></option>
                                        <option value="neumorphic" <?php selected($style_box_style_value, 'neumorphic'); ?>><?php esc_html_e('Neumorphic', 'nexdirectory'); ?></option>
                                    </select>
                                    <div class="eep-design-choice-grid" data-eep-choice-grid data-eep-select="#eep_style_box_style">
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="default">
                                            <span class="eep-design-choice-swatch eep-swatch-box-default" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Default', 'nexdirectory'); ?></strong>
                                            <span><?php esc_html_e('Clean white cards with subtle borders.', 'nexdirectory'); ?></span>
                                        </button>
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="gradient">
                                            <span class="eep-design-choice-swatch eep-swatch-box-gradient" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Gradient', 'nexdirectory'); ?></strong>
                                            <span><?php esc_html_e('Soft brand-tinted card background.', 'nexdirectory'); ?></span>
                                        </button>
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="bold">
                                            <span class="eep-design-choice-swatch eep-swatch-box-bold" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Bold Accent', 'nexdirectory'); ?></strong>
                                            <span><?php esc_html_e('Stronger border and highlight treatment.', 'nexdirectory'); ?></span>
                                        </button>
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="neumorphic">
                                            <span class="eep-design-choice-swatch eep-swatch-box-neumorphic" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Neumorphic', 'nexdirectory'); ?></strong>
                                            <span><?php esc_html_e('Soft lifted cards with minimal border.', 'nexdirectory'); ?></span>
                                        </button>
                                    </div>
                                </div>

                                <div class="eep-settings-field">
                                    <label for="eep_style_button_style"><?php esc_html_e('Button Style', 'nexdirectory'); ?></label>
                                    <select id="eep_style_button_style" name="eep_style_button_style">
                                        <option value="solid" <?php selected($style_button_style_value, 'solid'); ?>><?php esc_html_e('Solid', 'nexdirectory'); ?></option>
                                        <option value="outline" <?php selected($style_button_style_value, 'outline'); ?>><?php esc_html_e('Outline', 'nexdirectory'); ?></option>
                                        <option value="soft" <?php selected($style_button_style_value, 'soft'); ?>><?php esc_html_e('Soft', 'nexdirectory'); ?></option>
                                        <option value="dark" <?php selected($style_button_style_value, 'dark'); ?>><?php esc_html_e('Dark', 'nexdirectory'); ?></option>
                                    </select>
                                    <div class="eep-design-choice-grid" data-eep-choice-grid data-eep-select="#eep_style_button_style">
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="solid">
                                            <span class="eep-design-choice-swatch eep-swatch-btn-solid" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Solid', 'nexdirectory'); ?></strong>
                                            <span><?php esc_html_e('Primary filled call-to-action buttons.', 'nexdirectory'); ?></span>
                                        </button>
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="outline">
                                            <span class="eep-design-choice-swatch eep-swatch-btn-outline" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Outline', 'nexdirectory'); ?></strong>
                                            <span><?php esc_html_e('Transparent buttons with strong borders.', 'nexdirectory'); ?></span>
                                        </button>
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="soft">
                                            <span class="eep-design-choice-swatch eep-swatch-btn-soft" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Soft', 'nexdirectory'); ?></strong>
                                            <span><?php esc_html_e('Muted filled buttons for calmer UI.', 'nexdirectory'); ?></span>
                                        </button>
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="dark">
                                            <span class="eep-design-choice-swatch eep-swatch-btn-dark" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Dark', 'nexdirectory'); ?></strong>
                                            <span><?php esc_html_e('High contrast dark action styling.', 'nexdirectory'); ?></span>
                                        </button>
                                    </div>
                                </div>

                                <div class="eep-settings-field">
                                    <label for="eep_style_button_radius_mode"><?php esc_html_e('Button Corner Shape', 'nexdirectory'); ?></label>
                                    <select id="eep_style_button_radius_mode" name="eep_style_button_radius_mode">
                                        <option value="inherit" <?php selected($style_button_radius_mode_value, 'inherit'); ?>><?php esc_html_e('Default', 'nexdirectory'); ?></option>
                                        <option value="pill" <?php selected($style_button_radius_mode_value, 'pill'); ?>><?php esc_html_e('Pill', 'nexdirectory'); ?></option>
                                        <option value="sharp" <?php selected($style_button_radius_mode_value, 'sharp'); ?>><?php esc_html_e('Sharp', 'nexdirectory'); ?></option>
                                    </select>
                                    <div class="eep-design-choice-grid eep-design-choice-grid-compact" data-eep-choice-grid data-eep-select="#eep_style_button_radius_mode">
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="inherit">
                                            <span class="eep-design-choice-swatch eep-swatch-radius-inherit" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Default', 'nexdirectory'); ?></strong>
                                        </button>
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="pill">
                                            <span class="eep-design-choice-swatch eep-swatch-radius-pill" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Pill', 'nexdirectory'); ?></strong>
                                        </button>
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="sharp">
                                            <span class="eep-design-choice-swatch eep-swatch-radius-sharp" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Sharp', 'nexdirectory'); ?></strong>
                                        </button>
                                    </div>
                                </div>

                                <div class="eep-settings-field">
                                    <label for="eep_style_input_style"><?php esc_html_e('Input Field Style', 'nexdirectory'); ?></label>
                                    <select id="eep_style_input_style" name="eep_style_input_style">
                                        <option value="outline" <?php selected($style_input_style_value, 'outline'); ?>><?php esc_html_e('Outline', 'nexdirectory'); ?></option>
                                        <option value="filled" <?php selected($style_input_style_value, 'filled'); ?>><?php esc_html_e('Filled', 'nexdirectory'); ?></option>
                                        <option value="underlined" <?php selected($style_input_style_value, 'underlined'); ?>><?php esc_html_e('Underlined', 'nexdirectory'); ?></option>
                                    </select>
                                    <div class="eep-design-choice-grid eep-design-choice-grid-compact" data-eep-choice-grid data-eep-select="#eep_style_input_style">
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="outline">
                                            <span class="eep-design-choice-swatch eep-swatch-input-outline" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Outline', 'nexdirectory'); ?></strong>
                                        </button>
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="filled">
                                            <span class="eep-design-choice-swatch eep-swatch-input-filled" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Filled', 'nexdirectory'); ?></strong>
                                        </button>
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="underlined">
                                            <span class="eep-design-choice-swatch eep-swatch-input-underlined" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Underlined', 'nexdirectory'); ?></strong>
                                        </button>
                                    </div>
                                </div>

                                <div class="eep-settings-field">
                                    <label for="eep_style_density_mode"><?php esc_html_e('Layout Density', 'nexdirectory'); ?></label>
                                    <select id="eep_style_density_mode" name="eep_style_density_mode">
                                        <option value="compact" <?php selected($style_density_mode_value, 'compact'); ?>><?php esc_html_e('Compact', 'nexdirectory'); ?></option>
                                        <option value="comfortable" <?php selected($style_density_mode_value, 'comfortable'); ?>><?php esc_html_e('Comfortable', 'nexdirectory'); ?></option>
                                        <option value="loose" <?php selected($style_density_mode_value, 'loose'); ?>><?php esc_html_e('Loose', 'nexdirectory'); ?></option>
                                    </select>
                                    <div class="eep-design-choice-grid eep-design-choice-grid-compact" data-eep-choice-grid data-eep-select="#eep_style_density_mode">
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="compact">
                                            <span class="eep-design-choice-swatch eep-swatch-density-compact" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Compact', 'nexdirectory'); ?></strong>
                                        </button>
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="comfortable">
                                            <span class="eep-design-choice-swatch eep-swatch-density-comfortable" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Comfortable', 'nexdirectory'); ?></strong>
                                        </button>
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="loose">
                                            <span class="eep-design-choice-swatch eep-swatch-density-loose" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Loose', 'nexdirectory'); ?></strong>
                                        </button>
                                    </div>
                                </div>

                                <div class="eep-settings-field">
                                    <label for="eep_style_border_mode"><?php esc_html_e('Border Emphasis', 'nexdirectory'); ?></label>
                                    <select id="eep_style_border_mode" name="eep_style_border_mode">
                                        <option value="minimal" <?php selected($style_border_mode_value, 'minimal'); ?>><?php esc_html_e('Minimal', 'nexdirectory'); ?></option>
                                        <option value="subtle" <?php selected($style_border_mode_value, 'subtle'); ?>><?php esc_html_e('Subtle', 'nexdirectory'); ?></option>
                                        <option value="strong" <?php selected($style_border_mode_value, 'strong'); ?>><?php esc_html_e('Strong', 'nexdirectory'); ?></option>
                                    </select>
                                    <div class="eep-design-choice-grid eep-design-choice-grid-compact" data-eep-choice-grid data-eep-select="#eep_style_border_mode">
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="minimal">
                                            <span class="eep-design-choice-swatch eep-swatch-border-minimal" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Minimal', 'nexdirectory'); ?></strong>
                                        </button>
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="subtle">
                                            <span class="eep-design-choice-swatch eep-swatch-border-subtle" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Subtle', 'nexdirectory'); ?></strong>
                                        </button>
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="strong">
                                            <span class="eep-design-choice-swatch eep-swatch-border-strong" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Strong', 'nexdirectory'); ?></strong>
                                        </button>
                                    </div>
                                </div>

                                <div class="eep-settings-field">
                                    <label for="eep_style_shadow_mode"><?php esc_html_e('Shadow Depth', 'nexdirectory'); ?></label>
                                    <select id="eep_style_shadow_mode" name="eep_style_shadow_mode">
                                        <option value="none" <?php selected($style_shadow_mode_value, 'none'); ?>><?php esc_html_e('None', 'nexdirectory'); ?></option>
                                        <option value="soft" <?php selected($style_shadow_mode_value, 'soft'); ?>><?php esc_html_e('Soft', 'nexdirectory'); ?></option>
                                        <option value="medium" <?php selected($style_shadow_mode_value, 'medium'); ?>><?php esc_html_e('Medium', 'nexdirectory'); ?></option>
                                        <option value="dramatic" <?php selected($style_shadow_mode_value, 'dramatic'); ?>><?php esc_html_e('Dramatic', 'nexdirectory'); ?></option>
                                    </select>
                                    <div class="eep-design-choice-grid eep-design-choice-grid-compact" data-eep-choice-grid data-eep-select="#eep_style_shadow_mode">
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="none">
                                            <span class="eep-design-choice-swatch eep-swatch-shadow-none" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('None', 'nexdirectory'); ?></strong>
                                        </button>
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="soft">
                                            <span class="eep-design-choice-swatch eep-swatch-shadow-soft" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Soft', 'nexdirectory'); ?></strong>
                                        </button>
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="medium">
                                            <span class="eep-design-choice-swatch eep-swatch-shadow-medium" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Medium', 'nexdirectory'); ?></strong>
                                        </button>
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="dramatic">
                                            <span class="eep-design-choice-swatch eep-swatch-shadow-dramatic" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Dramatic', 'nexdirectory'); ?></strong>
                                        </button>
                                    </div>
                                </div>

                                <div class="eep-settings-field eep-full">
                                    <label for="eep_style_content_width"><?php esc_html_e('Content Width', 'nexdirectory'); ?></label>
                                    <select id="eep_style_content_width" name="eep_style_content_width">
                                        <option value="narrow" <?php selected($style_content_width_value, 'narrow'); ?>><?php esc_html_e('Narrow', 'nexdirectory'); ?></option>
                                        <option value="standard" <?php selected($style_content_width_value, 'standard'); ?>><?php esc_html_e('Standard', 'nexdirectory'); ?></option>
                                        <option value="wide" <?php selected($style_content_width_value, 'wide'); ?>><?php esc_html_e('Wide', 'nexdirectory'); ?></option>
                                        <option value="full" <?php selected($style_content_width_value, 'full'); ?>><?php esc_html_e('Full Width', 'nexdirectory'); ?></option>
                                    </select>
                                    <div class="eep-design-choice-grid" data-eep-choice-grid data-eep-select="#eep_style_content_width">
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="narrow">
                                            <span class="eep-design-choice-swatch eep-swatch-width-narrow" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Narrow', 'nexdirectory'); ?></strong>
                                            <span><?php esc_html_e('Reading-focused narrow content container.', 'nexdirectory'); ?></span>
                                        </button>
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="standard">
                                            <span class="eep-design-choice-swatch eep-swatch-width-standard" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Standard', 'nexdirectory'); ?></strong>
                                            <span><?php esc_html_e('Balanced width for most event directories.', 'nexdirectory'); ?></span>
                                        </button>
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="wide">
                                            <span class="eep-design-choice-swatch eep-swatch-width-wide" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Wide', 'nexdirectory'); ?></strong>
                                            <span><?php esc_html_e('More horizontal room for cards and maps.', 'nexdirectory'); ?></span>
                                        </button>
                                        <button type="button" class="eep-design-choice" data-eep-choice-value="full">
                                            <span class="eep-design-choice-swatch eep-swatch-width-full" aria-hidden="true"></span>
                                            <strong><?php esc_html_e('Full Width', 'nexdirectory'); ?></strong>
                                            <span><?php esc_html_e('Maximum canvas with minimal container limits.', 'nexdirectory'); ?></span>
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="eep-settings-field">
                            <label for="eep_page_side_padding"><?php esc_html_e('Page Padding (Left/Right)', 'nexdirectory'); ?></label>
                            <input type="text" id="eep_page_side_padding" name="eep_page_side_padding" value="<?php echo esc_attr($page_side_padding_value); ?>" placeholder="10%">
                            <p class="description"><?php esc_html_e('Applies to every frontend page wrapper. Use percent values from 0% to 15% (example: 10%).', 'nexdirectory'); ?></p>
                        </div>

                        <div class="eep-settings-field">
                            <label for="eep_page_side_padding_mobile"><?php esc_html_e('Mobile Page Padding (Left/Right)', 'nexdirectory'); ?></label>
                            <input type="text" id="eep_page_side_padding_mobile" name="eep_page_side_padding_mobile" value="<?php echo esc_attr($page_side_padding_mobile_value); ?>" placeholder="<?php esc_attr_e('Leave blank to inherit desktop', 'nexdirectory'); ?>">
                            <p class="description"><?php esc_html_e('Separate mobile side padding value from 0% to 15% (example: 8%).', 'nexdirectory'); ?></p>
                        </div>
                    </div>
                </section>

                <section class="eep-settings-panel" id="eep-tab-maps" data-tab="design-maps" data-subtab="maps">
                    <h2><?php esc_html_e('Maps', 'nexdirectory'); ?></h2>
                    <p class="eep-settings-subheading"><?php esc_html_e('Configure map views, providers, styles, and discovery behavior.', 'nexdirectory'); ?></p>

                    <div class="eep-settings-grid">
                        <?php $map_connected = !empty($settings_map_health['connected']); ?>
                        <div class="eep-settings-field eep-full">
                            <div class="eep-settings-section-card eep-connection-card">
                                <div class="eep-connection-header">
                                    <h3><span class="dashicons dashicons-location-alt"></span><?php esc_html_e('Map Connection Status', 'nexdirectory'); ?></h3>
                                    <span class="eep-connection-badge <?php echo $map_connected ? 'is-connected' : 'is-disconnected'; ?>">
                                        <?php echo esc_html($map_connected ? __('Connected', 'nexdirectory') : __('Not connected', 'nexdirectory')); ?>
                                    </span>
                                </div>
                                <p class="description"><?php echo esc_html((string) ($settings_map_health['summary'] ?? __('Connects your configured provider API keys to render map tiles correctly.', 'nexdirectory'))); ?></p>
                                <div class="eep-settings-actions eep-connection-actions">
                                    <button type="submit" class="button button-secondary" form="eep-test-map-form"><?php esc_html_e('Test Map Connection', 'nexdirectory'); ?></button>
                                </div>
                            </div>
                        </div>

                        <div class="eep-settings-field eep-full">
                            <h3 class="eep-settings-core-title"><span class="dashicons dashicons-screenoptions" aria-hidden="true"></span><?php esc_html_e('Layout & Region', 'nexdirectory'); ?></h3>
                            <div class="eep-settings-grid">
                                <div class="eep-settings-field">
                                    <label for="eep_map_layout_default"><?php esc_html_e('Map Layout Template', 'nexdirectory'); ?></label>
                                    <select id="eep_map_layout_default" name="eep_map_layout_default">
                                        <option value="three-column" <?php selected($map_layout_value, 'three-column'); ?>><?php esc_html_e('Sidebar + Map (three-column)', 'nexdirectory'); ?></option>
                                        <option value="below-list" <?php selected($map_layout_value, 'below-list'); ?>><?php esc_html_e('Map below list', 'nexdirectory'); ?></option>
                                        <option value="below-grid" <?php selected($map_layout_value, 'below-grid'); ?>><?php esc_html_e('Map below grid', 'nexdirectory'); ?></option>
                                        <option value="below-grid-large" <?php selected($map_layout_value, 'below-grid-large'); ?>><?php esc_html_e('Map below large grid', 'nexdirectory'); ?></option>
                                        <option value="grid-no-map" <?php selected($map_layout_value, 'grid-no-map'); ?>><?php esc_html_e('Grid only (no map)', 'nexdirectory'); ?></option>
                                        <option value="grid-no-map-large" <?php selected($map_layout_value, 'grid-no-map-large'); ?>><?php esc_html_e('Large grid only (no map)', 'nexdirectory'); ?></option>
                                    </select>
                                </div>
                                <div class="eep-settings-field">
                                    <label for="eep_map_view_template"><?php esc_html_e('Default Map View', 'nexdirectory'); ?></label>
                                    <select id="eep_map_view_template" name="eep_map_view_template">
                                        <option value="default" <?php selected($map_view_template_value, 'default'); ?>><?php esc_html_e('Map Default View', 'nexdirectory'); ?></option>
                                        <option value="triple" <?php selected($map_view_template_value, 'triple'); ?>><?php esc_html_e('Triple View', 'nexdirectory'); ?></option>
                                    </select>
                                </div>
                                <div class="eep-settings-field">
                                    <label for="eep_map_focus_region"><?php esc_html_e('Map Focus Region', 'nexdirectory'); ?></label>
                                    <select id="eep_map_focus_region" name="eep_map_focus_region">
                                        <?php foreach ((array) $map_focus_region_options as $focus_region_id => $focus_region_label) : ?>
                                            <option value="<?php echo esc_attr((string) $focus_region_id); ?>" <?php selected($map_focus_region_value, (string) $focus_region_id); ?>>
                                                <?php echo esc_html((string) $focus_region_label); ?>
                                            </option>
                                        <?php endforeach; ?>
                                    </select>
                                    <p class="description"><?php esc_html_e('Restricts pan/zoom bounds. Example: UK or Europe.', 'nexdirectory'); ?></p>
                                </div>
                                <div class="eep-settings-field">
                                    <label for="eep_map_results_density"><?php esc_html_e('Map Results Density', 'nexdirectory'); ?></label>
                                    <select id="eep_map_results_density" name="eep_map_results_density">
                                        <option value="comfortable" <?php selected((string) get_option('eep_map_results_density', 'comfortable'), 'comfortable'); ?>><?php esc_html_e('Comfortable', 'nexdirectory'); ?></option>
                                        <option value="compact" <?php selected((string) get_option('eep_map_results_density', 'comfortable'), 'compact'); ?>><?php esc_html_e('Compact', 'nexdirectory'); ?></option>
                                    </select>
                                </div>
                                <div class="eep-settings-field eep-full">
                                    <label for="eep_map_mobile_filter_mode"><?php esc_html_e('Mobile Map Filter UX', 'nexdirectory'); ?></label>
                                    <select id="eep_map_mobile_filter_mode" name="eep_map_mobile_filter_mode">
                                        <option value="drawer" <?php selected($map_mobile_filter_mode, 'drawer'); ?>><?php esc_html_e('Slide-in Drawer (Recommended)', 'nexdirectory'); ?></option>
                                        <option value="inline" <?php selected($map_mobile_filter_mode, 'inline'); ?>><?php esc_html_e('Inline Stack', 'nexdirectory'); ?></option>
                                    </select>
                                    <p class="description"><?php esc_html_e('Drawer keeps filters off-canvas on phones to save space.', 'nexdirectory'); ?></p>
                                </div>
                            </div>
                        </div>

                        <div class="eep-settings-field eep-full">
                            <h3 class="eep-settings-core-title"><span class="dashicons dashicons-admin-site-alt3" aria-hidden="true"></span><?php esc_html_e('Provider & Styling', 'nexdirectory'); ?></h3>
                            <div class="eep-settings-grid">
                                <div class="eep-settings-field">
                                    <label for="eep_map_provider"><?php esc_html_e('Map Provider', 'nexdirectory'); ?></label>
                                    <select id="eep_map_provider" name="eep_map_provider">
                                        <option value="openstreetmap" <?php selected($map_provider_value, 'openstreetmap'); ?>><?php esc_html_e('OpenStreetMap', 'nexdirectory'); ?></option>
                                        <option value="mapbox" <?php selected($map_provider_value, 'mapbox'); ?>><?php esc_html_e('Mapbox', 'nexdirectory'); ?></option>
                                        <option value="google" <?php selected($map_provider_value, 'google'); ?>><?php esc_html_e('Google Maps Tiles', 'nexdirectory'); ?></option>
                                    </select>
                                    <p class="description"><?php echo wp_kses_post(sprintf(__('Docs: <a href="%1$s" target="_blank" rel="noopener noreferrer">OSM</a> · <a href="%2$s" target="_blank" rel="noopener noreferrer">Mapbox</a> · <a href="%3$s" target="_blank" rel="noopener noreferrer">Google</a>', 'nexdirectory'), esc_url('https://www.openstreetmap.org/'), esc_url('https://docs.mapbox.com/'), esc_url('https://developers.google.com/maps'))); ?></p>
                                </div>
                                <div class="eep-settings-field">
                                    <label for="eep_map_style"><?php esc_html_e('Map Style / Skin', 'nexdirectory'); ?></label>
                                    <select id="eep_map_style" name="eep_map_style">
                                        <option value="osm-standard" data-provider="openstreetmap" <?php selected($map_style_value, 'osm-standard'); ?>><?php esc_html_e('Standard (OSM)', 'nexdirectory'); ?></option>
                                        <option value="carto-light" data-provider="openstreetmap" <?php selected($map_style_value, 'carto-light'); ?>><?php esc_html_e('Light (Carto Positron)', 'nexdirectory'); ?></option>
                                        <option value="carto-dark" data-provider="openstreetmap" <?php selected($map_style_value, 'carto-dark'); ?>><?php esc_html_e('Dark (Carto DarkMatter)', 'nexdirectory'); ?></option>
                                        <option value="osm-hot" data-provider="openstreetmap" <?php selected($map_style_value, 'osm-hot'); ?>><?php esc_html_e('Humanitarian (HOT)', 'nexdirectory'); ?></option>
                                        <option value="topo" data-provider="openstreetmap" <?php selected($map_style_value, 'topo'); ?>><?php esc_html_e('Topographic', 'nexdirectory'); ?></option>
                                        <option value="mapbox-streets" data-provider="mapbox" <?php selected($map_style_value, 'mapbox-streets'); ?>><?php esc_html_e('Mapbox Streets', 'nexdirectory'); ?></option>
                                        <option value="mapbox-outdoors" data-provider="mapbox" <?php selected($map_style_value, 'mapbox-outdoors'); ?>><?php esc_html_e('Mapbox Outdoors', 'nexdirectory'); ?></option>
                                        <option value="mapbox-satellite" data-provider="mapbox" <?php selected($map_style_value, 'mapbox-satellite'); ?>><?php esc_html_e('Mapbox Satellite', 'nexdirectory'); ?></option>
                                        <option value="google-roadmap" data-provider="google" <?php selected($map_style_value, 'google-roadmap'); ?>><?php esc_html_e('Google Roadmap', 'nexdirectory'); ?></option>
                                        <option value="google-satellite" data-provider="google" <?php selected($map_style_value, 'google-satellite'); ?>><?php esc_html_e('Google Satellite', 'nexdirectory'); ?></option>
                                        <option value="custom" data-provider="all" <?php selected($map_style_value, 'custom'); ?>><?php esc_html_e('Custom Tile URL', 'nexdirectory'); ?></option>
                                    </select>
                                </div>
                                <div class="eep-settings-field">
                                    <label for="eep_mapbox_access_token"><?php esc_html_e('Mapbox Access Token', 'nexdirectory'); ?></label>
                                    <input type="password" id="eep_mapbox_access_token" name="eep_mapbox_access_token" value="" autocomplete="off" placeholder="<?php esc_attr_e('Leave blank to keep existing token', 'nexdirectory'); ?>">
                                    <p class="description"><?php echo wp_kses_post(sprintf(__('Create token in <a href="%s" target="_blank" rel="noopener noreferrer">Mapbox Account</a>.', 'nexdirectory'), esc_url('https://account.mapbox.com/access-tokens/'))); ?></p>
                                </div>
                                <div class="eep-settings-field">
                                    <label for="eep_mapbox_style_id"><?php esc_html_e('Mapbox Style ID', 'nexdirectory'); ?></label>
                                    <select id="eep_mapbox_style_id" name="eep_mapbox_style_id">
                                        <?php foreach ((array) $mapbox_style_options as $mapbox_style_id => $mapbox_style_label) : ?>
                                            <option value="<?php echo esc_attr((string) $mapbox_style_id); ?>" <?php selected($mapbox_style_value, (string) $mapbox_style_id); ?>>
                                                <?php echo esc_html((string) $mapbox_style_label); ?>
                                            </option>
                                        <?php endforeach; ?>
                                    </select>
                                </div>
                                <div class="eep-settings-field eep-full">
                                    <div class="eep-settings-section-card">
                                        <h3><span class="dashicons dashicons-admin-site-alt3"></span><?php esc_html_e('Custom Map Skin Config', 'nexdirectory'); ?></h3>
                                        <div class="eep-settings-grid">
                                            <div class="eep-settings-field">
                                                <label for="eep_map_custom_tile_url"><?php esc_html_e('Tile URL Template', 'nexdirectory'); ?></label>
                                                <input type="text" id="eep_map_custom_tile_url" name="eep_map_custom_tile_url" value="<?php echo esc_attr((string) get_option('eep_map_custom_tile_url', '')); ?>" placeholder="https://{s}.example.com/tiles/{z}/{x}/{y}.png">
                                            </div>
                                            <div class="eep-settings-field">
                                                <label for="eep_map_custom_tile_subdomains"><?php esc_html_e('Subdomains', 'nexdirectory'); ?></label>
                                                <input type="text" id="eep_map_custom_tile_subdomains" name="eep_map_custom_tile_subdomains" value="<?php echo esc_attr((string) get_option('eep_map_custom_tile_subdomains', 'a,b,c')); ?>" placeholder="a,b,c">
                                            </div>
                                            <div class="eep-settings-field eep-full">
                                                <label for="eep_map_custom_tile_attribution"><?php esc_html_e('Attribution', 'nexdirectory'); ?></label>
                                                <input type="text" id="eep_map_custom_tile_attribution" name="eep_map_custom_tile_attribution" value="<?php echo esc_attr((string) get_option('eep_map_custom_tile_attribution', '&copy; OpenStreetMap contributors')); ?>">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="eep-settings-field eep-full">
                            <h3 class="eep-settings-core-title"><span class="dashicons dashicons-location" aria-hidden="true"></span><?php esc_html_e('Custom Map Pin Image', 'nexdirectory'); ?></h3>
                            <p class="description"><?php esc_html_e('Used for map markers across archive and map views.', 'nexdirectory'); ?></p>
                            <?php $map_pin_url = esc_url((string) get_option('eep_map_pin_url', '')); ?>
                            <input type="hidden" id="eep_map_pin_url" name="eep_map_pin_url" value="<?php echo esc_attr($map_pin_url); ?>">

                            <div class="eep-media-picker" data-eep-media-picker data-eep-media-target="#eep_map_pin_url" data-eep-media-multiple="0" data-eep-upload-target="cover">
                                <button type="button" class="eep-media-dropzone" data-eep-media-open>
                                    <span class="dashicons dashicons-location-alt" aria-hidden="true"></span>
                                    <strong><?php esc_html_e('Choose map pin image', 'nexdirectory'); ?></strong>
                                    <span><?php esc_html_e('Drag and drop or click to upload', 'nexdirectory'); ?></span>
                                </button>
                                <input type="file" accept="image/*" hidden data-eep-media-file-input>

                                <div class="eep-fallback-preview-single eep-media-gallery" id="eep-map-pin-preview">
                                    <?php if ($map_pin_url !== '') : ?>
                                        <div class="eep-media-tile" data-eep-media-url="<?php echo esc_attr($map_pin_url); ?>">
                                            <img src="<?php echo esc_url($map_pin_url); ?>" alt="<?php esc_attr_e('Map pin image', 'nexdirectory'); ?>">
                                            <button type="button" class="eep-media-remove" data-eep-media-remove aria-label="<?php esc_attr_e('Remove map pin image', 'nexdirectory'); ?>">&times;</button>
                                        </div>
                                    <?php endif; ?>
                                </div>
                                <p class="description eep-media-feedback" data-eep-media-feedback></p>
                            </div>
                        </div>
                    </div>
                </section>

```

---

## File: templates/admin/settings/page.php

```php
<?php
        wp_enqueue_media();
        $settings_brand_name = $this->get_white_label_brand_name();
        $site_profile_catalog = method_exists($this, 'get_site_profile_catalog') ? (array) $this->get_site_profile_catalog() : [];
        if (empty($site_profile_catalog)) {
            $site_profile_catalog = [
                'events' => ['label' => __('Events (default)', 'nexdirectory')],
            ];
        }
        if (method_exists($this, 'normalize_site_profile_key')) {
            $site_profile_value = (string) $this->normalize_site_profile_key((string) get_option('eep_site_profile', 'events'));
        } else {
            $site_profile_value = sanitize_key((string) get_option('eep_site_profile', 'events'));
        }
        if ($site_profile_value === '' || !isset($site_profile_catalog[$site_profile_value])) {
            $site_profile_value = 'events';
        }
        $this->sync_route_options_to_existing_pages($site_profile_value);
        $platform_mode_value = $this->sanitize_platform_mode_option((string) get_option('eep_platform_mode', 'user_generated'));
        $site_profile_ui = method_exists($this, 'get_site_profile_ui_labels') ? (array) $this->get_site_profile_ui_labels($site_profile_value) : [];
        $settings_events_page_url = $this->get_platform_page_url(
            'eep_page_events_url',
            $this->get_profile_route_slugs('events', $site_profile_value),
            $this->get_profile_route_default_url('events', $site_profile_value)
        );
        $settings_map_page_url = $this->get_platform_page_url(
            'eep_page_events_map_url',
            $this->get_profile_route_slugs('map', $site_profile_value),
            $this->get_profile_route_default_url('map', $site_profile_value)
        );
        $settings_calendar_page_url = $this->get_platform_page_url(
            'eep_page_events_calendar_url',
            $this->get_profile_route_slugs('calendar', $site_profile_value),
            $this->get_profile_route_default_url('calendar', $site_profile_value)
        );
        $settings_submit_page_url = $this->get_platform_page_url(
            'eep_page_submit_event_url',
            $this->get_profile_route_slugs('submit', $site_profile_value),
            $this->get_profile_route_default_url('submit', $site_profile_value)
        );
        $settings_my_items_page_url = $this->get_platform_page_url(
            'eep_page_my_events_url',
            $this->get_profile_route_slugs('my_items', $site_profile_value),
            $this->get_profile_route_default_url('my_items', $site_profile_value)
        );
        $settings_boost_page_url = $this->get_platform_page_url(
            'eep_page_boost_posts_url',
            $this->get_profile_route_slugs('boost', $site_profile_value),
            $this->get_profile_route_default_url('boost', $site_profile_value)
        );
        $settings_owner_analytics_page_url = $this->get_platform_page_url(
            'eep_page_owner_analytics_url',
            $this->get_profile_route_slugs('analytics', $site_profile_value),
            $this->get_profile_route_default_url('analytics', $site_profile_value)
        );
        $settings_saved_page_url = $this->get_platform_page_url(
            'eep_page_my_tickets_url',
            $this->get_profile_route_slugs('attending', $site_profile_value),
            $this->get_profile_route_default_url('attending', $site_profile_value)
        );
        $settings_whos_attending_page_url = $this->get_platform_page_url(
            'eep_page_whos_attending_url',
            $this->get_profile_route_slugs('attendees', $site_profile_value),
            $this->get_profile_route_default_url('attendees', $site_profile_value)
        );
        $settings_event_webapp_page_url = $this->get_platform_page_url(
            'eep_page_event_webapp_url',
            ['event-app'],
            home_url('/event-app/')
        );
        $settings_whats_new_page_url = $this->get_platform_page_url(
            'eep_page_whats_new_url',
            ['whats-new'],
            home_url('/whats-new/')
        );
        $settings_account_page_url = $this->get_platform_page_url(
            'eep_page_account_url',
            $this->get_profile_route_slugs('account', $site_profile_value),
            $this->get_profile_route_default_url('account', $site_profile_value)
        );
        $settings_auth_page_url = $this->get_platform_page_url(
            'eep_page_login_signup_url',
            $this->get_profile_route_slugs('auth', $site_profile_value),
            $this->get_profile_route_default_url('auth', $site_profile_value)
        );
        $settings_claim_page_url = $this->get_platform_page_url(
            'eep_claim_listing_page_url',
            $this->get_profile_route_slugs('claim', $site_profile_value),
            $this->get_profile_route_default_url('claim', $site_profile_value)
        );
        $settings_singular_label = sanitize_text_field((string) ($site_profile_ui['singular'] ?? __('Listing', 'nexdirectory')));
        $settings_plural_label = sanitize_text_field((string) ($site_profile_ui['plural'] ?? __('Listings', 'nexdirectory')));
        $settings_owner_singular = sanitize_text_field((string) ($site_profile_ui['owner_singular'] ?? __('Owner', 'nexdirectory')));
        $settings_type_label = sanitize_text_field((string) ($site_profile_ui['taxonomy_type_singular'] ?? __('Type', 'nexdirectory')));
        $settings_mode_label = sanitize_text_field((string) ($site_profile_ui['taxonomy_mode_singular'] ?? __('Mode', 'nexdirectory')));
        $settings_attending_title = sanitize_text_field((string) ($site_profile_ui['attending_title'] ?? __('Saved Listings', 'nexdirectory')));
        $settings_singular_lower = function_exists('mb_strtolower') ? mb_strtolower($settings_singular_label, 'UTF-8') : strtolower($settings_singular_label);
        $settings_plural_lower = function_exists('mb_strtolower') ? mb_strtolower($settings_plural_label, 'UTF-8') : strtolower($settings_plural_label);
        $settings_owner_singular_lower = function_exists('mb_strtolower') ? mb_strtolower($settings_owner_singular, 'UTF-8') : strtolower($settings_owner_singular);
        $settings_page_title = sprintf(
            __('%s Settings', 'nexdirectory'),
            $settings_brand_name
        );
        $premium_unlocked = !function_exists('epw_fs') || epw_fs()->can_use_premium_code__premium_only();
        $white_label_enabled = (string) get_option('eep_white_label_enabled', '0') === '1';
        $white_label_name_value = (string) get_option('eep_white_label_plugin_name', '');
        $white_label_description_value = (string) get_option('eep_white_label_plugin_description', '');
        $white_label_author_value = (string) get_option('eep_white_label_plugin_author', '');
        $white_label_url_value = (string) get_option('eep_white_label_plugin_url', '');
        $white_label_support_url_value = (string) get_option('eep_white_label_support_url', '');
        $white_label_support_email_value = (string) get_option('eep_white_label_support_email', '');
        $white_label_menu_icon_value = (string) get_option('eep_white_label_admin_menu_icon', 'dashicons-admin-generic');
        $white_label_footer_text_value = (string) get_option('eep_white_label_admin_footer_text', '');
        $white_label_lock_enabled = (string) get_option('eep_white_label_lock_enabled', '0') === '1';
        $white_label_has_password = trim((string) get_option('eep_white_label_password_hash', '')) !== '';
        $white_label_is_unlocked = $this->is_white_label_section_unlocked();
        $white_label_unlock_token = $this->get_white_label_unlock_token_from_request();
        $white_label_force_reset_url = $this->get_white_label_force_reset_url(get_current_user_id());
        $font_presets = [
            'Inter, system-ui, -apple-system, sans-serif' => __('Inter', 'nexdirectory'),
            'Roboto, system-ui, -apple-system, sans-serif' => __('Roboto', 'nexdirectory'),
            '"Open Sans", system-ui, -apple-system, sans-serif' => __('Open Sans', 'nexdirectory'),
            '"Montserrat", system-ui, -apple-system, sans-serif' => __('Montserrat', 'nexdirectory'),
            '"Lato", system-ui, -apple-system, sans-serif' => __('Lato', 'nexdirectory'),
        ];
        $display_font_presets = [
            'Oswald, Inter, sans-serif' => __('Oswald', 'nexdirectory'),
            'Inter, system-ui, -apple-system, sans-serif' => __('Inter', 'nexdirectory'),
            '"Montserrat", system-ui, -apple-system, sans-serif' => __('Montserrat', 'nexdirectory'),
            '"Bebas Neue", Oswald, sans-serif' => __('Bebas Neue', 'nexdirectory'),
            '"Anton", Oswald, sans-serif' => __('Anton', 'nexdirectory'),
        ];
        $font_size_presets = ['16px', '17px', '18px', '19px', '20px'];
        $h2_size_presets = ['1.5rem', '1.625rem', '1.75rem', '1.875rem', '2rem'];
        $h3_size_presets = ['1.2rem', '1.3rem', '1.35rem', '1.45rem', '1.5rem'];
        $font_weight_presets = ['300', '400', '500', '600', '700', '800'];
        $spacing_unit_presets = ['12px', '14px', '16px', '18px', '20px'];
        $spacing_scale_presets = ['0.85', '1', '1.15', '1.3', '1.5'];
        $radius_presets = ['8px', '10px', '12px', '14px', '16px', '20px', '24px'];

        $body_font_value = (string) get_option('eep_style_font_family', 'Inter, system-ui, -apple-system, sans-serif');
        $display_font_value = (string) get_option('eep_style_display_font_family', 'Oswald, Inter, sans-serif');
        $base_font_size_value = (string) get_option('eep_style_font_size_base', '18px');
        $h2_size_value = (string) get_option('eep_style_h2_size', '1.75rem');
        $h3_size_value = (string) get_option('eep_style_h3_size', '1.35rem');
        $body_weight_value = (string) get_option('eep_style_font_weight_body', '400');
        $heading_weight_value = (string) get_option('eep_style_font_weight_heading', '700');
        $spacing_unit_value = (string) get_option('eep_style_spacing_unit', '16px');
        $spacing_scale_value = (string) get_option('eep_style_spacing_scale', '1');
        $radius_md_value = (string) get_option('eep_style_radius_md', '12px');
        $radius_lg_value = (string) get_option('eep_style_radius_lg', '24px');
        $style_box_style_value = $this->sanitize_style_box_style_option((string) get_option('eep_style_box_style', 'default'));
        $style_button_style_value = $this->sanitize_style_button_style_option((string) get_option('eep_style_button_style', 'solid'));
        $style_button_radius_mode_value = $this->sanitize_style_button_radius_mode_option((string) get_option('eep_style_button_radius_mode', 'inherit'));
        $style_density_mode_value = $this->sanitize_style_density_mode_option((string) get_option('eep_style_density_mode', 'comfortable'));
        $style_border_mode_value = $this->sanitize_style_border_mode_option((string) get_option('eep_style_border_mode', 'subtle'));
        $style_shadow_mode_value = $this->sanitize_style_shadow_mode_option((string) get_option('eep_style_shadow_mode', 'soft'));
        $style_content_width_value = $this->sanitize_style_content_width_option((string) get_option('eep_style_content_width', 'standard'));
        $style_input_style_value = $this->sanitize_style_input_style_option((string) get_option('eep_style_input_style', 'outline'));
        $map_layout_value = sanitize_key((string) get_option('eep_map_layout_default', 'three-column'));
        if ($map_layout_value === 'below') {
            $map_layout_value = 'below-list';
        } elseif ($map_layout_value === 'sidebar') {
            $map_layout_value = 'three-column';
        }
        if (!in_array($map_layout_value, ['three-column', 'below-list', 'below-grid', 'below-grid-large', 'grid-no-map', 'grid-no-map-large'], true)) {
            $map_layout_value = 'three-column';
        }
        $map_view_template_value = sanitize_key((string) get_option('eep_map_view_template', 'default'));
        if (!in_array($map_view_template_value, ['default', 'triple'], true)) {
            $map_view_template_value = 'default';
        }
        $map_focus_region_value = $this->sanitize_map_focus_region_option((string) get_option('eep_map_focus_region', 'global'));
        $map_focus_region_options = (array) $this->get_map_focus_region_options();
        $page_side_padding_value = $this->sanitize_page_side_padding_option((string) get_option('eep_page_side_padding', '10%'));
        $page_side_padding_mobile_raw = (string) get_option('eep_page_side_padding_mobile', '2%');
        $page_side_padding_mobile_value = $this->sanitize_page_side_padding_mobile_option($page_side_padding_mobile_raw);
        $nav_side_padding_desktop_raw = (string) get_option('eep_nav_side_padding_desktop', '0%');
        $nav_side_padding_desktop_value = $this->sanitize_nav_side_padding_desktop_option($nav_side_padding_desktop_raw);
        $map_mobile_filter_mode = sanitize_key((string) get_option('eep_map_mobile_filter_mode', 'drawer'));
        if (!in_array($map_mobile_filter_mode, ['drawer', 'inline'], true)) {
            $map_mobile_filter_mode = 'drawer';
        }
        $map_provider_value = sanitize_key((string) get_option('eep_map_provider', 'openstreetmap'));
        if (!in_array($map_provider_value, ['openstreetmap', 'mapbox', 'google'], true)) {
            $map_provider_value = 'openstreetmap';
        }
        $map_style_value = sanitize_key((string) get_option('eep_map_style', 'osm-standard'));
        if (!in_array($map_style_value, ['osm-standard', 'osm-hot', 'carto-light', 'carto-dark', 'topo', 'mapbox-streets', 'mapbox-outdoors', 'mapbox-satellite', 'google-roadmap', 'google-satellite', 'custom'], true)) {
            $map_style_value = 'osm-standard';
        }
        $mapbox_style_value = $this->sanitize_mapbox_style_id_option((string) get_option('eep_mapbox_style_id', 'mapbox/streets-v12'));
        $mapbox_style_options = (array) $this->get_mapbox_style_id_options();
        $thumb_fallback_raw = (string) get_option('eep_style_fallback_thumb_url', '');
        $thumb_fallback_urls = preg_split('/\r\n|\r|\n|,/', $thumb_fallback_raw);
        if (!is_array($thumb_fallback_urls)) {
            $thumb_fallback_urls = [];
        }
        $thumb_fallback_urls = array_values(array_filter(array_map('esc_url', array_map('trim', $thumb_fallback_urls))));
        $hero_fallback_url = esc_url((string) get_option('eep_style_fallback_hero_url', ''));
        $favicon_url = esc_url((string) get_option('eep_style_favicon_url', ''));
        $home_meta_title_value = $this->sanitize_home_meta_title_option((string) get_option('eep_home_meta_title', ''));
        $home_meta_description_value = $this->sanitize_home_meta_description_option((string) get_option('eep_home_meta_description', ''));
        $home_meta_title_count = function_exists('mb_strlen') ? (int) mb_strlen($home_meta_title_value) : strlen($home_meta_title_value);
        $home_meta_description_count = function_exists('mb_strlen') ? (int) mb_strlen($home_meta_description_value) : strlen($home_meta_description_value);
        $home_meta_preview_title = $home_meta_title_value !== '' ? $home_meta_title_value : sanitize_text_field((string) $this->get_white_label_brand_name());
        $home_meta_preview_description = $home_meta_description_value !== '' ? $home_meta_description_value : sanitize_text_field((string) get_bloginfo('description'));
        $home_meta_preview_url = home_url('/');
        $recaptcha_version_value = sanitize_key((string) get_option('eep_recaptcha_version', 'v3'));
        if (!in_array($recaptcha_version_value, ['v3', 'v2'], true)) {
            $recaptcha_version_value = 'v3';
        }
        $email_template_defaults = $this->get_default_event_email_templates();
        $legacy_custom_form_fields_value = trim((string) get_option('eep_custom_form_fields', '[]'));
        if ($legacy_custom_form_fields_value === '') {
            $legacy_custom_form_fields_value = '[]';
        }
        $legacy_custom_form_fields_decoded = json_decode($legacy_custom_form_fields_value, true);
        if (is_array($legacy_custom_form_fields_decoded)) {
            $legacy_custom_form_fields_pretty = wp_json_encode(
                $legacy_custom_form_fields_decoded,
                JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES
            );
            if (is_string($legacy_custom_form_fields_pretty) && $legacy_custom_form_fields_pretty !== '') {
                $legacy_custom_form_fields_value = $legacy_custom_form_fields_pretty;
            }
        }

        $body_font_preset = isset($font_presets[$body_font_value]) ? $body_font_value : 'custom';
        $display_font_preset = isset($display_font_presets[$display_font_value]) ? $display_font_value : 'custom';
        $base_font_size_preset = in_array($base_font_size_value, $font_size_presets, true) ? $base_font_size_value : 'custom';
        $h2_size_preset = in_array($h2_size_value, $h2_size_presets, true) ? $h2_size_value : 'custom';
        $h3_size_preset = in_array($h3_size_value, $h3_size_presets, true) ? $h3_size_value : 'custom';
        $body_weight_preset = in_array($body_weight_value, $font_weight_presets, true) ? $body_weight_value : 'custom';
        $heading_weight_preset = in_array($heading_weight_value, $font_weight_presets, true) ? $heading_weight_value : 'custom';
        $spacing_unit_preset = in_array($spacing_unit_value, $spacing_unit_presets, true) ? $spacing_unit_value : 'custom';
        $spacing_scale_preset = in_array($spacing_scale_value, $spacing_scale_presets, true) ? $spacing_scale_value : 'custom';
        $radius_md_preset = in_array($radius_md_value, $radius_presets, true) ? $radius_md_value : 'custom';
        $radius_lg_preset = in_array($radius_lg_value, $radius_presets, true) ? $radius_lg_value : 'custom';
        $pending_badge_toggle_value = get_option('eep_notify_admin_pending_badge', null);
        if ($pending_badge_toggle_value === null || $pending_badge_toggle_value === false || $pending_badge_toggle_value === '') {
            $pending_badge_toggle_value = get_option('eep_enable_pending_admin_notifications', '1');
        }
        $pending_email_toggle_value = get_option('eep_notify_admin_pending_email', null);
        if ($pending_email_toggle_value === null || $pending_email_toggle_value === false || $pending_email_toggle_value === '') {
            $pending_email_toggle_value = get_option('eep_enable_pending_admin_notifications', '1');
        }
        $extension_app_pass = $this->get_extension_app_pass();
        $extension_import_status = sanitize_key((string) get_option('eep_extension_import_status', 'draft'));
        if (!in_array($extension_import_status, ['draft', 'publish'], true)) {
            $extension_import_status = 'draft';
        }
        $extension_import_media_policy = sanitize_key((string) get_option('eep_extension_import_media_policy', ''));
        if (!in_array($extension_import_media_policy, ['none', 'images', 'images_video', 'video'], true)) {
            $extension_import_media_policy = 'none';
        }
        $indexnow_enabled = (string) get_option('eep_indexnow_enabled', '0') === '1';
        $indexnow_key = preg_replace('/[^A-Za-z0-9]/', '', (string) get_option('eep_indexnow_key', ''));
        if (strlen((string) $indexnow_key) < 8 && method_exists($this, 'ensure_indexnow_key')) {
            $indexnow_key = (string) $this->ensure_indexnow_key();
        }
        $indexnow_endpoint = esc_url((string) get_option('eep_indexnow_endpoint', 'https://api.indexnow.org/indexnow'));
        if ($indexnow_endpoint === '') {
            $indexnow_endpoint = 'https://api.indexnow.org/indexnow';
        }
        $indexnow_submit_updates = (string) get_option('eep_indexnow_submit_updates', '0') === '1';
        $indexnow_submit_removals = (string) get_option('eep_indexnow_submit_removals', '0') === '1';
        $indexnow_key_url = $indexnow_key !== '' ? home_url('/' . rawurlencode($indexnow_key) . '.txt') : '';
        $extension_import_content_mode = sanitize_key((string) get_option('eep_extension_import_content_mode', 'rewrite'));
        if (!in_array($extension_import_content_mode, ['rewrite', 'verbatim'], true)) {
            $extension_import_content_mode = 'rewrite';
        }
        $extension_notify_owner_default = (string) get_option('eep_extension_notify_potential_owner_default', '0') === '1';
        $extension_import_author_id = absint((int) get_option('eep_extension_import_author_id', 0));
        $extension_import_author_options = get_users([
            'orderby' => 'display_name',
            'order' => 'ASC',
            'number' => 200,
            'fields' => ['ID', 'display_name', 'user_email'],
            'role__in' => ['administrator', 'editor', 'author', 'event_submitter'],
        ]);
        $sticky_nav_behavior = sanitize_key((string) get_option('eep_frontend_sticky_nav_behavior', 'sticky'));
        if (!in_array($sticky_nav_behavior, ['sticky', 'static', 'smart'], true)) {
            $sticky_nav_behavior = 'sticky';
        }
        $sticky_nav_logo_url = esc_url((string) get_option('eep_frontend_sticky_nav_logo_url', ''));
        $sticky_nav_logo_link_url = esc_url((string) get_option('eep_frontend_sticky_nav_logo_link_url', home_url('/')));
        if ($sticky_nav_logo_link_url === '') {
            $sticky_nav_logo_link_url = esc_url(home_url('/'));
        }
        $sticky_nav_custom_links_value = (string) get_option('eep_frontend_sticky_nav_custom_links', '');
        $sticky_nav_use_wp_menus = (string) get_option('eep_frontend_sticky_nav_use_wp_menus', '0') === '1';
        $sticky_nav_wp_menu_guest = absint((int) get_option('eep_frontend_sticky_nav_wp_menu_guest', 0));
        $sticky_nav_wp_menu_member = absint((int) get_option('eep_frontend_sticky_nav_wp_menu_member', 0));
        $sticky_nav_wp_menu_admin = absint((int) get_option('eep_frontend_sticky_nav_wp_menu_admin', 0));
        $sticky_nav_wp_menu_roles = get_option('eep_frontend_sticky_nav_wp_menu_roles', []);
        if (!is_array($sticky_nav_wp_menu_roles)) {
            $sticky_nav_wp_menu_roles = [];
        }
        $sticky_nav_wp_menu_roles = array_filter(array_map('absint', $sticky_nav_wp_menu_roles), static function ($menu_id) {
            return $menu_id > 0;
        });
        $sticky_nav_role_options = function_exists('get_editable_roles') ? (array) get_editable_roles() : [];
        $sticky_nav_wp_menus = wp_get_nav_menus(['orderby' => 'name', 'order' => 'ASC']);
        if (!is_array($sticky_nav_wp_menus)) {
            $sticky_nav_wp_menus = [];
        }
        $footer_enabled = (string) get_option('eep_enable_frontend_footer', '1') === '1';
        $footer_show_logo = (string) get_option('eep_frontend_footer_show_logo', '1') === '1';
        $footer_logo_url = esc_url((string) get_option('eep_frontend_footer_logo_url', ''));
        $footer_logo_link_url = esc_url((string) get_option('eep_frontend_footer_logo_link_url', home_url('/')));
        if ($footer_logo_link_url === '') {
            $footer_logo_link_url = esc_url(home_url('/'));
        }
        $footer_use_wp_menus = (string) get_option('eep_frontend_footer_use_wp_menus', '0') === '1';
        $footer_menu_count = (int) get_option('eep_frontend_footer_menu_count', 3);
        if (method_exists($this, 'sanitize_footer_menu_count_option')) {
            $footer_menu_count = (int) $this->sanitize_footer_menu_count_option($footer_menu_count);
        } else {
            $footer_menu_count = max(1, min(5, $footer_menu_count));
        }
        $footer_wp_menu_ids = get_option('eep_frontend_footer_wp_menus', []);
        if (!is_array($footer_wp_menu_ids)) {
            $footer_wp_menu_ids = [];
        }
        $footer_wp_menu_ids = array_values(array_unique(array_filter(array_map('absint', $footer_wp_menu_ids), static function ($menu_id) {
            return $menu_id > 0;
        })));
        $footer_wp_menu_ids = array_slice($footer_wp_menu_ids, 0, 5);
        $footer_show_privacy_link = (string) get_option('eep_frontend_footer_show_privacy_link', '1') === '1';
        $footer_bottom_text = (string) get_option('eep_frontend_footer_bottom_text', '');
        $shortcodes = [
            ['code' => '[eep_listings_archive]', 'usage' => __('Filterable listings archive grid page.', 'nexdirectory')],
            ['code' => '[eep_listings_map]', 'usage' => __('Interactive map page with filters and results list.', 'nexdirectory')],
            ['code' => '[eep_listings_calendar]', 'usage' => __('Monthly calendar/timeline view for listings.', 'nexdirectory')],
            ['code' => '[eep_events_query_grid]', 'usage' => __('Elementor-friendly query grid with custom taxonomy/category filtering.', 'nexdirectory')],
            ['code' => '[eep_events_bento_grid]', 'usage' => __('Bento-style query grid with hover effects and 6 layout templates.', 'nexdirectory')],
            ['code' => '[eep_events_ajax_search]', 'usage' => __('Dynamic AJAX search widget with custom query controls and filters.', 'nexdirectory')],
            ['code' => '[eep_event_chatbot]', 'usage' => __('AI chatbot assistant powered by indexed published listings.', 'nexdirectory')],
            ['code' => '[eep_submit]', 'usage' => __('Frontend submit/edit listing form for logged-in users.', 'nexdirectory')],
            ['code' => '[eep_my_listings]', 'usage' => __('User dashboard for submitted listings and quick edits.', 'nexdirectory')],
            ['code' => '[eep_boost_posts]', 'usage' => __('Paid boost dashboard with active plans, renewals, and boost history.', 'nexdirectory')],
            ['code' => '[eep_saved_listings]', 'usage' => __('Dashboard for saved/attending listings.', 'nexdirectory')],
            ['code' => '[eep_owner_analytics]', 'usage' => __('Owner analytics dashboard with listing performance metrics and export tools.', 'nexdirectory')],
            ['code' => '[eep_account]', 'usage' => __('Account management and recommendations.', 'nexdirectory')],
            ['code' => '[eep_auth]', 'usage' => __('Custom login/sign-up experience.', 'nexdirectory')],
            ['code' => '[eep_auth_links]', 'usage' => __('Reusable Login/Signup buttons with signed-in account dropdown menu.', 'nexdirectory')],
            ['code' => '[eep_user_management]', 'usage' => __('Admin user management and listing moderation actions.', 'nexdirectory')],
            ['code' => '[eep_moderation_queue]', 'usage' => __('Admin moderation queue for pending listings and reports.', 'nexdirectory')],
            ['code' => '[eep_organizers]', 'usage' => __('Public organizer directory.', 'nexdirectory')],
            ['code' => '[eep_claim_listing]', 'usage' => __('Frontend listing claim form for imported/admin-created listings.', 'nexdirectory')],
        ];
        $shortcode_aliases = [
            ['code' => '[eep_events_archive]', 'usage' => __('Legacy alias of [eep_listings_archive].', 'nexdirectory')],
            ['code' => '[eep_events_map]', 'usage' => __('Legacy alias of [eep_listings_map].', 'nexdirectory')],
            ['code' => '[eep_events_calendar]', 'usage' => __('Legacy alias of [eep_listings_calendar].', 'nexdirectory')],
            ['code' => '[eep_submit_event]', 'usage' => __('Legacy alias of [eep_submit].', 'nexdirectory')],
            ['code' => '[eep_my_events]', 'usage' => __('Legacy alias of [eep_my_listings].', 'nexdirectory')],
            ['code' => '[eep_my_tickets]', 'usage' => __('Legacy alias of [eep_saved_listings].', 'nexdirectory')],
            ['code' => '[nexdirectory_events_archive]', 'usage' => __('Alias of [eep_listings_archive] for page builders/templates.', 'nexdirectory')],
            ['code' => '[nexdirectory_events_map]', 'usage' => __('Alias of [eep_listings_map] for page builders/templates.', 'nexdirectory')],
            ['code' => '[nexdirectory_events_calendar]', 'usage' => __('Alias of [eep_listings_calendar] for page builders/templates.', 'nexdirectory')],
            ['code' => '[nexdirectory_events_query_grid]', 'usage' => __('Alias of [eep_events_query_grid] for page builders/templates.', 'nexdirectory')],
            ['code' => '[nexdirectory_events_bento_grid]', 'usage' => __('Alias of [eep_events_bento_grid] for page builders/templates.', 'nexdirectory')],
            ['code' => '[nexdirectory_events_ajax_search]', 'usage' => __('Alias of [eep_events_ajax_search] for page builders/templates.', 'nexdirectory')],
            ['code' => '[nexdirectory_event_chatbot]', 'usage' => __('Alias of [eep_event_chatbot] for page builders/templates.', 'nexdirectory')],
            ['code' => '[nexdirectory_submit_event]', 'usage' => __('Alias of [eep_submit] for page builders/templates.', 'nexdirectory')],
            ['code' => '[nexdirectory_my_events]', 'usage' => __('Alias of [eep_my_listings] for page builders/templates.', 'nexdirectory')],
            ['code' => '[nexdirectory_boost_posts]', 'usage' => __('Alias of [eep_boost_posts] for page builders/templates.', 'nexdirectory')],
            ['code' => '[nexdirectory_my_tickets]', 'usage' => __('Alias of [eep_saved_listings] for page builders/templates.', 'nexdirectory')],
            ['code' => '[nexdirectory_owner_analytics]', 'usage' => __('Alias of [eep_owner_analytics] for page builders/templates.', 'nexdirectory')],
            ['code' => '[nexdirectory_account]', 'usage' => __('Alias of [eep_account] for page builders/templates.', 'nexdirectory')],
            ['code' => '[nexdirectory_auth]', 'usage' => __('Alias of [eep_auth] for page builders/templates.', 'nexdirectory')],
            ['code' => '[nexdirectory_auth_links]', 'usage' => __('Alias of [eep_auth_links] for page builders/templates.', 'nexdirectory')],
            ['code' => '[nexdirectory_user_management]', 'usage' => __('Alias of [eep_user_management] for page builders/templates.', 'nexdirectory')],
            ['code' => '[nexdirectory_moderation_queue]', 'usage' => __('Alias of [eep_moderation_queue] for page builders/templates.', 'nexdirectory')],
            ['code' => '[nexdirectory_organizers]', 'usage' => __('Alias of [eep_organizers] for page builders/templates.', 'nexdirectory')],
            ['code' => '[nexdirectory_claim_listing]', 'usage' => __('Alias of [eep_claim_listing] for page builders/templates.', 'nexdirectory')],
        ];
        $runtime_logs = $this->get_runtime_logs(120);
        $chatbot_stats = $this->get_chatbot_index_stats();
        $settings_email_health = $this->get_settings_email_health();
        $settings_api_health = $this->get_settings_api_health($premium_unlocked);
        $settings_map_health = $this->get_settings_map_health();
        $settings_captcha_health = $this->get_settings_captcha_health();
        $settings_routing_health = $this->get_settings_routing_health($site_profile_value);
        $demo_limit_context = method_exists($this, 'get_demo_limit_admin_context')
            ? (array) $this->get_demo_limit_admin_context()
            : [];
        $settings_demo_mode_enabled = !empty($demo_limit_context['is_demo_mode']);
        $settings_demo_limit = max(1, (int) ($demo_limit_context['limit'] ?? 3));
        $settings_demo_used = max(0, (int) ($demo_limit_context['used'] ?? 0));
        $settings_demo_remaining = max(0, (int) ($demo_limit_context['remaining'] ?? 0));
        $settings_upgrade_url = esc_url((string) ($demo_limit_context['upgrade_url'] ?? 'https://nexdirectory.com/purchase'));
        $settings_license_url = esc_url((string) ($demo_limit_context['license_url'] ?? admin_url('admin.php?page=eep-settings#eep-tab-monetization--boost-packages')));
        $settings_license_label = sanitize_text_field((string) ($demo_limit_context['license_label'] ?? __('Activate License', 'nexdirectory')));
        ?>
        <div class="wrap eep-admin-premium eep-settings-premium">
            <?php $this->render_admin_premium_shell_styles(); ?>
            <section class="eep-admin-hero">
                <div class="eep-settings-hero-main">
                    <span class="eep-admin-hero-kicker"><?php esc_html_e('Admin Control Center', 'nexdirectory'); ?></span>
                    <h1><?php echo esc_html($settings_page_title); ?></h1>
                    <p><?php echo esc_html(sprintf(__('Configure routing, design, moderation, notifications, and AI tools for your %s experience.', 'nexdirectory'), $settings_plural_lower)); ?></p>
                    <div class="eep-settings-hero-meta">
                        <span class="eep-settings-hero-pill"><span class="dashicons dashicons-layout" aria-hidden="true"></span><?php esc_html_e('Template-Based Settings', 'nexdirectory'); ?></span>
                        <span class="eep-settings-hero-pill"><span class="dashicons dashicons-update" aria-hidden="true"></span><?php esc_html_e('Auto-Save Enabled', 'nexdirectory'); ?></span>
                    </div>
                </div>
                <div class="eep-settings-hero-tools">
                    <div class="eep-settings-search-wrap eep-settings-search-wrap-top">
                        <span class="dashicons dashicons-search" aria-hidden="true"></span>
                        <input type="search" id="eep-settings-search-top" placeholder="<?php esc_attr_e('Search all settings...', 'nexdirectory'); ?>" aria-label="<?php esc_attr_e('Search settings fields', 'nexdirectory'); ?>">
                        <button type="button" class="eep-settings-search-clear" id="eep-settings-search-top-clear" data-target-input="eep-settings-search-top" aria-label="<?php esc_attr_e('Clear settings search', 'nexdirectory'); ?>">&times;</button>
                    </div>
                    <p class="description"><?php esc_html_e('Press "/" from anywhere on this page to jump to search.', 'nexdirectory'); ?></p>
                </div>
            </section>
            <?php if ($settings_demo_mode_enabled) : ?>
                <section class="eep-settings-demo-alert" aria-label="<?php esc_attr_e('Demo mode status', 'nexdirectory'); ?>">
                    <div class="eep-settings-demo-alert-copy">
                        <h3><?php echo esc_html(sprintf(__('Demo Mode Active: %d Free Events', 'nexdirectory'), $settings_demo_limit)); ?></h3>
                        <p><?php esc_html_e('This site is currently in demo mode. Keep this visible to stakeholders so there is no surprise when the free cap is reached.', 'nexdirectory'); ?></p>
                        <span class="eep-settings-demo-alert-counter">
                            <?php
                            echo esc_html(
                                sprintf(
                                    __('Used %1$d of %2$d (Remaining: %3$d)', 'nexdirectory'),
                                    $settings_demo_used,
                                    $settings_demo_limit,
                                    $settings_demo_remaining
                                )
                            );
                            ?>
                        </span>
                    </div>
                    <div class="eep-settings-demo-alert-actions">
                        <a class="button button-primary" href="<?php echo $settings_upgrade_url; ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e('Buy / Upgrade', 'nexdirectory'); ?></a>
                        <a class="button" href="<?php echo $settings_license_url; ?>"><?php echo esc_html($settings_license_label); ?></a>
                    </div>
                </section>
            <?php endif; ?>
            <?php settings_errors(); ?>
            <section class="eep-admin-panel">
            <style>
                .eep-settings-premium .eep-admin-hero { position: relative; overflow: hidden; background: radial-gradient(circle at top right, rgba(79, 70, 229, .25), rgba(79, 70, 229, 0) 46%), radial-gradient(circle at bottom left, rgba(249, 115, 22, .2), rgba(249, 115, 22, 0) 44%), linear-gradient(135deg, #0f172a 0%, #111827 55%, #1f2937 100%); color: #fff; border-radius: 18px; padding: 24px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 400px); gap: 18px; align-items: center; margin-bottom: 14px; box-shadow: 0 20px 40px rgba(15, 23, 42, .28); border: 1px solid rgba(51, 65, 85, .45); }
                .eep-settings-premium .eep-admin-hero h1 { margin: 0 0 6px; font-size: 30px; font-weight: 800; color: #fff; letter-spacing: -.02em; }
                .eep-settings-premium .eep-admin-hero p { margin: 0; color: #d5ddeb; max-width: 880px; font-size: 15px; line-height: 1.5; }
                .eep-settings-premium .eep-admin-hero .eep-admin-hero-kicker { display: inline-block; margin-bottom: 8px; font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: #fdba74; background: rgba(251, 146, 60, .16); border: 1px solid rgba(251, 146, 60, .38); padding: 4px 9px; border-radius: 999px; }
                .eep-settings-hero-main { min-width: 0; }
                .eep-settings-hero-meta { margin-top: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
                .eep-settings-hero-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; border: 1px solid rgba(148, 163, 184, .45); background: rgba(15, 23, 42, .44); color: #dbeafe; font-size: 11px; font-weight: 700; letter-spacing: .02em; }
                .eep-settings-hero-pill .dashicons { width: 14px; height: 14px; font-size: 14px; }
                .eep-settings-hero-tools { display: grid; gap: 7px; align-content: start; }
                .eep-settings-search-wrap-top { margin: 0; }
                .eep-settings-search-wrap-top input { background: rgba(15, 23, 42, .45); border-color: rgba(148, 163, 184, .38); color: #0f172a; }
                .eep-settings-search-wrap-top input::placeholder { color: #9ca3af; }
                .eep-settings-search-wrap-top .dashicons-search { color: #cbd5e1; }
                .eep-settings-search-wrap-top .eep-settings-search-clear { color: #cbd5e1; }
                .eep-settings-search-wrap-top .eep-settings-search-clear:hover { background: rgba(148, 163, 184, .18); color: #fff; }
                .eep-settings-hero-tools .description { margin: 0; color: #cbd5e1; }
                .eep-settings-demo-alert {
                    margin-bottom: 14px;
                    border: 1px solid #fecaca;
                    border-radius: 14px;
                    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
                    box-shadow: 0 10px 26px rgba(249, 115, 22, .16);
                    padding: 14px 16px;
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
                    gap: 12px;
                    flex-wrap: wrap;
                }
                .eep-settings-demo-alert-copy h3 {
                    margin: 0 0 4px;
                    color: #9a3412;
                    font-size: 18px;
                    line-height: 1.25;
                }
                .eep-settings-demo-alert-copy p {
                    margin: 0;
                    color: #7c2d12;
                    font-size: 13px;
                }
                .eep-settings-demo-alert-counter {
                    display: inline-flex;
                    align-items: center;
                    margin-top: 8px;
                    padding: 4px 10px;
                    border-radius: 999px;
                    border: 1px solid #fdba74;
                    background: rgba(255, 255, 255, .62);
                    color: #9a3412;
                    font-size: 12px;
                    font-weight: 700;
                    letter-spacing: .01em;
                }
                .eep-settings-demo-alert-actions {
                    display: flex;
                    align-items: center;
                    gap: 8px;
                    flex-wrap: wrap;
                }
                .eep-settings-demo-alert-actions .button {
                    min-height: 40px;
                    font-weight: 700;
                }
                .eep-settings-tabs.nav-tab-wrapper { border-bottom: 0; margin: 18px 0 14px; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
                .eep-settings-tabs .nav-tab { cursor: pointer; border: 1px solid #dde3ec; border-radius: 999px; padding: 7px 14px; line-height: 1.3; margin: 0; background: #fff; color: #334155; font-weight: 700; font-size: 12px; transition: all .2s ease; display: inline-flex; align-items: center; gap: 6px; }
                .eep-settings-tabs .nav-tab .dashicons { width: 14px; height: 14px; font-size: 14px; }
                .eep-settings-tabs .nav-tab:hover { border-color: #f97316; color: #f97316; background: #fff7ed; transform: translateY(-1px); }
                .eep-settings-tabs .nav-tab.nav-tab-active { border-color: #f97316; background: #f97316; color: #fff; box-shadow: 0 8px 18px rgba(249, 115, 22, .25); }
                .eep-settings-tabs .nav-tab.is-disabled { cursor: not-allowed; opacity: .58; color: #6b7280; border-color: #d1d5db; background: #f3f4f6; }
                .eep-settings-tabs .nav-tab.is-disabled:hover { border-color: #d1d5db; color: #6b7280; background: #f3f4f6; }
                .eep-settings-shell { display: grid; grid-template-columns: minmax(240px, 280px) minmax(0, 1fr); gap: 16px; align-items: start; }
                .eep-settings-sidebar { position: sticky; top: 48px; align-self: start; border: 1px solid #dce3ed; border-radius: 14px; background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%); box-shadow: 0 10px 24px rgba(15, 23, 42, .06); padding: 12px; }
                .eep-settings-sidebar-title { margin: 0 0 8px; color: #0f172a; font-size: 13px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
                .eep-settings-search-wrap { position: relative; margin-bottom: 10px; }
                .eep-settings-search-wrap input { width: 100%; border-radius: 10px; border: 1px solid #d8e0ec; padding: 9px 38px 9px 34px; font-size: 13px; background: #fff; }
                .eep-settings-search-wrap .dashicons-search { position: absolute; top: 9px; left: 10px; font-size: 16px; width: 16px; height: 16px; color: #64748b; pointer-events: none; }
                .eep-settings-search-clear { position: absolute; top: 4px; right: 4px; border: 0; background: transparent; color: #94a3b8; width: 28px; height: 28px; border-radius: 8px; cursor: pointer; }
                .eep-settings-search-clear:hover { background: #f1f5f9; color: #0f172a; }
                .eep-settings-search-meta { margin: 0 0 10px; font-size: 11px; color: #64748b; min-height: 16px; }
                .eep-settings-subtabs { margin: 0; display: grid; gap: 7px; border: 0; padding: 0; }
                .eep-settings-subtabs .eep-settings-subtab { display: flex; align-items: center; justify-content: flex-start; min-height: 34px; padding: 7px 10px; border: 1px solid #d7dee9; border-radius: 10px; background: #fff; color: #334155; text-decoration: none; font-weight: 600; font-size: 12px; line-height: 1.2; cursor: pointer; transition: all .2s ease; letter-spacing: .01em; }
                .eep-settings-subtabs .eep-settings-subtab:hover { border-color: #f97316; color: #f97316; background: #fff7ed; transform: translateX(1px); }
                .eep-settings-subtabs .eep-settings-subtab.is-active { background: #f97316; border-color: #f97316; color: #fff; box-shadow: 0 8px 18px rgba(249, 115, 22, .2); }
                .eep-settings-subtabs .eep-settings-subtab.is-disabled { cursor: not-allowed; opacity: .58; color: #6b7280; border-color: #d1d5db; background: #f3f4f6; transform: none; }
                .eep-settings-subtabs .eep-settings-subtab.is-disabled:hover { border-color: #d1d5db; color: #6b7280; background: #f3f4f6; transform: none; }
                .eep-settings-subtabs .eep-settings-subtab[hidden] { display: none !important; }
                .eep-settings-content { min-width: 0; }
                .eep-settings-content-header { border: 1px solid #edf0f5; border-radius: 14px; background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%); padding: 14px 16px; margin-bottom: 12px; }
                .eep-settings-content-header h2 { margin: 0; font-size: 20px; line-height: 1.25; color: #0f172a; }
                .eep-settings-content-header p { margin: 4px 0 0; font-size: 13px; color: #64748b; }
                .eep-settings-search-empty { border: 1px dashed #d7dee9; background: #fff; border-radius: 12px; padding: 12px; margin-bottom: 12px; color: #475569; font-size: 13px; }
                .eep-settings-search-empty[hidden] { display: none !important; }
                .eep-settings-panel { display: none; background: linear-gradient(180deg, #ffffff 0%, #f8faff 100%); border: 1px solid #dcdcde; border-radius: 14px; padding: 18px 20px; margin-bottom: 14px; box-shadow: 0 10px 22px rgba(16,24,40,.06); }
                .eep-settings-panel.is-active { display: block; }
                .eep-settings-panel h2 { margin-top: 0; margin-bottom: 6px; }
                .eep-settings-subheading { margin: 0 0 14px; font-size: 13px; color: #50575e; max-width: 860px; line-height: 1.5; }
                .eep-settings-section-card { border: 1px solid #ececf0; border-radius: 10px; background: #f9fafb; padding: 12px; }
                .eep-settings-section-card h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 14px; }
                .eep-settings-section-card .dashicons { color: #2271b1; width: 18px; height: 18px; font-size: 18px; }
                .eep-connection-card { border-color: #dbe5f1; background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%); }
                .eep-connection-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
                .eep-connection-badge { display: inline-flex; align-items: center; justify-content: center; padding: 4px 10px; border-radius: 999px; border: 1px solid transparent; font-size: 11px; line-height: 1.1; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
                .eep-connection-badge.is-connected { background: #dcfce7; color: #166534; border-color: #86efac; }
                .eep-connection-badge.is-disconnected { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
                .eep-connection-list { display: grid; gap: 10px; margin-top: 6px; }
                .eep-connection-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; border: 1px solid #e7edf6; border-radius: 10px; background: #fff; padding: 10px; }
                .eep-connection-row strong { color: #0f172a; font-size: 13px; line-height: 1.3; }
                .eep-connection-row .description { margin: 3px 0 0; }
                .eep-connection-actions { margin-top: 10px; justify-content: flex-start; }
                .eep-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; }
                .eep-settings-field { background: #fff; border: 1px solid #edf0f5; border-radius: 12px; padding: 12px; }
                .eep-settings-field label { font-weight: 600; display: block; margin-bottom: 4px; }
                .eep-settings-field .description { margin-top: 4px; color: #646970; font-size: 12px; }
                .eep-settings-field input[type="text"],
                .eep-settings-field input[type="url"],
                .eep-settings-field input[type="password"],
                .eep-settings-field input[type="number"],
                .eep-settings-field select,
                .eep-settings-field textarea { width: 100%; max-width: 760px; }
                .eep-settings-field.eep-full { grid-column: 1 / -1; }
                .eep-settings-field.eep-search-hidden { display: none !important; }
                .eep-settings-field-grid { display: grid; gap: 10px; }
                .eep-settings-inline { display: flex; gap: 8px; align-items: center; }
                .eep-settings-inline input[type="text"],
                .eep-settings-inline input[type="url"],
                .eep-settings-inline input[type="number"],
                .eep-settings-inline input[type="password"],
                .eep-settings-inline textarea { flex: 1 1 auto; max-width: none; }
                .eep-settings-select-helper { margin-top: 6px; display: grid; gap: 6px; }
                .eep-settings-preset-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
                .eep-settings-preset-status { font-size: 12px; color: #166534; min-height: 18px; }
                .eep-settings-hint-list { margin: 8px 0 0 18px; color: #50575e; list-style: disc; }
                .eep-settings-hint-list li { margin-bottom: 4px; }
                .eep-settings-toggle-list { display: grid; gap: 8px; }
                .eep-settings-toggle-item { border: 1px solid #dcdcde; border-radius: 8px; background: #fff; padding: 10px 12px; }
                .eep-settings-toggle-item label { margin-bottom: 2px; }
                .eep-settings-autosave-note { margin: 0; display: inline-flex; align-items: center; gap: 6px; color: #64748b; font-size: 12px; }
                .eep-settings-autosave-note .dashicons { width: 16px; height: 16px; font-size: 16px; line-height: 1; }
                .eep-settings-autosave-status[data-tone="pending"] { color: #1d4ed8; }
                .eep-settings-autosave-status[data-tone="success"] { color: #15803d; }
                .eep-settings-autosave-status[data-tone="error"] { color: #b91c1c; }
                .eep-monetization-grid { gap: 16px; }
                .eep-monetization-card { padding: 14px; border-color: #e7ecf4; background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%); }
                .eep-monetization-repeater { display: grid; gap: 10px; }
                .eep-monetization-row { display: grid; grid-template-columns: minmax(110px, 1fr) minmax(120px, 1fr) auto; gap: 10px; padding: 10px; border: 1px solid #e8edf5; border-radius: 10px; background: #fff; }
                .eep-monetization-row-type { grid-template-columns: minmax(160px, 1fr) minmax(140px, 1fr) minmax(120px, 1fr) auto; }
                .eep-monetization-col label { font-size: 12px; font-weight: 600; color: #4b5563; margin-bottom: 5px; }
                .eep-monetization-col-actions { display: flex; align-items: flex-end; justify-content: flex-end; }
                .eep-settings-sticky-save { position: sticky; bottom: 8px; z-index: 30; margin-top: 14px; background: rgba(255,255,255,.95); border: 1px solid #dcdcde; border-radius: 12px; padding: 12px; box-shadow: 0 10px 24px rgba(15, 23, 42, .12); display: flex; align-items: center; justify-content: space-between; gap: 12px; backdrop-filter: blur(3px); }
                .eep-settings-sticky-status { display: flex; align-items: center; gap: 8px; min-width: 0; }
                .eep-settings-sticky-status p { margin: 0; color: #4b5563; font-size: 12px; }
                .eep-settings-status-dot { width: 10px; height: 10px; border-radius: 999px; background: #cbd5e1; flex: 0 0 auto; }
                .eep-settings-status-dot[data-tone="pending"] { background: #3b82f6; box-shadow: 0 0 0 4px rgba(59, 130, 246, .15); }
                .eep-settings-status-dot[data-tone="success"] { background: #10b981; box-shadow: 0 0 0 4px rgba(16, 185, 129, .15); }
                .eep-settings-status-dot[data-tone="error"] { background: #ef4444; box-shadow: 0 0 0 4px rgba(239, 68, 68, .15); }
                .eep-settings-sticky-actions { display: flex; align-items: center; gap: 8px; }
                .eep-settings-sticky-save .button-primary { min-width: 150px; }
                .eep-settings-route-grid { display: grid; gap: 10px; margin-top: 10px; }
                .eep-settings-route-row { display: grid; grid-template-columns: minmax(180px, 240px) minmax(0, 1fr) auto; gap: 8px; align-items: center; }
                .eep-settings-route-row strong { color: #111827; font-size: 13px; }
                .eep-settings-route-row .eep-shortcode-inline { width: 100%; display: flex; gap: 8px; align-items: center; }
                .eep-settings-route-row .eep-shortcode-inline input { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 12px; background: #f8fafc; }
                .eep-settings-route-row .button { white-space: nowrap; }
                .eep-settings-visual-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 10px; margin-top: 10px; }
                .eep-settings-visual-option { border: 1px solid #dce3ed; border-radius: 12px; padding: 10px; background: #fff; text-align: left; cursor: pointer; transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
                .eep-settings-visual-option:hover { border-color: #ff5e14; transform: translateY(-1px); box-shadow: 0 8px 18px rgba(15, 23, 42, .09); }
                .eep-settings-visual-option.is-active { border-color: #ff5e14; box-shadow: 0 0 0 2px rgba(255, 94, 20, .2); background: #fff7ed; }
                .eep-settings-visual-option span { display: block; font-size: 12px; color: #4b5563; margin-top: 3px; }
                .eep-design-choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-top: 8px; }
                .eep-design-choice-grid-compact { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
                .eep-design-choice { border: 1px solid #dce3ed; border-radius: 10px; padding: 8px; background: #fff; text-align: left; cursor: pointer; display: grid; gap: 4px; transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
                .eep-design-choice:hover { border-color: #f97316; transform: translateY(-1px); box-shadow: 0 8px 18px rgba(15, 23, 42, .08); }
                .eep-design-choice.is-active { border-color: #f97316; box-shadow: 0 0 0 2px rgba(249, 115, 22, .2); background: #fff7ed; }
                .eep-design-choice strong { font-size: 12px; color: #111827; line-height: 1.3; }
                .eep-design-choice span { font-size: 11px; color: #64748b; line-height: 1.35; }
                .eep-design-choice-swatch { height: 26px; border-radius: 8px; border: 1px solid #d8dee9; background: #fff; display: block; }
                .eep-swatch-box-default { background: #fff; border-color: #dde3ed; box-shadow: inset 0 0 0 1px #f3f4f6; }
                .eep-swatch-box-gradient { background: linear-gradient(135deg, #fff7ed, #ffffff 42%, #fef3c7); border-color: #fdba74; }
                .eep-swatch-box-bold { background: #fff7ed; border: 2px solid #fb923c; }
                .eep-swatch-box-neumorphic { background: #f3f4f6; border-color: transparent; box-shadow: 6px 6px 12px #d5d9de, -6px -6px 12px #ffffff; }
                .eep-swatch-btn-solid { background: #f97316; border-color: #ea580c; }
                .eep-swatch-btn-outline { background: #fff; border: 2px solid #f97316; }
                .eep-swatch-btn-soft { background: #ffedd5; border-color: #fdba74; }
                .eep-swatch-btn-dark { background: #111827; border-color: #030712; }
                .eep-swatch-radius-inherit { border-radius: 10px; background: #f8fafc; }
                .eep-swatch-radius-pill { border-radius: 999px; background: #f8fafc; }
                .eep-swatch-radius-sharp { border-radius: 0; background: #f8fafc; }
                .eep-swatch-input-outline { background: #fff; border: 1px solid #d1d5db; }
                .eep-swatch-input-filled { background: #f8fafc; border: 1px solid #e2e8f0; }
                .eep-swatch-input-underlined { background: linear-gradient(to top, #f97316 0 2px, transparent 2px 100%), #fff; border: 0; border-bottom: 1px solid #d1d5db; border-radius: 0; }
                .eep-swatch-density-compact { background: linear-gradient(#e2e8f0 0 3px, transparent 3px 8px, #e2e8f0 8px 11px, transparent 11px 16px, #e2e8f0 16px 19px, transparent 19px 100%), #fff; }
                .eep-swatch-density-comfortable { background: linear-gradient(#e2e8f0 0 3px, transparent 3px 10px, #e2e8f0 10px 13px, transparent 13px 20px, #e2e8f0 20px 23px, transparent 23px 100%), #fff; }
                .eep-swatch-density-loose { background: linear-gradient(#e2e8f0 0 3px, transparent 3px 13px, #e2e8f0 13px 16px, transparent 16px 100%), #fff; }
                .eep-swatch-border-minimal { border-color: transparent; box-shadow: inset 0 0 0 1px rgba(148, 163, 184, .2); }
                .eep-swatch-border-subtle { border-color: #dbe2ec; }
                .eep-swatch-border-strong { border: 2px solid #94a3b8; }
                .eep-swatch-shadow-none { box-shadow: none; }
                .eep-swatch-shadow-soft { box-shadow: 0 4px 10px rgba(15, 23, 42, .08); }
                .eep-swatch-shadow-medium { box-shadow: 0 8px 18px rgba(15, 23, 42, .13); }
                .eep-swatch-shadow-dramatic { box-shadow: 0 16px 32px rgba(15, 23, 42, .24); }
                .eep-swatch-width-narrow { background: linear-gradient(to right, transparent 0 22%, #e2e8f0 22% 78%, transparent 78% 100%), #fff; }
                .eep-swatch-width-standard { background: linear-gradient(to right, transparent 0 14%, #e2e8f0 14% 86%, transparent 86% 100%), #fff; }
                .eep-swatch-width-wide { background: linear-gradient(to right, transparent 0 7%, #e2e8f0 7% 93%, transparent 93% 100%), #fff; }
                .eep-swatch-width-full { background: linear-gradient(to right, #e2e8f0 0 100%), #fff; }
                .eep-settings-core-title { margin: 0 0 8px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
                .eep-settings-core-title .dashicons { color: #ff5e14; }
                .eep-settings-core-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
                .eep-settings-core-actions .description { margin: 0 !important; }
                .eep-preloader-preview-shell { --eep-preloader-preview-bg: #ffffff; --eep-preloader-preview-fade: 420ms; --eep-preloader-preview-width: 420px; position: relative; min-height: 220px; border: 1px solid #d9e2ee; border-radius: 14px; background: var(--eep-preloader-preview-bg); overflow: hidden; display: flex; align-items: center; justify-content: center; box-shadow: inset 0 0 0 1px rgba(255,255,255,.65), 0 8px 18px rgba(15, 23, 42, .05); opacity: 1; transform: scale(1); transition: opacity var(--eep-preloader-preview-fade) ease, transform var(--eep-preloader-preview-fade) ease; }
                .eep-preloader-preview-shell::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(to right, rgba(148,163,184,.12) 1px, transparent 1px), linear-gradient(to bottom, rgba(148,163,184,.12) 1px, transparent 1px); background-size: 24px 24px; pointer-events: none; }
                .eep-preloader-preview-shell.is-fading { opacity: 0; transform: scale(.985); }
                .eep-preloader-preview-stage { position: relative; z-index: 2; width: min(var(--eep-preloader-preview-width), 90%); max-height: 70%; display: flex; align-items: center; justify-content: center; }
                .eep-preloader-preview-stage img,
                .eep-preloader-preview-stage svg { display: block; width: 100%; height: auto; max-width: 100%; max-height: 160px; }
                .eep-preloader-preview-empty { text-align: center; color: #64748b; font-size: 12px; font-weight: 600; letter-spacing: .01em; }
                .eep-preloader-preview-meta { margin-top: 8px; font-size: 12px; color: #64748b; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
                .eep-settings-panel input[type="checkbox"] { -webkit-appearance: none; appearance: none; width: 42px; height: 24px; border-radius: 999px; border: 1px solid #cbd5e1; background: #e5e7eb; position: relative; cursor: pointer; vertical-align: middle; margin: 0 10px 0 0; transition: background-color .2s ease, border-color .2s ease; }
                .eep-settings-panel input[type="checkbox"]::before { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .25); transition: transform .2s ease; }
                .eep-settings-panel input[type="checkbox"]:checked { background: #ff5e14; border-color: #ff5e14; }
                .eep-settings-panel input[type="checkbox"]:checked::before { transform: translateX(18px); }
                .eep-settings-panel input[type="checkbox"]:focus-visible { outline: 2px solid #1d4ed8; outline-offset: 2px; }
                .eep-settings-panel label:has(> input[type="checkbox"]) { display: flex; align-items: center; gap: 2px; line-height: 1.4; margin-bottom: 0; }
                .eep-shortcode-table code { font-size: 12px; }
                .eep-shortcode-copy-cell { width: 130px; text-align: right; }
                .eep-settings-shortcode-actions { margin-bottom: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
                .eep-media-picker { display: grid; gap: 8px; }
                .eep-media-dropzone { width: 100%; border: 1px dashed #d0d7e2; border-radius: 12px; background: #f7fafc; padding: 14px; text-align: center; cursor: pointer; display: grid; gap: 4px; align-items: center; justify-items: center; }
                .eep-media-dropzone .dashicons { color: #f97316; font-size: 20px; width: 20px; height: 20px; }
                .eep-media-dropzone strong { font-size: 13px; color: #111827; }
                .eep-media-dropzone span { font-size: 12px; color: #64748b; }
                .eep-media-dropzone.is-dragover { border-color: #f97316; background: #fff7ed; }
                .eep-media-gallery { display: grid; gap: 8px; margin-top: 2px; }
                .eep-fallback-preview-grid { grid-template-columns: repeat(auto-fit, minmax(82px, 82px)); }
                .eep-fallback-preview-single { grid-template-columns: minmax(0, 260px); }
                .eep-media-tile { position: relative; border: 1px solid #dcdcde; border-radius: 10px; overflow: hidden; background: #fff; }
                .eep-media-tile img { width: 100%; height: 82px; object-fit: cover; display: block; }
                .eep-fallback-preview-single .eep-media-tile img { height: 148px; }
                .eep-media-remove { position: absolute; top: 6px; right: 6px; border: 0; border-radius: 999px; width: 22px; height: 22px; cursor: pointer; background: rgba(15, 23, 42, 0.82); color: #fff; font-size: 16px; line-height: 1; }
                .eep-media-remove:hover { background: rgba(220, 38, 38, 0.9); }
                .eep-media-feedback { min-height: 16px; margin: 0 !important; }
                .eep-media-feedback[data-tone="error"] { color: #b91c1c; }
                .eep-media-feedback[data-tone="success"] { color: #166534; }
                .eep-settings-counter { margin-top: 5px; color: #64748b; font-size: 12px; }
                .eep-seo-serp-preview { margin-top: 10px; padding: 12px; border: 1px solid #e5e7eb; border-radius: 12px; background: #fff; }
                .eep-seo-serp-url { color: #166534; font-size: 12px; margin-bottom: 5px; line-height: 1.4; word-break: break-all; }
                .eep-seo-serp-title { color: #1a0dab; font-size: 18px; line-height: 1.35; margin-bottom: 4px; font-weight: 500; }
                .eep-seo-serp-description { color: #4b5563; font-size: 13px; line-height: 1.45; }
                .eep-settings-accordion { border: 1px solid #dcdcde; border-radius: 10px; background: #fff; padding: 8px 10px; margin-top: 4px; }
                .eep-settings-accordion > summary { cursor: pointer; font-weight: 600; color: #1d2327; }
                .eep-settings-accordion[open] > summary { margin-bottom: 10px; }
                .eep-map-skin-legend { margin: 8px 0 0; padding-left: 18px; color: #50575e; }
                .eep-help-link { margin-left: 6px; text-decoration: none; }
                .eep-help-link .dashicons { font-size: 16px; width: 16px; height: 16px; vertical-align: text-bottom; }
                .eep-help-trigger { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-left: 6px; border: 1px solid #dcdcde; border-radius: 50%; background: #f6f7f7; color: #2271b1; cursor: pointer; vertical-align: middle; }
                .eep-help-trigger:hover { border-color: #2271b1; background: #eef4fb; color: #135e96; }
                .eep-help-trigger .dashicons { width: 16px; height: 16px; font-size: 16px; line-height: 1; }
                .eep-help-dialog-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.48); z-index: 99998; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
                .eep-help-dialog { position: fixed; top: 50%; left: 50%; width: min(680px, calc(100vw - 34px)); max-height: calc(100vh - 48px); overflow: auto; transform: translate(-50%, -48%); z-index: 99999; background: #fff; border-radius: 14px; box-shadow: 0 18px 42px rgba(16, 24, 40, .28); border: 1px solid #dcdcde; padding: 18px 18px 16px; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
                .eep-help-dialog.is-open,
                .eep-help-dialog-backdrop.is-open { opacity: 1; pointer-events: auto; }
                .eep-help-dialog.is-open { transform: translate(-50%, -50%); }
                .eep-help-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
                .eep-help-dialog-header h3 { margin: 0; font-size: 18px; line-height: 1.3; }
                .eep-help-dialog-close { border: 1px solid #dcdcde; border-radius: 50%; width: 28px; height: 28px; background: #fff; cursor: pointer; font-size: 18px; line-height: 1; color: #1d2327; }
                .eep-help-dialog-close:hover { border-color: #2271b1; color: #135e96; }
                .eep-help-dialog-body { color: #2c3338; font-size: 14px; line-height: 1.55; }
                .eep-help-dialog-body p { margin: 0 0 10px; }
                .eep-custom-fields-wrap { border: 1px solid #dcdcde; border-radius: 8px; overflow: hidden; background: #fff; }
                .eep-custom-fields-table { width: 100%; border-collapse: collapse; }
                .eep-custom-fields-table th, .eep-custom-fields-table td { padding: 8px; border-bottom: 1px solid #f0f0f1; vertical-align: top; }
                .eep-custom-fields-table th { background: #f6f7f7; text-align: left; font-weight: 600; }
                .eep-custom-fields-table input[type="text"], .eep-custom-fields-table select, .eep-custom-fields-table textarea { width: 100%; margin: 0; }
                .eep-custom-fields-table textarea { min-height: 68px; }
                .eep-custom-fields-controls { margin-top: 10px; display: flex; gap: 8px; align-items: center; }
                .eep-custom-fields-empty { padding: 10px; color: #646970; }
                @media (max-width: 900px) {
                    .eep-settings-premium .eep-admin-hero { grid-template-columns: 1fr; gap: 12px; padding: 18px; }
                    .eep-settings-premium .eep-admin-hero h1 { font-size: 24px; }
                    .eep-settings-shell { grid-template-columns: 1fr; }
                    .eep-settings-sidebar { position: static; top: auto; padding: 10px; }
                    .eep-settings-content-header { padding: 12px; }
                    .eep-settings-content-header h2 { font-size: 18px; }
                    .eep-settings-grid { grid-template-columns: 1fr; }
                    .eep-settings-subtabs { gap: 5px; grid-template-columns: 1fr; }
                    .eep-settings-subtabs .eep-settings-subtab { width: 100%; justify-content: flex-start; border-radius: 8px; min-height: 30px; padding: 6px 9px; font-size: 11px; }
                    .eep-settings-inline { flex-direction: column; align-items: stretch; }
                    .eep-monetization-row,
                    .eep-monetization-row-type { grid-template-columns: 1fr; }
                    .eep-monetization-col-actions { justify-content: flex-start; }
                    .eep-settings-route-row { grid-template-columns: 1fr; gap: 6px; }
                    .eep-connection-row { grid-template-columns: 1fr; }
                    .eep-shortcode-copy-cell { width: auto; text-align: left; }
                    .eep-fallback-preview-grid { grid-template-columns: repeat(auto-fit, minmax(64px, 64px)); }
                    .eep-media-tile img { height: 64px; }
                    .eep-fallback-preview-single { grid-template-columns: 1fr; }
                    .eep-fallback-preview-single .eep-media-tile img { height: auto; max-height: 220px; }
                    .eep-custom-fields-table th, .eep-custom-fields-table td { padding: 6px; }
                    .eep-settings-sticky-save { flex-direction: column; align-items: stretch; }
                    .eep-settings-sticky-actions { width: 100%; justify-content: stretch; }
                    .eep-settings-sticky-actions .button { width: 100%; text-align: center; }
                }
            </style>
            <form method="post" action="options.php">
                <?php settings_fields('eep_settings_group'); ?>
                <?php if ($white_label_is_unlocked && $white_label_unlock_token !== '') : ?>
                    <input type="hidden" name="eep_white_label_unlock_token" value="<?php echo esc_attr($white_label_unlock_token); ?>">
                <?php endif; ?>
                <nav class="nav-tab-wrapper eep-settings-tabs" id="eep-settings-tabs">
                    <a href="#eep-tab-general" class="nav-tab nav-tab-active" data-tab="general"><span class="dashicons dashicons-admin-generic" aria-hidden="true"></span><?php esc_html_e('General', 'nexdirectory'); ?></a>
                    <a href="#eep-tab-design-maps" class="nav-tab" data-tab="design-maps"><span class="dashicons dashicons-art" aria-hidden="true"></span><?php esc_html_e('Design & Maps', 'nexdirectory'); ?></a>
                    <a href="#eep-tab-submissions" class="nav-tab" data-tab="submissions"><span class="dashicons dashicons-clipboard" aria-hidden="true"></span><?php esc_html_e('Submissions', 'nexdirectory'); ?></a>
                    <a href="#eep-tab-monetization" class="nav-tab" data-tab="monetization"><span class="dashicons dashicons-money-alt" aria-hidden="true"></span><?php esc_html_e('Monetisation', 'nexdirectory'); ?></a>
                    <a href="#eep-tab-notifications" class="nav-tab" data-tab="notifications"><span class="dashicons dashicons-bell" aria-hidden="true"></span><?php esc_html_e('Notifications', 'nexdirectory'); ?></a>
                    <a href="#eep-tab-chatbot" class="nav-tab is-disabled" data-tab="chatbot" data-disabled="1" aria-disabled="true"><span class="dashicons dashicons-format-chat" aria-hidden="true"></span><?php esc_html_e('AI Chatbot (Coming soon)', 'nexdirectory'); ?></a>
                    <a href="#eep-tab-advanced" class="nav-tab" data-tab="advanced"><span class="dashicons dashicons-admin-tools" aria-hidden="true"></span><?php esc_html_e('Advanced', 'nexdirectory'); ?></a>
                </nav>
                <div class="eep-settings-shell">
                    <aside class="eep-settings-sidebar">
                        <h3 class="eep-settings-sidebar-title"><?php esc_html_e('Navigate Settings', 'nexdirectory'); ?></h3>
                        <p class="eep-settings-search-meta" id="eep-settings-search-meta"><?php esc_html_e('Search all sections and tabs.', 'nexdirectory'); ?></p>
                        <nav class="eep-settings-subtabs" id="eep-settings-subtabs" aria-label="<?php esc_attr_e('Settings sections', 'nexdirectory'); ?>">
                            <a href="#eep-tab-general--setup" class="eep-settings-subtab is-active" data-parent-tab="general" data-subtab="setup"><?php esc_html_e('Setup', 'nexdirectory'); ?></a>
                            <a href="#eep-tab-general--routing" class="eep-settings-subtab" data-parent-tab="general" data-subtab="routing"><?php esc_html_e('Routing', 'nexdirectory'); ?></a>
                            <a href="#eep-tab-general--navbar" class="eep-settings-subtab" data-parent-tab="general" data-subtab="navbar"><?php esc_html_e('Navbar', 'nexdirectory'); ?></a>
                            <a href="#eep-tab-general--footer" class="eep-settings-subtab" data-parent-tab="general" data-subtab="footer"><?php esc_html_e('Footer', 'nexdirectory'); ?></a>
                            <a href="#eep-tab-general--shortcodes" class="eep-settings-subtab" data-parent-tab="general" data-subtab="shortcodes"><?php esc_html_e('Shortcodes', 'nexdirectory'); ?></a>
                            <a href="#eep-tab-design-maps--branding" class="eep-settings-subtab" data-parent-tab="design-maps" data-subtab="branding"><?php esc_html_e('Branding & UI', 'nexdirectory'); ?></a>
                            <a href="#eep-tab-design-maps--heros" class="eep-settings-subtab" data-parent-tab="design-maps" data-subtab="heros"><?php esc_html_e('Heroes', 'nexdirectory'); ?></a>
                            <a href="#eep-tab-design-maps--layouts" class="eep-settings-subtab" data-parent-tab="design-maps" data-subtab="layouts"><?php esc_html_e('Layouts', 'nexdirectory'); ?></a>
                            <a href="#eep-tab-design-maps--maps" class="eep-settings-subtab" data-parent-tab="design-maps" data-subtab="maps"><?php esc_html_e('Maps Configuration', 'nexdirectory'); ?></a>
                            <a href="#eep-tab-submissions--rules" class="eep-settings-subtab" data-parent-tab="submissions" data-subtab="rules"><?php esc_html_e('Rules & Moderation', 'nexdirectory'); ?></a>
                            <a href="#eep-tab-submissions--permissions" class="eep-settings-subtab" data-parent-tab="submissions" data-subtab="permissions"><?php esc_html_e('Roles & Access', 'nexdirectory'); ?></a>
                            <a href="#eep-tab-submissions--submission-form" class="eep-settings-subtab" data-parent-tab="submissions" data-subtab="submission-form"><?php esc_html_e('Form Setup & Limits', 'nexdirectory'); ?></a>
                            <a href="#eep-tab-monetization--boost-packages" class="eep-settings-subtab" data-parent-tab="monetization" data-subtab="boost-packages"><?php esc_html_e('Boost Packages', 'nexdirectory'); ?></a>
                            <a href="#eep-tab-monetization--boost-payment" class="eep-settings-subtab" data-parent-tab="monetization" data-subtab="boost-payment"><?php esc_html_e('Boost Payment', 'nexdirectory'); ?></a>
                            <a href="#eep-tab-monetization--tickets" class="eep-settings-subtab" data-parent-tab="monetization" data-subtab="tickets"><?php esc_html_e('Tickets', 'nexdirectory'); ?></a>
                            <a href="#eep-tab-notifications--email" class="eep-settings-subtab" data-parent-tab="notifications" data-subtab="email"><?php esc_html_e('Email', 'nexdirectory'); ?></a>
                            <a href="#eep-tab-notifications--alerts" class="eep-settings-subtab" data-parent-tab="notifications" data-subtab="alerts"><?php esc_html_e('Alerts', 'nexdirectory'); ?></a>
                            <a href="#eep-tab-chatbot--chatbot" class="eep-settings-subtab is-disabled" data-parent-tab="chatbot" data-subtab="chatbot" data-disabled="1" aria-disabled="true"><?php esc_html_e('Chatbot (Coming soon)', 'nexdirectory'); ?></a>
                            <a href="#eep-tab-advanced--seo" class="eep-settings-subtab" data-parent-tab="advanced" data-subtab="seo"><?php esc_html_e('SEO', 'nexdirectory'); ?></a>
                            <a href="#eep-tab-advanced--extension" class="eep-settings-subtab" data-parent-tab="advanced" data-subtab="extension"><?php esc_html_e('Chrome Extension', 'nexdirectory'); ?></a>
                            <a href="#eep-tab-advanced--email" class="eep-settings-subtab" data-parent-tab="advanced" data-subtab="email"><?php esc_html_e('SMTP Email', 'nexdirectory'); ?></a>
                            <a href="#eep-tab-advanced--apis" class="eep-settings-subtab" data-parent-tab="advanced" data-subtab="apis"><?php esc_html_e('APIs', 'nexdirectory'); ?></a>
                            <a href="#eep-tab-advanced--display" class="eep-settings-subtab" data-parent-tab="advanced" data-subtab="display"><?php esc_html_e('Display', 'nexdirectory'); ?></a>
                            <a href="#eep-tab-advanced--white-label" class="eep-settings-subtab" data-parent-tab="advanced" data-subtab="white-label"><?php esc_html_e('White Label', 'nexdirectory'); ?></a>
                            <a href="#eep-tab-advanced--logs" class="eep-settings-subtab" data-parent-tab="advanced" data-subtab="logs"><?php esc_html_e('Logs', 'nexdirectory'); ?></a>
                        </nav>
                    </aside>
                    <div class="eep-settings-content" id="eep-settings-content">
                        <div class="eep-settings-content-header">
                            <h2 id="eep-settings-active-section-title"><?php esc_html_e('Setup', 'nexdirectory'); ?></h2>
                            <p id="eep-settings-active-section-description"><?php esc_html_e('Manage configuration and preferences for this section.', 'nexdirectory'); ?></p>
                        </div>
                        <div class="eep-settings-search-empty" id="eep-settings-search-empty" hidden><?php esc_html_e('No fields matched your search across settings.', 'nexdirectory'); ?></div>
                <?php require __DIR__ . '/sections/tab-general.php'; ?>
                <?php require __DIR__ . '/sections/tab-design-maps.php'; ?>
                <?php require __DIR__ . '/sections/tab-submissions.php'; ?>
                <?php require __DIR__ . '/sections/tab-monetization.php'; ?>
                <?php require __DIR__ . '/sections/tab-notifications.php'; ?>
                <?php require __DIR__ . '/sections/tab-chatbot.php'; ?>
                <?php require __DIR__ . '/sections/tab-advanced.php'; ?>
                    </div>
                </div>

                <div class="eep-settings-sticky-save">
                    <div class="eep-settings-sticky-status">
                        <span class="eep-settings-status-dot" id="eep-settings-status-dot" aria-hidden="true"></span>
                        <p id="eep-settings-autosave-status-sticky" class="eep-settings-autosave-status"><?php esc_html_e('Auto-save is active. Changes save automatically.', 'nexdirectory'); ?></p>
                    </div>
                    <div class="eep-settings-sticky-actions">
                        <button type="button" class="button" id="eep-settings-reset-button-sticky"><?php esc_html_e('Reset View', 'nexdirectory'); ?></button>
                        <button type="submit" class="button button-primary" id="eep-settings-save-button"><?php esc_html_e('Save Settings', 'nexdirectory'); ?></button>
                    </div>
                </div>
            </form>
            </section>
            <form id="eep-clear-logs-form" method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>">
                <input type="hidden" name="action" value="eep_clear_logs">
                <?php wp_nonce_field('eep_clear_logs', 'eep_clear_logs_nonce'); ?>
            </form>
            <form id="eep-send-test-email-form" method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>">
                <input type="hidden" name="action" value="eep_send_test_email">
                <?php wp_nonce_field('eep_send_test_email', 'eep_send_test_email_nonce'); ?>
            </form>
            <form id="eep-test-map-form" method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>">
                <input type="hidden" name="action" value="eep_test_map_connection">
                <?php wp_nonce_field('eep_test_map_connection', 'eep_test_map_connection_nonce'); ?>
            </form>
            <form id="eep-test-captcha-form" method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>">
                <input type="hidden" name="action" value="eep_test_captcha_connection">
                <?php wp_nonce_field('eep_test_captcha_connection', 'eep_test_captcha_connection_nonce'); ?>
            </form>
            <form id="eep-test-routing-form" method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>">
                <input type="hidden" name="action" value="eep_test_routing_connection">
                <?php wp_nonce_field('eep_test_routing_connection', 'eep_test_routing_connection_nonce'); ?>
            </form>
            <form id="eep-reset-smooth-scroll-form" method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>">
                <input type="hidden" name="action" value="eep_reset_smooth_scroll_defaults">
                <?php wp_nonce_field('eep_reset_smooth_scroll_defaults', 'eep_reset_smooth_scroll_defaults_nonce'); ?>
            </form>
            <form id="eep-chatbot-test-form" method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>">
                <input type="hidden" name="action" value="eep_chatbot_test_connection">
                <?php wp_nonce_field('eep_chatbot_test_connection', 'eep_chatbot_test_connection_nonce'); ?>
            </form>
            <form id="eep-chatbot-reindex-form" method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>">
                <input type="hidden" name="action" value="eep_chatbot_reindex_now">
                <?php wp_nonce_field('eep_chatbot_reindex_now', 'eep_chatbot_reindex_now_nonce'); ?>
            </form>
            <form id="eep-chatbot-clear-form" method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>">
                <input type="hidden" name="action" value="eep_chatbot_clear_index">
                <?php wp_nonce_field('eep_chatbot_clear_index', 'eep_chatbot_clear_index_nonce'); ?>
            </form>
            <form id="eep-generate-pages-form" method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>">
                <input type="hidden" name="action" value="eep_generate_pages">
                <?php wp_nonce_field('eep_generate_pages', 'eep_generate_pages_nonce'); ?>
            </form>
            <form id="eep-regenerate-app-pass-form" method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>">
                <input type="hidden" name="action" value="eep_regenerate_extension_app_pass">
                <?php wp_nonce_field('eep_regenerate_extension_app_pass', 'eep_regenerate_extension_app_pass_nonce'); ?>
            </form>
            <form id="eep-white-label-unlock-form" method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>">
                <input type="hidden" name="action" value="eep_white_label_unlock">
                <?php wp_nonce_field('eep_white_label_unlock', 'eep_white_label_unlock_nonce'); ?>
            </form>
            <form id="eep-white-label-lock-form" method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>">
                <input type="hidden" name="action" value="eep_white_label_lock">
                <?php wp_nonce_field('eep_white_label_lock', 'eep_white_label_lock_nonce'); ?>
            </form>
            <form id="eep-white-label-reset-defaults-form" method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>">
                <input type="hidden" name="action" value="eep_white_label_reset_defaults">
                <input type="hidden" name="eep_white_label_unlock_token" value="<?php echo esc_attr($white_label_unlock_token); ?>">
                <?php wp_nonce_field('eep_white_label_reset_defaults', 'eep_white_label_reset_defaults_nonce'); ?>
            </form>
            <form id="eep-white-label-force-reset-form" method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>">
                <input type="hidden" name="action" value="eep_white_label_force_reset">
                <?php wp_nonce_field('eep_white_label_force_reset', 'eep_white_label_force_reset_nonce'); ?>
            </form>
            <div class="eep-help-dialog-backdrop" id="eep-settings-help-backdrop" data-eep-help-close="1"></div>
            <div class="eep-help-dialog" id="eep-settings-help-dialog" role="dialog" aria-modal="true" aria-hidden="true" aria-labelledby="eep-settings-help-title">
                <div class="eep-help-dialog-header">
                    <h3 id="eep-settings-help-title"><?php esc_html_e('Settings Help', 'nexdirectory'); ?></h3>
                    <button type="button" class="eep-help-dialog-close" data-eep-help-close="1" aria-label="<?php esc_attr_e('Close help dialog', 'nexdirectory'); ?>">&times;</button>
                </div>
                <div class="eep-help-dialog-body" id="eep-settings-help-body">
                    <p><?php esc_html_e('Click the help icons beside each field to see guidance.', 'nexdirectory'); ?></p>
                </div>
            </div>
            <script>
                (function () {
                    var tabsRoot = document.getElementById('eep-settings-tabs');
                    if (!tabsRoot) {
                        return;
                    }
                    var tabs = tabsRoot.querySelectorAll('[data-tab]');
                    var subtabsRoot = document.getElementById('eep-settings-subtabs');
                    var subtabs = subtabsRoot ? subtabsRoot.querySelectorAll('[data-parent-tab][data-subtab]') : [];
                    var panels = document.querySelectorAll('.eep-settings-panel[data-tab][data-subtab]');
                    var settingsForm = document.querySelector('form[action="options.php"]');
                    var dirtyState = false;
                    var activeTabStorageKey = 'eepSettingsActiveTab';
                    var activeSubtabStorageKey = 'eepSettingsActiveSubtab';
                    var settingsSearchPrimaryInput = document.getElementById('eep-settings-search');
                    var settingsSearchTopInput = document.getElementById('eep-settings-search-top');
                    var settingsSearchInputs = [settingsSearchPrimaryInput, settingsSearchTopInput].filter(function (inputEl) {
                        return !!inputEl;
                    });
                    var settingsSearchPrimaryClear = document.getElementById('eep-settings-search-clear');
                    var settingsSearchTopClear = document.getElementById('eep-settings-search-top-clear');
                    var settingsSearchClearButtons = [settingsSearchPrimaryClear, settingsSearchTopClear].filter(function (buttonEl) {
                        return !!buttonEl;
                    });
                    var settingsSearchMeta = document.getElementById('eep-settings-search-meta');
                    var settingsSearchEmpty = document.getElementById('eep-settings-search-empty');
                    var settingsSaveButton = document.getElementById('eep-settings-save-button');
                    var resetViewButtonSticky = document.getElementById('eep-settings-reset-button-sticky');
                    var autosaveStatusNodes = [
                        document.getElementById('eep-settings-autosave-status-sticky')
                    ].filter(function (nodeEl) {
                        return !!nodeEl;
                    });
                    var autosaveStatusDot = document.getElementById('eep-settings-status-dot');
                    var activeSectionTitleNode = document.getElementById('eep-settings-active-section-title');
                    var activeSectionDescriptionNode = document.getElementById('eep-settings-active-section-description');
                    var autosaveDebounceMs = 900;
                    var autosaveTimer = null;
                    var autosaveInFlight = false;
                    var autosaveQueued = false;
                    var autosaveStatusTimer = null;
                    var searchCrossTabJumpInProgress = false;
                    var getSettingsSearchQuery = function () {
                        if (!settingsSearchInputs.length) {
                            return '';
                        }
                        var raw = String(settingsSearchInputs[0].value || '').trim();
                        return raw.toLowerCase();
                    };
                    var syncSettingsSearchInputs = function (value, originInput) {
                        settingsSearchInputs.forEach(function (inputEl) {
                            if (!inputEl || inputEl === originInput) {
                                return;
                            }
                            inputEl.value = String(value || '');
                        });
                    };
                    var clearSettingsSearch = function (focusInput) {
                        settingsSearchInputs.forEach(function (inputEl) {
                            if (inputEl) {
                                inputEl.value = '';
                            }
                        });
                        if (focusInput && typeof focusInput.focus === 'function') {
                            focusInput.focus();
                        }
                    };
                    var pendingBadgeToggle = document.querySelector('input[name="eep_notify_admin_pending_badge"][type="checkbox"]');
                    var pendingEmailToggle = document.querySelector('input[name="eep_notify_admin_pending_email"][type="checkbox"]');
                    var legacyPendingToggleInput = document.getElementById('eep_enable_pending_admin_notifications');
                    var syncLegacyPendingToggle = function () {
                        if (!legacyPendingToggleInput) {
                            return;
                        }
                        var enabled = false;
                        if (pendingBadgeToggle && pendingBadgeToggle.checked) {
                            enabled = true;
                        }
                        if (pendingEmailToggle && pendingEmailToggle.checked) {
                            enabled = true;
                        }
                        legacyPendingToggleInput.value = enabled ? '1' : '0';
                    };
                    if (pendingBadgeToggle) {
                        pendingBadgeToggle.addEventListener('change', syncLegacyPendingToggle);
                    }
                    if (pendingEmailToggle) {
                        pendingEmailToggle.addEventListener('change', syncLegacyPendingToggle);
                    }
                    syncLegacyPendingToggle();
                    document.addEventListener('click', function (event) {
                        var submitter = event.target ? event.target.closest('button[form]') : null;
                        if (!submitter) {
                            return;
                        }
                        var formId = String(submitter.getAttribute('form') || '').trim();
                        if (!formId) {
                            return;
                        }
                        var externalForm = document.getElementById(formId);
                        if (!externalForm) {
                            return;
                        }
                        var parentForm = submitter.closest('form');
                        if (parentForm && parentForm === externalForm) {
                            return;
                        }
                        if (submitter.disabled) {
                            return;
                        }
                        event.preventDefault();
                        if (typeof externalForm.requestSubmit === 'function') {
                            externalForm.requestSubmit();
                            return;
                        }
                        externalForm.submit();
                    });
                    var getActivePanel = function () {
                        return document.querySelector('.eep-settings-panel.is-active');
                    };
                    var getSubtabLabel = function (parentKey, subtabKey) {
                        var label = '';
                        subtabs.forEach(function (subtab) {
                            var tabParent = String(subtab.getAttribute('data-parent-tab') || '').trim();
                            var tabChild = String(subtab.getAttribute('data-subtab') || '').trim();
                            if (tabParent === String(parentKey || '').trim() && tabChild === String(subtabKey || '').trim()) {
                                label = String(subtab.textContent || '').trim();
                            }
                        });
                        return label;
                    };
                    var getTabLabel = function (tabKey) {
                        var label = '';
                        tabs.forEach(function (tab) {
                            if (label) {
                                return;
                            }
                            if (String(tab.getAttribute('data-tab') || '').trim() !== String(tabKey || '').trim()) {
                                return;
                            }
                            label = String(tab.textContent || '').replace(/\s+/g, ' ').trim();
                        });
                        return label;
                    };
                    var updateActiveSectionHeader = function (parentKey, subtabKey) {
                        if (!activeSectionTitleNode && !activeSectionDescriptionNode) {
                            return;
                        }
                        var subtabLabel = getSubtabLabel(parentKey, subtabKey);
                        var tabLabel = getTabLabel(parentKey);
                        if (activeSectionTitleNode) {
                            activeSectionTitleNode.textContent = subtabLabel || '<?php echo esc_js(__('Settings', 'nexdirectory')); ?>';
                        }
                        if (activeSectionDescriptionNode) {
                            if (subtabLabel && tabLabel) {
                                activeSectionDescriptionNode.textContent = '<?php echo esc_js(__('Manage configuration and preferences for', 'nexdirectory')); ?> ' + tabLabel + ' / ' + subtabLabel + '.';
                            } else {
                                activeSectionDescriptionNode.textContent = '<?php echo esc_js(__('Manage configuration and preferences for this section.', 'nexdirectory')); ?>';
                            }
                        }
                    };
                    var isControlDisabled = function (el) {
                        if (!el) {
                            return false;
                        }
                        return String(el.getAttribute('data-disabled') || '').trim() === '1';
                    };
                    var getFieldSearchText = function (fieldEl) {
                        if (!fieldEl) {
                            return '';
                        }
                        var cache = String(fieldEl.getAttribute('data-eep-search-text') || '').trim();
                        if (cache !== '') {
                            return cache;
                        }
                        var textParts = [];
                        var titleNodes = fieldEl.querySelectorAll('label, h2, h3, h4, legend, summary, strong');
                        titleNodes.forEach(function (node) {
                            var text = String(node.textContent || '').replace(/\s+/g, ' ').trim();
                            if (text) {
                                textParts.push(text);
                            }
                        });
                        var descriptionNodes = fieldEl.querySelectorAll('.description');
                        descriptionNodes.forEach(function (node) {
                            var text = String(node.textContent || '').replace(/\s+/g, ' ').trim();
                            if (text) {
                                textParts.push(text);
                            }
                        });
                        var valueNodes = fieldEl.querySelectorAll('input, textarea, select, option, button, code');
                        valueNodes.forEach(function (node) {
                            var text = String(node.textContent || '').replace(/\s+/g, ' ').trim();
                            if (text) {
                                textParts.push(text);
                            }
                            var attrs = ['name', 'id', 'placeholder', 'value', 'data-subtab', 'data-parent-tab'];
                            attrs.forEach(function (attrKey) {
                                var attrValue = String(node.getAttribute(attrKey) || '').replace(/\s+/g, ' ').trim();
                                if (attrValue) {
                                    textParts.push(attrValue);
                                }
                            });
                        });
                        var fallbackFieldText = String(fieldEl.textContent || '').replace(/\s+/g, ' ').trim();
                        if (fallbackFieldText) {
                            textParts.push(fallbackFieldText);
                        }
                        var serialized = textParts.join(' ').toLowerCase();
                        fieldEl.setAttribute('data-eep-search-text', serialized);
                        return serialized;
                    };
                    var applySettingsSearch = function (parentKey, subtabKey, allowCrossTabJump) {
                        var canCrossTabJump = !!allowCrossTabJump;
                        var panel = getActivePanel();
                        var query = getSettingsSearchQuery();
                        var globalMatchCount = 0;
                        var globalSectionsWithMatches = [];
                        var firstMatchingPanel = null;
                        panels.forEach(function (panelEl) {
                            if (!panelEl) {
                                return;
                            }
                            var panelParent = String(panelEl.getAttribute('data-tab') || '').trim();
                            var panelSubtab = String(panelEl.getAttribute('data-subtab') || '').trim();
                            if (!panelParent || !panelSubtab) {
                                return;
                            }
                            var matchingSubtab = null;
                            subtabs.forEach(function (subtabEl) {
                                if (matchingSubtab) {
                                    return;
                                }
                                var subParent = String(subtabEl.getAttribute('data-parent-tab') || '').trim();
                                var subChild = String(subtabEl.getAttribute('data-subtab') || '').trim();
                                if (subParent === panelParent && subChild === panelSubtab) {
                                    matchingSubtab = subtabEl;
                                }
                            });
                            if (matchingSubtab && isControlDisabled(matchingSubtab)) {
                                return;
                            }
                            var panelFields = panelEl.querySelectorAll('.eep-settings-field');
                            var panelMatches = 0;
                            panelFields.forEach(function (fieldEl) {
                                var matched = true;
                                if (query !== '') {
                                    matched = getFieldSearchText(fieldEl).indexOf(query) > -1;
                                }
                                fieldEl.classList.toggle('eep-search-hidden', !matched);
                                if (matched) {
                                    panelMatches += 1;
                                }
                            });
                            if (query !== '' && panelMatches > 0) {
                                globalMatchCount += panelMatches;
                                globalSectionsWithMatches.push(panelParent + '::' + panelSubtab);
                                if (!firstMatchingPanel) {
                                    firstMatchingPanel = {
                                        parent: panelParent,
                                        subtab: panelSubtab
                                    };
                                }
                            }
                        });
                        if (!panel) {
                            if (settingsSearchMeta) {
                                settingsSearchMeta.textContent = '<?php echo esc_js(__('No settings section is active.', 'nexdirectory')); ?>';
                            }
                            if (settingsSearchEmpty) {
                                settingsSearchEmpty.hidden = true;
                            }
                            return;
                        }
                        if (query !== '' && canCrossTabJump && firstMatchingPanel && !searchCrossTabJumpInProgress) {
                            var activeParent = String(panel.getAttribute('data-tab') || '').trim();
                            var activeSubtab = String(panel.getAttribute('data-subtab') || '').trim();
                            if (activeParent !== firstMatchingPanel.parent || activeSubtab !== firstMatchingPanel.subtab) {
                                searchCrossTabJumpInProgress = true;
                                activate(firstMatchingPanel.parent, firstMatchingPanel.subtab);
                                searchCrossTabJumpInProgress = false;
                                return;
                            }
                        }
                        panel = getActivePanel();
                        if (settingsSearchMeta) {
                            var sectionLabel = getSubtabLabel(parentKey, subtabKey);
                            if (query === '') {
                                settingsSearchMeta.textContent = sectionLabel
                                    ? '<?php echo esc_js(__('Viewing section:', 'nexdirectory')); ?> ' + sectionLabel
                                    : '<?php echo esc_js(__('Search all sections and tabs.', 'nexdirectory')); ?>';
                            } else {
                                var sectionCount = Array.from(new Set(globalSectionsWithMatches)).length;
                                if (globalMatchCount > 0) {
                                    settingsSearchMeta.textContent = globalMatchCount + ' <?php echo esc_js(__('fields match across', 'nexdirectory')); ?> ' + sectionCount + ' <?php echo esc_js(__('sections.', 'nexdirectory')); ?>';
                                } else {
                                    settingsSearchMeta.textContent = '<?php echo esc_js(__('No settings fields matched your search.', 'nexdirectory')); ?>';
                                }
                            }
                        }
                        if (settingsSearchEmpty) {
                            settingsSearchEmpty.hidden = !(query !== '' && globalMatchCount === 0);
                        }
                    };
                    var findFirstSubtab = function (parentKey) {
                        var found = '';
                        subtabs.forEach(function (subtab) {
                            if (found !== '') {
                                return;
                            }
                            if (isControlDisabled(subtab)) {
                                return;
                            }
                            if (String(subtab.getAttribute('data-parent-tab') || '') === String(parentKey || '')) {
                                found = String(subtab.getAttribute('data-subtab') || '').trim();
                            }
                        });
                        return found;
                    };
                    var activate = function (parentKey, subtabKey) {
                        if (!parentKey) {
                            parentKey = 'general';
                        }
                        var parentMatched = false;
                        tabs.forEach(function (tab) {
                            if (tab.getAttribute('data-tab') === parentKey && !isControlDisabled(tab)) {
                                parentMatched = true;
                            }
                        });
                        if (!parentMatched) {
                            parentKey = 'general';
                        }
                        if (!subtabKey) {
                            subtabKey = findFirstSubtab(parentKey);
                        }
                        var subtabMatched = false;
                        subtabs.forEach(function (subtab) {
                            if (String(subtab.getAttribute('data-parent-tab') || '') === parentKey && String(subtab.getAttribute('data-subtab') || '') === subtabKey) {
                                subtabMatched = true;
                            }
                        });
                        if (!subtabMatched) {
                            subtabKey = findFirstSubtab(parentKey);
                        }
                        tabs.forEach(function (tab) {
                            var active = tab.getAttribute('data-tab') === parentKey;
                            tab.classList.toggle('nav-tab-active', active);
                        });
                        subtabs.forEach(function (subtab) {
                            var tabParent = String(subtab.getAttribute('data-parent-tab') || '').trim();
                            var tabChild = String(subtab.getAttribute('data-subtab') || '').trim();
                            var visible = tabParent === parentKey;
                            subtab.hidden = !visible;
                            subtab.classList.toggle('is-active', visible && tabChild === subtabKey);
                        });
                        panels.forEach(function (panel) {
                            var active = panel.getAttribute('data-tab') === parentKey && panel.getAttribute('data-subtab') === subtabKey;
                            panel.classList.toggle('is-active', active);
                        });
                        updateActiveSectionHeader(parentKey, subtabKey);
                        applySettingsSearch(parentKey, subtabKey, false);
                        try {
                            window.localStorage.setItem(activeTabStorageKey, parentKey);
                            window.localStorage.setItem(activeSubtabStorageKey, subtabKey);
                        } catch (storageError) {
                            // no-op
                        }
                        try {
                            if (window.history && typeof window.history.replaceState === 'function') {
                                var baseUrl = String(window.location.href || '').split('#')[0];
                                var hash = '#eep-tab-' + parentKey;
                                if (subtabKey) {
                                    hash += '--' + subtabKey;
                                }
                                window.history.replaceState({}, '', baseUrl + hash);
                            }
                        } catch (historyError) {
                            // no-op
                        }
                    };
                    var setAutosaveStatus = function (message, tone, persist) {
                        if (!autosaveStatusNodes.length) {
                            return;
                        }
                        autosaveStatusNodes.forEach(function (statusNode) {
                            statusNode.textContent = String(message || '').trim();
                            if (tone) {
                                statusNode.setAttribute('data-tone', String(tone));
                            } else {
                                statusNode.removeAttribute('data-tone');
                            }
                        });
                        if (autosaveStatusDot) {
                            if (tone) {
                                autosaveStatusDot.setAttribute('data-tone', String(tone));
                            } else {
                                autosaveStatusDot.removeAttribute('data-tone');
                            }
                        }
                        if (autosaveStatusTimer) {
                            window.clearTimeout(autosaveStatusTimer);
                            autosaveStatusTimer = null;
                        }
                        if (!persist && String(message || '').trim() !== '') {
                            autosaveStatusTimer = window.setTimeout(function () {
                                setAutosaveStatus('<?php echo esc_js(__('Auto-save enabled. Changes are saved automatically.', 'nexdirectory')); ?>', '', true);
                            }, 2800);
                        }
                    };
                    var runSettingsAutosave = function () {
                        if (!settingsForm || !dirtyState) {
                            return;
                        }
                        if (autosaveInFlight) {
                            autosaveQueued = true;
                            return;
                        }
                        autosaveInFlight = true;
                        autosaveQueued = false;
                        if (settingsSaveButton) {
                            settingsSaveButton.disabled = true;
                        }
                        setAutosaveStatus('<?php echo esc_js(__('Saving changes...', 'nexdirectory')); ?>', 'pending', true);
                        window.fetch(settingsForm.action, {
                            method: 'POST',
                            credentials: 'same-origin',
                            cache: 'no-store',
                            headers: {
                                'X-Requested-With': 'XMLHttpRequest'
                            },
                            body: new window.FormData(settingsForm)
                        }).then(function (response) {
                            if (!response || !response.ok) {
                                throw new Error('save_failed');
                            }
                            return response.text();
                        }).then(function () {
                            clearDirty();
                            setAutosaveStatus('<?php echo esc_js(__('All changes saved.', 'nexdirectory')); ?>', 'success');
                        }).catch(function () {
                            setAutosaveStatus('<?php echo esc_js(__('Auto-save failed. Use Save Settings.', 'nexdirectory')); ?>', 'error', true);
                        }).finally(function () {
                            autosaveInFlight = false;
                            if (settingsSaveButton) {
                                settingsSaveButton.disabled = false;
                            }
                            if (autosaveQueued) {
                                dirtyState = true;
                                scheduleSettingsAutosave(450);
                            }
                        });
                    };
                    var scheduleSettingsAutosave = function (delayMs) {
                        if (!settingsForm) {
                            return;
                        }
                        if (autosaveTimer) {
                            window.clearTimeout(autosaveTimer);
                            autosaveTimer = null;
                        }
                        autosaveTimer = window.setTimeout(function () {
                            autosaveTimer = null;
                            runSettingsAutosave();
                        }, typeof delayMs === 'number' ? delayMs : autosaveDebounceMs);
                    };
                    var markDirty = function () {
                        dirtyState = true;
                        scheduleSettingsAutosave();
                    };
                    var clearDirty = function () {
                        dirtyState = false;
                    };
                    if (settingsForm) {
                        settingsForm.querySelectorAll('input[name], select[name], textarea[name]').forEach(function (inputEl) {
                            inputEl.addEventListener('input', markDirty);
                            inputEl.addEventListener('change', markDirty);
                        });
                        settingsForm.addEventListener('submit', function () {
                            syncLegacyPendingToggle();
                            if (autosaveTimer) {
                                window.clearTimeout(autosaveTimer);
                                autosaveTimer = null;
                            }
                            clearDirty();
                        });
                    }
                    var resetSettingsView = function () {
                        var shouldReset = window.confirm('<?php echo esc_js(__('Reset the settings view and reload this page?', 'nexdirectory')); ?>');
                        if (!shouldReset) {
                            return;
                        }
                        try {
                            window.localStorage.removeItem(activeTabStorageKey);
                            window.localStorage.removeItem(activeSubtabStorageKey);
                        } catch (storageError) {
                            // no-op
                        }
                        var cleanUrl = String(window.location.href || '').split('#')[0];
                        window.location.href = cleanUrl;
                    };
                    if (resetViewButtonSticky) {
                        resetViewButtonSticky.addEventListener('click', resetSettingsView);
                    }
                    tabs.forEach(function (tab) {
                        tab.addEventListener('click', function (event) {
                            event.preventDefault();
                            if (isControlDisabled(tab)) {
                                return;
                            }
                            var key = tab.getAttribute('data-tab') || '';
                            if (key) {
                                activate(key, findFirstSubtab(key));
                            }
                        });
                    });
                    subtabs.forEach(function (subtab) {
                        subtab.addEventListener('click', function (event) {
                            event.preventDefault();
                            if (isControlDisabled(subtab)) {
                                return;
                            }
                            var parentKey = String(subtab.getAttribute('data-parent-tab') || '').trim();
                            var childKey = String(subtab.getAttribute('data-subtab') || '').trim();
                            if (parentKey && childKey) {
                                activate(parentKey, childKey);
                            }
                        });
                    });
                    var hashTab = '';
                    var hashSubtab = '';
                    var hashValue = String(window.location.hash || '').trim();
                    if (hashValue.indexOf('#eep-tab-') === 0) {
                        var hashToken = hashValue.replace('#eep-tab-', '');
                        if (hashToken.indexOf('--') > -1) {
                            var hashParts = hashToken.split('--');
                            hashTab = String(hashParts.shift() || '').trim();
                            hashSubtab = String(hashParts.shift() || '').trim();
                        } else {
                            hashTab = String(hashToken || '').trim();
                        }
                    }
                    if ((hashTab === '' || hashSubtab === '') && /^#eep-tab-[a-z0-9-]+$/i.test(hashValue)) {
                        var panelFromHash = document.getElementById(hashValue.replace('#', ''));
                        if (panelFromHash && panelFromHash.hasAttribute('data-tab') && panelFromHash.hasAttribute('data-subtab')) {
                            hashTab = String(panelFromHash.getAttribute('data-tab') || hashTab).trim();
                            hashSubtab = String(panelFromHash.getAttribute('data-subtab') || hashSubtab).trim();
                        }
                    }
                    var storedTab = '';
                    var storedSubtab = '';
                    try {
                        storedTab = String(window.localStorage.getItem(activeTabStorageKey) || '').trim();
                        storedSubtab = String(window.localStorage.getItem(activeSubtabStorageKey) || '').trim();
                    } catch (storageError) {
                        storedTab = '';
                        storedSubtab = '';
                    }
                    var initialTab = hashTab || storedTab || 'general';
                    var initialSubtab = hashSubtab || storedSubtab || '';
                    activate(initialTab, initialSubtab);
                    settingsSearchInputs.forEach(function (searchInput) {
                        searchInput.addEventListener('input', function () {
                            syncSettingsSearchInputs(searchInput.value, searchInput);
                            var activePanel = getActivePanel();
                            var tabKey = activePanel ? String(activePanel.getAttribute('data-tab') || '').trim() : initialTab;
                            var subtabKey = activePanel ? String(activePanel.getAttribute('data-subtab') || '').trim() : initialSubtab;
                            applySettingsSearch(tabKey, subtabKey, true);
                        });
                        searchInput.addEventListener('keydown', function (event) {
                            if (event.key === 'Escape') {
                                clearSettingsSearch(searchInput);
                                var activePanel = getActivePanel();
                                var tabKey = activePanel ? String(activePanel.getAttribute('data-tab') || '').trim() : initialTab;
                                var subtabKey = activePanel ? String(activePanel.getAttribute('data-subtab') || '').trim() : initialSubtab;
                                applySettingsSearch(tabKey, subtabKey, true);
                            }
                        });
                    });
                    settingsSearchClearButtons.forEach(function (clearButton) {
                        clearButton.addEventListener('click', function () {
                            var targetInputId = String(clearButton.getAttribute('data-target-input') || '').trim();
                            var focusTarget = targetInputId ? document.getElementById(targetInputId) : settingsSearchTopInput || settingsSearchPrimaryInput;
                            if (!focusTarget) {
                                focusTarget = settingsSearchTopInput || settingsSearchPrimaryInput;
                            }
                            clearSettingsSearch(focusTarget);
                            var activePanel = getActivePanel();
                            var tabKey = activePanel ? String(activePanel.getAttribute('data-tab') || '').trim() : initialTab;
                            var subtabKey = activePanel ? String(activePanel.getAttribute('data-subtab') || '').trim() : initialSubtab;
                            applySettingsSearch(tabKey, subtabKey, true);
                        });
                    });
                    document.addEventListener('keydown', function (event) {
                        var primarySearchInput = settingsSearchTopInput || settingsSearchPrimaryInput;
                        if (!primarySearchInput) {
                            return;
                        }
                        if (event.key !== '/') {
                            return;
                        }
                        var activeTag = document.activeElement ? String(document.activeElement.tagName || '').toLowerCase() : '';
                        if (activeTag === 'input' || activeTag === 'textarea' || activeTag === 'select') {
                            return;
                        }
                        event.preventDefault();
                        primarySearchInput.focus();
                    });

                    var autosaveToggle = document.getElementById('eep_enable_submit_autosave');
                    var autosaveField = document.getElementById('eep-autosave-interval-field');
                    var syncAutosaveField = function () {
                        if (!autosaveToggle || !autosaveField) {
                            return;
                        }
                        var enabled = !!autosaveToggle.checked;
                        autosaveField.style.display = enabled ? '' : 'none';
                    };
                    if (autosaveToggle && autosaveField) {
                        autosaveToggle.addEventListener('change', syncAutosaveField);
                        syncAutosaveField();
                    }

                    var themeOverrideMasterToggle = document.getElementById('eep_theme_override_all_plugin_pages');
                    var themeOverrideGranular = document.getElementById('eep-theme-override-granular');
                    var syncThemeOverrideFields = function () {
                        if (!themeOverrideMasterToggle || !themeOverrideGranular) {
                            return;
                        }
                        var showGranular = !themeOverrideMasterToggle.checked;
                        themeOverrideGranular.style.display = showGranular ? '' : 'none';
                    };
                    if (themeOverrideMasterToggle && themeOverrideGranular) {
                        themeOverrideMasterToggle.addEventListener('change', syncThemeOverrideFields);
                        syncThemeOverrideFields();
                    }

                    var presetSelects = document.querySelectorAll('[data-eep-preset-target]');
                    presetSelects.forEach(function (selectEl) {
                        var targetSelector = selectEl.getAttribute('data-eep-preset-target') || '';
                        if (!targetSelector) {
                            return;
                        }
                        var targetInput = document.querySelector(targetSelector);
                        if (!targetInput) {
                            return;
                        }
                        selectEl.addEventListener('change', function () {
                            var value = String(selectEl.value || '').trim();
                            if (value && value !== 'custom') {
                                targetInput.value = value;
                                markDirty();
                            }
                        });
                    });

                    var initHomepageSeoPreview = function () {
                        var titleInput = document.getElementById('eep_home_meta_title');
                        var descriptionInput = document.getElementById('eep_home_meta_description');
                        var titleCount = document.getElementById('eep-home-meta-title-count');
                        var descriptionCount = document.getElementById('eep-home-meta-description-count');
                        var titleStatus = document.getElementById('eep-home-meta-title-status');
                        var descriptionStatus = document.getElementById('eep-home-meta-description-status');
                        var serpTitle = document.getElementById('eep-home-serp-title');
                        var serpDescription = document.getElementById('eep-home-serp-description');
                        if (!titleInput || !descriptionInput || !titleCount || !descriptionCount || !titleStatus || !descriptionStatus || !serpTitle || !serpDescription) {
                            return;
                        }

                        var fallbackSerpTitle = String(serpTitle.textContent || '').trim();
                        var fallbackSerpDescription = String(serpDescription.textContent || '').trim();

                        var countChars = function (value) {
                            return Array.from(String(value || '')).length;
                        };
                        var buildTitleStatus = function (count) {
                            if (count === 0) {
                                return '<?php echo esc_js(__('Set an SEO title for homepage search results.', 'nexdirectory')); ?>';
                            }
                            if (count < 50) {
                                return '<?php echo esc_js(__('Too short. Aim for 50–60 characters.', 'nexdirectory')); ?>';
                            }
                            if (count <= 60) {
                                return '<?php echo esc_js(__('Good length for search display.', 'nexdirectory')); ?>';
                            }
                            return '<?php echo esc_js(__('Too long. Keep it under 60 characters.', 'nexdirectory')); ?>';
                        };
                        var buildDescriptionStatus = function (count) {
                            if (count === 0) {
                                return '<?php echo esc_js(__('Write a concise summary for homepage search snippets.', 'nexdirectory')); ?>';
                            }
                            if (count < 120) {
                                return '<?php echo esc_js(__('Too short. Aim for 120–158 characters.', 'nexdirectory')); ?>';
                            }
                            if (count <= 158) {
                                return '<?php echo esc_js(__('Good length for search display.', 'nexdirectory')); ?>';
                            }
                            return '<?php echo esc_js(__('Too long. Keep it under 158 characters.', 'nexdirectory')); ?>';
                        };
                        var sync = function () {
                            var titleValue = String(titleInput.value || '').trim();
                            var descriptionValue = String(descriptionInput.value || '').trim();
                            var titleLength = countChars(titleValue);
                            var descriptionLength = countChars(descriptionValue);

                            titleCount.textContent = String(titleLength);
                            descriptionCount.textContent = String(descriptionLength);
                            titleStatus.textContent = buildTitleStatus(titleLength);
                            descriptionStatus.textContent = buildDescriptionStatus(descriptionLength);

                            serpTitle.textContent = titleValue || fallbackSerpTitle;
                            serpDescription.textContent = descriptionValue || fallbackSerpDescription;
                        };

                        titleInput.addEventListener('input', sync);
                        descriptionInput.addEventListener('input', sync);
                        titleInput.addEventListener('change', sync);
                        descriptionInput.addEventListener('change', sync);
                        sync();
                    };
                    initHomepageSeoPreview();

                    var buildVisualSelectors = function () {
                        var selects = document.querySelectorAll('select[data-eep-visual-select]');
                        selects.forEach(function (selectEl) {
                            if (!selectEl || selectEl.nextElementSibling && selectEl.nextElementSibling.classList.contains('eep-settings-visual-options')) {
                                return;
                            }
                            var wrapper = document.createElement('div');
                            wrapper.className = 'eep-settings-visual-options';
                            var syncActiveOption = function () {
                                var currentValue = String(selectEl.value || '');
                                wrapper.querySelectorAll('.eep-settings-visual-option').forEach(function (opt) {
                                    var value = String(opt.getAttribute('data-eep-value') || '');
                                    opt.classList.toggle('is-active', value === currentValue);
                                });
                            };
                            Array.prototype.forEach.call(selectEl.options || [], function (option) {
                                if (!option || option.disabled) {
                                    return;
                                }
                                var button = document.createElement('button');
                                button.type = 'button';
                                button.className = 'eep-settings-visual-option';
                                button.setAttribute('data-eep-value', String(option.value || ''));
                                var title = document.createElement('strong');
                                title.textContent = String(option.textContent || '').trim();
                                button.appendChild(title);
                                var hint = document.createElement('span');
                                hint.textContent = '<?php echo esc_js(__('Click to apply this layout', 'nexdirectory')); ?>';
                                button.appendChild(hint);
                                if (String(selectEl.value || '') === String(option.value || '')) {
                                    button.classList.add('is-active');
                                }
                                button.addEventListener('click', function () {
                                    selectEl.value = String(option.value || '');
                                    selectEl.dispatchEvent(new Event('change', { bubbles: true }));
                                    syncActiveOption();
                                    markDirty();
                                });
                                wrapper.appendChild(button);
                            });
                            selectEl.insertAdjacentElement('afterend', wrapper);
                            selectEl.addEventListener('change', syncActiveOption);
                            syncActiveOption();
                        });
                    };
                    buildVisualSelectors();

                    var initDesignChoiceGrids = function () {
                        var grids = document.querySelectorAll('[data-eep-choice-grid][data-eep-select]');
                        grids.forEach(function (grid) {
                            var selectSelector = String(grid.getAttribute('data-eep-select') || '').trim();
                            if (!selectSelector) {
                                return;
                            }
                            var selectEl = document.querySelector(selectSelector);
                            if (!selectEl) {
                                return;
                            }
                            var sync = function () {
                                var currentValue = String(selectEl.value || '');
                                grid.querySelectorAll('.eep-design-choice').forEach(function (choice) {
                                    var choiceValue = String(choice.getAttribute('data-eep-choice-value') || '');
                                    choice.classList.toggle('is-active', choiceValue === currentValue);
                                });
                            };
                            grid.querySelectorAll('.eep-design-choice').forEach(function (choice) {
                                choice.addEventListener('click', function () {
                                    var nextValue = String(choice.getAttribute('data-eep-choice-value') || '');
                                    if (!nextValue || !Array.prototype.some.call(selectEl.options || [], function (option) { return String(option.value || '') === nextValue; })) {
                                        return;
                                    }
                                    selectEl.value = nextValue;
                                    selectEl.dispatchEvent(new Event('change', { bubbles: true }));
                                    sync();
                                    markDirty();
                                });
                            });
                            selectEl.addEventListener('change', sync);
                            sync();
                        });
                    };
                    initDesignChoiceGrids();

                    var initDesignPresets = function () {
                        var presetSelect = document.querySelector('[data-eep-design-preset-select]');
                        var presetApply = document.querySelector('[data-eep-design-preset-apply]');
                        var presetStatus = document.querySelector('[data-eep-design-preset-status]');
                        if (!presetSelect || !presetApply) {
                            return;
                        }
                        var presets = {
                            'launchpad-modern': {
                                label: 'Launchpad Modern',
                                values: {
                                    eep_event_hero_layout: 'cinematic',
                                    eep_event_page_layout: 'modern',
                                    eep_event_gallery_type: 'default',
                                    eep_style_box_style: 'default',
                                    eep_style_button_style: 'solid',
                                    eep_style_button_radius_mode: 'inherit',
                                    eep_style_input_style: 'outline',
                                    eep_style_density_mode: 'comfortable',
                                    eep_style_border_mode: 'subtle',
                                    eep_style_shadow_mode: 'soft',
                                    eep_style_content_width: 'standard',
                                    eep_page_side_padding: '10%',
                                    eep_page_side_padding_mobile: '2%'
                                }
                            },
                            'minimal-focus': {
                                label: 'Minimal Focus',
                                values: {
                                    eep_event_hero_layout: 'minimal',
                                    eep_event_page_layout: 'single-column',
                                    eep_event_gallery_type: 'default',
                                    eep_style_box_style: 'default',
                                    eep_style_button_style: 'outline',
                                    eep_style_button_radius_mode: 'sharp',
                                    eep_style_input_style: 'underlined',
                                    eep_style_density_mode: 'loose',
                                    eep_style_border_mode: 'minimal',
                                    eep_style_shadow_mode: 'none',
                                    eep_style_content_width: 'narrow',
                                    eep_page_side_padding: '8%',
                                    eep_page_side_padding_mobile: '4%'
                                }
                            },
                            'editorial-story': {
                                label: 'Editorial Story',
                                values: {
                                    eep_event_hero_layout: 'split',
                                    eep_event_page_layout: 'editorial',
                                    eep_event_gallery_type: 'default',
                                    eep_style_box_style: 'gradient',
                                    eep_style_button_style: 'soft',
                                    eep_style_button_radius_mode: 'inherit',
                                    eep_style_input_style: 'filled',
                                    eep_style_density_mode: 'comfortable',
                                    eep_style_border_mode: 'subtle',
                                    eep_style_shadow_mode: 'medium',
                                    eep_style_content_width: 'standard',
                                    eep_page_side_padding: '10%',
                                    eep_page_side_padding_mobile: '3%'
                                }
                            },
                            'executive-spotlight': {
                                label: 'Executive Spotlight',
                                values: {
                                    eep_event_hero_layout: 'spotlight',
                                    eep_event_page_layout: 'left-sidebar',
                                    eep_event_gallery_type: 'default',
                                    eep_style_box_style: 'bold',
                                    eep_style_button_style: 'dark',
                                    eep_style_button_radius_mode: 'sharp',
                                    eep_style_input_style: 'outline',
                                    eep_style_density_mode: 'comfortable',
                                    eep_style_border_mode: 'strong',
                                    eep_style_shadow_mode: 'medium',
                                    eep_style_content_width: 'wide',
                                    eep_page_side_padding: '8%',
                                    eep_page_side_padding_mobile: '2%'
                                }
                            },
                            'immersive-showcase': {
                                label: 'Immersive Showcase',
                                values: {
                                    eep_event_hero_layout: 'immersive',
                                    eep_event_page_layout: 'full3',
                                    eep_event_gallery_type: 'carousel',
                                    eep_style_box_style: 'gradient',
                                    eep_style_button_style: 'solid',
                                    eep_style_button_radius_mode: 'pill',
                                    eep_style_input_style: 'filled',
                                    eep_style_density_mode: 'loose',
                                    eep_style_border_mode: 'minimal',
                                    eep_style_shadow_mode: 'dramatic',
                                    eep_style_content_width: 'wide',
                                    eep_page_side_padding: '6%',
                                    eep_page_side_padding_mobile: '2%'
                                }
                            },
                            'compact-control': {
                                label: 'Compact Control',
                                values: {
                                    eep_event_hero_layout: 'compact',
                                    eep_event_page_layout: 'zig-zag',
                                    eep_event_gallery_type: 'default',
                                    eep_style_box_style: 'default',
                                    eep_style_button_style: 'outline',
                                    eep_style_button_radius_mode: 'sharp',
                                    eep_style_input_style: 'outline',
                                    eep_style_density_mode: 'compact',
                                    eep_style_border_mode: 'strong',
                                    eep_style_shadow_mode: 'soft',
                                    eep_style_content_width: 'standard',
                                    eep_page_side_padding: '7%',
                                    eep_page_side_padding_mobile: '2%'
                                }
                            },
                            'zen-clean': {
                                label: 'Zen Clean',
                                values: {
                                    eep_event_hero_layout: 'minimal',
                                    eep_event_page_layout: 'zen',
                                    eep_event_gallery_type: 'default',
                                    eep_style_box_style: 'default',
                                    eep_style_button_style: 'soft',
                                    eep_style_button_radius_mode: 'inherit',
                                    eep_style_input_style: 'underlined',
                                    eep_style_density_mode: 'loose',
                                    eep_style_border_mode: 'minimal',
                                    eep_style_shadow_mode: 'none',
                                    eep_style_content_width: 'narrow',
                                    eep_page_side_padding: '9%',
                                    eep_page_side_padding_mobile: '4%'
                                }
                            },
                            'bold-campaign': {
                                label: 'Bold Campaign',
                                values: {
                                    eep_event_hero_layout: 'cinematic',
                                    eep_event_page_layout: 'fifty-fifty',
                                    eep_event_gallery_type: 'carousel',
                                    eep_style_box_style: 'bold',
                                    eep_style_button_style: 'solid',
                                    eep_style_button_radius_mode: 'pill',
                                    eep_style_input_style: 'filled',
                                    eep_style_density_mode: 'compact',
                                    eep_style_border_mode: 'strong',
                                    eep_style_shadow_mode: 'dramatic',
                                    eep_style_content_width: 'full',
                                    eep_page_side_padding: '4%',
                                    eep_page_side_padding_mobile: '2%'
                                }
                            },
                            'gallery-plus': {
                                label: 'Gallery Plus',
                                values: {
                                    eep_event_hero_layout: 'split',
                                    eep_event_page_layout: 'full3',
                                    eep_event_gallery_type: 'wall',
                                    eep_style_box_style: 'gradient',
                                    eep_style_button_style: 'dark',
                                    eep_style_button_radius_mode: 'inherit',
                                    eep_style_input_style: 'filled',
                                    eep_style_density_mode: 'comfortable',
                                    eep_style_border_mode: 'subtle',
                                    eep_style_shadow_mode: 'medium',
                                    eep_style_content_width: 'wide',
                                    eep_page_side_padding: '6%',
                                    eep_page_side_padding_mobile: '2%'
                                }
                            },
                            'professional-default': {
                                label: 'Professional Default',
                                values: {
                                    eep_event_hero_layout: 'cinematic',
                                    eep_event_page_layout: 'modern',
                                    eep_event_gallery_type: 'default',
                                    eep_style_box_style: 'default',
                                    eep_style_button_style: 'solid',
                                    eep_style_button_radius_mode: 'inherit',
                                    eep_style_input_style: 'outline',
                                    eep_style_density_mode: 'comfortable',
                                    eep_style_border_mode: 'subtle',
                                    eep_style_shadow_mode: 'soft',
                                    eep_style_content_width: 'standard',
                                    eep_page_side_padding: '10%',
                                    eep_page_side_padding_mobile: '2%'
                                }
                            }
                        };
                        var applyPreset = function (presetKey) {
                            var config = presets[String(presetKey || '')] || null;
                            if (!config || !config.values) {
                                return false;
                            }
                            Object.keys(config.values).forEach(function (fieldId) {
                                var field = document.getElementById(fieldId);
                                if (!field) {
                                    return;
                                }
                                var nextValue = String(config.values[fieldId]);
                                if (String(field.value || '') === nextValue) {
                                    return;
                                }
                                field.value = nextValue;
                                field.dispatchEvent(new Event('input', { bubbles: true }));
                                field.dispatchEvent(new Event('change', { bubbles: true }));
                            });
                            markDirty();
                            if (presetStatus) {
                                presetStatus.textContent = config.label + ' <?php echo esc_js(__('preset applied. Save settings to publish it.', 'nexdirectory')); ?>';
                            }
                            return true;
                        };
                        presetApply.addEventListener('click', function () {
                            var selectedKey = String(presetSelect.value || '');
                            if (!applyPreset(selectedKey) && presetStatus) {
                                presetStatus.textContent = '<?php echo esc_js(__('Choose a preset first.', 'nexdirectory')); ?>';
                            }
                        });
                    };
                    initDesignPresets();

                    var mapProviderSelect = document.getElementById('eep_map_provider');
                    var mapStyleSelect = document.getElementById('eep_map_style');
                    var syncMapStyleOptions = function () {
                        if (!mapProviderSelect || !mapStyleSelect) {
                            return;
                        }
                        var provider = String(mapProviderSelect.value || '').toLowerCase();
                        var selectedStillVisible = false;
                        Array.prototype.forEach.call(mapStyleSelect.options || [], function (option) {
                            var scope = String(option.getAttribute('data-provider') || 'all').toLowerCase();
                            var visible = (scope === 'all' || scope === provider);
                            option.hidden = !visible;
                            option.disabled = !visible;
                            if (visible && option.value === mapStyleSelect.value) {
                                selectedStillVisible = true;
                            }
                        });
                        if (!selectedStillVisible) {
                            var firstVisible = Array.prototype.find.call(mapStyleSelect.options || [], function (option) {
                                return !option.hidden && !option.disabled;
                            });
                            if (firstVisible) {
                                mapStyleSelect.value = String(firstVisible.value || '');
                            }
                        }
                    };
                    if (mapProviderSelect && mapStyleSelect) {
                        mapProviderSelect.addEventListener('change', syncMapStyleOptions);
                        syncMapStyleOptions();
                    }

                    var preloaderEnabledToggle = document.getElementById('eep_preloader_enabled');
                    var preloaderSourceSelect = document.getElementById('eep_preloader_source');
                    var preloaderSvgField = document.querySelector('[data-eep-preloader-field="svg"]');
                    var preloaderImageField = document.querySelector('[data-eep-preloader-field="image"]');
                    var preloaderResetButton = document.getElementById('eep-preloader-reset-defaults');
                    var preloaderSvgTextarea = document.getElementById('eep_preloader_svg_markup');
                    var preloaderImageInput = document.getElementById('eep_preloader_image_url');
                    var preloaderBgInput = document.getElementById('eep_preloader_background_color');
                    var preloaderWidthInput = document.getElementById('eep_preloader_logo_max_width');
                    var preloaderMinInput = document.getElementById('eep_preloader_min_duration_ms');
                    var preloaderFadeInput = document.getElementById('eep_preloader_fade_duration_ms');
                    var preloaderInitialToggle = document.querySelector('input[type="checkbox"][name="eep_preloader_show_on_initial"]');
                    var preloaderSpaToggle = document.querySelector('input[type="checkbox"][name="eep_preloader_show_on_spa"]');
                    var preloaderOnlyHomeToggle = document.querySelector('input[type="checkbox"][name="eep_preloader_show_only_home"]');
                    var preloaderShowOnceToggle = document.querySelector('input[type="checkbox"][name="eep_preloader_show_once"]');
                    var preloaderMobileToggle = document.querySelector('input[type="checkbox"][name="eep_preloader_disable_mobile"]');
                    var preloaderMotionToggle = document.querySelector('input[type="checkbox"][name="eep_preloader_respect_motion"]');
                    var preloaderDefaultSvg = <?php echo wp_json_encode((string) (method_exists($this, 'get_default_preloader_svg_markup') ? $this->get_default_preloader_svg_markup() : '')); ?>;
                    var preloaderPreviewShell = document.getElementById('eep-preloader-preview-shell');
                    var preloaderPreviewStage = document.getElementById('eep-preloader-preview-stage');
                    var preloaderPreviewStatus = document.getElementById('eep-preloader-preview-status');
                    var preloaderPreviewTiming = document.getElementById('eep-preloader-preview-timing');
                    var preloaderPreviewPlay = document.getElementById('eep-preloader-preview-play');
                    var preloaderPreviewStop = document.getElementById('eep-preloader-preview-stop');
                    var preloaderPreviewTimer = null;
                    var preloaderPreviewFadeTimer = null;
                    var preloaderPreviewImageCache = preloaderImageInput ? String(preloaderImageInput.value || '').trim() : '';

                    var parseNumericWithin = function (value, min, max, fallback) {
                        var parsed = parseFloat(String(value || '').trim());
                        if (!Number.isFinite(parsed)) {
                            return fallback;
                        }
                        if (parsed < min) {
                            return min;
                        }
                        if (parsed > max) {
                            return max;
                        }
                        return parsed;
                    };

                    var preloaderPreviewStopPlayback = function () {
                        if (preloaderPreviewTimer) {
                            window.clearTimeout(preloaderPreviewTimer);
                            preloaderPreviewTimer = null;
                        }
                        if (preloaderPreviewFadeTimer) {
                            window.clearTimeout(preloaderPreviewFadeTimer);
                            preloaderPreviewFadeTimer = null;
                        }
                        if (preloaderPreviewShell) {
                            preloaderPreviewShell.classList.remove('is-fading');
                        }
                        if (preloaderPreviewStatus) {
                            preloaderPreviewStatus.textContent = '<?php echo esc_js(__('Ready', 'nexdirectory')); ?>';
                        }
                    };

                    var syncPreloaderPreview = function () {
                        if (!preloaderPreviewShell || !preloaderPreviewStage) {
                            return;
                        }
                        var source = preloaderSourceSelect ? String(preloaderSourceSelect.value || 'svg').toLowerCase() : 'svg';
                        var bgColor = preloaderBgInput ? String(preloaderBgInput.value || '').trim() : '#FFFFFF';
                        var artWidth = preloaderWidthInput ? parseNumericWithin(preloaderWidthInput.value, 120, 900, 420) : 420;
                        var minMs = preloaderMinInput ? parseNumericWithin(preloaderMinInput.value, 0, 8000, 400) : 400;
                        var fadeMs = preloaderFadeInput ? parseNumericWithin(preloaderFadeInput.value, 80, 2000, 420) : 420;
                        var imageUrl = preloaderImageInput ? String(preloaderImageInput.value || '').trim() : '';
                        var svgMarkup = preloaderSvgTextarea ? String(preloaderSvgTextarea.value || '').trim() : '';
                        var enabled = preloaderEnabledToggle ? !!preloaderEnabledToggle.checked : true;

                        preloaderPreviewShell.style.setProperty('--eep-preloader-preview-bg', bgColor || '#FFFFFF');
                        preloaderPreviewShell.style.setProperty('--eep-preloader-preview-width', String(Math.round(artWidth)) + 'px');
                        preloaderPreviewShell.style.setProperty('--eep-preloader-preview-fade', String(Math.round(fadeMs)) + 'ms');

                        if (!enabled) {
                            preloaderPreviewStage.innerHTML = '<div class="eep-preloader-preview-empty"><?php echo esc_js(__('Pre-loader is disabled.', 'nexdirectory')); ?></div>';
                        } else if (source === 'image') {
                            if (imageUrl) {
                                preloaderPreviewStage.innerHTML = '';
                                var image = document.createElement('img');
                                image.src = imageUrl;
                                image.alt = '<?php echo esc_js(__('Pre-loader image preview', 'nexdirectory')); ?>';
                                image.decoding = 'async';
                                preloaderPreviewStage.appendChild(image);
                            } else {
                                preloaderPreviewStage.innerHTML = '<div class="eep-preloader-preview-empty"><?php echo esc_js(__('Choose an image to preview.', 'nexdirectory')); ?></div>';
                            }
                        } else if (svgMarkup) {
                            preloaderPreviewStage.innerHTML = svgMarkup;
                        } else {
                            preloaderPreviewStage.innerHTML = '<div class="eep-preloader-preview-empty"><?php echo esc_js(__('Paste SVG markup to preview.', 'nexdirectory')); ?></div>';
                        }

                        if (preloaderPreviewTiming) {
                            preloaderPreviewTiming.textContent = '<?php echo esc_js(__('Min', 'nexdirectory')); ?> ' + Math.round(minMs) + 'ms · <?php echo esc_js(__('Fade', 'nexdirectory')); ?> ' + Math.round(fadeMs) + 'ms';
                        }
                    };

                    var playPreloaderPreview = function () {
                        if (!preloaderPreviewShell) {
                            return;
                        }
                        preloaderPreviewStopPlayback();
                        syncPreloaderPreview();
                        if (preloaderPreviewStatus) {
                            preloaderPreviewStatus.textContent = '<?php echo esc_js(__('Playing...', 'nexdirectory')); ?>';
                        }

                        var minMs = preloaderMinInput ? parseNumericWithin(preloaderMinInput.value, 0, 8000, 400) : 400;
                        var fadeMs = preloaderFadeInput ? parseNumericWithin(preloaderFadeInput.value, 80, 2000, 420) : 420;
                        preloaderPreviewTimer = window.setTimeout(function () {
                            preloaderPreviewShell.classList.add('is-fading');
                            if (preloaderPreviewStatus) {
                                preloaderPreviewStatus.textContent = '<?php echo esc_js(__('Fading...', 'nexdirectory')); ?>';
                            }
                            preloaderPreviewFadeTimer = window.setTimeout(function () {
                                preloaderPreviewShell.classList.remove('is-fading');
                                preloaderPreviewFadeTimer = null;
                                if (preloaderPreviewStatus) {
                                    preloaderPreviewStatus.textContent = '<?php echo esc_js(__('Preview complete', 'nexdirectory')); ?>';
                                }
                            }, Math.round(fadeMs));
                            preloaderPreviewTimer = null;
                        }, Math.round(minMs));
                    };

                    var syncPreloaderFields = function () {
                        if (!preloaderSourceSelect) {
                            return;
                        }
                        var enabled = preloaderEnabledToggle ? preloaderEnabledToggle.checked : true;
                        var source = String(preloaderSourceSelect.value || 'svg').toLowerCase();
                        if (preloaderSvgField) {
                            preloaderSvgField.style.display = (enabled && source === 'svg') ? '' : 'none';
                        }
                        if (preloaderImageField) {
                            preloaderImageField.style.display = (enabled && source === 'image') ? '' : 'none';
                        }
                        syncPreloaderPreview();
                    };

                    if (preloaderEnabledToggle) {
                        preloaderEnabledToggle.addEventListener('change', syncPreloaderFields);
                    }
                    if (preloaderSourceSelect) {
                        preloaderSourceSelect.addEventListener('change', syncPreloaderFields);
                    }
                    syncPreloaderFields();

                    if (preloaderResetButton) {
                        preloaderResetButton.addEventListener('click', function () {
                            if (preloaderSourceSelect) {
                                preloaderSourceSelect.value = 'svg';
                            }
                            if (preloaderSvgTextarea) {
                                preloaderSvgTextarea.value = String(preloaderDefaultSvg || '').trim();
                            }
                            if (preloaderImageInput) {
                                preloaderImageInput.value = '';
                            }
                            if (preloaderBgInput) {
                                preloaderBgInput.value = '#FFFFFF';
                            }
                            if (preloaderWidthInput) {
                                preloaderWidthInput.value = '420';
                            }
                            if (preloaderMinInput) {
                                preloaderMinInput.value = '400';
                            }
                            if (preloaderFadeInput) {
                                preloaderFadeInput.value = '420';
                            }
                            if (preloaderEnabledToggle) {
                                preloaderEnabledToggle.checked = true;
                            }
                            if (preloaderInitialToggle) {
                                preloaderInitialToggle.checked = true;
                            }
                            if (preloaderSpaToggle) {
                                preloaderSpaToggle.checked = true;
                            }
                            if (preloaderOnlyHomeToggle) {
                                preloaderOnlyHomeToggle.checked = false;
                            }
                            if (preloaderShowOnceToggle) {
                                preloaderShowOnceToggle.checked = false;
                            }
                            if (preloaderMobileToggle) {
                                preloaderMobileToggle.checked = false;
                            }
                            if (preloaderMotionToggle) {
                                preloaderMotionToggle.checked = true;
                            }

                            var imagePreview = document.getElementById('eep-preloader-image-preview');
                            if (imagePreview) {
                                imagePreview.innerHTML = '';
                            }
                            syncPreloaderFields();
                            preloaderPreviewStopPlayback();
                            markDirty();
                        });
                    }

                    if (preloaderPreviewPlay) {
                        preloaderPreviewPlay.addEventListener('click', playPreloaderPreview);
                    }
                    if (preloaderPreviewStop) {
                        preloaderPreviewStop.addEventListener('click', function () {
                            preloaderPreviewStopPlayback();
                            syncPreloaderPreview();
                        });
                    }
                    if (preloaderSvgTextarea) {
                        preloaderSvgTextarea.addEventListener('input', syncPreloaderPreview);
                        preloaderSvgTextarea.addEventListener('change', syncPreloaderPreview);
                    }
                    if (preloaderBgInput) {
                        preloaderBgInput.addEventListener('input', syncPreloaderPreview);
                        preloaderBgInput.addEventListener('change', syncPreloaderPreview);
                    }
                    if (preloaderWidthInput) {
                        preloaderWidthInput.addEventListener('input', syncPreloaderPreview);
                        preloaderWidthInput.addEventListener('change', syncPreloaderPreview);
                    }
                    if (preloaderMinInput) {
                        preloaderMinInput.addEventListener('input', syncPreloaderPreview);
                        preloaderMinInput.addEventListener('change', syncPreloaderPreview);
                    }
                    if (preloaderFadeInput) {
                        preloaderFadeInput.addEventListener('input', syncPreloaderPreview);
                        preloaderFadeInput.addEventListener('change', syncPreloaderPreview);
                    }
                    if (preloaderImageInput) {
                        preloaderImageInput.addEventListener('input', syncPreloaderPreview);
                        preloaderImageInput.addEventListener('change', syncPreloaderPreview);
                        window.setInterval(function () {
                            var currentImageValue = String(preloaderImageInput.value || '').trim();
                            if (currentImageValue !== preloaderPreviewImageCache) {
                                preloaderPreviewImageCache = currentImageValue;
                                syncPreloaderPreview();
                            }
                        }, 500);
                    }
                    syncPreloaderPreview();

                    var monetizationPanels = document.querySelectorAll('.eep-settings-panel[data-tab="monetization"]');
                    var monetizationPanel = document.getElementById('eep-tab-monetization');
                    if (monetizationPanels.length) {
                        var packageRowsWrap = monetizationPanel ? monetizationPanel.querySelector('[data-eep-package-rows]') : null;
                        var typeRowsWrap = monetizationPanel ? monetizationPanel.querySelector('[data-eep-type-rows]') : null;
                        var packageHiddenInput = document.getElementById('eep_boost_duration_pricing');
                        var typeHiddenInput = document.getElementById('eep_boost_type_pricing');
                        var typePricingToggle = document.getElementById('eep_boost_type_pricing_enabled');
                        var conditionalBindings = [
                            { toggle: '#eep_boost_enabled', target: 'boost-settings' },
                            { toggle: '#eep_boost_vat_enabled', target: 'boost-vat' },
                            { toggle: '#eep_boost_auto_renew_enabled', target: 'boost-autorenew-settings' },
                            { toggle: '#eep_boost_stripe_enabled', target: 'boost-stripe' },
                            { toggle: '#eep_boost_paypal_enabled', target: 'boost-paypal' },
                            { toggle: '#eep_ticketing_enabled', target: 'ticket-settings' },
                            { toggle: '#eep_ticket_stripe_enabled', target: 'ticket-stripe' },
                            { toggle: '#eep_ticket_paypal_enabled', target: 'ticket-paypal' },
                            { toggle: '#eep_boost_show_featured_badge', target: 'boost-featured-settings' },
                            { toggle: '#eep_boost_type_pricing_enabled', target: 'boost-type-pricing' }
                        ];

                        var sanitizeInteger = function (value, min, max, fallback) {
                            var parsed = parseInt(String(value || ''), 10);
                            if (Number.isNaN(parsed)) {
                                return fallback;
                            }
                            if (typeof min === 'number' && parsed < min) {
                                parsed = min;
                            }
                            if (typeof max === 'number' && parsed > max) {
                                parsed = max;
                            }
                            return parsed;
                        };
                        var sanitizeDecimal = function (value, fallback) {
                            var normalized = String(value || '').trim().replace(',', '.');
                            var parsed = parseFloat(normalized);
                            if (!Number.isFinite(parsed)) {
                                return fallback;
                            }
                            if (parsed < 0) {
                                parsed = 0;
                            }
                            return Math.round(parsed * 100) / 100;
                        };
                        var formatMoney = function (value) {
                            var amount = sanitizeDecimal(value, 0);
                            return amount.toFixed(2);
                        };
                        var escapeHtml = function (value) {
                            return String(value || '')
                                .replace(/&/g, '&amp;')
                                .replace(/</g, '&lt;')
                                .replace(/>/g, '&gt;')
                                .replace(/"/g, '&quot;')
                                .replace(/'/g, '&#039;');
                        };
                        var getTypeOptions = function () {
                            if (!typeRowsWrap) {
                                return [];
                            }
                            var raw = String(typeRowsWrap.getAttribute('data-eep-type-options') || '').trim();
                            if (!raw) {
                                return [];
                            }
                            try {
                                var parsed = JSON.parse(raw);
                                if (!parsed || typeof parsed !== 'object') {
                                    return [];
                                }
                                return Object.keys(parsed).map(function (slug) {
                                    return {
                                        slug: String(slug || '').trim(),
                                        label: String(parsed[slug] || slug || '').trim()
                                    };
                                }).filter(function (item) {
                                    return item.slug !== '';
                                });
                            } catch (error) {
                                return [];
                            }
                        };
                        var getPackageRows = function () {
                            if (!packageRowsWrap) {
                                return [];
                            }
                            var rows = [];
                            packageRowsWrap.querySelectorAll('[data-eep-package-row]').forEach(function (rowEl) {
                                var daysEl = rowEl.querySelector('[data-eep-package-days]');
                                var priceEl = rowEl.querySelector('[data-eep-package-price]');
                                var days = sanitizeInteger(daysEl ? daysEl.value : '', 1, 3650, 0);
                                var price = sanitizeDecimal(priceEl ? priceEl.value : '', 0);
                                if (days > 0 && price > 0) {
                                    rows.push({
                                        days: days,
                                        price: price
                                    });
                                }
                            });
                            rows.sort(function (a, b) {
                                return a.days - b.days;
                            });
                            var dedup = {};
                            rows.forEach(function (row) {
                                dedup[row.days] = row;
                            });
                            return Object.keys(dedup).map(function (daysKey) {
                                return dedup[daysKey];
                            });
                        };
                        var getDurationChoices = function () {
                            var rows = getPackageRows();
                            if (!rows.length) {
                                return [7, 30, 90];
                            }
                            var unique = {};
                            rows.forEach(function (row) {
                                unique[String(row.days)] = row.days;
                            });
                            return Object.keys(unique).map(function (key) {
                                return unique[key];
                            }).sort(function (a, b) { return a - b; });
                        };
                        var serializePackageRows = function () {
                            if (!packageHiddenInput) {
                                return;
                            }
                            var rows = getPackageRows();
                            if (!rows.length) {
                                packageHiddenInput.value = '';
                                return;
                            }
                            packageHiddenInput.value = JSON.stringify(rows);
                        };
                        var normalizeTypeRows = function () {
                            if (!typeRowsWrap) {
                                return [];
                            }
                            var rows = [];
                            typeRowsWrap.querySelectorAll('[data-eep-type-row]').forEach(function (rowEl) {
                                var typeEl = rowEl.querySelector('[data-eep-type-slug]');
                                var daysEl = rowEl.querySelector('[data-eep-type-days]');
                                var priceEl = rowEl.querySelector('[data-eep-type-price]');
                                var typeSlug = String(typeEl ? typeEl.value : '').trim();
                                var days = sanitizeInteger(daysEl ? daysEl.value : '', 1, 3650, 0);
                                var price = sanitizeDecimal(priceEl ? priceEl.value : '', 0);
                                if (typeSlug !== '' && days > 0 && price > 0) {
                                    rows.push({
                                        type: typeSlug,
                                        days: days,
                                        price: price
                                    });
                                }
                            });
                            return rows;
                        };
                        var serializeTypeRows = function () {
                            if (!typeHiddenInput) {
                                return;
                            }
                            if (!typePricingToggle || !typePricingToggle.checked) {
                                typeHiddenInput.value = '';
                                return;
                            }
                            var rows = normalizeTypeRows();
                            if (!rows.length) {
                                typeHiddenInput.value = '';
                                return;
                            }
                            var grouped = {};
                            rows.forEach(function (row) {
                                if (!grouped[row.type]) {
                                    grouped[row.type] = {};
                                }
                                grouped[row.type][String(row.days)] = row.price;
                            });
                            var lines = [];
                            Object.keys(grouped).sort().forEach(function (typeSlug) {
                                var dayMap = grouped[typeSlug];
                                var parts = Object.keys(dayMap).map(function (dayKey) {
                                    return parseInt(dayKey, 10);
                                }).filter(function (dayInt) {
                                    return Number.isFinite(dayInt) && dayInt > 0;
                                }).sort(function (a, b) {
                                    return a - b;
                                }).map(function (dayInt) {
                                    return String(dayInt) + ':' + formatMoney(dayMap[String(dayInt)]);
                                });
                                if (parts.length) {
                                    lines.push(typeSlug + '|' + parts.join(','));
                                }
                            });
                            typeHiddenInput.value = lines.join('\n');
                        };
                        var renderTypeDurationOptions = function () {
                            if (!typeRowsWrap) {
                                return;
                            }
                            var choices = getDurationChoices();
                            typeRowsWrap.querySelectorAll('[data-eep-type-days]').forEach(function (selectEl) {
                                var current = sanitizeInteger(selectEl.value, 1, 3650, choices[0]);
                                var hasCurrent = choices.indexOf(current) !== -1;
                                var html = '';
                                choices.forEach(function (dayValue) {
                                    html += '<option value="' + String(dayValue) + '">' + String(dayValue) + ' <?php echo esc_js(__('days', 'nexdirectory')); ?></option>';
                                });
                                if (!hasCurrent && current > 0) {
                                    html += '<option value="' + String(current) + '">' + String(current) + ' <?php echo esc_js(__('days', 'nexdirectory')); ?></option>';
                                }
                                selectEl.innerHTML = html;
                                selectEl.value = hasCurrent ? String(current) : String(choices[0] || current);
                            });
                        };
                        var setConditionalVisibility = function (targetKey, visible) {
                            monetizationPanels.forEach(function (panelEl) {
                                panelEl.querySelectorAll('[data-eep-conditional-field="' + targetKey + '"]').forEach(function (fieldEl) {
                                    fieldEl.style.display = visible ? '' : 'none';
                                });
                            });
                        };
                        var syncConditionalFields = function () {
                            conditionalBindings.forEach(function (binding) {
                                var toggleEl = document.querySelector(binding.toggle);
                                if (!toggleEl) {
                                    return;
                                }
                                setConditionalVisibility(binding.target, !!toggleEl.checked);
                            });
                        };
                        var createPackageRow = function (days, price) {
                            var row = document.createElement('div');
                            row.className = 'eep-monetization-row';
                            row.setAttribute('data-eep-package-row', '');
                            row.innerHTML = '' +
                                '<div class="eep-monetization-col">' +
                                '<label><?php echo esc_js(__('Duration (days)', 'nexdirectory')); ?></label>' +
                                '<input type="number" min="1" max="3650" step="1" value="' + String(sanitizeInteger(days, 1, 3650, 30)) + '" data-eep-package-days>' +
                                '</div>' +
                                '<div class="eep-monetization-col">' +
                                '<label><?php echo esc_js(__('Price', 'nexdirectory')); ?></label>' +
                                '<input type="number" min="0" step="0.01" value="' + formatMoney(price) + '" data-eep-package-price>' +
                                '</div>' +
                                '<div class="eep-monetization-col eep-monetization-col-actions">' +
                                '<button type="button" class="button-link-delete" data-eep-remove-package><?php echo esc_js(__('Remove', 'nexdirectory')); ?></button>' +
                                '</div>';
                            return row;
                        };
                        var createTypeRow = function (typeSlug, days, price) {
                            var typeOptions = getTypeOptions();
                            var optionsHtml = '<option value=""><?php echo esc_js(__('Select type', 'nexdirectory')); ?></option>';
                            typeOptions.forEach(function (option) {
                                optionsHtml += '<option value="' + escapeHtml(option.slug) + '">' + escapeHtml(option.label) + '</option>';
                            });
                            var row = document.createElement('div');
                            row.className = 'eep-monetization-row eep-monetization-row-type';
                            row.setAttribute('data-eep-type-row', '');
                            row.innerHTML = '' +
                                '<div class="eep-monetization-col">' +
                                '<label><?php echo esc_js(__('Listing type', 'nexdirectory')); ?></label>' +
                                '<select data-eep-type-slug>' + optionsHtml + '</select>' +
                                '</div>' +
                                '<div class="eep-monetization-col">' +
                                '<label><?php echo esc_js(__('Duration', 'nexdirectory')); ?></label>' +
                                '<select data-eep-type-days></select>' +
                                '</div>' +
                                '<div class="eep-monetization-col">' +
                                '<label><?php echo esc_js(__('Override price', 'nexdirectory')); ?></label>' +
                                '<input type="number" min="0" step="0.01" value="' + formatMoney(price) + '" data-eep-type-price>' +
                                '</div>' +
                                '<div class="eep-monetization-col eep-monetization-col-actions">' +
                                '<button type="button" class="button-link-delete" data-eep-remove-type-row><?php echo esc_js(__('Remove', 'nexdirectory')); ?></button>' +
                                '</div>';
                            var typeSelect = row.querySelector('[data-eep-type-slug]');
                            var daysSelect = row.querySelector('[data-eep-type-days]');
                            if (typeSelect) {
                                typeSelect.value = String(typeSlug || '');
                            }
                            if (daysSelect) {
                                daysSelect.value = String(sanitizeInteger(days, 1, 3650, 30));
                            }
                            return row;
                        };
                        var ensureAtLeastOneTypeRow = function () {
                            if (!typeRowsWrap) {
                                return;
                            }
                            var rows = typeRowsWrap.querySelectorAll('[data-eep-type-row]');
                            if (rows.length > 0) {
                                return;
                            }
                            typeRowsWrap.appendChild(createTypeRow('', getDurationChoices()[0] || 30, 0));
                            renderTypeDurationOptions();
                        };
                        var syncMonetizationHiddenFields = function () {
                            serializePackageRows();
                            renderTypeDurationOptions();
                            serializeTypeRows();
                        };

                        conditionalBindings.forEach(function (binding) {
                            var toggleEl = document.querySelector(binding.toggle);
                            if (!toggleEl) {
                                return;
                            }
                            toggleEl.addEventListener('change', function () {
                                syncConditionalFields();
                                syncMonetizationHiddenFields();
                                markDirty();
                            });
                        });

                        var monetizationClickHandler = function (event) {
                            var addPackage = event.target.closest('[data-eep-add-boost-package]');
                            if (addPackage && packageRowsWrap) {
                                event.preventDefault();
                                packageRowsWrap.appendChild(createPackageRow(30, 0));
                                syncMonetizationHiddenFields();
                                markDirty();
                                return;
                            }
                            var removePackage = event.target.closest('[data-eep-remove-package]');
                            if (removePackage && packageRowsWrap) {
                                event.preventDefault();
                                var packageRow = removePackage.closest('[data-eep-package-row]');
                                if (packageRow) {
                                    packageRow.remove();
                                }
                                if (!packageRowsWrap.querySelector('[data-eep-package-row]')) {
                                    packageRowsWrap.appendChild(createPackageRow(30, 9.99));
                                }
                                syncMonetizationHiddenFields();
                                markDirty();
                                return;
                            }
                            var addTypeRow = event.target.closest('[data-eep-add-type-row]');
                            if (addTypeRow && typeRowsWrap) {
                                event.preventDefault();
                                typeRowsWrap.appendChild(createTypeRow('', getDurationChoices()[0] || 30, 0));
                                syncMonetizationHiddenFields();
                                markDirty();
                                return;
                            }
                            var removeTypeRow = event.target.closest('[data-eep-remove-type-row]');
                            if (removeTypeRow && typeRowsWrap) {
                                event.preventDefault();
                                var typeRow = removeTypeRow.closest('[data-eep-type-row]');
                                if (typeRow) {
                                    typeRow.remove();
                                }
                                ensureAtLeastOneTypeRow();
                                syncMonetizationHiddenFields();
                                markDirty();
                            }
                        };
                        var monetizationInputHandler = function (event) {
                            if (!event.target || !event.target.closest('[data-eep-package-row], [data-eep-type-row]')) {
                                return;
                            }
                            syncMonetizationHiddenFields();
                            markDirty();
                        };
                        var monetizationChangeHandler = function (event) {
                            if (!event.target || !event.target.closest('[data-eep-package-row], [data-eep-type-row], #eep_boost_type_pricing_enabled')) {
                                return;
                            }
                            syncMonetizationHiddenFields();
                            markDirty();
                        };

                        monetizationPanels.forEach(function (panelEl) {
                            panelEl.addEventListener('click', monetizationClickHandler);
                            panelEl.addEventListener('input', monetizationInputHandler);
                            panelEl.addEventListener('change', monetizationChangeHandler);
                        });

                        if (settingsForm) {
                            settingsForm.addEventListener('submit', function () {
                                syncMonetizationHiddenFields();
                            });
                        }

                        syncConditionalFields();
                        ensureAtLeastOneTypeRow();
                        syncMonetizationHiddenFields();
                    }

                    var uploadEndpoint = '<?php echo esc_js(admin_url('admin-post.php')); ?>';
                    var uploadNonce = '<?php echo esc_js(wp_create_nonce('eep_upload_image_nonce')); ?>';
                    var mediaPickers = document.querySelectorAll('[data-eep-media-picker]');
                    var parseUrls = function (value) {
                        return String(value || '')
                            .split(/\r?\n|,/)
                            .map(function (row) { return String(row || '').trim(); })
                            .filter(function (row) { return /^https?:\/\//i.test(row); });
                    };
                    var uniqueUrls = function (rows) {
                        var seen = {};
                        return (rows || []).filter(function (row) {
                            var key = String(row || '').trim();
                            if (!key || seen[key]) {
                                return false;
                            }
                            seen[key] = true;
                            return true;
                        });
                    };
                    var setPickerFeedback = function (picker, text, tone) {
                        var feedback = picker ? picker.querySelector('[data-eep-media-feedback]') : null;
                        if (!feedback) {
                            return;
                        }
                        feedback.textContent = String(text || '').trim();
                        if (tone) {
                            feedback.setAttribute('data-tone', String(tone));
                        } else {
                            feedback.removeAttribute('data-tone');
                        }
                    };
                    var createTile = function (url) {
                        var tile = document.createElement('div');
                        tile.className = 'eep-media-tile';
                        tile.setAttribute('data-eep-media-url', url);
                        var img = document.createElement('img');
                        img.src = url;
                        img.alt = '<?php echo esc_js(__('Fallback image', 'nexdirectory')); ?>';
                        var remove = document.createElement('button');
                        remove.type = 'button';
                        remove.className = 'eep-media-remove';
                        remove.setAttribute('data-eep-media-remove', '1');
                        remove.setAttribute('aria-label', '<?php echo esc_js(__('Remove image', 'nexdirectory')); ?>');
                        remove.textContent = '×';
                        tile.appendChild(img);
                        tile.appendChild(remove);
                        return tile;
                    };
                    var renderPicker = function (picker) {
                        if (!picker) {
                            return;
                        }
                        var targetSelector = String(picker.getAttribute('data-eep-media-target') || '').trim();
                        var targetInput = targetSelector ? document.querySelector(targetSelector) : null;
                        var gallery = picker.querySelector('.eep-media-gallery');
                        if (!targetInput || !gallery) {
                            return;
                        }
                        var urls = uniqueUrls(parseUrls(targetInput.value));
                        gallery.innerHTML = '';
                        urls.forEach(function (url) {
                            gallery.appendChild(createTile(url));
                        });
                    };
                    var updatePickerValue = function (picker, urls) {
                        if (!picker) {
                            return;
                        }
                        var targetSelector = String(picker.getAttribute('data-eep-media-target') || '').trim();
                        var targetInput = targetSelector ? document.querySelector(targetSelector) : null;
                        if (!targetInput) {
                            return;
                        }
                        var allowMultiple = String(picker.getAttribute('data-eep-media-multiple') || '0') === '1';
                        var rows = uniqueUrls((urls || []).map(function (row) { return String(row || '').trim(); }));
                        if (!allowMultiple) {
                            rows = rows.length ? [rows[0]] : [];
                        }
                        targetInput.value = allowMultiple ? rows.join('\n') : (rows[0] || '');
                        markDirty();
                        renderPicker(picker);
                    };
                    var pickWithMediaModal = function (picker) {
                        if (!picker || !window.wp || !window.wp.media) {
                            return;
                        }
                        var targetSelector = String(picker.getAttribute('data-eep-media-target') || '').trim();
                        var targetInput = targetSelector ? document.querySelector(targetSelector) : null;
                        if (!targetInput) {
                            return;
                        }
                        var allowMultiple = String(picker.getAttribute('data-eep-media-multiple') || '0') === '1';
                        var frame = window.wp.media({
                            title: '<?php echo esc_js(__('Select an image', 'nexdirectory')); ?>',
                            button: { text: '<?php echo esc_js(__('Use image', 'nexdirectory')); ?>' },
                            library: { type: 'image' },
                            multiple: allowMultiple
                        });
                        frame.on('select', function () {
                            var selectionState = frame.state().get('selection');
                            if (!selectionState) {
                                return;
                            }
                            var selected = [];
                            selectionState.each(function (attachment) {
                                if (!attachment) {
                                    return;
                                }
                                var data = attachment.toJSON ? attachment.toJSON() : null;
                                if (data && data.url) {
                                    selected.push(String(data.url));
                                }
                            });
                            if (!selected.length) {
                                return;
                            }
                            var existing = parseUrls(targetInput.value);
                            var merged = allowMultiple ? existing.concat(selected) : [selected[0]];
                            updatePickerValue(picker, merged);
                            setPickerFeedback(picker, '<?php echo esc_js(__('Media selection updated.', 'nexdirectory')); ?>', 'success');
                        });
                        frame.open();
                    };
                    var uploadImageFile = function (file, target) {
                        var formData = new FormData();
                        formData.append('action', 'eep_upload_image');
                        formData.append('eep_upload_nonce', uploadNonce);
                        formData.append('eep_upload_target', target);
                        formData.append('eep_upload_kind', 'image');
                        formData.append('file', file);
                        return fetch(uploadEndpoint, {
                            method: 'POST',
                            credentials: 'same-origin',
                            body: formData
                        }).then(function (response) {
                            return response.json().catch(function () { return {}; }).then(function (payload) {
                                if (!response.ok || !payload || payload.success !== true || !payload.data || !payload.data.url) {
                                    var message = payload && payload.data && payload.data.message
                                        ? String(payload.data.message)
                                        : '<?php echo esc_js(__('Image upload failed.', 'nexdirectory')); ?>';
                                    throw new Error(message);
                                }
                                return String(payload.data.url || '').trim();
                            });
                        });
                    };
                    var handleDroppedFiles = function (picker, files) {
                        if (!picker || !files || !files.length) {
                            return;
                        }
                        var targetSelector = String(picker.getAttribute('data-eep-media-target') || '').trim();
                        var targetInput = targetSelector ? document.querySelector(targetSelector) : null;
                        if (!targetInput) {
                            return;
                        }
                        var allowMultiple = String(picker.getAttribute('data-eep-media-multiple') || '0') === '1';
                        var uploadTarget = String(picker.getAttribute('data-eep-upload-target') || (allowMultiple ? 'gallery' : 'cover')).trim();
                        var existing = parseUrls(targetInput.value);
                        var queue = Array.prototype.slice.call(files || []);
                        var uploaded = [];
                        var failures = [];
                        var chain = Promise.resolve();
                        queue.forEach(function (file) {
                            chain = chain.then(function () {
                                if (!file || String(file.type || '').indexOf('image/') !== 0) {
                                    failures.push('<?php echo esc_js(__('One file was skipped because it is not an image.', 'nexdirectory')); ?>');
                                    return;
                                }
                                return uploadImageFile(file, uploadTarget).then(function (url) {
                                    if (url) {
                                        uploaded.push(url);
                                    }
                                }).catch(function (error) {
                                    failures.push(error && error.message ? String(error.message) : '<?php echo esc_js(__('Image upload failed.', 'nexdirectory')); ?>');
                                });
                            });
                        });
                        chain.then(function () {
                            if (uploaded.length) {
                                var merged = allowMultiple ? existing.concat(uploaded) : [uploaded[uploaded.length - 1]];
                                updatePickerValue(picker, merged);
                            }
                            if (failures.length) {
                                setPickerFeedback(picker, failures[0], 'error');
                            } else if (uploaded.length) {
                                setPickerFeedback(picker, '<?php echo esc_js(__('Upload complete.', 'nexdirectory')); ?>', 'success');
                            }
                        });
                    };
                    mediaPickers.forEach(function (picker) {
                        renderPicker(picker);
                        var dropzone = picker.querySelector('[data-eep-media-open]');
                        var fileInput = picker.querySelector('[data-eep-media-file-input]');
                        if (dropzone) {
                            dropzone.addEventListener('click', function () {
                                pickWithMediaModal(picker);
                            });
                            dropzone.addEventListener('dragover', function (event) {
                                event.preventDefault();
                                dropzone.classList.add('is-dragover');
                            });
                            dropzone.addEventListener('dragleave', function () {
                                dropzone.classList.remove('is-dragover');
                            });
                            dropzone.addEventListener('drop', function (event) {
                                event.preventDefault();
                                dropzone.classList.remove('is-dragover');
                                handleDroppedFiles(picker, event.dataTransfer && event.dataTransfer.files ? event.dataTransfer.files : []);
                            });
                        }
                        if (fileInput) {
                            fileInput.addEventListener('change', function () {
                                handleDroppedFiles(picker, fileInput.files || []);
                                fileInput.value = '';
                            });
                        }
                        picker.addEventListener('click', function (event) {
                            var remove = event.target && event.target.closest ? event.target.closest('[data-eep-media-remove]') : null;
                            if (!remove) {
                                return;
                            }
                            event.preventDefault();
                            var tile = remove.closest('[data-eep-media-url]');
                            var targetSelector = String(picker.getAttribute('data-eep-media-target') || '').trim();
                            var targetInput = targetSelector ? document.querySelector(targetSelector) : null;
                            if (!tile || !targetInput) {
                                return;
                            }
                            var removeUrl = String(tile.getAttribute('data-eep-media-url') || '').trim();
                            var rows = parseUrls(targetInput.value).filter(function (row) {
                                return String(row || '').trim() !== removeUrl;
                            });
                            updatePickerValue(picker, rows);
                            setPickerFeedback(picker, '<?php echo esc_js(__('Image removed.', 'nexdirectory')); ?>', 'success');
                        });
                    });

                    var copyButtons = document.querySelectorAll('.eep-copy-shortcode');
                    copyButtons.forEach(function (button) {
                        button.addEventListener('click', function () {
                            var shortcode = String(button.getAttribute('data-shortcode') || '').trim();
                            if (!shortcode) {
                                return;
                            }
                            var restoreLabel = button.textContent;
                            var onCopied = function () {
                                button.textContent = '<?php echo esc_js(__('Copied', 'nexdirectory')); ?>';
                                window.setTimeout(function () {
                                    button.textContent = restoreLabel;
                                }, 1100);
                            };
                            var fallbackCopy = function () {
                                var fallbackInput = document.createElement('input');
                                fallbackInput.type = 'text';
                                fallbackInput.value = shortcode;
                                document.body.appendChild(fallbackInput);
                                fallbackInput.select();
                                try {
                                    document.execCommand('copy');
                                    onCopied();
                                } catch (copyError) {
                                    // no-op
                                }
                                document.body.removeChild(fallbackInput);
                            };
                            if (navigator.clipboard && typeof navigator.clipboard.writeText === 'function') {
                                navigator.clipboard.writeText(shortcode).then(onCopied).catch(function () {
                                    fallbackCopy();
                                });
                                return;
                            }
                            fallbackCopy();
                        });
                    });

                    var helpDialog = document.getElementById('eep-settings-help-dialog');
                    var helpBackdrop = document.getElementById('eep-settings-help-backdrop');
                    var helpTitle = document.getElementById('eep-settings-help-title');
                    var helpBody = document.getElementById('eep-settings-help-body');
                    var helpTriggers = [];
                    var genericHelpBody = '<?php echo esc_js(__('Configure this option based on your platform behavior, design, moderation, and submission workflow.', 'nexdirectory')); ?>';
                    var makeHelpTrigger = function (title, body) {
                        var trigger = document.createElement('button');
                        trigger.type = 'button';
                        trigger.className = 'eep-help-trigger';
                        trigger.setAttribute('data-eep-help-title', String(title || '').trim());
                        trigger.setAttribute('data-eep-help-body', String(body || '').trim());
                        trigger.setAttribute('aria-label', '<?php echo esc_js(__('Open help dialog', 'nexdirectory')); ?>');
                        var icon = document.createElement('span');
                        icon.className = 'dashicons dashicons-editor-help';
                        icon.setAttribute('aria-hidden', 'true');
                        trigger.appendChild(icon);
                        return trigger;
                    };
                    var openHelpDialog = function (title, body) {
                        if (!helpDialog || !helpBackdrop || !helpTitle || !helpBody) {
                            return;
                        }
                        helpTitle.textContent = String(title || '<?php echo esc_js(__('Settings Help', 'nexdirectory')); ?>');
                        helpBody.innerHTML = '';
                        var paragraphs = String(body || '').split(/\n{2,}/).map(function (entry) {
                            return String(entry || '').trim();
                        }).filter(function (entry) {
                            return entry.length > 0;
                        });
                        if (!paragraphs.length) {
                            paragraphs = [genericHelpBody];
                        }
                        paragraphs.forEach(function (text) {
                            var p = document.createElement('p');
                            p.textContent = text;
                            helpBody.appendChild(p);
                        });
                        helpDialog.classList.add('is-open');
                        helpBackdrop.classList.add('is-open');
                        helpDialog.setAttribute('aria-hidden', 'false');
                        var closeButton = helpDialog.querySelector('[data-eep-help-close]');
                        if (closeButton) {
                            closeButton.focus();
                        }
                    };
                    var closeHelpDialog = function () {
                        if (!helpDialog || !helpBackdrop) {
                            return;
                        }
                        helpDialog.classList.remove('is-open');
                        helpBackdrop.classList.remove('is-open');
                        helpDialog.setAttribute('aria-hidden', 'true');
                    };
                    var getFieldBodyText = function (field) {
                        var bodyParts = [];
                        var descriptionNodes = field.querySelectorAll('.description');
                        descriptionNodes.forEach(function (node) {
                            var text = String(node.textContent || '').trim();
                            if (text) {
                                bodyParts.push(text);
                            }
                        });
                        if (!bodyParts.length) {
                            var cards = field.querySelectorAll('.eep-settings-section-card p');
                            cards.forEach(function (node) {
                                var text = String(node.textContent || '').trim();
                                if (text) {
                                    bodyParts.push(text);
                                }
                            });
                        }
                        if (!bodyParts.length) {
                            bodyParts.push(genericHelpBody);
                        }
                        return bodyParts.join('\n\n');
                    };
                    var injectHelpTriggers = function () {
                        var panelHeadings = document.querySelectorAll('.eep-settings-panel > h2');
                        panelHeadings.forEach(function (heading) {
                            if (heading.querySelector('.eep-help-trigger')) {
                                return;
                            }
                            var panel = heading.closest('.eep-settings-panel');
                            if (!panel) {
                                return;
                            }
                            var summaryNode = panel.querySelector('.description, .eep-settings-subheading');
                            var summaryText = summaryNode ? String(summaryNode.textContent || '').trim() : '';
                            if (!summaryText) {
                                summaryText = genericHelpBody;
                            }
                            var title = String(heading.textContent || '').trim() || '<?php echo esc_js(__('Settings Section', 'nexdirectory')); ?>';
                            var trigger = makeHelpTrigger(title, summaryText);
                            heading.appendChild(trigger);
                            helpTriggers.push(trigger);
                        });

                        var fields = document.querySelectorAll('.eep-settings-panel .eep-settings-field');
                        fields.forEach(function (field) {
                            if (field.querySelector('.eep-help-trigger')) {
                                return;
                            }
                            var label = field.querySelector('label');
                            if (!label) {
                                return;
                            }
                            var labelText = String(label.textContent || '').replace(/\s+/g, ' ').trim();
                            if (!labelText) {
                                return;
                            }
                            var trigger = makeHelpTrigger(labelText, getFieldBodyText(field));
                            label.insertAdjacentElement('afterend', trigger);
                            helpTriggers.push(trigger);
                        });
                    };
                    injectHelpTriggers();

                    document.addEventListener('click', function (event) {
                        var closeEl = event.target.closest('[data-eep-help-close="1"]');
                        if (closeEl) {
                            event.preventDefault();
                            closeHelpDialog();
                            return;
                        }
                        var trigger = event.target.closest('[data-eep-help-title]');
                        if (!trigger) {
                            return;
                        }
                        event.preventDefault();
                        openHelpDialog(
                            String(trigger.getAttribute('data-eep-help-title') || '').trim(),
                            String(trigger.getAttribute('data-eep-help-body') || '').trim()
                        );
                    });

                    document.addEventListener('keydown', function (event) {
                        if (event.key === 'Escape') {
                            closeHelpDialog();
                        }
                    });

                    // Custom submission fields are now managed by creators in the frontend submit/edit form.
                })();
            </script>
        </div>

```

---

## File: includes/utilities/class-eep-media-helper.php

```php
<?php
if (!defined('ABSPATH')) {
    exit;
}

/**
 * Service for handling image resolution, fallbacks, gallery parsing, and media ownership.
 */
class EEP_Media_Helper {

    /**
     * @var EEP_User_Capabilities
     */
    private $user_caps;

    /**
     * Constructor.
     * * @param EEP_User_Capabilities $user_caps Required for checking media ownership/moderation rights.
     */
    public function __construct($user_caps) {
        $this->user_caps = $user_caps;
    }

    /**
     * Shared brand-name fallback used by media placeholders.
     */
    private function get_platform_brand_name() {
        $company_brand_name = sanitize_text_field((string) get_option('eep_company_brand_name', ''));
        if ($company_brand_name !== '') {
            return $company_brand_name;
        }

        if ((string) get_option('eep_white_label_enabled', '0') === '1') {
            $white_label_name = sanitize_text_field((string) get_option('eep_white_label_plugin_name', ''));
            if ($white_label_name !== '') {
                return $white_label_name;
            }
        }

        $site_name = sanitize_text_field((string) get_option('blogname', get_bloginfo('name')));
        if ($site_name !== '') {
            return $site_name;
        }

        return __('nexdirectory', 'nexdirectory');
    }

    /**
     * Parses a string of URLs (separated by newlines, commas, pipes, or JSON) into a clean array.
     */
    public function parse_multiline_urls($raw) {
        $raw = (string) $raw;
        if ($raw === '') {
            return [];
        }

        // Normalize HTML/editor separators.
        $raw = preg_replace('/<br\s*\/?>/i', "\n", $raw);
        $raw = html_entity_decode($raw, ENT_QUOTES, 'UTF-8');

        // Accept JSON array payloads when imported/edited from external tools.
        $json_decoded = json_decode($raw, true);
        if (is_array($json_decoded)) {
            $json_values = [];
            foreach ($json_decoded as $item) {
                if (!is_scalar($item)) {
                    continue;
                }
                $candidate = esc_url_raw((string) $item);
                if ($candidate !== '') {
                    $json_values[] = $candidate;
                }
            }
            if (!empty($json_values)) {
                return array_values(array_unique($json_values));
            }
        }

        $lines = preg_split('/\r\n|\r|\n/', $raw) ?: [];
        
        // Backward compatibility with old comma-separated or pipe-separated values.
        if (count($lines) <= 1) {
            if (strpos($raw, ',') !== false) {
                $lines = array_merge($lines, preg_split('/\s*,\s*/', $raw) ?: []);
            } elseif (strpos($raw, '|') !== false) {
                $lines = array_merge($lines, preg_split('/\s*\|\s*/', $raw) ?: []);
            }
        }

        $urls = [];
        foreach ($lines as $line) {
            $line = trim($line);
            if (!$line) {
                continue;
            }

            // Extract multiple URLs from a single line if needed.
            if (preg_match_all('~https?://[^\s<>"\']+~i', $line, $matches) && !empty($matches[0])) {
                foreach ((array) $matches[0] as $match) {
                    $url = esc_url_raw((string) $match);
                    if ($url !== '') {
                        $urls[] = $url;
                    }
                }
                continue;
            }

            $url = esc_url_raw($line);
            if ($url !== '') {
                $urls[] = $url;
            }
        }
        
        return array_values(array_unique($urls));
    }

    /**
     * Ensures the cover image is included in the gallery array and deduplicates them.
     */
    public function normalize_cover_and_gallery_meta_urls($cover_url, $gallery_raw) {
        $cover_url = esc_url_raw((string) $cover_url);
        $gallery_urls = $this->parse_multiline_urls((string) $gallery_raw);

        if ($cover_url !== '' && !in_array($cover_url, $gallery_urls, true)) {
            array_unshift($gallery_urls, $cover_url);
        }

        return [
            'cover' => $cover_url,
            'gallery' => array_values(array_unique(array_filter($gallery_urls))),
        ];
    }

    /**
     * Updates post meta for videos, gallery, and cover images cleanly.
     */
    public function update_media_meta($post_id, $video_raw, $gallery_raw) {
        $post_id = absint($post_id);
        if ($post_id <= 0) return;

        $videos = $this->parse_multiline_urls($video_raw);
        $normalized = $this->normalize_cover_and_gallery_meta_urls(
            (string) get_post_meta($post_id, 'eep_cover_image_url', true),
            (string) $gallery_raw
        );
        
        $gallery = (array) ($normalized['gallery'] ?? []);
        $cover = (string) ($normalized['cover'] ?? '');
        
        update_post_meta($post_id, 'eep_video_urls', implode("\n", $videos));
        update_post_meta($post_id, 'eep_gallery_urls', implode("\n", $gallery));
        
        if ($cover !== '') {
            update_post_meta($post_id, 'eep_cover_image_url', $cover);
        }
    }

    /**
     * Returns maximum file upload limits defined in settings.
     */
    public function get_upload_limits() {
        $cover_max_kb = max(64, min(10240, absint((int) get_option('eep_upload_cover_max_kb', 500))));
        $gallery_max_kb = max(64, min(20480, absint((int) get_option('eep_upload_gallery_max_kb', 2000))));
        $gallery_max_files = max(1, min(100, absint((int) get_option('eep_upload_gallery_max_files', 10))));
        $file_max_kb = max(64, min(20480, absint((int) get_option('eep_upload_file_max_kb', 2048))));

        return [
            'cover_max_kb' => $cover_max_kb,
            'gallery_max_kb' => $gallery_max_kb,
            'gallery_max_files' => $gallery_max_files,
            'file_max_kb' => $file_max_kb,
            'cover_max_bytes' => $cover_max_kb * 1024,
            'gallery_max_bytes' => $gallery_max_kb * 1024,
            'file_max_bytes' => $file_max_kb * 1024,
        ];
    }

    /**
     * Compatibility provider for platform design settings used by legacy frontend flow.
     *
     * @return array<string, mixed>
     */
    public function get_platform_design_settings() {
        $accent = sanitize_hex_color((string) get_option('eep_style_accent_color', '#FF5E14')) ?: '#FF5E14';
        $hover = sanitize_hex_color((string) get_option('eep_style_accent_hover_color', '#E04F0D')) ?: '#E04F0D';

        $font_body = sanitize_text_field((string) get_option('eep_style_font_family', 'Inter, system-ui, -apple-system, sans-serif'));
        if ($font_body === '') {
            $font_body = 'Inter, system-ui, -apple-system, sans-serif';
        }
        $font_display = sanitize_text_field((string) get_option('eep_style_display_font_family', 'Oswald, Inter, sans-serif'));
        if ($font_display === '') {
            $font_display = 'Oswald, Inter, sans-serif';
        }
        $box_style = sanitize_key((string) get_option('eep_style_box_style', 'default'));
        if (!in_array($box_style, ['default', 'gradient', 'bold', 'neumorphic'], true)) {
            $box_style = 'default';
        }
        $button_style = sanitize_key((string) get_option('eep_style_button_style', 'solid'));
        if (!in_array($button_style, ['solid', 'outline', 'soft', 'dark'], true)) {
            $button_style = 'solid';
        }
        $button_radius_mode = sanitize_key((string) get_option('eep_style_button_radius_mode', 'inherit'));
        if (!in_array($button_radius_mode, ['inherit', 'pill', 'sharp'], true)) {
            $button_radius_mode = 'inherit';
        }
        $density_mode = sanitize_key((string) get_option('eep_style_density_mode', 'comfortable'));
        if (!in_array($density_mode, ['compact', 'comfortable', 'loose'], true)) {
            $density_mode = 'comfortable';
        }
        $border_mode = sanitize_key((string) get_option('eep_style_border_mode', 'subtle'));
        if (!in_array($border_mode, ['minimal', 'subtle', 'strong'], true)) {
            $border_mode = 'subtle';
        }
        $shadow_mode = sanitize_key((string) get_option('eep_style_shadow_mode', 'soft'));
        if (!in_array($shadow_mode, ['none', 'soft', 'medium', 'dramatic'], true)) {
            $shadow_mode = 'soft';
        }
        $content_width = sanitize_key((string) get_option('eep_style_content_width', 'standard'));
        if (!in_array($content_width, ['narrow', 'standard', 'wide', 'full'], true)) {
            $content_width = 'standard';
        }
        $input_style = sanitize_key((string) get_option('eep_style_input_style', 'outline'));
        if (!in_array($input_style, ['outline', 'filled', 'underlined'], true)) {
            $input_style = 'outline';
        }

        return [
            'use_defaults' => (string) get_option('eep_style_use_theme_defaults', '0') === '1',
            'accent' => $accent,
            'hover' => $hover,
            'on_primary' => sanitize_hex_color((string) get_option('eep_style_on_primary_color', '#FFFFFF')) ?: '#FFFFFF',
            'font_body' => $font_body,
            'font_display' => $font_display,
            'font_size_base' => sanitize_text_field((string) get_option('eep_style_font_size_base', '18px')) ?: '18px',
            'h2_size' => sanitize_text_field((string) get_option('eep_style_h2_size', '1.75rem')) ?: '1.75rem',
            'h3_size' => sanitize_text_field((string) get_option('eep_style_h3_size', '1.35rem')) ?: '1.35rem',
            'weight_body' => sanitize_text_field((string) get_option('eep_style_font_weight_body', '400')) ?: '400',
            'weight_heading' => sanitize_text_field((string) get_option('eep_style_font_weight_heading', '700')) ?: '700',
            'space_unit' => sanitize_text_field((string) get_option('eep_style_spacing_unit', '16px')) ?: '16px',
            'space_scale' => sanitize_text_field((string) get_option('eep_style_spacing_scale', '1')) ?: '1',
            'radius_md' => sanitize_text_field((string) get_option('eep_style_radius_md', '12px')) ?: '12px',
            'radius_lg' => sanitize_text_field((string) get_option('eep_style_radius_lg', '24px')) ?: '24px',
            'box_style' => $box_style,
            'button_style' => $button_style,
            'button_radius_mode' => $button_radius_mode,
            'density_mode' => $density_mode,
            'border_mode' => $border_mode,
            'shadow_mode' => $shadow_mode,
            'content_width' => $content_width,
            'input_style' => $input_style,
        ];
    }

    /**
     * Checks if a specific user is allowed to use an existing media library URL.
     */
    public function can_current_user_use_media_url($url, $user_id = 0) {
        $url = esc_url_raw((string) $url);
        if ($url === '') {
            return false;
        }
        
        $user_id = absint((int) $user_id);
        if ($user_id <= 0) {
            $user_id = get_current_user_id();
        }
        if ($user_id <= 0) {
            return false;
        }
        
        if ($this->user_caps->user_can_moderate_events($user_id)) {
            return true;
        }
        
        $attachment_id = attachment_url_to_postid($url);
        if ($attachment_id <= 0) {
            // External URLs remain allowed; ownership checks apply only to media-library assets.
            return true;
        }
        
        return (int) get_post_field('post_author', $attachment_id) === $user_id;
    }

    /**
     * Filters an array of URLs to ensure the user has permission to use them.
     */
    public function filter_media_urls_for_user(array $urls, $user_id = 0) {
        $filtered = [];
        foreach ($urls as $url) {
            $clean_url = esc_url_raw((string) $url);
            if ($clean_url !== '' && $this->can_current_user_use_media_url($clean_url, $user_id)) {
                $filtered[] = $clean_url;
            }
        }
        return array_values(array_unique($filtered));
    }

    /**
     * Takes raw gallery text input, parses it, filters by permission, and returns clean newline separated string.
     */
    public function filter_gallery_urls_text_for_user($raw, $user_id = 0) {
        $urls = $this->parse_multiline_urls((string) $raw);
        $urls = $this->filter_media_urls_for_user($urls, $user_id);
        return implode("\n", $urls);
    }

    /**
     * Generates an SVG data URI as a fallback when no image exists.
     */
    public function get_placeholder_image_data_uri($context = 'thumbnail', array $ui_labels = [], $brand_name = '') {
        $is_hero = $context === 'hero';
        
        // Use injected UI labels to prevent cross-service dependencies inside this helper
        $default_singular = sanitize_text_field((string) ($ui_labels['singular'] ?? __('Event', 'nexdirectory')));
        $kicker = sanitize_text_field((string) ($ui_labels['hero_kicker_default'] ?? ($brand_name . ' ' . __('Event', 'nexdirectory'))));
        
        $title = $is_hero ? $kicker : $default_singular;
        $subtitle = $brand_name !== '' ? $brand_name : $this->get_platform_brand_name();
        
        $width = $is_hero ? 1920 : 800;
        $height = $is_hero ? 1080 : 600;
        $accent_hex = sanitize_hex_color((string) get_option('eep_style_accent_color', '#FF5E14')) ?: '#FF5E14';
        $accent_rgb = [255, 94, 20];
        if (preg_match('/^#?([a-f0-9]{6})$/i', $accent_hex, $accent_match) === 1) {
            $accent_value = ltrim((string) $accent_match[1], '#');
            $accent_rgb = [
                (int) hexdec(substr($accent_value, 0, 2)),
                (int) hexdec(substr($accent_value, 2, 2)),
                (int) hexdec(substr($accent_value, 4, 2)),
            ];
        }
        $accent_overlay = 'rgba(' . implode(',', $accent_rgb) . ',0.25)';
        
        $svg = '<svg xmlns="http://www.w3.org/2000/svg" width="' . $width . '" height="' . $height . '" viewBox="0 0 ' . $width . ' ' . $height . '">'
            . '<defs><linearGradient id="g" x1="0" x2="1" y1="0" y2="1"><stop stop-color="#0B1221"/><stop offset="1" stop-color="#1F2A3D"/></linearGradient></defs>'
            . '<rect width="100%" height="100%" fill="url(#g)"/>'
            . '<circle cx="' . (int) round($width * 0.84) . '" cy="' . (int) round($height * 0.2) . '" r="' . (int) round($width * 0.12) . '" fill="' . esc_attr($accent_overlay) . '"/>'
            . '<text x="50%" y="48%" text-anchor="middle" font-family="Inter,Arial,sans-serif" font-size="' . ($is_hero ? '74' : '52') . '" fill="#FFFFFF" opacity="0.95" font-weight="700">' . esc_html($title) . '</text>'
            . '<text x="50%" y="57%" text-anchor="middle" font-family="Inter,Arial,sans-serif" font-size="' . ($is_hero ? '30' : '24') . '" fill="#FFFFFF" opacity="0.72">' . esc_html($subtitle) . '</text>'
            . '</svg>';
            
        return 'data:image/svg+xml;charset=UTF-8,' . rawurlencode($svg);
    }

    /**
     * Resolves the default image URL (either configured in settings or falls back to SVG placeholder).
     */
    public function get_default_image_url($context = 'thumbnail', $seed = 0, array $ui_labels = [], $brand_name = '') {
        $context = $context === 'hero' ? 'hero' : 'thumbnail';
        $option_key = $context === 'hero' ? 'eep_style_fallback_hero_url' : 'eep_style_fallback_thumb_url';
        $seed = absint((int) $seed);

        if ($context === 'hero') {
            $featured_source_id = $seed > 0 ? $seed : absint((int) get_queried_object_id());
            if ($featured_source_id > 0 && has_post_thumbnail($featured_source_id)) {
                $featured = get_the_post_thumbnail_url($featured_source_id, 'full');
                if (is_string($featured) && $featured !== '') {
                    return esc_url_raw($featured);
                }
            }
        }
        
        $configured = (string) get_option($option_key, '');
        if ($configured !== '') {
            $candidates = $this->parse_multiline_urls($configured);
            if (!empty($candidates)) {
                if ($context === 'hero') {
                    return esc_url_raw((string) $candidates[0]);
                }
                
                $count = count($candidates);
                if ($count === 1) {
                    return esc_url_raw((string) $candidates[0]);
                }
                
                if ($seed <= 0) {
                    $seed = absint((int) get_queried_object_id());
                }
                if ($seed <= 0) {
                    $seed = abs(crc32((string) wp_json_encode([
                        'uri' => (string) ($_SERVER['REQUEST_URI'] ?? ''),
                        'context' => $context,
                    ])));
                }
                $index = $seed % $count;
                return esc_url_raw((string) $candidates[$index]);
            }
        }
        
        return $this->get_placeholder_image_data_uri($context, $ui_labels, $brand_name);
    }

    /**
     * Formats an image URL for display, intercepting demo placeholder URLs and replacing them cleanly.
     */
    public function normalize_event_image_url_for_display($url, $post_id = 0, $context = 'thumbnail', $seed_offset = 0, array $ui_labels = [], $brand_name = '') {
        $context = $context === 'hero' ? 'hero' : 'thumbnail';
        $post_id = absint((int) $post_id);
        $seed_offset = max(0, absint((int) $seed_offset));
        
        $url = esc_url_raw((string) $url);
        if ($url === '') {
            return esc_url_raw($this->get_default_image_url($context, $post_id + $seed_offset, $ui_labels, $brand_name));
        }

        $parts = wp_parse_url($url);
        if (!is_array($parts)) {
            return esc_url_raw($this->get_default_image_url($context, $post_id + $seed_offset, $ui_labels, $brand_name));
        }
        
        $host = strtolower((string) ($parts['host'] ?? ''));
        $path = strtolower((string) ($parts['path'] ?? ''));
        $query = (string) ($parts['query'] ?? '');
        
        if ($host === '') {
            return esc_url_raw($this->get_default_image_url($context, $post_id + $seed_offset, $ui_labels, $brand_name));
        }

        $is_demo_imported = $post_id > 0 && (string) get_post_meta($post_id, 'eep_demo_imported', true) === '1';
        $looks_unstable_demo_url = false;
        
        if (strpos($host, 'source.unsplash.com') !== false) {
            $looks_unstable_demo_url = true;
        } elseif (strpos($host, 'example.com') !== false && (strpos($path, '/images/') !== false || strpos($path, '.jpg') !== false)) {
            $looks_unstable_demo_url = true;
        }

        // Map unstable demo URLs to stable picsum images
        if ($looks_unstable_demo_url || ($is_demo_imported && strpos($host, 'source.unsplash.com') !== false)) {
            $seed_bits = [];
            if ($post_id > 0) {
                $seed_bits[] = (string) $post_id;
                $title_seed = eep_sanitize_title((string) get_the_title($post_id));
                if ($title_seed !== '') {
                    $seed_bits[] = $title_seed;
                }
            }
            if ($query !== '') {
                $seed_bits[] = eep_sanitize_title((string) urldecode($query));
            }
            $seed_bits[] = (string) $seed_offset;
            
            $seed = eep_sanitize_title(implode('-', array_filter($seed_bits, static function ($bit) {
                return trim((string) $bit) !== '';
            })));
            
            if ($seed === '') {
                $seed = 'eep-' . (string) max(1, $post_id + $seed_offset);
            }
            
            $size = $context === 'hero' ? '1600/900' : '1200/900';
            return esc_url_raw('https://picsum.photos/seed/' . rawurlencode($seed) . '/' . $size);
        }

        return $url;
    }

    /**
     * Resolves the canonical cover image for a specific post.
     */
    public function get_event_cover_image_url($post_id, $size = 'medium_large', $context = 'thumbnail', array $ui_labels = [], $brand_name = '') {
        $post_id = absint($post_id);
        if ($post_id <= 0) {
            return esc_url($this->get_default_image_url($context, 0, $ui_labels, $brand_name));
        }

        $cover = esc_url_raw((string) get_post_meta($post_id, 'eep_cover_image_url', true));
        if ($cover !== '') {
            $normalized_cover = $this->normalize_event_image_url_for_display($cover, $post_id, $context, 0, $ui_labels, $brand_name);
            return esc_url((string) $normalized_cover);
        }

        if (has_post_thumbnail($post_id)) {
            // Keep a single canonical source image across hero/card/map contexts.
            $thumb = get_the_post_thumbnail_url($post_id, 'full');
            if (is_string($thumb) && $thumb !== '') {
                return esc_url($thumb);
            }
        }

        return esc_url($this->get_default_image_url($context, $post_id, $ui_labels, $brand_name));
    }

    /**
     * Resolves all gallery images attached to an event.
     */
    public function get_event_gallery_image_urls($post_id, $context = 'thumbnail', array $ui_labels = [], $brand_name = '') {
        $post_id = absint((int) $post_id);
        $raw_urls = $this->parse_multiline_urls((string) get_post_meta($post_id, 'eep_gallery_urls', true));
        $normalized = [];
        
        foreach (array_values((array) $raw_urls) as $index => $raw_url) {
            $candidate = $this->normalize_event_image_url_for_display(
                (string) $raw_url,
                $post_id,
                $context,
                (int) $index + 1,
                $ui_labels,
                $brand_name
            );
            $candidate = esc_url_raw((string) $candidate);
            if ($candidate !== '') {
                $normalized[] = $candidate;
            }
        }
        
        return array_values(array_unique(array_filter($normalized)));
    }
}

```

---

## Segment: Admin setting registrations for style/hero/layout/map

Source: `includes/trait-eep-admin.php:720,1265`

```php
            'type' => 'string',
            'sanitize_callback' => 'esc_url_raw',
            'default' => '',
        ]);
        register_setting('eep_settings_group', 'eep_frontend_footer_logo_link_url', [
            'type' => 'string',
            'sanitize_callback' => 'esc_url_raw',
            'default' => '',
        ]);
        register_setting('eep_settings_group', 'eep_frontend_footer_use_wp_menus', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '0',
        ]);
        register_setting('eep_settings_group', 'eep_frontend_footer_menu_count', [
            'type' => 'integer',
            'sanitize_callback' => [$this, 'sanitize_footer_menu_count_option'],
            'default' => 3,
        ]);
        register_setting('eep_settings_group', 'eep_frontend_footer_wp_menus', [
            'type' => 'array',
            'sanitize_callback' => [$this, 'sanitize_footer_wp_menu_list_option'],
            'default' => [],
        ]);
        register_setting('eep_settings_group', 'eep_frontend_footer_show_privacy_link', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_frontend_footer_bottom_text', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_footer_bottom_text_option'],
            'default' => '',
        ]);
        register_setting('eep_settings_group', 'eep_style_use_theme_defaults', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '0',
        ]);
        register_setting('eep_settings_group', 'eep_style_accent_color', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_color_option'],
            'default' => '#FF5E14',
        ]);
        register_setting('eep_settings_group', 'eep_style_accent_hover_color', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_color_option'],
            'default' => '#E04F0D',
        ]);
        register_setting('eep_settings_group', 'eep_style_fallback_thumb_url', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_multi_image_urls_option'],
            'default' => '',
        ]);
        register_setting('eep_settings_group', 'eep_style_fallback_hero_url', [
            'type' => 'string',
            'sanitize_callback' => 'esc_url_raw',
            'default' => '',
        ]);
        register_setting('eep_settings_group', 'eep_style_favicon_url', [
            'type' => 'string',
            'sanitize_callback' => 'esc_url_raw',
            'default' => '',
        ]);
        register_setting('eep_settings_group', 'eep_home_meta_title', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_home_meta_title_option'],
            'default' => '',
        ]);
        register_setting('eep_settings_group', 'eep_home_meta_description', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_home_meta_description_option'],
            'default' => '',
        ]);
        register_setting('eep_settings_group', 'eep_style_font_family', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_font_family_option'],
            'default' => 'Inter, system-ui, -apple-system, sans-serif',
        ]);
        register_setting('eep_settings_group', 'eep_style_display_font_family', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_font_family_option'],
            'default' => 'Oswald, Inter, sans-serif',
        ]);
        register_setting('eep_settings_group', 'eep_style_font_size_base', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_size_option'],
            'default' => '18px',
        ]);
        register_setting('eep_settings_group', 'eep_style_h2_size', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_size_option'],
            'default' => '1.75rem',
        ]);
        register_setting('eep_settings_group', 'eep_style_h3_size', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_size_option'],
            'default' => '1.35rem',
        ]);
        register_setting('eep_settings_group', 'eep_style_font_weight_body', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_font_weight_option'],
            'default' => '400',
        ]);
        register_setting('eep_settings_group', 'eep_style_font_weight_heading', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_font_weight_option'],
            'default' => '700',
        ]);
        register_setting('eep_settings_group', 'eep_style_spacing_unit', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_size_option'],
            'default' => '16px',
        ]);
        register_setting('eep_settings_group', 'eep_style_spacing_scale', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_spacing_scale_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_style_radius_md', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_size_option'],
            'default' => '12px',
        ]);
        register_setting('eep_settings_group', 'eep_style_radius_lg', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_size_option'],
            'default' => '24px',
        ]);
        register_setting('eep_settings_group', 'eep_style_box_style', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_style_box_style_option'],
            'default' => 'default',
        ]);
        register_setting('eep_settings_group', 'eep_style_button_style', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_style_button_style_option'],
            'default' => 'solid',
        ]);
        register_setting('eep_settings_group', 'eep_style_button_radius_mode', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_style_button_radius_mode_option'],
            'default' => 'inherit',
        ]);
        register_setting('eep_settings_group', 'eep_style_density_mode', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_style_density_mode_option'],
            'default' => 'comfortable',
        ]);
        register_setting('eep_settings_group', 'eep_style_border_mode', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_style_border_mode_option'],
            'default' => 'subtle',
        ]);
        register_setting('eep_settings_group', 'eep_style_shadow_mode', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_style_shadow_mode_option'],
            'default' => 'soft',
        ]);
        register_setting('eep_settings_group', 'eep_style_content_width', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_style_content_width_option'],
            'default' => 'standard',
        ]);
        register_setting('eep_settings_group', 'eep_style_input_style', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_style_input_style_option'],
            'default' => 'outline',
        ]);
        register_setting('eep_settings_group', 'eep_enable_submit_autosave', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_autosave_interval_seconds', [
            'type' => 'integer',
            'sanitize_callback' => [$this, 'sanitize_autosave_interval'],
            'default' => 60,
        ]);
        register_setting('eep_settings_group', 'eep_enable_event_reporting', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_default_submit_show_nav', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_hide_theme_titles_on_plugin_pages', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '0',
        ]);
        register_setting('eep_settings_group', 'eep_theme_override_all_plugin_pages', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_theme_override_full_width', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_theme_override_remove_padding', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_theme_override_hide_title', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_theme_override_hide_comments', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_theme_override_hide_featured_image', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_theme_override_hide_header', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '0',
        ]);
        register_setting('eep_settings_group', 'eep_theme_override_reset_theme_styles', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_enable_map_auto_search', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_map_results_per_page', [
            'type' => 'integer',
            'sanitize_callback' => [$this, 'sanitize_map_results_per_page_option'],
            'default' => 120,
        ]);
        register_setting('eep_settings_group', 'eep_map_layout_default', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_map_layout_option'],
            'default' => 'three-column',
        ]);
        register_setting('eep_settings_group', 'eep_page_side_padding', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_page_side_padding_option'],
            'default' => '10%',
        ]);
        register_setting('eep_settings_group', 'eep_page_side_padding_mobile', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_page_side_padding_mobile_option'],
            'default' => '2%',
        ]);
        register_setting('eep_settings_group', 'eep_nav_side_padding_desktop', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_nav_side_padding_desktop_option'],
            'default' => '0%',
        ]);
        register_setting('eep_settings_group', 'eep_enable_smooth_scrolling', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '0',
        ]);
        register_setting('eep_settings_group', 'eep_smooth_scroll_profile', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_smooth_scroll_profile_option'],
            'default' => 'balanced',
        ]);
        register_setting('eep_settings_group', 'eep_smooth_scroll_touchpad_behavior', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_smooth_scroll_touchpad_behavior_option'],
            'default' => 'native',
        ]);
        register_setting('eep_settings_group', 'eep_smooth_scroll_wheel_multiplier', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_smooth_scroll_wheel_multiplier_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_smooth_scroll_ease', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_smooth_scroll_ease_option'],
            'default' => '1.2',
        ]);
        register_setting('eep_settings_group', 'eep_smooth_scroll_max_step_px', [
            'type' => 'integer',
            'sanitize_callback' => [$this, 'sanitize_smooth_scroll_max_step_option'],
            'default' => 960,
        ]);
        register_setting('eep_settings_group', 'eep_smooth_scroll_min_step_px', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_smooth_scroll_min_step_option'],
            'default' => '0.16',
        ]);
        register_setting('eep_settings_group', 'eep_smooth_scroll_enable_on_touch', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '0',
        ]);
        register_setting('eep_settings_group', 'eep_preloader_enabled', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_preloader_source', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_preloader_source_option'],
            'default' => 'svg',
        ]);
        register_setting('eep_settings_group', 'eep_preloader_svg_markup', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_preloader_svg_option'],
            'default' => $this->get_default_preloader_svg_markup(),
        ]);
        register_setting('eep_settings_group', 'eep_preloader_image_url', [
            'type' => 'string',
            'sanitize_callback' => 'esc_url_raw',
            'default' => '',
        ]);
        register_setting('eep_settings_group', 'eep_preloader_background_color', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_preloader_background_color_option'],
            'default' => '#FFFFFF',
        ]);
        register_setting('eep_settings_group', 'eep_preloader_logo_max_width', [
            'type' => 'integer',
            'sanitize_callback' => [$this, 'sanitize_preloader_logo_max_width_option'],
            'default' => 420,
        ]);
        register_setting('eep_settings_group', 'eep_preloader_min_duration_ms', [
            'type' => 'integer',
            'sanitize_callback' => [$this, 'sanitize_preloader_min_duration_option'],
            'default' => 400,
        ]);
        register_setting('eep_settings_group', 'eep_preloader_fade_duration_ms', [
            'type' => 'integer',
            'sanitize_callback' => [$this, 'sanitize_preloader_fade_duration_option'],
            'default' => 420,
        ]);
        register_setting('eep_settings_group', 'eep_preloader_show_on_initial', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_preloader_show_on_spa', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_preloader_show_only_home', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '0',
        ]);
        register_setting('eep_settings_group', 'eep_preloader_show_once', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '0',
        ]);
        register_setting('eep_settings_group', 'eep_preloader_disable_mobile', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '0',
        ]);
        register_setting('eep_settings_group', 'eep_preloader_respect_motion', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_map_view_template', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_map_view_template_option'],
            'default' => 'default',
        ]);
        register_setting('eep_settings_group', 'eep_map_focus_region', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_map_focus_region_option'],
            'default' => 'global',
        ]);
        register_setting('eep_settings_group', 'eep_map_results_density', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_map_density_option'],
            'default' => 'comfortable',
        ]);
        register_setting('eep_settings_group', 'eep_map_mobile_filter_mode', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_map_mobile_filter_mode_option'],
            'default' => 'drawer',
        ]);
        register_setting('eep_settings_group', 'eep_map_provider', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_map_provider_option'],
            'default' => 'openstreetmap',
        ]);
        register_setting('eep_settings_group', 'eep_map_style', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_map_style_option'],
            'default' => 'osm-standard',
        ]);
        register_setting('eep_settings_group', 'eep_mapbox_access_token', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_mapbox_access_token_option'],
            'default' => '',
        ]);
        register_setting('eep_settings_group', 'eep_mapbox_style_id', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_mapbox_style_id_option'],
            'default' => 'mapbox/streets-v12',
        ]);
        register_setting('eep_settings_group', 'eep_map_custom_tile_url', [
            'type' => 'string',
            'sanitize_callback' => 'eep_sanitize_text',
            'default' => '',
        ]);
        register_setting('eep_settings_group', 'eep_map_custom_tile_attribution', [
            'type' => 'string',
            'sanitize_callback' => 'eep_sanitize_text',
            'default' => '',
        ]);
        register_setting('eep_settings_group', 'eep_map_custom_tile_subdomains', [
            'type' => 'string',
            'sanitize_callback' => 'eep_sanitize_text',
            'default' => '',
        ]);
        register_setting('eep_settings_group', 'eep_site_profile', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_site_profile_option'],
            'default' => 'events',
        ]);
        register_setting('eep_settings_group', 'eep_platform_mode', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_platform_mode_option'],
            'default' => 'user_generated',
        ]);
        register_setting('eep_settings_group', 'eep_event_hero_layout', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_hero_layout_option'],
            'default' => 'cinematic',
        ]);
        register_setting('eep_settings_group', 'eep_event_hero_kicker_text', [
            'type' => 'string',
            'sanitize_callback' => 'eep_sanitize_text',
            'default' => 'NexDirectory',
        ]);
        register_setting('eep_settings_group', 'eep_company_brand_name', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_company_brand_name_option'],
            'default' => '',
        ]);
        register_setting('eep_settings_group', 'eep_event_page_layout', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_event_page_layout_option'],
            'default' => 'modern',
        ]);
        register_setting('eep_settings_group', 'eep_event_gallery_type', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_event_gallery_type_option'],
            'default' => 'default',
        ]);
        register_setting('eep_settings_group', 'eep_enable_hero_parallax', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_map_filter_show_search', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_map_filter_show_type', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_map_filter_show_mode', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '0',
        ]);
        register_setting('eep_settings_group', 'eep_map_filter_show_tag', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '0',
        ]);
        register_setting('eep_settings_group', 'eep_map_filter_show_price', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_map_filter_show_official', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '0',
        ]);
        register_setting('eep_settings_group', 'eep_map_filter_show_date', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_map_filter_show_distance', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_enable_account_tabs_ajax', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '0',
        ]);
        register_setting('eep_settings_group', 'eep_enable_moderation_ajax', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_use_action_scheduler', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '0',
        ]);
        register_setting('eep_settings_group', 'eep_uninstall_remove_data', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '0',
        ]);
        register_setting('eep_settings_group', 'eep_use_rich_editor', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_enable_duplicate_detection', [
            'type' => 'string',
            'sanitize_callback' => [$this, 'sanitize_checkbox_option'],
            'default' => '1',
        ]);
        register_setting('eep_settings_group', 'eep_official_classification_suffix', [
            'type' => 'string',
            'sanitize_callback' => 'eep_sanitize_text',
            'default' => '',
        ]);
        register_setting('eep_settings_group', 'eep_white_label_enabled', [
            'type' => 'string',

```

---

## Segment: Style option sanitizers

Source: `includes/trait-eep-admin.php:2320,2385`

```php

    public function sanitize_spacing_scale_option($value) {
        $value = str_replace(',', '.', trim((string) $value));
        if (!is_numeric($value)) {
            return '1';
        }
        $float = (float) $value;
        if ($float < 0.6) {
            $float = 0.6;
        }
        if ($float > 2) {
            $float = 2;
        }
        if (abs($float - (float) ((int) $float)) < 0.000001) {
            return (string) ((int) $float);
        }
        $normalized = rtrim(rtrim(sprintf('%.6F', $float), '0'), '.');
        return $normalized !== '' ? $normalized : '1';
    }

    public function sanitize_style_box_style_option($value) {
        $value = sanitize_key((string) $value);
        return in_array($value, ['default', 'gradient', 'bold', 'neumorphic'], true) ? $value : 'default';
    }

    public function sanitize_style_button_style_option($value) {
        $value = sanitize_key((string) $value);
        return in_array($value, ['solid', 'outline', 'soft', 'dark'], true) ? $value : 'solid';
    }

    public function sanitize_style_button_radius_mode_option($value) {
        $value = sanitize_key((string) $value);
        return in_array($value, ['inherit', 'pill', 'sharp'], true) ? $value : 'inherit';
    }

    public function sanitize_style_density_mode_option($value) {
        $value = sanitize_key((string) $value);
        return in_array($value, ['compact', 'comfortable', 'loose'], true) ? $value : 'comfortable';
    }

    public function sanitize_style_border_mode_option($value) {
        $value = sanitize_key((string) $value);
        return in_array($value, ['minimal', 'subtle', 'strong'], true) ? $value : 'subtle';
    }

    public function sanitize_style_shadow_mode_option($value) {
        $value = sanitize_key((string) $value);
        return in_array($value, ['none', 'soft', 'medium', 'dramatic'], true) ? $value : 'soft';
    }

    public function sanitize_style_content_width_option($value) {
        $value = sanitize_key((string) $value);
        return in_array($value, ['narrow', 'standard', 'wide', 'full'], true) ? $value : 'standard';
    }

    public function sanitize_style_input_style_option($value) {
        $value = sanitize_key((string) $value);
        return in_array($value, ['outline', 'filled', 'underlined'], true) ? $value : 'outline';
    }


    public function sanitize_map_layout_option($value) {
        $value = sanitize_key((string) $value);
        if ($value === 'below') {
            $value = 'below-list';
        } elseif ($value === 'sidebar') {

```

---

## Segment: Event page + gallery layout sanitizers

Source: `includes/trait-eep-admin.php:3780,3865`

```php
        }
        $generated = wp_generate_password(48, false, false);
        update_option('eep_extension_app_pass', $generated, false);
        return $generated;
    }


    public function sanitize_map_results_per_page_option($value) {
        $count = absint((int) $value);
        if ($count < 12) {
            $count = 12;
        }
        if ($count > 250) {
            $count = 250;
        }
        return $count;
    }


    public function sanitize_hero_layout_option($value) {
        $value = sanitize_key((string) $value);
        return in_array($value, ['cinematic', 'compact', 'split', 'minimal', 'immersive', 'spotlight'], true) ? $value : 'cinematic';
    }


    public function sanitize_event_page_layout_option($value) {
        $value = sanitize_key((string) $value);
        $allowed = ['modern', 'single-column', 'editorial', 'fifty-fifty', 'left-sidebar', 'zig-zag', 'full3', 'zen'];
        return in_array($value, $allowed, true) ? $value : 'modern';
    }


    public function sanitize_event_gallery_type_option($value) {
        $value = sanitize_key((string) $value);
        $allowed = ['default', 'carousel', 'wall'];
        return in_array($value, $allowed, true) ? $value : 'default';
    }


    public function sanitize_smtp_port_option($value) {
        $port = absint((int) $value);
        if ($port < 1) {
            $port = 587;
        }
        if ($port > 65535) {
            $port = 65535;
        }
        return $port;
    }


    public function sanitize_smtp_encryption_option($value) {
        $value = strtolower(trim((string) $value));
        return in_array($value, ['', 'none', 'tls', 'ssl'], true) ? $value : 'tls';
    }


    public function sanitize_upload_limit_kb_option($value) {
        $v = absint((int) $value);
        if ($v < 64) {
            $v = 64;
        }
        if ($v > 20480) {
            $v = 20480;
        }
        return $v;
    }


    public function sanitize_upload_files_count_option($value) {
        $v = absint((int) $value);
        if ($v < 1) {
            $v = 1;
        }
        if ($v > 100) {
            $v = 100;
        }
        return $v;
    }


    public function sanitize_custom_form_fields_option($value) {
        $decoded = [];
        if (is_string($value)) {
            $decoded = json_decode($value, true);
            if (!is_array($decoded)) {

```

---

## Segment: Runtime CSS variable mapping + frontend config (event relevant)

Source: `includes/trait-eep-content.php:1500,1815`

```php
            $shadow_lg = 'none';
        } elseif ($shadow_mode === 'medium') {
            $shadow_sm = '0 8px 18px rgba(11, 18, 33, 0.09)';
            $shadow_md = '0 14px 34px rgba(11, 18, 33, 0.14)';
            $shadow_lg = '0 24px 50px rgba(11, 18, 33, 0.2)';
        } elseif ($shadow_mode === 'dramatic') {
            $shadow_sm = '0 10px 24px rgba(11, 18, 33, 0.14)';
            $shadow_md = '0 20px 44px rgba(11, 18, 33, 0.2)';
            $shadow_lg = '0 30px 70px rgba(11, 18, 33, 0.3)';
        }

        if ($box_style === 'neumorphic') {
            $shadow_sm = '6px 6px 14px rgba(148, 163, 184, 0.25), -6px -6px 14px rgba(255, 255, 255, 0.95)';
            $shadow_md = '10px 10px 24px rgba(148, 163, 184, 0.27), -10px -10px 24px rgba(255, 255, 255, 0.96)';
            $shadow_lg = '14px 14px 32px rgba(148, 163, 184, 0.28), -14px -14px 32px rgba(255, 255, 255, 0.96)';
            if ($shadow_mode === 'none') {
                $shadow_sm = 'none';
                $shadow_md = 'none';
                $shadow_lg = 'none';
            }
            $border_color = 'transparent';
        }

        $btn_bg = 'var(--eep-primary)';
        $btn_bg_hover = 'var(--eep-primary-hover)';
        $btn_color = 'var(--eep-on-primary, #ffffff)';
        $btn_border = '1px solid transparent';
        $btn_letter_spacing = '.06em';
        $btn_transform = 'uppercase';
        $btn_weight = '700';
        if ($button_style === 'outline') {
            $btn_bg = 'transparent';
            $btn_bg_hover = 'color-mix(in srgb, var(--eep-primary) 10%, #ffffff)';
            $btn_color = 'var(--eep-primary)';
            $btn_border = '2px solid var(--eep-primary)';
            $btn_letter_spacing = '.03em';
            $btn_transform = 'none';
        } elseif ($button_style === 'soft') {
            $btn_bg = 'color-mix(in srgb, var(--eep-primary) 16%, #ffffff)';
            $btn_bg_hover = 'color-mix(in srgb, var(--eep-primary) 24%, #ffffff)';
            $btn_color = 'color-mix(in srgb, var(--eep-primary-hover) 66%, #111827)';
            $btn_border = '1px solid color-mix(in srgb, var(--eep-primary) 26%, #ffffff)';
            $btn_letter_spacing = '.02em';
            $btn_transform = 'none';
        } elseif ($button_style === 'dark') {
            $btn_bg = '#0f172a';
            $btn_bg_hover = '#111827';
            $btn_color = '#ffffff';
            $btn_border = '1px solid #0f172a';
            $btn_letter_spacing = '.03em';
            $btn_transform = 'none';
        }

        $btn_radius = 'var(--eep-radius-pill)';
        if ($button_radius_mode === 'pill') {
            $btn_radius = '999px';
        } elseif ($button_radius_mode === 'sharp') {
            $btn_radius = '6px';
        }

        $input_bg = '#ffffff';
        $input_border = '#e5e7eb';
        $input_border_focus = 'var(--eep-primary)';
        $input_border_width = '1px';
        $input_radius = 'var(--eep-radius)';
        if ($input_style === 'filled') {
            $input_bg = '#f8fafc';
            $input_border = '#e2e8f0';
        } elseif ($input_style === 'underlined') {
            $input_bg = 'transparent';
            $input_border = 'transparent transparent #cbd5e1 transparent';
            $input_border_focus = 'transparent transparent var(--eep-primary) transparent';
            $input_border_width = '0 0 2px 0';
            $input_radius = '0';
        }

        $dynamic_css = ':root{'
            . '--eep-primary:' . $clean_css_value($accent_hex) . ';'
            . '--eep-primary-hover:' . $clean_css_value($hover_hex) . ';'
            . '--eep-on-primary:' . $clean_css_value($on_primary_hex) . ';'
            . '--eep-font:' . $clean_css_value($design['font_body']) . ';'
            . '--eep-font-display:' . $clean_css_value($design['font_display']) . ';'
            . '--eep-base-font-size:' . $clean_css_value($design['font_size_base']) . ';'
            . '--eep-h2-size:' . $clean_css_value($design['h2_size']) . ';'
            . '--eep-h3-size:' . $clean_css_value($design['h3_size']) . ';'
            . '--eep-font-weight-body:' . $clean_css_value($design['weight_body']) . ';'
            . '--eep-font-weight-heading:' . $clean_css_value($design['weight_heading']) . ';'
            . '--eep-space-unit:' . $clean_css_value($design['space_unit']) . ';'
            . '--eep-space-scale:' . $clean_css_value($design['space_scale']) . ';'
            . '--eep-radius:' . $clean_css_value($design['radius_md']) . ';'
            . '--eep-radius-lg:' . $clean_css_value($design['radius_lg']) . ';'
            . '--eep-page-side-padding:' . $clean_css_value($page_side_padding_desktop) . ';'
            . '--eep-page-side-padding-mobile:' . $clean_css_value($page_side_padding_mobile) . ';'
            . '--eep-content-max-width:' . $clean_css_value($content_width_max) . ';'
            . '--eep-event-page-max-width:' . $clean_css_value($event_page_max_width) . ';'
            . '--eep-archive-max-width:' . $clean_css_value($archive_map_max_width) . ';'
            . '--eep-density-scale:' . $clean_css_value($density_scale) . ';'
            . '--eep-field-pad-y:' . $clean_css_value($field_pad_y) . ';'
            . '--eep-field-pad-x:' . $clean_css_value($field_pad_x) . ';'
            . '--eep-btn-min-height:' . $clean_css_value($button_min_height) . ';'
            . '--eep-box-bg:' . $clean_css_value($box_background) . ';'
            . '--eep-box-bg-alt:' . $clean_css_value($box_background_alt) . ';'
            . '--eep-box-border-color:' . $clean_css_value($border_color) . ';'
            . '--eep-box-border-width:' . $clean_css_value($border_width) . ';'
            . '--eep-shadow-sm:' . $clean_css_value($shadow_sm) . ';'
            . '--eep-shadow:' . $clean_css_value($shadow_md) . ';'
            . '--eep-shadow-lg:' . $clean_css_value($shadow_lg) . ';'
            . '--eep-btn-bg:' . $clean_css_value($btn_bg) . ';'
            . '--eep-btn-bg-hover:' . $clean_css_value($btn_bg_hover) . ';'
            . '--eep-btn-color:' . $clean_css_value($btn_color) . ';'
            . '--eep-btn-border:' . $clean_css_value($btn_border) . ';'
            . '--eep-btn-letter-spacing:' . $clean_css_value($btn_letter_spacing) . ';'
            . '--eep-btn-transform:' . $clean_css_value($btn_transform) . ';'
            . '--eep-btn-font-weight:' . $clean_css_value($btn_weight) . ';'
            . '--eep-btn-radius:' . $clean_css_value($btn_radius) . ';'
            . '--eep-input-bg:' . $clean_css_value($input_bg) . ';'
            . '--eep-input-border:' . $clean_css_value($input_border) . ';'
            . '--eep-input-border-focus:' . $clean_css_value($input_border_focus) . ';'
            . '--eep-input-border-width:' . $clean_css_value($input_border_width) . ';'
            . '--eep-input-radius:' . $clean_css_value($input_radius) . ';'
            . '--eep-primary-rgb:' . implode(', ', $accent_rgb) . ';'
            . '}';
        $dynamic_css .= '@media (max-width: 767px){:root{--eep-page-side-padding:var(--eep-page-side-padding-mobile);}}';
        if (!empty($design['use_defaults'])) {
            $dynamic_css .= '.eep-theme-shell,.eep-layout,.eep-submit-wrap,.eep-auth-grid,.eep-my-events,.eep-form{font-family:inherit!important;}';
        } else {
            $font_scope = '.eep-theme-shell,.eep-layout,.eep-submit-wrap,.eep-auth-grid,.eep-my-events,.eep-form,.eep-account-shell,.eep-platform-nav,#eep-map-default-wrapper,#eep-map-triple-wrapper';
            $dynamic_css .= $font_scope . '{font-family:var(--eep-font)!important;}';
            $dynamic_css .= $font_scope . ' :is(p,span,a,li,ul,ol,label,small,strong,em,b,button,input,select,textarea,th,td,caption,figcaption,blockquote,dt,dd,summary,details){font-family:var(--eep-font)!important;}';
            $dynamic_css .= $font_scope . ' :is(h1,h2,h3,h4,h5,h6,.eep-event-hero-title,.eep-map-item-title){font-family:var(--eep-font-display)!important;}';
        }
        wp_register_style('eep-runtime-vars', false, [], $frontend_css_ver);
        wp_enqueue_style('eep-runtime-vars');
        wp_add_inline_style('eep-runtime-vars', $dynamic_css);
        wp_enqueue_script('eep-frontend');
        wp_add_inline_script(
            'eep-frontend',
            '(function(){var tries=0;function boot(){if(typeof window.__eepDeferredAlpineInit==="function"){window.__eepDeferredAlpineInit();window.__eepDeferredAlpineInit=null;return true;}return false;}if(!boot()){var timer=window.setInterval(function(){tries++;if(boot()||tries>120){window.clearInterval(timer);}},50);}})();',
            'after'
        );
        if (is_user_logged_in()) {
            wp_enqueue_media();
        }
        $upload_limits = $this->get_upload_limits();
        $excerpt_max_chars = max(80, min(1000, (int) get_option('eep_excerpt_max_chars', 220)));
        $ui_labels = method_exists($this, 'get_site_profile_ui_labels') ? (array) $this->get_site_profile_ui_labels() : [];
        $singular_label = sanitize_text_field((string) ($ui_labels['singular'] ?? __('Event', 'nexdirectory')));
        $plural_label = sanitize_text_field((string) ($ui_labels['plural'] ?? __('Events', 'nexdirectory')));
        $singular_lower = sanitize_text_field((string) ($ui_labels['singular_lower'] ?? strtolower((string) $singular_label)));
        $plural_lower = sanitize_text_field((string) ($ui_labels['plural_lower'] ?? strtolower((string) $plural_label)));
        $owner_plural = sanitize_text_field((string) ($ui_labels['owner_plural'] ?? __('Organizers', 'nexdirectory')));
        $spa_route_urls = method_exists($this, 'get_spa_hybrid_route_urls') ? (array) $this->get_spa_hybrid_route_urls() : [];
        $spa_route_urls = array_values(array_unique(array_filter(array_map('esc_url_raw', $spa_route_urls))));
        wp_localize_script('eep-frontend', 'eepConfig', [
            'googleMapsApiKey' => (string) get_option('eep_google_maps_api_key', ''),
            'mapPinUrl' => (string) get_option('eep_map_pin_url', ''),
            'recaptchaSiteKey' => (string) get_option('eep_recaptcha_site_key', ''),
            'recaptchaVersion' => (string) get_option('eep_recaptcha_version', 'v3'),
            'recaptchaShowSubmit' => $this->is_option_enabled('eep_recaptcha_show_submit', '0'),
            'recaptchaBypassSubmitForPrivileged' => (is_user_logged_in() && current_user_can('manage_options')),
            'autosaveEndpoint' => admin_url('admin-post.php'),
            'autosaveNonce' => wp_create_nonce('eep_autosave_event_nonce'),
            'uploadEndpoint' => admin_url('admin-post.php'),
            'uploadNonce' => wp_create_nonce('eep_upload_image_nonce'),
            'uploadCoverMaxBytes' => (int) ($upload_limits['cover_max_bytes'] ?? 512000),
            'uploadGalleryMaxBytes' => (int) ($upload_limits['gallery_max_bytes'] ?? 2048000),
            'uploadGalleryMaxFiles' => (int) ($upload_limits['gallery_max_files'] ?? 10),
            'uploadFileMaxBytes' => (int) ($upload_limits['file_max_bytes'] ?? 2097152),
            'excerptMaxChars' => $excerpt_max_chars,
            'enableSubmitAutosave' => $this->is_option_enabled('eep_enable_submit_autosave', '1'),
            'smoothScrolling' => $this->is_option_enabled('eep_enable_smooth_scrolling', '0'),
            'smoothScrollProfile' => method_exists($this, 'sanitize_smooth_scroll_profile_option')
                ? (string) $this->sanitize_smooth_scroll_profile_option((string) get_option('eep_smooth_scroll_profile', 'balanced'))
                : (string) get_option('eep_smooth_scroll_profile', 'balanced'),
            'smoothScrollTouchpadBehavior' => method_exists($this, 'sanitize_smooth_scroll_touchpad_behavior_option')
                ? (string) $this->sanitize_smooth_scroll_touchpad_behavior_option((string) get_option('eep_smooth_scroll_touchpad_behavior', 'native'))
                : (string) get_option('eep_smooth_scroll_touchpad_behavior', 'native'),
            'smoothScrollWheelMultiplier' => method_exists($this, 'sanitize_smooth_scroll_wheel_multiplier_option')
                ? (float) $this->sanitize_smooth_scroll_wheel_multiplier_option((string) get_option('eep_smooth_scroll_wheel_multiplier', '1'))
                : (float) get_option('eep_smooth_scroll_wheel_multiplier', '1'),
            'smoothScrollEase' => method_exists($this, 'sanitize_smooth_scroll_ease_option')
                ? (float) $this->sanitize_smooth_scroll_ease_option((string) get_option('eep_smooth_scroll_ease', '1.2'))
                : (float) get_option('eep_smooth_scroll_ease', '1.2'),
            'smoothScrollMaxStepPx' => method_exists($this, 'sanitize_smooth_scroll_max_step_option')
                ? (int) $this->sanitize_smooth_scroll_max_step_option((int) get_option('eep_smooth_scroll_max_step_px', 960))
                : (int) get_option('eep_smooth_scroll_max_step_px', 960),
            'smoothScrollMinStepPx' => method_exists($this, 'sanitize_smooth_scroll_min_step_option')
                ? (float) $this->sanitize_smooth_scroll_min_step_option((string) get_option('eep_smooth_scroll_min_step_px', '0.16'))
                : (float) get_option('eep_smooth_scroll_min_step_px', '0.16'),
            'smoothScrollEnableOnTouch' => $this->is_option_enabled('eep_smooth_scroll_enable_on_touch', '0'),
            'preloaderEnabled' => $this->is_option_enabled('eep_preloader_enabled', '1'),
            'preloaderSource' => method_exists($this, 'sanitize_preloader_source_option')
                ? (string) $this->sanitize_preloader_source_option((string) get_option('eep_preloader_source', 'svg'))
                : (string) get_option('eep_preloader_source', 'svg'),
            'preloaderSvg' => method_exists($this, 'sanitize_preloader_svg_option')
                ? (string) $this->sanitize_preloader_svg_option((string) get_option('eep_preloader_svg_markup', method_exists($this, 'get_default_preloader_svg_markup') ? (string) $this->get_default_preloader_svg_markup() : ''))
                : (string) get_option('eep_preloader_svg_markup', ''),
            'preloaderImageUrl' => esc_url_raw((string) get_option('eep_preloader_image_url', '')),
            'preloaderBackgroundColor' => method_exists($this, 'sanitize_preloader_background_color_option')
                ? (string) $this->sanitize_preloader_background_color_option((string) get_option('eep_preloader_background_color', '#FFFFFF'))
                : (string) get_option('eep_preloader_background_color', '#FFFFFF'),
            'preloaderLogoMaxWidth' => method_exists($this, 'sanitize_preloader_logo_max_width_option')
                ? (int) $this->sanitize_preloader_logo_max_width_option((int) get_option('eep_preloader_logo_max_width', 420))
                : (int) get_option('eep_preloader_logo_max_width', 420),
            'preloaderMinDurationMs' => method_exists($this, 'sanitize_preloader_min_duration_option')
                ? (int) $this->sanitize_preloader_min_duration_option((int) get_option('eep_preloader_min_duration_ms', 400))
                : (int) get_option('eep_preloader_min_duration_ms', 400),
            'preloaderFadeDurationMs' => method_exists($this, 'sanitize_preloader_fade_duration_option')
                ? (int) $this->sanitize_preloader_fade_duration_option((int) get_option('eep_preloader_fade_duration_ms', 420))
                : (int) get_option('eep_preloader_fade_duration_ms', 420),
            'preloaderShowOnInitial' => $this->is_option_enabled('eep_preloader_show_on_initial', '1'),
            'preloaderShowOnSpa' => $this->is_option_enabled('eep_preloader_show_on_spa', '1'),
            'preloaderShowOnlyHome' => $this->is_option_enabled('eep_preloader_show_only_home', '0'),
            'preloaderShowOnce' => $this->is_option_enabled('eep_preloader_show_once', '0'),
            'preloaderHomeUrl' => esc_url_raw(home_url('/')),
            'preloaderIsHomePage' => (bool) (is_front_page() || is_home()),
            'preloaderSeenStorageKey' => 'eep_preloader_seen_' . md5((string) home_url('/')),
            'preloaderDisableOnMobile' => $this->is_option_enabled('eep_preloader_disable_mobile', '0'),
            'preloaderRespectReducedMotion' => $this->is_option_enabled('eep_preloader_respect_motion', '1'),
            'autosaveInterval' => (int) get_option('eep_autosave_interval_seconds', 60),
            'mapRestUrl' => esc_url_raw(rest_url('eep/v1/map-events')),
            'geocodeRestUrl' => esc_url_raw(rest_url('eep/v1/geocode')),
            'addressSuggestRestUrl' => esc_url_raw(rest_url('eep/v1/address-suggestions')),
            'archiveRestUrl' => esc_url_raw(rest_url('eep/v1/archive-events')),
            'quickSearchRestUrl' => esc_url_raw(rest_url('eep/v1/quick-search')),
            'analyticsTrackUrl' => esc_url_raw(rest_url('eep/v1/analytics-track')),
            'userSearchRestUrl' => esc_url_raw(rest_url('eep/v1/user-search')),
            'submitRestUrl' => esc_url_raw(rest_url('eep/v1/event-submit')),
            'rsvpRestUrl' => esc_url_raw(rest_url('eep/v1/rsvp')),
            'saveFiltersRestUrl' => esc_url_raw(rest_url('eep/v1/save-filters')),
            'inboxPollRestUrl' => esc_url_raw(rest_url('eep/v1/inbox-poll')),
            'moderationRestUrl' => esc_url_raw(rest_url('eep/v1/moderate-event')),
            'moderationBulkRestUrl' => esc_url_raw(rest_url('eep/v1/moderate-events-bulk')),
            'inboxPageUrl' => esc_url_raw((string) $this->get_notifications_page_url()),
            'eventsPageUrl' => esc_url_raw((string) $this->get_platform_page_url(
                'eep_page_events_url',
                $this->get_profile_route_slugs('events'),
                $this->get_profile_route_default_url('events')
            )),
            'mapPageUrl' => esc_url_raw((string) $this->get_platform_page_url(
                'eep_page_events_map_url',
                $this->get_profile_route_slugs('map'),
                $this->get_profile_route_default_url('map')
            )),
            'spaEnabled' => method_exists($this, 'is_spa_hybrid_enabled') ? (bool) $this->is_spa_hybrid_enabled() : true,
            'spaFeedbackBadge' => (string) get_option('eep_show_spa_feedback_badge', '0') === '1',
            'spaSelector' => '[data-eep-spa-main="1"]',
            'spaRoutes' => $spa_route_urls,
            'enableModerationAjax' => (string) get_option('eep_enable_moderation_ajax', '1') === '1',
            'restNonce' => wp_create_nonce('wp_rest'),
            'currentUserId' => get_current_user_id(),
            'mapAutoSearch' => (string) get_option('eep_enable_map_auto_search', '1') === '1',
            'mapResultsPerPage' => (int) get_option('eep_map_results_per_page', 120),
            'mapProvider' => (string) get_option('eep_map_provider', 'openstreetmap'),
            'mapStyle' => (string) get_option('eep_map_style', 'osm-standard'),
            'mapFocusRegion' => method_exists($this, 'sanitize_map_focus_region_option')
                ? (string) $this->sanitize_map_focus_region_option((string) get_option('eep_map_focus_region', 'global'))
                : (string) get_option('eep_map_focus_region', 'global'),
            'mapboxAccessToken' => (string) get_option('eep_mapbox_access_token', ''),
            'mapboxStyleId' => method_exists($this, 'sanitize_mapbox_style_id_option')
                ? (string) $this->sanitize_mapbox_style_id_option((string) get_option('eep_mapbox_style_id', 'mapbox/streets-v12'))
                : (string) get_option('eep_mapbox_style_id', 'mapbox/streets-v12'),
            'mapCustomTileUrl' => (string) get_option('eep_map_custom_tile_url', ''),
            'mapCustomTileAttribution' => (string) get_option('eep_map_custom_tile_attribution', ''),
            'mapCustomTileSubdomains' => (string) get_option('eep_map_custom_tile_subdomains', 'a,b,c'),
            'fallbackThumbUrl' => esc_url_raw((string) $this->get_default_image_url('thumbnail')),
            'fallbackHeroUrl' => esc_url_raw((string) $this->get_default_image_url('hero')),
            'enableHeroParallax' => (string) get_option('eep_enable_hero_parallax', '1') === '1',
            'chatbotEnabled' => (string) get_option('eep_chatbot_enabled', '0') === '1',
            'chatbotDebugMode' => (string) get_option('eep_chatbot_debug_mode', '0') === '1',
            'chatbotRestUrl' => esc_url_raw(rest_url('eep/v1/chatbot-query')),
            'chatbotName' => sanitize_text_field((string) get_option('eep_chatbot_name', __('Listing Assistant', 'nexdirectory'))),
            'chatbotWelcomeText' => sanitize_text_field((string) get_option('eep_chatbot_welcome_text', __('Ask me about upcoming listings and I will recommend the best matches.', 'nexdirectory'))),
            'chatbotPosition' => sanitize_key((string) get_option('eep_chatbot_position_desktop', 'bottom-right')),
            'chatbotPositionDesktop' => sanitize_key((string) get_option('eep_chatbot_position_desktop', 'bottom-right')),
            'chatbotPositionMobile' => sanitize_key((string) get_option('eep_chatbot_position_mobile', 'right-edge-center')),
            'chatbotThemeColor' => sanitize_hex_color((string) get_option('eep_chatbot_theme_color', '#FF5E14')) ?: '#FF5E14',
            'chatbotTextColor' => sanitize_hex_color((string) get_option('eep_chatbot_text_color', '#0B1221')) ?: '#0B1221',
            'messages' => [
                'noMapResults' => sprintf(__('No matching %s found.', 'nexdirectory'), $plural_lower),
                'enterAddress' => __('Enter an address first.', 'nexdirectory'),
                'geocodeNoResult' => __('No location found for that address.', 'nexdirectory'),
                'geocodeFailed' => __('Could not locate that address right now.', 'nexdirectory'),
                'recaptchaLoadFailed' => __('reCAPTCHA failed to load.', 'nexdirectory'),
                'recaptchaRequired' => __('Please complete the reCAPTCHA challenge before submitting.', 'nexdirectory'),
                'mapLoadFailed' => sprintf(__('Could not load map %s.', 'nexdirectory'), $plural_lower),
                'mapLoading' => sprintf(__('Loading %s...', 'nexdirectory'), $plural_lower),
                'mapLocateUnsupported' => __('Your browser does not support location services.', 'nexdirectory'),
                'mapLocateDenied' => __('Could not access your location.', 'nexdirectory'),
                'mapLocateInProgress' => __('Finding your location...', 'nexdirectory'),
                'mapNearMeLabel' => sanitize_text_field((string) ($ui_labels['map_near_me_label'] ?? __('Find Near Me', 'nexdirectory'))),
                'mapLoadMore' => __('Load more results', 'nexdirectory'),
                'mapLoadMoreDone' => __('No more results', 'nexdirectory'),
                'mapAriaLabel' => sprintf(__('%s locations map', 'nexdirectory'), $plural_label),
                'addressSuggestFailed' => __('Could not load address suggestions right now.', 'nexdirectory'),
                'archiveLoading' => sprintf(__('Updating %s...', 'nexdirectory'), $plural_lower),
                'archiveLoadFailed' => sprintf(__('Could not update %s list.', 'nexdirectory'), $plural_lower),
                'archiveFiltersSaved' => __('Filters saved on this device.', 'nexdirectory'),
                'archiveNoSavedFilters' => __('No saved filters found on this device.', 'nexdirectory'),
                'archiveNoFiltersToSave' => __('Apply at least one filter before saving.', 'nexdirectory'),
                'archiveSaveFailed' => __('Could not save filters on this device.', 'nexdirectory'),
                'quickSearchPlaceholder' => sprintf(__('Search %1$s, locations, and %2$s...', 'nexdirectory'), $plural_lower, strtolower((string) $owner_plural)),
                'quickSearchNoResults' => __('No matches yet. Try different keywords.', 'nexdirectory'),
                'quickSearchLabelDate' => __('Date', 'nexdirectory'),
                'quickSearchLabelLocation' => __('Location', 'nexdirectory'),
                'viewDetails' => sprintf(__('View %s', 'nexdirectory'), $singular_label),
                'boostBadgeLabel' => sanitize_text_field((string) get_option('eep_boost_featured_badge_text', __('Featured', 'nexdirectory'))),
                'verifiedLabel' => __('Verified', 'nexdirectory'),
                'calendarEvents' => $plural_label,
                'calendarNoEvents' => sprintf(__('No %s found for this day.', 'nexdirectory'), $plural_lower),
                'calendarUntitled' => sprintf(__('Untitled %s', 'nexdirectory'), $singular_lower),
                'userSearchFailed' => __('Could not search users right now.', 'nexdirectory'),
                'pastDateWarning' => __('Start date is in the past. You can still submit if this is intentional.', 'nexdirectory'),
                'pastDateConfirm' => __('The start date is in the past. Are you sure you want to continue?', 'nexdirectory'),
                'pastDateCancelled' => __('Submission cancelled. Adjust the date or submit again to confirm.', 'nexdirectory'),
                'restActionFailed' => __('Request failed. Please try again.', 'nexdirectory'),

```

---

## Segment: Single event rendering pipeline and template params

Source: `includes/trait-eep-frontend.php:22240,22490`

```php
                __('Closes %s', 'nexdirectory'),
                wp_date('M j, Y', (int) $job_closing_ts)
            );
        } elseif ($start_ts && $end_ts && wp_date('Y-m-d', (int) $end_ts) !== wp_date('Y-m-d', (int) $start_ts)) {
            $hero_date_label = (string) $this->format_event_date($post_id);
        } elseif ($start_ts) {
            $hero_date_label = wp_date('M j, Y', (int) $start_ts);
        } else {
            $posted_ts = strtotime((string) get_post_field('post_date', $post_id));
            $hero_date_label = $posted_ts ? wp_date('M j, Y', (int) $posted_ts) : __('Date TBD', 'nexdirectory');
        }
        $hero_location_label = $location_line !== '' ? $location_line : '';
        $job_application_deadline = $is_job_profile ? $job_closing_display : '';
        $local_time_start_iso = ($start && $start_has_time) ? gmdate('c', (int) $start) : '';
        $local_time_end_iso = ($end && $end_has_time) ? gmdate('c', (int) $end) : '';
        $login_url = $this->get_login_signup_url(get_permalink($post_id));
        $signup_url = $this->get_auth_screen_url('signup', get_permalink($post_id));
        $whos_attending_url = '';
        if ($is_events_profile) {
            $whos_attending_base_url = $this->get_platform_page_url(
                'eep_page_whos_attending_url',
                $this->get_profile_route_slugs('attendees', $resolved_profile_key),
                $this->get_profile_route_default_url('attendees', $resolved_profile_key)
            );
            if ($whos_attending_base_url !== '') {
                $whos_attending_url = eep_add_query_arg([
                    'event_id' => $post_id,
                    'status' => 'yes',
                ], $whos_attending_base_url);
            }
        }
        $event_webapp_settings = $is_events_profile ? $this->get_event_webapp_settings($post_id) : [];
        $event_webapp_enabled = $is_events_profile && !empty($event_webapp_settings['enabled']);
        $event_webapp_url = $event_webapp_enabled ? (string) $this->get_event_webapp_page_url($post_id) : '';
        $single_open_event_app_cta = sanitize_text_field((string) ($ui_labels['single_open_event_app_cta'] ?? __('Download App', 'nexdirectory')));
        $primary_action_url = '';
        $primary_action_label = '';
        $primary_action_metric = '';
        if ($is_directory_profile && $directory_appointment_url !== '') {
            $primary_action_url = $directory_appointment_url;
            $primary_action_label = $single_directory_book_cta;
            $primary_action_metric = 'click_website';
        } elseif ($is_directory_profile && $directory_whatsapp_url !== '') {
            $primary_action_url = $directory_whatsapp_url;
            $primary_action_label = $single_directory_whatsapp_cta;
            $primary_action_metric = 'click_whatsapp';
        } elseif ($is_job_profile && $job_apply_url !== '') {
            $primary_action_url = $job_apply_url;
            $primary_action_label = $single_visit_site_cta;
            $primary_action_metric = 'click_website';
        } elseif ($is_job_profile && $job_application_email !== '') {
            $primary_action_url = 'mailto:' . sanitize_email($job_application_email);
            $primary_action_label = $single_apply_email_cta;
            $primary_action_metric = 'click_contact_email';
        } elseif (!$is_events_profile && $external_url !== '') {
            $primary_action_url = $external_url;
            $primary_action_label = $single_visit_site_cta;
            $primary_action_metric = $external_click_metric;
        }
        $hero_layout = sanitize_key((string) get_option('eep_event_hero_layout', 'cinematic'));
        if (!in_array($hero_layout, ['cinematic', 'compact', 'split', 'minimal', 'immersive', 'spotlight'], true)) {
            $hero_layout = 'cinematic';
        }
        $page_layout = sanitize_key((string) get_option('eep_event_page_layout', 'modern'));
        if (in_array($page_layout, ['balanced', 'compact-aside', 'cards-heavy'], true)) {
            $page_layout = 'fifty-fifty';
        }
        if (!in_array($page_layout, ['modern', 'single-column', 'editorial', 'fifty-fifty', 'left-sidebar', 'zig-zag', 'full3', 'zen'], true)) {
            $page_layout = 'modern';
        }
        $event_gallery_type = method_exists($this, 'sanitize_event_gallery_type_option')
            ? $this->sanitize_event_gallery_type_option((string) get_option('eep_event_gallery_type', 'default'))
            : 'default';
        $reporting_enabled = (string) get_option('eep_enable_event_reporting', '1') === '1';
        if ($single_org_mode) {
            $reporting_enabled = false;
        }
        $report_nonce_html = wp_nonce_field('eep_report_' . $post_id, 'eep_report_nonce', true, false);

        if ((string) get_post_status($post_id) === 'publish') {
            $viewer_identity = is_user_logged_in()
                ? 'u:' . (string) get_current_user_id()
                : 'ip:' . sanitize_text_field((string) ($_SERVER['REMOTE_ADDR'] ?? '0.0.0.0'));
            $view_throttle_key = 'eep_view_' . md5((string) $post_id . '|' . $viewer_identity);
            if (!get_transient($view_throttle_key)) {
                set_transient($view_throttle_key, '1', 30 * MINUTE_IN_SECONDS);
                $this->record_analytics_event($post_id, 'listing_view', [
                    'context' => 'single',
                    'user_id' => is_user_logged_in() ? get_current_user_id() : 0,
                ]);
            }
        }

        $event_markup = $this->render_frontend_template('single-event.php', [
            'post_id' => $post_id,
            'event_title' => $event_title,
            'event_subtitle' => $excerpt,
            'content_html' => $content_html,
            'hero_image' => $cover_image,
            'hero_style_attr' => $hero_style_attr,
            'hero_kicker_text' => $hero_kicker_text,
            'hero_layout' => $hero_layout,
            'page_layout' => $page_layout,
            'event_gallery_type' => $event_gallery_type,
            'hero_date_label' => $hero_date_label,
            'show_hero_date_card' => $show_hero_date_card,
            'hero_location_label' => $hero_location_label,
            'local_time_start_iso' => $local_time_start_iso,
            'local_time_end_iso' => $local_time_end_iso,
            'event_timezone_label' => $timezone,
            'summary_cards' => $summary_cards,
            'overview_chips' => $overview_chips,
            'detail_rows' => $detail_rows,
            'show_event_overview' => $overview_has_content,
            'custom_fields_display' => $custom_fields_display,
            'sessions' => $sessions_rows,
            'show_timeline' => $show_timeline,
            'key_speakers' => $key_speakers_rows,
            'show_key_speakers' => $show_key_speakers,
            'gallery_images' => $gallery_display_urls,
            'video_cards' => $video_cards,
            'supporting_documents' => $supporting_document_cards,
            'map_link' => $map_link,
            'map_embed_url' => $map_embed_url,
            'venue_label' => $venue !== '' ? $venue : $event_title,
            'location_full' => $location_full,
            'status_text' => $status_text,
            'job_application_deadline' => $job_application_deadline,
            'countdown_target' => $countdown_target,
            'show_countdown' => $show_countdown,
            'external_url' => esc_url($external_url),
            'external_click_metric' => $external_click_metric,
            'calendar_url' => esc_url($calendar_url),
            'google_url' => esc_url($google_url),
            'viewer_logged_in' => $viewer_logged_in,
            'rsvp_enabled' => $viewer_logged_in,
            'show_rsvp_actions' => $show_rsvp_actions,
            'single_org_mode' => $single_org_mode,
            'show_calendar_actions' => $show_calendar_actions,
            'show_ticket_cta' => $show_ticket_cta,
            'ticket_checkout_url' => esc_url(admin_url('admin-post.php')),
            'ticket_checkout_nonce_html' => wp_nonce_field('eep_ticket_checkout_' . $post_id, 'eep_ticket_checkout_nonce', true, false),
            'ticket_default_gateway' => $ticket_gateway_default,
            'ticket_gateway_stripe_enabled' => $ticket_gateway_stripe_enabled,
            'ticket_gateway_paypal_enabled' => $ticket_gateway_paypal_enabled,
            'ticket_test_free_enabled' => $ticket_test_free_enabled,
            'ticket_button_label' => $ticket_button_label,
            'ticket_price_display' => $ticket_price_display,
            'ticket_is_paid' => $ticket_is_paid,
            'rsvp_count' => count($rsvp),
            'waitlist_count' => count($waitlist),
            'whos_attending_url' => $whos_attending_url,
            'event_webapp_enabled' => $event_webapp_enabled,
            'event_webapp_url' => esc_url($event_webapp_url),
            'rsvp_intent' => $is_joined ? 'leave' : 'join',
            'rsvp_button_label' => $is_joined ? $single_rsvp_cancel : $single_rsvp_join,
            'rsvp_nonce_html' => wp_nonce_field('eep_rsvp_' . $post_id, 'eep_rsvp_nonce', true, false),
            'primary_action_url' => esc_url($primary_action_url),
            'primary_action_label' => $primary_action_label,
            'primary_action_metric' => $primary_action_metric,
            'directory_appointment_url' => esc_url($directory_appointment_url),
            'directory_whatsapp_url' => esc_url($directory_whatsapp_url),
            'directory_contact_person' => $directory_contact_person,
            'login_url' => $login_url,
            'signup_url' => $signup_url,
            'edit_event_url' => $edit_event_url,
            'edit_event_is_duplicate' => $edit_event_is_duplicate,
            'claimable' => $claimable,
            'claim_status' => $claim_status,
            'claim_url' => $claim_url,
            'show_autogenerated_disclaimer' => $show_autogenerated_disclaimer,
            'autogenerated_disclaimer_text' => $autogenerated_disclaimer_text,
            'autogenerated_source_url' => esc_url($autogenerated_source_url),
            'organizer_name' => $organizer_name,
            'organizer_id' => $organizer_id,
            'organizer_email' => $organizer_email,
            'organizer_verified' => $verified,
            'organizer_events_url' => $organizer_events_url,
            'organizer_member_since' => $organizer_member_since,
            'organizer_listing_count' => $organizer_listing_count,
            'show_organizer_card' => $show_organizer_card,
            'owner_event_messages_enabled' => $owner_event_messages_enabled,
            'contact_nonce_html' => wp_nonce_field('eep_contact_holder_' . $post_id, 'eep_contact_nonce', true, false),
            'contact_email' => $contact_email,
            'contact_phone' => $contact_phone,
            'market_accept_offers' => $market_accept_offers,
            'reporting_enabled' => $reporting_enabled,
            'report_nonce_html' => $report_nonce_html,
            'is_events_profile' => $is_events_profile,
            'is_job_profile' => $is_job_profile,
            'is_directory_profile' => $is_directory_profile,
            'is_marketplace_profile' => $is_marketplace_profile,
            'ui_labels' => $ui_labels,
            'single_overview_heading' => $single_overview_heading,
            'single_timeline_heading' => $single_timeline_heading,
            'single_gallery_heading' => $single_gallery_heading,
            'single_videos_heading' => $single_videos_heading,
            'single_cta_heading' => $single_cta_heading,
            'single_cta_copy' => $single_cta_copy,
            'single_visit_site_cta' => $single_visit_site_cta,
            'single_report_cta' => $single_report_cta,
            'single_report_placeholder' => $single_report_placeholder,
            'single_contact_login' => $single_contact_login,
            'single_owner_items_cta' => $single_owner_items_cta,
            'single_login_rsvp' => $single_login_rsvp,
            'single_edit_cta' => $single_edit_cta,
            'single_open_event_app_cta' => $single_open_event_app_cta,
        ]);

            return $top_injected_html . $this->render_notice() . $event_markup . $bottom_injected_html;
        } finally {
            $is_rendering_event_content = false;
        }
    }
}

```

---

## File: assets/css/eep-frontend.css

```css
:root {
  --eep-primary: #FF5E14;
  --eep-primary-rgb: 255, 94, 20;
  --eep-primary-hover: #E04F0D;
  --eep-on-primary: #ffffff;
  --eep-navy: #0B1221;
  --eep-navy-light: #1a1f2e;
  --eep-surface: #ffffff;
  --eep-surface-alt: #f8fafc;
  --eep-border: #e5e7eb;
  --eep-text-main: #1f2937;
  --eep-text-muted: #6b7280;
  --eep-text-inv: #ffffff;
  --eep-radius: 12px;
  --eep-radius-lg: 24px;
  --eep-radius-pill: 999px;
  --eep-space-unit: 16px;
  --eep-space-scale: 1;
  --eep-density-scale: 1;
  --eep-content-max-width: 1220px;
  --eep-event-page-max-width: 1240px;
  --eep-archive-max-width: 1400px;
  --eep-field-pad-y: 10px;
  --eep-field-pad-x: 12px;
  --eep-btn-min-height: 40px;
  --eep-box-bg: #ffffff;
  --eep-box-bg-alt: #f8fafc;
  --eep-box-border-color: #e5e7eb;
  --eep-box-border-width: 1px;
  --eep-shadow-sm: 0 6px 16px rgba(0, 0, 0, 0.04);
  --eep-shadow: 0 12px 30px rgba(11, 18, 33, 0.08);
  --eep-shadow-lg: 0 22px 45px rgba(11, 18, 33, 0.14);
  --eep-btn-bg: var(--eep-primary);
  --eep-btn-bg-hover: var(--eep-primary-hover);
  --eep-btn-color: var(--eep-on-primary, #ffffff);
  --eep-btn-border: 1px solid transparent;
  --eep-btn-letter-spacing: .06em;
  --eep-btn-transform: uppercase;
  --eep-btn-font-weight: 700;
  --eep-btn-radius: var(--eep-radius-pill);
  --eep-input-bg: #ffffff;
  --eep-input-border: #e5e7eb;
  --eep-input-border-focus: var(--eep-primary);
  --eep-input-border-width: 1px;
  --eep-input-radius: var(--eep-radius);
  --eep-font: 'Inter', system-ui, -apple-system, sans-serif;
  --eep-font-display: 'Oswald', 'Inter', sans-serif;
  --eep-trans: all 0.2s ease-in-out;
  
  /* Runtime Base Assignments */
  --eep-base-font-size: 18px;
  --eep-h2-size: 1.75rem;
  --eep-h3-size: 1.35rem;
  --eep-font-weight-body: 400;
  --eep-font-weight-heading: 700;
}

/* --- Base Reset & Typography --- */
:is(.eep-layout, .eep-submit-wrap, .eep-auth-grid, .eep-my-events, .eep-theme-shell, .eep-account-shell) {
  font-family: var(--eep-font);
  font-size: var(--eep-base-font-size);
  font-weight: var(--eep-font-weight-body);
  color: var(--eep-text-main);
  line-height: 1.5;
  box-sizing: border-box;
  max-width: var(--eep-content-max-width, 1220px);
  margin: 0 auto calc(24px * var(--eep-density-scale, 1));
  border-radius: var(--eep-radius);
}

:is(.eep-layout, .eep-submit-wrap, .eep-auth-grid, .eep-my-events, .eep-theme-shell, .eep-account-shell) * { 
  box-sizing: border-box; 
}

:is(.eep-layout, .eep-submit-wrap, .eep-auth-grid, .eep-my-events, .eep-theme-shell, .eep-account-shell) :is(h1, h2, h3, h4, h5) {
  font-family: var(--eep-font-display);
  font-weight: var(--eep-font-weight-heading);
  color: var(--eep-navy);
  margin: 0 0 16px 0;
  line-height: 1.25;
  letter-spacing: 0.01em;
}

:is(.eep-layout, .eep-submit-wrap, .eep-auth-grid, .eep-my-events, .eep-theme-shell, .eep-account-shell) h2 { font-size: var(--eep-h2-size); }
:is(.eep-layout, .eep-submit-wrap, .eep-auth-grid, .eep-my-events, .eep-theme-shell, .eep-account-shell) h3 { font-size: var(--eep-h3-size); }

:is(.eep-layout, .eep-submit-wrap, .eep-auth-grid, .eep-my-events, .eep-theme-shell, .eep-account-shell) a {
  color: var(--eep-primary);
  text-decoration: none;
  font-weight: 600;
  transition: var(--eep-trans);
}

:is(.eep-layout, .eep-submit-wrap, .eep-auth-grid, .eep-my-events, .eep-theme-shell, .eep-account-shell) a:hover {
  color: var(--eep-navy);
}

/* Account tabs AJAX shell spacing */
.eep-account-shell {
  padding: 10px !important;
}

/* --- Utilities & Structural --- */
.eep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: calc(16px * var(--eep-density-scale, 1)); }
.eep-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: calc(24px * var(--eep-density-scale, 1)); }
.eep-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: calc(24px * var(--eep-density-scale, 1)); }

.eep-hide-theme-page-title :is(.entry-title, .page-title, .wp-block-post-title, .elementor-page-title, .entry-header .entry-title, .site-main .entry-title, .site-main .page-title) {
  display: none !important;
}

.eep-is-hidden { display: none !important; }

/* Shared card surfaces driven by runtime design tokens */
:is(.eep-event-section, .eep-form-section, .eep-submit-nav, .eep-map-item-card, .eep-archive-event-card, .eep-archive-sidebar, .eep-map-sidebar, .eep-sidebar, .eep-auth-shell, .eep-account-shell, .eep-account-card, .eep-user-event-card) {
  background: var(--eep-box-bg, #ffffff);
  border-color: var(--eep-box-border-color, #e5e7eb);
  border-width: var(--eep-box-border-width, 1px);
  box-shadow: var(--eep-shadow-sm);
}

/* --- Toasts --- */
#eep-toast-root {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 2147483647 !important;
  display: grid;
  gap: 10px;
  justify-items: end;
  pointer-events: none;
}

#eep-toast-root .eep-toast {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.28s ease, transform 0.28s ease;
  pointer-events: auto;
  width: min(420px, calc(100vw - max(28px, env(safe-area-inset-left) + env(safe-area-inset-right) + 28px)));
  margin: 0;
  border-radius: 14px;
  padding: 12px 13px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(145deg, #0f172a, #1f2937);
  color: #fff;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.34);
  font-family: var(--eep-font);
  line-height: 1.4;
}

#eep-toast-root .eep-toast:not(.eep-toast-hide) {
  opacity: 1;
  transform: translateY(0);
}

#eep-toast-root .eep-toast.eep-toast-hide {
  opacity: 0;
  transform: translateY(10px);
}

#eep-toast-root .eep-toast.eep-toast-success {
  background: linear-gradient(145deg, #14532d, #166534);
}

#eep-toast-root .eep-toast.eep-toast-error {
  background: linear-gradient(145deg, #7f1d1d, #991b1b);
}

#eep-toast-root .eep-toast.eep-toast-warning {
  background: linear-gradient(145deg, #92400e, #b45309);
}

#eep-toast-root .eep-toast.eep-toast-info {
  background: linear-gradient(145deg, #1e3a8a, #1d4ed8);
}

#eep-toast-root .eep-toast-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 3px;
}

#eep-toast-root .eep-toast-title {
  font-family: var(--eep-font-display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#eep-toast-root .eep-toast-subtitle {
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  opacity: 0.87;
  margin-bottom: 6px;
}

#eep-toast-root .eep-toast-message {
  font-size: 0.94rem;
  font-weight: 500;
  line-height: 1.45;
  color: #f8fafc;
}

#eep-toast-root .eep-toast-close {
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  width: 24px;
  height: 24px;
  padding: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

#eep-toast-root .eep-toast-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

#eep-toast-root .eep-toast.eep-toast-imported-wide {
  position: fixed !important;
  left: max(5vw, 14px) !important;
  right: max(5vw, 14px) !important;
  bottom: max(14px, env(safe-area-inset-bottom)) !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 auto !important;
}

.eep-notice.eep-toasted {
  display: none !important;
}

@media (max-width: 640px) {
  #eep-toast-root {
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    justify-items: stretch;
  }

  #eep-toast-root .eep-toast {
    width: 100%;
    max-width: 100%;
    padding: 12px;
    border-radius: 13px;
  }

  #eep-toast-root .eep-toast-title {
    font-size: 0.78rem;
  }

  #eep-toast-root .eep-toast-message {
    font-size: 0.92rem;
    line-height: 1.42;
  }
}

/* --- Buttons --- */
:is(.eep-btn, .eep-form button[type='submit'], .eep-filter-form button[type='submit']) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--eep-btn-bg, var(--eep-primary));
  color: var(--eep-btn-color, #fff) !important;
  font-weight: var(--eep-btn-font-weight, 700);
  padding: 9px 14px;
  border-radius: var(--eep-btn-radius, var(--eep-radius-pill));
  min-height: var(--eep-btn-min-height, 40px);
  text-decoration: none;
  text-transform: var(--eep-btn-transform, uppercase);
  letter-spacing: var(--eep-btn-letter-spacing, 0.06em);
  font-size: 0.78rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  border: var(--eep-btn-border, 1px solid transparent);
  cursor: pointer;
  box-shadow: var(--eep-shadow-sm);
}

:is(.eep-btn, .eep-form button[type='submit']):hover {
  background: var(--eep-btn-bg-hover, var(--eep-primary-hover));
  transform: translateY(-1px);
  box-shadow: var(--eep-shadow);
}

:is(.eep-btn, .eep-form button[type="submit"]):focus-visible {
  outline: 3px solid rgba(var(--eep-primary-rgb), 0.25);
  outline-offset: 1px;
}

.eep-btn-secondary { background: #fff; color: var(--eep-navy) !important; border: 1px solid var(--eep-border); }
.eep-btn-secondary:hover { background: var(--eep-surface-alt); border-color: var(--eep-text-muted); color: var(--eep-navy) !important; }
.eep-btn-danger { background: #ef4444; color: #fff !important; }
.eep-btn-danger:hover { background: #dc2626; }
:is(.eep-btn:disabled, .eep-btn-disabled) { opacity: 0.6; cursor: not-allowed; filter: grayscale(1); }
.eep-force-accent-action,
.eep-force-accent-action:hover,
.eep-force-accent-action:focus,
.eep-force-accent-action:active,
.eep-force-accent-action:visited {
  background: var(--eep-primary) !important;
  border-color: var(--eep-primary) !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}
.eep-force-accent-action:hover {
  background: var(--eep-primary-hover) !important;
  border-color: var(--eep-primary-hover) !important;
}

.eep-btn-sm {
  min-height: 34px !important;
  padding: 8px 12px !important;
  font-size: 0.74rem !important;
}

.eep-btn.eep-loading { position: relative; opacity: 0.9; }
.eep-btn.eep-loading::after {
  content: ''; width: 10px; height: 10px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; display: inline-block; margin-left: 8px; animation: eep-spin 0.75s linear infinite;
}

/* --- Forms (Consolidated) --- */
:is(.eep-form, .eep-filter-form, .eep-user-event-tools, .eep-map-sidebar, .eep-archive-filter-card) :is(input:not([type="radio"]):not([type="checkbox"]):not([type="submit"]):not([type="file"]), textarea, select) {
  width: 100%;
  padding: var(--eep-field-pad-y, 10px) var(--eep-field-pad-x, 12px);
  border-style: solid;
  border-color: var(--eep-input-border, var(--eep-border));
  border-width: var(--eep-input-border-width, 1px);
  border-radius: var(--eep-input-radius, var(--eep-radius));
  font-size: 0.875rem;
  color: var(--eep-navy);
  background: var(--eep-input-bg, #fff);
  transition: var(--eep-trans);
  margin-bottom: calc(14px * var(--eep-density-scale, 1));
}

:is(.eep-form, .eep-filter-form, .eep-user-event-tools, .eep-map-sidebar, .eep-archive-filter-card) :is(input:focus, textarea:focus, select:focus) {
  outline: none;
  border-color: var(--eep-input-border-focus, var(--eep-primary));
  box-shadow: 0 0 0 3px rgba(var(--eep-primary-rgb), 0.1);
  background: var(--eep-input-bg, #fff);
}

:is(.eep-form, .eep-filter-form, .eep-user-event-tools, .eep-archive-filter-card) label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--eep-navy);
}

.eep-help-text { font-size: 0.82rem; color: #64748b; margin: -2px 0 8px; display: block; }
.eep-validation-error { color: #b91c1c; font-size: 0.84rem; margin: -8px 0 10px; }
.eep-validation-warning { color: #b45309; font-size: 0.84rem; }
:is(.eep-form, .eep-filter-form, .eep-user-event-tools, .eep-map-sidebar, .eep-archive-filter-card) :is(input:not([type="radio"]):not([type="checkbox"]):not([type="submit"]):not([type="file"]), textarea, select).eep-field-invalid {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14) !important;
  background: #fff7f7 !important;
}
.eep-field-invalid-group {
  border: 1px solid rgba(220, 38, 38, 0.45) !important;
  border-radius: 12px;
  padding: 8px;
  background: rgba(254, 242, 242, 0.55);
}

/* Radio/Checkboxes */
.eep-radio-group { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.eep-radio-group input[type="radio"] { display: none; }
.eep-radio-group label {
  padding: 10px 20px; border: 1px solid var(--eep-border); border-radius: var(--eep-radius-pill);
  cursor: pointer; margin: 0; font-weight: 500; transition: var(--eep-trans); background: #fff; color: var(--eep-text-muted);
}
.eep-radio-group input[type="radio"]:checked + label {
  background: var(--eep-primary); color: #fff; border-color: var(--eep-primary); box-shadow: 0 4px 6px rgba(var(--eep-primary-rgb), 0.2);
}
.eep-checkbox-row { display: flex; align-items: center; gap: 10px; margin: 10px 0 14px; }
.eep-checkbox-row input[type='checkbox'] { width: 18px; height: 18px; margin: 0; accent-color: var(--eep-primary); }
.eep-checkbox-row label { margin: 0; font-size: 0.92rem; font-weight: 500; }

/* File Upload */
.eep-dropzone {
  border: 2px dashed #f2c3ae; background: #fffaf7; border-radius: 12px;
  padding: 16px; text-align: center; cursor: pointer; transition: var(--eep-trans);
}
.eep-dropzone:hover { border-color: var(--eep-primary); background: #fff; }
.eep-upload-preview { width: 100%; max-height: 260px; object-fit: cover; border-radius: 10px; }

/* --- Banners / Heroes --- */
.eep-page-banner {
  position: relative; overflow: hidden; border-radius: 24px; padding: clamp(20px, 3.5vw, 40px);
  margin: 0 auto calc(24px * var(--eep-density-scale, 1)); max-width: var(--eep-content-max-width, 1220px);
  background: radial-gradient(circle at top right, rgba(var(--eep-primary-rgb), 0.35), transparent 40%), linear-gradient(135deg, var(--eep-navy), var(--eep-navy-light));
  color: #fff; box-shadow: var(--eep-shadow-lg);
}
.eep-page-banner h1 { font-size: clamp(2rem, 4.4vw, 3rem) !important; color: #fff !important; text-transform: uppercase; margin: 0 0 8px; line-height: 1.2 !important; text-shadow: 0 3px 16px rgba(11, 18, 33, 0.32); }
.eep-page-banner p { max-width: 64ch; margin: 0 auto; color: rgba(255, 255, 255, 0.9); font-size: 1rem; line-height: 1.55; }
.eep-page-kicker { display: block; width: 100%; text-align: center; margin: 0 auto 8px; font-size: 0.875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: color-mix(in srgb, var(--eep-primary) 68%, #ffffff); }
.eep-page-banner.eep-page-banner-has-image {
  background-image:
    linear-gradient(140deg, rgba(11, 18, 33, 0.72), rgba(26, 31, 46, 0.64)),
    var(--eep-page-hero-image);
  background-size: cover;
  background-position: var(--eep-page-hero-bg-pos, center center);
  background-repeat: no-repeat;
}

/* --- Single Event Page --- */
.eep-event-page { max-width: var(--eep-event-page-max-width, 1240px); margin: 0 auto calc(56px * var(--eep-density-scale, 1)); letter-spacing: normal; }
.eep-event-hero {
  border-radius: 0 0 34px 34px; min-height: clamp(340px, 52vh, 520px);
  background: linear-gradient(135deg, #122235, #1f3f63);
  background-size: cover !important; background-position: var(--eep-hero-bg-pos, center center) !important;
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; text-align: center;
  box-shadow: var(--eep-shadow-lg); transform: translateZ(0);
}
.eep-event-hero::before {
  content: ''; position: absolute; inset: 0 !important;
  background: linear-gradient(180deg, rgba(11, 18, 33, 0.35), rgba(11, 18, 33, 0.72));
}
.eep-event-hero-overlay {
  position: relative; z-index: 2; width: 100%; max-width: 880px; padding: clamp(28px, 5vw, 64px) 18px; color: #fff;
}
.eep-event-hero-title { font-size: clamp(2.2rem, 5vw, 4.2rem); margin-bottom: 12px; color: #fff !important; line-height: 0.95; text-wrap: balance; font-family: var(--eep-font-display); text-transform: uppercase; }
.eep-event-hero-subtitle { max-width: 620px; margin: 0 auto 18px; color: rgba(255, 255, 255, 0.94); font-size: clamp(0.95rem, 1.5vw, 1.15rem); line-height: 1.6; }

.eep-event-hero-info-cards {
  display: grid; grid-template-columns: minmax(0, 172px) minmax(0, 1fr) !important; gap: 8px !important; width: min(100%, 560px) !important; margin: 0 auto 10px;
}
.eep-hero-info-card {
  border-radius: 14px !important; border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(15, 23, 42, 0.45); color: #fff; padding: 8px 11px !important; text-align: left;
}
.eep-hero-info-card span { display: block; margin-bottom: 2px !important; font-size: 0.57rem !important; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; color: rgba(255, 255, 255, 0.74); }
.eep-hero-info-card strong { display: block; font-family: var(--eep-font); font-size: 0.9rem !important; line-height: 1.24 !important; font-weight: 700 !important; color: #fff; word-break: break-word; }

.eep-event-hero-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.eep-event-chip {
  display: inline-flex !important; align-items: center !important; justify-content: center !important;
  min-width: 84px !important; height: 24px !important; padding: 0 10px !important;
  border-radius: 999px !important; border: 1px solid rgba(255, 255, 255, 0.26); background: rgba(0, 0, 0, 0.36);
  color: #fff; font-size: 0.58rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; font-family: var(--eep-font-display); white-space: nowrap;
}

/* Single Event Layout & Sidebar */
.eep-event-layout-modern {
  display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: clamp(16px, 2.5vw, 30px) !important; max-width: 1080px; margin: 20px auto 0 !important; padding: 0 clamp(16px, 2.2vw, 30px) !important; align-items: start !important; overflow: visible !important;
}
.eep-event-main, .eep-event-aside { display: grid; gap: calc(14px * var(--eep-density-scale, 1)); }
.eep-event-aside { position: -webkit-sticky !important; position: sticky !important; top: 30px !important; height: max-content !important; z-index: 99 !important; }
.eep-event-section { border: var(--eep-box-border-width, 1px) solid var(--eep-box-border-color, #e4ebf3); border-radius: 20px !important; background: var(--eep-box-bg, #fff); padding: clamp(18px, 2.2vw, 24px) !important; box-shadow: var(--eep-shadow-sm); }

/* Event Sub-Components */
:is(.eep-event-overview, .eep-event-section) h3 {
  position: relative; padding-left: 16px; margin-bottom: 10px; text-transform: uppercase; font-family: var(--eep-font-display); font-size: clamp(1.35rem, 1.9vw, 1.75rem); letter-spacing: 0.01em;
}
:is(.eep-event-overview, .eep-event-section) h3::before {
  content: ''; position: absolute; left: 0; top: 7px; width: 5px; height: 1.25em; border-radius: 999px; background: var(--eep-primary);
}
.eep-event-body { margin-top: 14px !important; font-size: 0.95rem; line-height: 1.65; color: #334155; }
.eep-event-body p { margin: 0 0 14px !important; line-height: 1.62 !important; }

/* Fact Grid */
.eep-fact-grid-modern { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px !important; }
.eep-fact-card { border-radius: 10px !important; padding: 8px 10px !important; background: #f9fafc; border: 1px solid #eceff3; align-content: start; }
.eep-fact-label { display: block; font-size: 0.58rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--eep-text-muted); margin-bottom: 2px !important; }
.eep-fact-value { color: var(--eep-navy); font-family: var(--eep-font); font-size: 0.88rem !important; font-weight: 700; line-height: 1.22 !important; word-break: break-word; }

/* CTA Card */
.eep-event-cta-card {
  background: linear-gradient(145deg, var(--eep-primary), var(--eep-primary-hover));
  border: 0; box-shadow: 0 24px 48px color-mix(in srgb, var(--eep-primary) 40%, transparent); color: var(--eep-on-primary, #fff) !important;
}
.eep-event-cta-card h3, .eep-event-cta-card .eep-cta-text, .eep-event-cta-card .eep-cta-status { color: inherit !important; }
.eep-event-cta-card h3::before { background: rgba(255, 255, 255, 0.82); }
.eep-event-cta-card .eep-cta-status { border-top: 1px solid color-mix(in srgb, var(--eep-on-primary, #ffffff) 35%, transparent); display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; padding-top: 8px; }
.eep-event-cta-card .eep-cta-status span { font-size: 0.58rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.eep-event-cta-card .eep-cta-status strong { font-size: 0.62rem; padding: 3px 8px; border-radius: 999px; background: color-mix(in srgb, var(--eep-on-primary, #ffffff) 20%, transparent); }
.eep-event-cta-card .eep-actions { display: grid; gap: 5px !important; }
.eep-event-cta-card .eep-btn { background: var(--eep-navy); color: #fff !important; min-height: 30px !important; padding: 5px 9px !important; font-size: 0.56rem !important; letter-spacing: 0.05em !important; border-radius: 8px; }
.eep-event-cta-card .eep-btn-secondary { background: rgba(255, 255, 255, 0.2); border-color: color-mix(in srgb, var(--eep-on-primary, #ffffff) 42%, transparent); color: var(--eep-on-primary, #ffffff) !important; }

/* --- Archive & Map Layouts --- */
.eep-archive-layout, .eep-map-layout { max-width: var(--eep-archive-max-width, 1400px); margin: 0 auto; padding: 0 20px calc(80px * var(--eep-density-scale, 1)); display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: calc(30px * var(--eep-density-scale, 1)); align-items: start; overflow: visible !important; }
:is(.eep-archive-sidebar, .eep-map-sidebar, .eep-sidebar) {
  position: -webkit-sticky !important; position: sticky !important; top: 40px !important; height: max-content !important; z-index: 99 !important;
  border: var(--eep-box-border-width, 1px) solid var(--eep-box-border-color, #e2e8f0); border-radius: 16px; background: var(--eep-box-bg, #fff); box-shadow: var(--eep-shadow-sm); padding: calc(24px * var(--eep-density-scale, 1));
}
:is(.eep-archive-sidebar, .eep-map-sidebar) h3 { margin: 0 0 16px; padding-bottom: 12px; font-family: var(--eep-font); font-size: 1.25rem; border-bottom: 2px solid #f1f5f9; }

/* Map List Cards */
#eep-map-list { display: grid; gap: 10px; margin-top: 10px; }
.eep-map-item-card {
  display: flex; flex-direction: column; border: var(--eep-box-border-width, 1px) solid var(--eep-box-border-color, #e4ebf3) !important; border-radius: 16px !important;
  background: var(--eep-box-bg, #fff); padding: 0 !important; box-shadow: var(--eep-shadow-sm); cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; overflow: hidden;
}
.eep-map-item-card:hover { border-color: rgba(var(--eep-primary-rgb), .45); box-shadow: 0 10px 26px rgba(15, 23, 42, .12); transform: translateY(-1px); }
.eep-map-item-thumb { width: 100% !important; height: 180px !important; border-radius: 0 !important; background: #eff4fa; overflow: hidden; }
.eep-map-item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.eep-map-item-body { padding: 20px !important; display: flex; flex-direction: column; gap: 8px; }
.eep-map-item-title { margin: 0; font-family: var(--eep-font-display); font-size: 1.125rem; font-weight: 700; color: #1e293b; line-height: 1.3; }
.eep-map-item-date, .eep-map-item-location { margin: 0; color: #64748b; font-size: 0.85rem; line-height: 1.35; }
.eep-map-item-view {
  margin-top: auto; padding: 12px; border-radius: 10px; text-align: center; border: 1px solid #dbe3ee; background: #f8fafc;
  color: #1e293b !important; font-size: 0.95rem; font-weight: 600; text-decoration: none; display: block;
}
.eep-map-item-view:hover { border-color: var(--eep-primary); background: var(--eep-primary); color: #fff !important; }

/* --- Account / Submit Wrap --- */
.eep-submit-wrap { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: calc(16px * var(--eep-density-scale, 1)); align-items: start; max-width: var(--eep-content-max-width, 1220px); margin: 0 auto calc(24px * var(--eep-density-scale, 1)); padding: 0 14px; overflow: visible !important; }
.eep-submit-nav {
  position: -webkit-sticky !important; position: sticky !important; top: 40px !important; z-index: 99 !important;
  background: var(--eep-box-bg, #fff); border: var(--eep-box-border-width, 1px) solid var(--eep-box-border-color, #e9edf3); border-radius: 16px; padding: calc(10px * var(--eep-density-scale, 1)); box-shadow: var(--eep-shadow-sm); max-height: calc(100vh - 24px) !important; overflow: auto !important;
}
.eep-submit-nav-link { display: block; padding: calc(10px * var(--eep-density-scale, 1)) calc(12px * var(--eep-density-scale, 1)); border-radius: 10px; margin-bottom: calc(6px * var(--eep-density-scale, 1)); font-size: 0.76rem; font-weight: 700; color: #334155; text-transform: uppercase; letter-spacing: 0.03em; text-decoration: none; }
.eep-submit-nav-link.is-active, .eep-submit-nav-link:hover { background: #fff3ec; color: var(--eep-primary); }
.eep-form-section { background: var(--eep-box-bg, #fff); border: var(--eep-box-border-width, 1px) solid var(--eep-box-border-color, #e4ebf3); border-radius: 18px; padding: clamp(14px, 2vw, 20px); margin-bottom: calc(14px * var(--eep-density-scale, 1)); box-shadow: var(--eep-shadow-sm); }

/* --- Badges & Pills --- */
.eep-badge { background: var(--eep-surface-alt); color: var(--eep-navy); padding: 4px 8px; border-radius: 4px; font-size: 0.8em; font-weight: 700; text-transform: uppercase; }
.eep-badge-primary { background: var(--eep-primary); color: #fff; }
.eep-status-pill, .eep-pill {
  display: inline-flex; align-items: center; justify-content: center; min-height: 24px; border-radius: 999px;
  padding: 4px 10px; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  border: 1px solid #dbe4ef; background: #f8fafc; color: #334155;
}
.eep-status-pending { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.eep-status-publish, .eep-pill-success { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.eep-status-draft, .eep-pill-muted { background: #e2e8f0; color: #475569; border-color: #cbd5e1; }
.eep-live-toggle-form {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.eep-live-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 34px;
  min-height: 32px;
  border-radius: 999px;
  border: 1px solid #dbe4ef;
  background: #f8fafc;
  cursor: pointer;
  user-select: none;
}
.eep-live-toggle input[type='checkbox'] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.eep-live-toggle-track {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 10px;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background-color 0.2s ease;
}
.eep-live-toggle-track::after {
  content: '';
  position: absolute;
  left: 1px;
  top: 1px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ffffff;
  transition: transform 0.2s ease;
}
.eep-live-toggle-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #64748b;
  transition: color 0.2s ease;
}
.eep-live-toggle input[type='checkbox']:checked + .eep-live-toggle-track {
  background: rgba(var(--eep-primary-rgb), 0.72);
}
.eep-live-toggle input[type='checkbox']:checked + .eep-live-toggle-track::after {
  transform: translateX(8px);
}
.eep-live-toggle input[type='checkbox']:checked ~ .eep-live-toggle-label-live {
  color: #166534;
}
.eep-live-toggle input[type='checkbox']:not(:checked) ~ .eep-live-toggle-label-draft {
  color: #334155;
}
.eep-live-toggle-meta {
  font-size: 0.7rem;
  color: #b45309;
  font-weight: 600;
}

/* Boost Badges */
.eep-boost-badge, .eep-verified-badge { position: absolute; top: 10px; z-index: 5; display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 5px 10px; font-size: 11px; font-weight: 700; text-transform: uppercase; color: #fff; }
.eep-boost-badge { left: 10px; background: rgba(var(--eep-primary-rgb), 0.95); }
.eep-verified-badge { right: 10px; background: rgba(37, 99, 235, 0.92); }
.eep-card-boosted { box-shadow: 0 14px 36px rgba(var(--eep-primary-rgb), 0.16), 0 6px 18px rgba(15, 23, 42, 0.08) !important; border-color: rgba(var(--eep-primary-rgb), 0.38) !important; }

/* --- Responsive Media Queries (Consolidated) --- */
@media (max-width: 1160px) {
  .eep-event-page .eep-event-layout-modern { grid-template-columns: 1fr !important; }
  .eep-event-aside { position: static !important; }
  .eep-submit-wrap { grid-template-columns: 1fr; }
  .eep-submit-nav { position: static !important; max-height: none !important; display: flex; flex-wrap: wrap; }
  .eep-submit-nav-link { margin: 0 6px 6px 0; display: inline-flex; }
  .eep-map-layout { grid-template-columns: 1fr; }
  .eep-map-results-col { position: static !important; }
}

@media (max-width: 900px) {
  :is(.eep-layout, .eep-submit-wrap, .eep-auth-grid, .eep-my-events, .eep-account-shell) { padding-inline: 10px; }
  .eep-page-banner { border-radius: 18px; margin-bottom: 18px; padding: 18px 14px; }
  .eep-event-page .eep-event-hero { border-radius: 0 0 24px 24px; min-height: 320px !important; margin-top: 0 !important; }
  .eep-event-page .eep-event-hero-title { font-size: clamp(1.9rem, 9vw, 2.8rem) !important; }
  .eep-event-page .eep-event-hero-info-cards { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; width: 100% !important; gap: 7px !important; }
  .eep-event-page .eep-event-layout-modern { padding: 18px 12px 0 !important; gap: 14px !important; }
  .eep-event-page .eep-fact-grid-modern { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .eep-event-page .eep-detail-row { padding: 7px 0 !important; }
  .eep-archive-layout, .eep-map-layout { grid-template-columns: 1fr; padding: 0 16px 56px; gap: 18px; }
  .eep-archive-sidebar, .eep-map-sidebar { position: static !important; background: #fff !important; }
  .eep-map-layout .eep-map { min-height: 320px !important; }
  .eep-map-list { grid-template-columns: 1fr !important; }
}

@media (max-width: 640px) {
  .eep-event-page .eep-event-hero-info-cards { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .eep-hero-info-card { padding: 7px 9px !important; }
  .eep-hero-info-card strong { font-size: 0.84rem !important; }
  .eep-event-page .eep-fact-grid-modern { grid-template-columns: 1fr !important; }
  .eep-my-events-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .eep-auth-shell { padding: 10px; border-radius: 14px; }
  .eep-submit-form .eep-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* --- Layout Overrides (Forced Layout Options) --- */
.eep-event-page.eep-page-layout-modern .eep-event-layout-modern { grid-template-columns: minmax(0, 1fr) minmax(320px, 360px) !important; max-width: 1220px !important; }
.eep-event-page.eep-page-layout-balanced .eep-event-layout-modern { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; max-width: 1260px !important; }
.eep-event-page.eep-page-layout-single-column .eep-event-layout-modern { grid-template-columns: 1fr !important; max-width: 940px !important; }
.eep-event-page.eep-page-layout-cards-heavy .eep-event-layout-modern { grid-template-columns: 1fr !important; max-width: 1260px !important; }
.eep-event-page.eep-page-layout-cards-heavy :is(.eep-event-main, .eep-event-aside) { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; position: static !important; }
.eep-event-page.eep-page-layout-editorial .eep-event-layout-modern { grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.55fr) !important; max-width: 1280px !important; }
.eep-event-page.eep-page-layout-editorial .eep-event-main .eep-event-section { border: 0 !important; border-radius: 0 !important; box-shadow: none !important; border-bottom: 1px solid #e2e8f0 !important; padding-inline: 0 !important; }

/* Overflow Trap Fix (Ensures Sticky Sidebars Work) */
html, body, .site, #page, #content, #primary, #main, .site-content, .elementor-page-wrap, .elementor-section-wrap {
  overflow: visible !important;
  overflow-x: clip !important;
}


/* ==========================================================
   Restored Interactive Components & Modals
========================================================== */

/* --- Sticky Top Auth Links --- */
.eep-page-auth-links {
  position: sticky;
  top: 10px;
  z-index: 92;
  margin: 8px auto 10px;
  max-width: 1220px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding-inline: 12px;
  pointer-events: none;
}
.eep-page-auth-link {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: rgba(255, 255, 255, 0.94);
  color: #0f172a;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.eep-page-auth-link:hover {
  border-color: var(--eep-primary);
  color: var(--eep-primary);
  transform: translateY(-1px);
}
.eep-page-auth-link.eep-page-auth-link-primary {
  background: var(--eep-primary);
  border-color: var(--eep-primary);
  color: #ffffff;
}
.eep-page-auth-link.eep-page-auth-link-primary:hover {
  background: var(--eep-primary-hover);
}

/* --- Contact Modals --- */
.eep-contact-modal[hidden] {
  display: none !important;
}
.eep-contact-modal {
  position: fixed;
  inset: 0;
  z-index: 1202;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.eep-contact-modal.is-open {
  opacity: 1;
}
.eep-contact-modal-dialog {
  width: min(680px, calc(100vw - 30px));
  max-height: calc(100vh - 34px);
  overflow: auto;
  border-radius: 18px;
  border: 1px solid #dbe3ee;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 32px 70px rgba(15, 23, 42, 0.26);
  padding: 20px;
  position: relative;
  transform: translateY(18px) scale(0.98);
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
}
.eep-contact-modal.is-open .eep-contact-modal-dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.eep-contact-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid #dbe3ee;
  background: #fff;
  color: #1e293b;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.eep-contact-modal-close:hover {
  border-color: var(--eep-primary);
  color: var(--eep-primary);
}

/* --- Lightboxes (Global, Doc, Video) --- */
.eep-lightbox[hidden] {
  display: none !important;
}
.eep-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(9, 15, 24, 0.92);
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* Attendees modal sizing + layering hardening */
.eep-attendees-modal.eep-lightbox {
  z-index: 2147483600 !important;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 2vw, 28px);
}
.eep-attendees-modal .eep-attendees-modal-dialog {
  position: relative;
  width: min(1040px, 90vw);
  max-height: min(90vh, 920px);
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 22px 46px rgba(2, 6, 23, 0.34);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.eep-attendees-modal .eep-attendees-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 20;
  width: 36px;
  height: 36px;
  border: 1px solid #dbe3ee;
  border-radius: 999px;
  background: #ffffff;
  color: #0f172a;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.eep-attendees-modal .eep-attendees-modal-close:hover {
  border-color: var(--eep-primary);
  color: var(--eep-primary);
}
.eep-attendees-modal .eep-attendees-panel {
  overflow: auto;
  max-height: inherit;
  padding: 20px;
}
.eep-attendees-modal .eep-attendees-panel-head {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #ffffff;
  padding-right: 46px;
}
@media (max-width: 900px) {
  .eep-attendees-modal.eep-lightbox {
    padding: 10px;
  }
  .eep-attendees-modal .eep-attendees-modal-dialog {
    width: 96vw;
    max-height: 92vh;
    border-radius: 14px;
  }
  .eep-attendees-modal .eep-attendees-panel {
    padding: 14px;
  }
}
body.eep-lightbox-open {
  overflow: hidden;
}
.eep-lightbox img {
  max-width: min(1180px, 92vw);
  max-height: 86vh;
  border-radius: 10px;
  object-fit: contain;
}

/* --- Gallery Base Overrides --- */
.eep-gallery-item {
  border: 0;
  background: transparent;
  border-radius: 10px;
  overflow: hidden;
  cursor: zoom-in;
  padding: 0;
}
.eep-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* --- Alpine.js specific fallbacks (Optional but safe) --- */
[x-cloak] { display: none !important; }

/* ==========================================================
   Archive / "What's New" Page Layout & Cards
========================================================== */

/* --- Breadcrumbs --- */
.eep-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  max-width: var(--eep-content-max-width, 1220px);
  margin: 0 auto calc(12px * var(--eep-density-scale, 1));
  padding: 0 14px;
  color: #64748b;
  font-size: 0.85rem;
}
.eep-breadcrumbs a {
  color: #475569;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}
.eep-breadcrumbs a:hover {
  color: var(--eep-primary);
}
.eep-breadcrumbs .is-current {
  color: #0f172a;
  font-weight: 600;
}
.eep-breadcrumbs .eep-breadcrumb-sep {
  color: #94a3b8;
  margin: 0 4px;
}

/* --- Archive Hero Overrides --- */
.eep-page-banner.eep-archive-hero {
  min-height: 290px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 14px;
}
.eep-page-banner.eep-archive-hero .eep-page-kicker {
  margin: 0 auto;
}

/* --- Archive Layout --- */
.eep-layout-no-sidebar {
  grid-template-columns: 1fr !important;
}
.eep-archive-content {
  width: 100%;
}

/* --- Archive Event Cards (The Grid Items) --- */
.eep-archive-event-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0 !important; /* Resets generic card padding so image goes edge-to-edge */
  overflow: hidden;
}
.eep-archive-event-card .eep-card-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #e9eef5;
  overflow: hidden;
  border-bottom: 1px solid var(--eep-border);
}
.eep-archive-event-card .eep-card-cover-link {
  display: block;
  width: 100%;
  height: 100%;
}
.eep-archive-event-card .eep-card-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.eep-archive-event-card:hover .eep-card-cover {
  transform: scale(1.05);
}

/* --- Archive Card Content --- */
.eep-archive-card-content {
  padding: calc(20px * var(--eep-density-scale, 1));
  display: flex;
  flex-direction: column;
  flex: 1;
}
.eep-archive-card-content .eep-card-title {
  font-size: 1.25rem;
  margin-bottom: 12px;
  line-height: 1.35;
}
.eep-archive-card-content .eep-card-title a {
  color: inherit;
  text-decoration: none;
}
.eep-archive-card-content .eep-card-title a:hover {
  color: var(--eep-primary);
}
.eep-card-meta-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--eep-text-muted);
  line-height: 1.4;
}
.eep-card-meta-row svg {
  flex-shrink: 0;
  margin-top: 3px;
  color: var(--eep-primary);
}

/* Forces the button to the bottom of the card */
.eep-archive-event-card-footer {
  margin-top: auto; 
  padding-top: 20px;
}
.eep-archive-view-btn {
  width: 100%;
}

/* --- Pagination --- */
.eep-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 40px;
  width: 100%;
}
.eep-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--eep-border);
  color: var(--eep-navy);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.eep-pagination .page-numbers:hover {
  border-color: var(--eep-primary);
  color: var(--eep-primary);
  background: var(--eep-surface-alt);
  transform: translateY(-2px);
}
.eep-pagination .page-numbers.current {
  background: var(--eep-primary);
  border-color: var(--eep-primary);
  color: #fff;
  pointer-events: none;
}

/* ==========================================================
   Frontend Sticky Navigation Bar
========================================================== */

.eep-front-sticky-nav {
  width: 100%;
  z-index: 96;
  padding: 0 10px;
  transition: transform 0.24s ease, opacity 0.24s ease;
}

.eep-front-sticky-nav.eep-front-sticky-nav-sticky,
.eep-front-sticky-nav.eep-front-sticky-nav-smart {
  position: sticky;
  top: 0;
}

/* Smart hide on scroll down */
.eep-front-sticky-nav.eep-front-sticky-nav-smart.is-scroll-hidden {
  transform: translateY(calc(-100% - 10px));
  opacity: 0.98;
}

/* Glassmorphism Inner Container */
.eep-front-sticky-nav-inner {
  position: relative;
  max-width: 1240px;
  margin: 0 auto;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 14px;
  background: color-mix(in srgb, #ffffff 92%, transparent);
  border: 1px solid color-mix(in srgb, var(--eep-primary, #FF5E14) 12%, #dbe3ef);
  border-radius: 0 0 14px 14px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(8px);
}

/* Brand / Logo */
.eep-front-sticky-nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #0f172a;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.eep-front-sticky-nav-brand img {
  display: block;
  max-height: 36px;
  width: auto;
  object-fit: contain;
}

/* Main Nav Layout */
.eep-front-sticky-nav-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex: 1 1 auto;
  min-width: 0;
}
.eep-front-sticky-nav-groups {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  overflow: visible;
}
.eep-front-sticky-nav-group-item {
  position: relative;
}

/* Dropdown Groups */
.eep-front-sticky-nav-group {
  position: relative;
}
.eep-front-sticky-nav-group > summary {
  list-style: none;
}
.eep-front-sticky-nav-group > summary::-webkit-details-marker {
  display: none;
}

.eep-front-sticky-nav-group-trigger,
.eep-front-sticky-nav-direct {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, #0f172a 10%, transparent);
  color: #0f172a;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.8rem;
  line-height: 1.1;
  white-space: nowrap;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.eep-front-sticky-nav-group-trigger::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-left: 8px;
  margin-top: -2px;
  transition: transform .2s ease;
}
.eep-front-sticky-nav-group[open] .eep-front-sticky-nav-group-trigger::after {
  transform: rotate(-135deg);
  margin-top: 3px;
}

.eep-front-sticky-nav-group-trigger:hover,
.eep-front-sticky-nav-direct:hover,
.eep-front-sticky-nav-group.is-current .eep-front-sticky-nav-group-trigger {
  border-color: color-mix(in srgb, var(--eep-primary, #FF5E14) 45%, transparent);
  color: var(--eep-primary, #FF5E14);
  background: color-mix(in srgb, var(--eep-primary, #FF5E14) 8%, transparent);
}

/* Dropdown Panel */
.eep-front-sticky-nav-group-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  display: grid;
  gap: 3px;
  padding: 8px;
  border: 1px solid #dbe1ea;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity .16s ease, transform .16s ease;
  z-index: 100;
}
.eep-front-sticky-nav-group[open] .eep-front-sticky-nav-group-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Dropdown Links */
.eep-front-sticky-nav-menu-link {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  color: #0f172a;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.25;
}
.eep-front-sticky-nav-menu-link:hover {
  border-color: color-mix(in srgb, var(--eep-primary, #FF5E14) 35%, transparent);
  background: #f8fafc;
  color: var(--eep-primary, #FF5E14);
}
/* CTA Button */
.eep-front-sticky-nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.eep-front-sticky-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.16);
  color: #0f172a;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.eep-front-sticky-nav-btn.is-primary {
  border-color: var(--eep-primary, #FF5E14);
  background: var(--eep-primary, #FF5E14);
  color: #fff;
}

/* Mobile Toggle (Hamburger) */
.eep-front-sticky-nav-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border: 1px solid #d9e1ec;
  border-radius: 10px;
  background: #fff;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex-direction: column;
  padding: 0;
  cursor: pointer;
}
.eep-front-sticky-nav-toggle-bar {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: #0f172a;
}

/* --- Mobile Responsive Overrides --- */
@media (max-width: 900px) {
  .eep-front-sticky-nav {
    padding: 0 8px;
  }
  .eep-front-sticky-nav-inner {
    min-height: 52px;
    border-radius: 0 0 12px 12px;
    padding: 8px 10px;
    gap: 10px;
  }
  .eep-front-sticky-nav-brand {
    font-size: 0.75rem;
    letter-spacing: 0.03em;
  }
  .eep-front-sticky-nav-brand img {
    max-height: 30px;
  }
  .eep-front-sticky-nav-toggle {
    display: inline-flex;
    margin-left: auto;
  }
  
  /* Hidden by default on mobile, toggled via JS .is-open class */
  .eep-front-sticky-nav-main {
    position: absolute;
    left: 8px;
    right: 8px;
    top: calc(100% + 6px);
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16);
  }
  .eep-front-sticky-nav.is-open .eep-front-sticky-nav-main {
    display: flex;
  }
  .eep-front-sticky-nav-groups {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .eep-front-sticky-nav-group-item,
  .eep-front-sticky-nav-btn {
    width: 100%;
  }
  .eep-front-sticky-nav-group-trigger,
  .eep-front-sticky-nav-direct {
    justify-content: flex-start;
    width: 100%;
    border-radius: 10px;
  }
  .eep-front-sticky-nav-group-panel {
    position: static;
    min-width: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    padding: 5px 0 0 10px;
    gap: 4px;
  }
  .eep-front-sticky-nav-group:not([open]) .eep-front-sticky-nav-group-panel {
    display: none;
  }
  .eep-front-sticky-nav-cta {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
}

/* ==========================================================
   Frontend Sticky Navigation Bar (Unified Events Style)
========================================================== */
.eep-front-sticky-nav {
  width: 100%;
  padding: 0;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
  z-index: 96;
  transition: transform 0.24s ease, opacity 0.24s ease;
}
.eep-front-sticky-nav.eep-front-sticky-nav-sticky,
.eep-front-sticky-nav.eep-front-sticky-nav-smart {
  position: sticky;
  top: 0;
}
.eep-front-sticky-nav.eep-front-sticky-nav-smart.is-scroll-hidden {
  transform: translateY(-100%);
  opacity: 0.98;
}
.eep-front-sticky-nav-inner {
  position: relative;
  width: 100%;
  max-width: none;
  margin: 0;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 10%;
  background: #ffffff;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
}
.eep-front-sticky-nav-brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-width: 0;
  color: var(--eep-primary);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  text-transform: none;
  line-height: 1;
}
.eep-front-sticky-nav-brand img {
  display: block;
  max-height: 34px;
  width: auto;
  object-fit: contain;
}
.eep-front-sticky-nav-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.eep-front-sticky-nav-groups {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 34px;
  flex-wrap: wrap;
}
.eep-front-sticky-nav-group-item {
  position: relative;
}
.eep-front-sticky-nav-direct,
.eep-front-sticky-nav-menu-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #374151;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: none;
}
.eep-front-sticky-nav-direct:hover,
.eep-front-sticky-nav-menu-link:hover {
  color: #111827;
}
.eep-front-sticky-nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.eep-front-sticky-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.eep-front-sticky-nav-btn:hover {
  border-color: #9ca3af;
  color: #111827;
}
.eep-front-sticky-nav-btn.is-primary {
  border-color: var(--eep-primary);
  background: var(--eep-primary);
  color: #ffffff;
}
.eep-front-sticky-nav-btn.is-primary:hover {
  border-color: var(--eep-primary-hover);
  background: var(--eep-primary-hover);
  color: #ffffff;
}
.eep-front-sticky-nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex-direction: column;
  padding: 0;
  cursor: pointer;
}
.eep-front-sticky-nav-toggle-bar {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: #374151;
}

@media (max-width: 900px) {
  .eep-front-sticky-nav-inner {
    min-height: 60px;
    gap: 12px;
    padding: 0 10%;
  }
  .eep-front-sticky-nav-brand {
    font-size: 1.1rem;
  }
  .eep-front-sticky-nav-brand img {
    max-height: 30px;
  }
  .eep-front-sticky-nav-toggle {
    display: inline-flex;
    margin-left: auto;
  }
  .eep-front-sticky-nav-main {
    position: absolute;
    left: 10%;
    right: 10%;
    top: calc(100% + 8px);
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
    z-index: 100;
  }
  .eep-front-sticky-nav.is-open .eep-front-sticky-nav-main {
    display: flex;
  }
  .eep-front-sticky-nav-groups {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .eep-front-sticky-nav-group-item,
  .eep-front-sticky-nav-btn {
    width: 100%;
  }
  .eep-front-sticky-nav-direct,
  .eep-front-sticky-nav-menu-link {
    justify-content: flex-start;
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.95rem;
  }
  .eep-front-sticky-nav-direct:hover,
  .eep-front-sticky-nav-menu-link:hover {
    background: #f9fafb;
  }
  .eep-front-sticky-nav-cta {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
}

/* Sticky nav typography lock (global consistency across all templates/pages) */
.eep-front-sticky-nav-brand,
.eep-platform-nav .eep-platform-nav-brand-text {
  font-size: 1.1rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.01em !important;
}
.eep-front-sticky-nav-group-trigger,
.eep-front-sticky-nav-direct,
.eep-front-sticky-nav-menu-link,
.eep-platform-nav .eep-platform-nav-trigger,
.eep-platform-nav .eep-platform-nav-link {
  font-size: 14px !important;
  line-height: 1.2 !important;
}
.eep-front-sticky-nav-group-trigger,
.eep-front-sticky-nav-direct,
.eep-platform-nav .eep-platform-nav-trigger {
  font-weight: 500 !important;
}
.eep-front-sticky-nav-menu-link,
.eep-platform-nav .eep-platform-nav-link {
  font-weight: 500 !important;
}
.eep-front-sticky-nav-btn,
.eep-platform-nav .eep-platform-nav-cta-link {
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
}
.eep-platform-nav .eep-platform-nav-mobile-trigger {
  font-size: 12px !important;
  font-weight: 700 !important;
  letter-spacing: 0.05em !important;
}
.eep-platform-nav .eep-platform-nav-mobile-link {
  font-size: 14px !important;
  font-weight: 500 !important;
  line-height: 1.2 !important;
}
.eep-platform-nav .eep-platform-nav-mobile-cta-link {
  font-size: 14px !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
}
@media (max-width: 900px) {
  .eep-front-sticky-nav-brand {
    font-size: 1rem !important;
  }
  .eep-front-sticky-nav-group-trigger,
  .eep-front-sticky-nav-direct,
  .eep-front-sticky-nav-menu-link {
    font-size: 14px !important;
    font-weight: 500 !important;
  }
  .eep-front-sticky-nav-btn {
    font-size: 13px !important;
    font-weight: 600 !important;
  }
}

.header{display:none;}

/* Hide sticky/platform nav while media lightbox is open */
body.eep-media-lightbox-open .eep-front-sticky-nav,
body.eep-media-lightbox-open .eep-platform-nav {
  transform: translate3d(0, calc(-100% - 14px), 0) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

```

---

## Segment: Frontend hero parallax + fallback hero image logic

Source: `assets/js/eep-frontend.js:5860,5945`

```js
      'link[id^="eep-frontend"], style[id^="eep-frontend"], link[id^="eep-tailwind"], style[id^="eep-tailwind"], link[id^="eep-fonts"], link[href*="assets/css/eep-frontend.css"], link[href*="assets/css/eep-tailwind.css"]'
    );
    legacyNodes.forEach(function (node) {
      if (node && node.parentNode) {
        node.parentNode.removeChild(node);
      }
    });
  }

  function initEventHeroParallax() {
    if (!getConfig('enableHeroParallax', true)) {
      return;
    }
    const heroes = document.querySelectorAll('.eep-event-hero-has-image');
    const archiveBanners = document.querySelectorAll('.eep-page-banner-has-image[data-eep-hero-parallax="1"]');
    if (!heroes.length && !archiveBanners.length) {
      return;
    }
    const mobileMedia = window.matchMedia ? window.matchMedia('(max-width: 900px)') : null;
    if (mobileMedia && mobileMedia.matches) {
      heroes.forEach(function (hero) {
        hero.style.setProperty('--eep-hero-bg-pos', 'center center');
      });
      archiveBanners.forEach(function (banner) {
        banner.style.setProperty('--eep-page-hero-bg-pos', 'center center');
      });
      return;
    }

    const updateParallax = function () {
      heroes.forEach(function (hero) {
        const rect = hero.getBoundingClientRect();
        const centerDelta = rect.top + rect.height / 2 - window.innerHeight / 2;
        const shift = Math.round(centerDelta * -0.08);
        hero.style.setProperty('--eep-hero-bg-pos', 'center calc(50% + ' + shift + 'px)');
      });
      archiveBanners.forEach(function (banner) {
        const rect = banner.getBoundingClientRect();
        const centerDelta = rect.top + rect.height / 2 - window.innerHeight / 2;
        const shift = Math.round(centerDelta * -0.06);
        banner.style.setProperty('--eep-page-hero-bg-pos', 'center calc(50% + ' + shift + 'px)');
      });
    };

    updateParallax();
    window.addEventListener('scroll', updateParallax, { passive: true });
    window.addEventListener('resize', updateParallax);
  }

  function initPageBannerHeroBackground() {
    const heroUrl = String(getConfig('fallbackHeroUrl', '') || '').trim();
    if (!heroUrl) {
      return;
    }
    const banners = document.querySelectorAll('.eep-page-banner');
    if (!banners.length) {
      return;
    }
    const escapedUrl = heroUrl.replace(/["\\]/g, '\\$&');
    banners.forEach(function (banner) {
      if (!(banner instanceof HTMLElement)) {
        return;
      }
      banner.classList.add('eep-page-banner-has-image');
      banner.style.setProperty('--eep-page-hero-image', 'url("' + escapedUrl + '")');
      if (!banner.hasAttribute('data-eep-hero-parallax')) {
        banner.setAttribute('data-eep-hero-parallax', '1');
      }
    });
  }

  function initFrontendStickyNav() {
    const nav = document.querySelector('.eep-front-sticky-nav[data-eep-sticky-nav="1"]');
    if (!nav) {
      if (stickyNavSmartState && stickyNavSmartState.onScroll && stickyNavSmartState.onResize) {
        window.removeEventListener('scroll', stickyNavSmartState.onScroll);
        window.removeEventListener('resize', stickyNavSmartState.onResize);
      }
      stickyNavSmartState = null;
      return;
    }

    const behavior = String(nav.getAttribute('data-eep-sticky-behavior') || 'sticky').trim();
    const toggleButton = nav.querySelector('[data-eep-sticky-nav-toggle="1"]');
    const menu = nav.querySelector('.eep-front-sticky-nav-main');
    const navLinks = Array.from(nav.querySelectorAll('.eep-front-sticky-nav-menu-link[data-eep-nav-link="1"]'));

```

---

## Quick Option Index

```text
Hero layouts: cinematic, compact, split, minimal, immersive, spotlight
Page layouts: modern, single-column, editorial, fifty-fifty, left-sidebar, zig-zag, full3, zen
Gallery types: default, carousel, wall
(legacy file still present: templates/frontend/layout/bento.php, but removed from active settings options)
```

