<?php
/**
 * ITSWEBER CMS – Page Builder Admin Form: Video / YouTube Section
 * Loaded via AJAX into section cards.
 * Migrated from plugins/video-section.
 *
 * @author  Benny Weber
 * @copyright ITSWEBER, www.itsweber.de
 *
 * @var array $data    Decoded JSON content
 * @var array $section DB row (id, section_type, instance_label, ...)
 */
?>

<?php admin_field('text', 'title', __('admin.section.heading'), $data['title'] ?? '', [
    'placeholder' => __('admin.section.video_ph_title'),
    'hint'        => __('admin.section.video_title_hint'),
]) ?>

<?php admin_field('text', 'subtitle', __('admin.section.subtitle'), $data['subtitle'] ?? '', [
    'placeholder' => __('admin.section.video_ph_subtitle'),
    'hint'        => __('admin.section.video_subtitle_hint'),
]) ?>

<?php admin_field('select', 'video_type', __('admin.section.video_type_label'), $data['video_type'] ?? 'youtube', [
    'options' => [
        'youtube' => __('admin.section.video_opt_youtube'),
        'local'   => __('admin.section.video_opt_local'),
    ],
    'hint' => __('admin.section.video_type_hint'),
]) ?>

<?php admin_field('text', 'video_url', __('admin.section.video_url_label'), $data['video_url'] ?? '', [
    'placeholder' => __('admin.section.video_ph_url'),
    'hint'        => __('admin.section.video_url_hint'),
]) ?>

<?php admin_media_picker('poster_image', $data['poster_image'] ?? '', __('admin.section.video_poster_label'), 'image', __('admin.section.video_ph_poster')) ?>

<?php admin_field('checkbox', 'autoplay', __('admin.section.video_autoplay_label'), (int)($data['autoplay'] ?? 0), [
    'checkbox_label' => __('admin.section.video_autoplay_label'),
    'hint'           => __('admin.section.video_autoplay_hint'),
]) ?>

<?php admin_field('text', 'cta_text', __('admin.section.cta_text'), $data['cta_text'] ?? '', [
    'placeholder' => __('admin.section.video_ph_cta'),
    'hint'        => __('admin.section.video_cta_hint'),
]) ?>

<?php admin_field('text', 'cta_url', __('admin.section.cta_url'), $data['cta_url'] ?? '', [
    'placeholder' => 'https://example.com',
    'hint'        => __('admin.section.video_cta_url_hint'),
]) ?>

<?php admin_section_separator() ?>

<?php admin_field_grid_open(2) ?>
    <?php admin_color_scheme_field($data['color_scheme'] ?? '', true) ?>
    <?php render_section_text_color_field($data) ?>
<?php admin_field_grid_close() ?>
