<?php
/**
 * ITSWEBER CMS – Page Builder Admin Form: High Score (Arcade Theme)
 *
 * @var array $data    Decoded JSON content
 * @var array $section DB row
 */
$sectionId = (int) $section['id'];
$items = $data['items'] ?? [];
?>

<div style="background:linear-gradient(135deg,#0f0f1a 0%,#1a1a2e 100%);border-radius:8px;padding:0.625rem 1rem;margin-bottom:1.25rem;display:flex;align-items:center;gap:0.5rem;">
    <span style="color:#ffd700;font-size:0.75rem;font-weight:700;text-transform:uppercase;letter-spacing:0.08em;">★ Arcade Theme – High Scores</span>
</div>

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

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

<?php admin_field('text', 'footer_text', 'Footer-Text', $data['footer_text'] ?? '', [
    'placeholder' => 'z.B. Dein Name koennte hier stehen',
    'hint' => 'Wird unter der Tabelle angezeigt',
]) ?>

<h5 style="margin:1.5rem 0 1rem;font-size:.85rem;text-transform:uppercase;letter-spacing:.06em;color:#ffd700;">
    Eintraege (bis zu 10)
</h5>

<div style="display:grid;grid-template-columns:80px 1fr 1fr 120px;gap:0.25rem 0.75rem;align-items:center;margin-bottom:0.5rem;padding:0 0.25rem;">
    <span style="font-size:0.75rem;font-weight:600;color:var(--gray-500,#6b7280);">Rang</span>
    <span style="font-size:0.75rem;font-weight:600;color:var(--gray-500,#6b7280);">Spieler (3 Zeichen)</span>
    <span style="font-size:0.75rem;font-weight:600;color:var(--gray-500,#6b7280);">Kategorie</span>
    <span style="font-size:0.75rem;font-weight:600;color:var(--gray-500,#6b7280);">Score</span>
</div>

<?php for ($i = 0; $i < 10; $i++):
    $item = $items[$i] ?? ['player_code' => '', 'category' => '', 'score' => ''];
    $num = $i + 1;
?>
<div style="display:grid;grid-template-columns:80px 1fr 1fr 120px;gap:0.25rem 0.75rem;align-items:center;margin-bottom:0.25rem;padding:0.25rem;">
    <span style="font-weight:700;font-size:0.875rem;color:<?= $num <= 3 ? '#ffd700' : 'var(--gray-400,#9ca3af)' ?>;">#<?= $num ?></span>
    <input type="text" name="player_code[]" class="form-control" value="<?= e($item['player_code']) ?>" placeholder="BNY" maxlength="3" style="text-transform:uppercase;font-family:monospace;">
    <input type="text" name="player_category[]" class="form-control" value="<?= e($item['category']) ?>" placeholder="z.B. Beitraege">
    <input type="text" name="player_score[]" class="form-control" value="<?= e($item['score']) ?>" placeholder="12.480" style="font-family:monospace;">
</div>
<?php endfor; ?>

<?php admin_field('select', 'color_scheme', __('admin.section.color_scheme'), $data['color_scheme'] ?? '', [
    'options' => ['' => 'Standard', 'alt' => 'Alternativ', 'primary' => 'Primaer', 'dark' => 'Dunkel', 'none' => 'Transparent'],
]) ?>
