<?php /** @var array $artist */ ?>
<div class="p-8 max-w-3xl">
  <a href="<?= url('/admin/artists') ?>" class="text-xs text-bone/50 hover:text-bone">← <?= e(t('admin.artists.back')) ?></a>
  <h1 class="mt-2 text-3xl font-display"><?= e($artist['display_name'] ?? '') ?></h1>

  <form method="POST" action="<?= url('/admin/artists/' . e($artist['id'])) ?>" enctype="multipart/form-data" class="mt-8 space-y-5">
    <?= csrf_field() ?>
    <div class="grid grid-cols-2 gap-4">
      <div><label class="label"><?= e(t('admin.artists.display_name')) ?></label><input name="display_name" value="<?= e($artist['display_name'] ?? '') ?>" required class="input"></div>
      <div><label class="label"><?= e(t('admin.artists.instagram')) ?></label><input name="instagram_handle" value="<?= e($artist['instagram_handle'] ?? '') ?>" placeholder="lorenzodiazink" class="input"></div>
      <div class="col-span-2"><label class="label"><?= e(t('admin.artists.specialties')) ?></label><input name="specialties" value="<?= e(implode(', ', (array)($artist['specialties'] ?? []))) ?>" class="input"></div>
    </div>
    <div><label class="label"><?= e(t('admin.artists.bio')) ?></label><textarea name="bio" rows="5" class="input"><?= e($artist['bio'] ?? '') ?></textarea></div>
    <div><label class="label"><?= e(t('admin.artists.avatar')) ?></label><input type="file" name="avatar" accept="image/*" class="text-sm text-bone/70"></div>
    <?php if (!empty($artist['avatar_url'])): ?>
      <img src="<?= e(url($artist['avatar_url'])) ?>" class="w-32 h-32 rounded-md object-cover">
    <?php endif; ?>
    <label class="flex items-center gap-2"><input type="checkbox" name="is_active" value="1" <?= !empty($artist['is_active']) ? 'checked' : '' ?>> <?= e(t('admin.artists.active')) ?></label>
    <div class="flex items-center justify-between pt-4 border-t border-white/10">
      <button class="btn-gold"><?= e(t('common.save')) ?></button>
      <a href="<?= url('/admin/artists/' . e($artist['id']) . '/schedule') ?>" class="text-gold text-sm hover:underline"><?= e(t('admin.artists.edit_schedule')) ?> →</a>
    </div>
  </form>

  <form method="POST" action="<?= url('/admin/artists/' . e($artist['id']) . '/delete') ?>" onsubmit="return confirm('<?= e(t('admin.artists.delete_confirm')) ?>')" class="mt-10 pt-6 border-t border-red-500/30">
    <?= csrf_field() ?>
    <button class="text-red-400 text-sm hover:underline"><?= e(t('admin.artists.delete')) ?></button>
  </form>
</div>
