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

$sectionId = (int) $section['id'];
?>

<!-- ── Content ── -->
<h5 class="admin-section-heading"><?= __('admin.section.content') ?></h5>

<?php admin_field('text', 'eyebrow', __('admin.section.eyebrow'), $data['eyebrow'] ?? '', [
    'placeholder' => __('admin.section.hero_ph_eyebrow'),
    'hint'        => __('admin.section.eyebrow_hint'),
]) ?>

<?php admin_field('text', 'title', __('admin.section.hero_headline'), $data['title'] ?? '', [
    'placeholder' => __('admin.section.hero_ph_headline'),
]) ?>

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

<?php admin_field_grid_open(2) ?>
    <?php admin_field('text', 'cta_text', __('admin.section.cta_text'), $data['cta_text'] ?? '', [
        'placeholder' => __('admin.section.hero_ph_cta1'), 'wrap_style' => 'margin:0;',
    ]) ?>
    <?php admin_field('text', 'cta_url', __('admin.section.cta_url'), $data['cta_url'] ?? '', [
        'placeholder' => __('admin.section.hero_ph_cta1_url'), 'wrap_style' => 'margin:0;',
    ]) ?>
    <?php admin_field('text', 'cta2_text', __('admin.section.cta_text_2'), $data['cta2_text'] ?? '', [
        'placeholder' => __('admin.section.hero_ph_cta2'), 'hint' => __('admin.section.optional'), 'wrap_style' => 'margin:0;',
    ]) ?>
    <?php admin_field('text', 'cta2_url', __('admin.section.cta_url_2'), $data['cta2_url'] ?? '', [
        'placeholder' => __('admin.section.hero_ph_cta2_url'), 'wrap_style' => 'margin:0;',
    ]) ?>
    <?php admin_field('color', 'cta_bg', __('admin.section.cta_bg_color'), $data['cta_bg'] ?? '', [
        'hint' => __('admin.section.optional'), 'wrap_style' => 'margin:0;',
    ]) ?>
    <?php admin_field('color', 'cta_color', __('admin.section.cta_text_color'), $data['cta_color'] ?? '', [
        'hint' => __('admin.section.optional'), 'wrap_style' => 'margin:0;',
    ]) ?>
    <?php admin_field('color', 'cta2_bg', __('admin.section.cta2_bg_color'), $data['cta2_bg'] ?? '', [
        'hint' => __('admin.section.optional'), 'wrap_style' => 'margin:0;',
    ]) ?>
    <?php admin_field('color', 'cta2_color', __('admin.section.cta2_text_color'), $data['cta2_color'] ?? '', [
        'hint' => __('admin.section.optional'), 'wrap_style' => 'margin:0;',
    ]) ?>
<?php admin_field_grid_close() ?>

<!-- ── Media ── -->
<?php admin_section_separator(__('admin.section.media'), '') ?>

<?php admin_media_picker('image', $data['image'] ?? '', __('admin.section.background_image'), 'image', __('admin.section.ph_image_path')) ?>

<?php admin_media_picker('video_url', $data['video_url'] ?? '', __('admin.section.video_background'), 'video', __('admin.section.ph_video_path')) ?>

<?php admin_field_grid_open(2) ?>
    <?php admin_field('select', 'video_bg_mode', __('admin.section.video_playback'), $data['video_bg_mode'] ?? '', [
        'options' => ['' => __('admin.section.hero_opt_autoplay'), 'autoplay' => __('admin.section.hero_opt_autoplay'), 'manual' => __('admin.section.hero_opt_manual')],
        'wrap_style' => 'margin:0;',
    ]) ?>
    <?php admin_field('select', 'video_bg_fit', __('admin.section.video_scale'), $data['video_bg_fit'] ?? '', [
        'options' => ['' => __('admin.section.hero_opt_cover'), 'cover' => __('admin.section.hero_opt_cover'), 'contain' => __('admin.section.hero_opt_contain')],
        'wrap_style' => 'margin:0;',
    ]) ?>
    <?php admin_field('select', 'video_display', __('admin.section.video_display'), $data['video_display'] ?? '', [
        'options' => ['' => __('admin.section.hero_opt_bg'), 'background' => __('admin.section.hero_opt_bg'), 'inline' => __('admin.section.hero_opt_box')],
        'hint' => __('admin.section.hero_hint_video_display'), 'wrap_style' => 'margin:0;',
    ]) ?>
    <?php admin_field('select', 'video_inline_size', __('admin.section.video_box_size'), $data['video_inline_size'] ?? '', [
        'options' => ['' => __('admin.section.hero_opt_box_md'), 'sm' => __('admin.section.hero_opt_box_sm'), 'md' => __('admin.section.hero_opt_box_md'), 'lg' => __('admin.section.hero_opt_box_lg'), 'full' => __('admin.section.hero_opt_box_full')],
        'hint' => __('admin.section.hero_hint_box_size'), 'wrap_style' => 'margin:0;',
    ]) ?>
<?php admin_field_grid_close() ?>

<?php admin_media_picker('portrait_image', $data['portrait_image'] ?? '', __('admin.section.portrait_image'), 'image', __('admin.section.ph_portrait_path')) ?>

<?php admin_field('text', 'portrait_alt', __('admin.section.portrait_alt'), $data['portrait_alt'] ?? '', [
    'placeholder' => __('admin.section.hero_hint_portrait_alt'),
]) ?>

<!-- ── Presentation ── -->
<?php admin_section_separator() ?>

<?php admin_field_grid_open(2) ?>
    <?php admin_field('select', 'layout_mode', __('admin.section.layout'), $data['layout_mode'] ?? '', [
        'options' => ['' => __('admin.section.layout_center'), 'full' => __('admin.section.layout_full'), 'boxed' => __('admin.section.layout_boxed'), 'split' => __('admin.section.layout_split')],
        'hint' => __('admin.section.hero_hint_layout'), 'wrap_style' => 'margin:0;',
    ]) ?>
    <?php admin_field('select', 'text_align', __('admin.section.text_align'), $data['text_align'] ?? '', [
        'options' => ['' => __('admin.section.align_center'), 'left' => __('admin.section.align_left'), 'right' => __('admin.section.align_right')],
        'wrap_style' => 'margin:0;',
    ]) ?>
    <?php admin_field('select', 'text_color', __('admin.section.text_color'), $data['text_color'] ?? '', [
        'options' => ['' => __('admin.section.scheme_default'), 'auto' => __('admin.section.color_auto'), 'white' => __('admin.section.color_white'), 'black' => __('admin.section.color_black'), 'red' => __('admin.section.hero_color_red'), 'green' => __('admin.section.hero_color_green'), 'blue' => __('admin.section.hero_color_blue')],
        'wrap_style' => 'margin:0;',
    ]) ?>
    <?php admin_field('select', 'overlay_strength', __('admin.section.overlay'), $data['overlay_strength'] ?? '', [
        'options' => ['' => __('admin.section.overlay_none'), 'light' => __('admin.section.overlay_light'), 'medium' => __('admin.section.overlay_medium'), 'heavy' => __('admin.section.overlay_heavy')],
        'hint' => __('admin.section.hero_hint_overlay'), 'wrap_style' => 'margin:0;',
    ]) ?>
    <?php admin_field('select', 'heading_size', __('admin.section.heading_size'), $data['heading_size'] ?? '', [
        'options' => ['' => __('admin.section.size_default'), 'sm' => __('admin.section.size_sm'), 'md' => __('admin.section.size_md'), 'lg' => __('admin.section.size_lg'), 'xl' => __('admin.section.size_xl')],
        'wrap_style' => 'margin:0;',
    ]) ?>
    <?php admin_field('select', 'heading_weight', __('admin.section.heading_weight'), $data['heading_weight'] ?? '', [
        'options' => ['' => __('admin.section.scheme_default'), 'normal' => __('admin.section.hero_weight_normal'), 'medium' => __('admin.section.hero_weight_medium'), 'bold' => __('admin.section.hero_weight_bold'), 'black' => __('admin.section.hero_weight_black')],
        'wrap_style' => 'margin:0;',
    ]) ?>
    <?php admin_field('select', 'body_size', __('admin.section.body_size'), $data['body_size'] ?? '', [
        'options' => ['' => __('admin.section.size_default'), 'sm' => __('admin.section.size_sm'), 'md' => __('admin.section.size_md'), 'lg' => __('admin.section.size_lg')],
        'wrap_style' => 'margin:0;',
    ]) ?>
    <?php admin_field('select', 'hero_height', __('admin.section.hero_height'), $data['hero_height'] ?? '', [
        'options' => ['' => __('admin.section.size_default'), 'tall' => __('admin.section.hero_height_tall')],
        'wrap_style' => 'margin:0;',
    ]) ?>
    <?php admin_field('select', 'portrait_shape', __('admin.section.portrait_shape'), $data['portrait_shape'] ?? '', [
        'options' => ['' => __('admin.section.size_default'), 'circle' => __('admin.section.hero_opt_circle'), 'rounded' => __('admin.section.hero_opt_rounded'), 'square' => __('admin.section.hero_opt_square')],
        'wrap_style' => 'margin:0;',
    ]) ?>
    <?php admin_field('select', 'portrait_style', __('admin.section.portrait_shadow'), $data['portrait_style'] ?? '', [
        'options' => ['' => __('admin.section.size_default'), 'elevated' => __('admin.section.hero_portrait_elevated'), 'flat' => __('admin.section.hero_portrait_flat')],
        'wrap_style' => 'margin:0;',
    ]) ?>
    <?php admin_field('select', 'cta_layout', __('admin.section.cta_layout'), $data['cta_layout'] ?? '', [
        'options' => ['' => __('admin.section.cta_side_by_side'), 'stacked' => __('admin.section.cta_stacked')],
        'wrap_style' => 'margin:0;',
    ]) ?>
<?php admin_field_grid_close() ?>
