<?php $pageTitle = 'Identitas Kampus'; ?>
<?php require BASE_PATH . '/app/Views/admin/layouts/header.php'; ?>

<div class="page-head">
  <h2>Identitas Kampus</h2>
</div>

<form method="POST" action="<?= APP_URL ?>/admin/identitas" enctype="multipart/form-data">
  <?= \App\Core\Csrf::field() ?>

  <div class="card" style="max-width:760px; margin-bottom:20px;">
    <h3 style="margin-top:0; font-size:14px;">Informasi Umum</h3>

    <div class="form-row">
      <div class="form-group">
        <label for="nama_fakultas">Nama Fakultas</label>
        <input type="text" id="nama_fakultas" name="nama_fakultas" class="form-control" required
               value="<?= htmlspecialchars($identitas['nama_fakultas'] ?? '') ?>">
      </div>
      <div class="form-group">
        <label for="singkatan">Singkatan</label>
        <input type="text" id="singkatan" name="singkatan" class="form-control" placeholder="Contoh: FASILKOM"
               value="<?= htmlspecialchars($identitas['singkatan'] ?? '') ?>">
      </div>
    </div>

    <div class="form-group">
      <label for="tagline">Tagline</label>
      <input type="text" id="tagline" name="tagline" class="form-control"
             value="<?= htmlspecialchars($identitas['tagline'] ?? '') ?>" placeholder="Contoh: Membentuk Karakter, Menciptakan Inovasi">
    </div>

    <div class="form-group">
      <label for="alamat">Alamat</label>
      <textarea id="alamat" name="alamat" class="form-control" rows="2"><?= htmlspecialchars($identitas['alamat'] ?? '') ?></textarea>
    </div>

    <div class="form-row">
      <div class="form-group">
        <label for="telepon">Telepon</label>
        <input type="text" id="telepon" name="telepon" class="form-control" value="<?= htmlspecialchars($identitas['telepon'] ?? '') ?>">
      </div>
      <div class="form-group">
        <label for="email">Email</label>
        <input type="email" id="email" name="email" class="form-control" value="<?= htmlspecialchars($identitas['email'] ?? '') ?>">
      </div>
    </div>
  </div>

  <div class="card" style="max-width:760px; margin-bottom:20px;">
    <h3 style="margin-top:0; font-size:14px;">Media Sosial</h3>
    <div class="form-row">
      <div class="form-group">
        <label for="facebook">Facebook</label>
        <input type="url" id="facebook" name="facebook" class="form-control" placeholder="https://facebook.com/..." value="<?= htmlspecialchars($identitas['facebook'] ?? '') ?>">
      </div>
      <div class="form-group">
        <label for="instagram">Instagram</label>
        <input type="url" id="instagram" name="instagram" class="form-control" placeholder="https://instagram.com/..." value="<?= htmlspecialchars($identitas['instagram'] ?? '') ?>">
      </div>
    </div>
    <div class="form-row">
      <div class="form-group">
        <label for="youtube">YouTube</label>
        <input type="url" id="youtube" name="youtube" class="form-control" placeholder="https://youtube.com/..." value="<?= htmlspecialchars($identitas['youtube'] ?? '') ?>">
      </div>
      <div class="form-group">
        <label for="twitter">Twitter / X</label>
        <input type="url" id="twitter" name="twitter" class="form-control" placeholder="https://x.com/..." value="<?= htmlspecialchars($identitas['twitter'] ?? '') ?>">
      </div>
    </div>
  </div>

  <div class="card" style="max-width:760px; margin-bottom:20px;">
    <h3 style="margin-top:0; font-size:14px;">Tampilan Hero (Landing Page)</h3>
    <div class="form-group">
      <label for="hero_judul">Judul Hero</label>
      <input type="text" id="hero_judul" name="hero_judul" class="form-control"
             value="<?= htmlspecialchars($identitas['hero_judul'] ?? '') ?>" placeholder="Kosongkan untuk pakai Nama Fakultas">
    </div>
    <div class="form-group">
      <label for="hero_subjudul">Subjudul Hero</label>
      <input type="text" id="hero_subjudul" name="hero_subjudul" class="form-control"
             value="<?= htmlspecialchars($identitas['hero_subjudul'] ?? '') ?>" placeholder="Contoh: THE CHARACTER OF SUCCESS">
    </div>
  </div>

  <div class="card" style="max-width:760px; margin-bottom:20px;">
    <h3 style="margin-top:0; font-size:14px;">Logo &amp; Gambar</h3>

    <div class="form-row">
      <div class="form-group">
        <label for="logo">Logo</label>
        <?php if (!empty($identitas['logo'])): ?>
          <div style="margin-bottom:8px;"><img src="<?= APP_URL . '/uploads/identitas/' . htmlspecialchars($identitas['logo']) ?>" alt="Logo" style="width:70px; height:70px; object-fit:cover; border-radius:50%; border:1px solid var(--admin-border);"></div>
        <?php endif; ?>
        <input type="file" id="logo" name="logo" class="form-control" accept="image/jpeg,image/png,image/webp">
        <p class="hint">Ditampilkan bulat di navbar &amp; emblem hero.</p>
      </div>

      <div class="form-group">
        <label for="favicon">Favicon</label>
        <?php if (!empty($identitas['favicon'])): ?>
          <div style="margin-bottom:8px;"><img src="<?= APP_URL . '/uploads/identitas/' . htmlspecialchars($identitas['favicon']) ?>" alt="Favicon" style="width:32px; height:32px; object-fit:cover; border-radius:6px; border:1px solid var(--admin-border);"></div>
        <?php endif; ?>
        <input type="file" id="favicon" name="favicon" class="form-control" accept="image/png,image/webp">
        <p class="hint">Ikon kecil di tab browser. Idealnya persegi (32x32px).</p>
      </div>
    </div>

    <div class="form-group">
      <label for="hero_image">Foto Latar Hero</label>
      <?php if (!empty($identitas['hero_image'])): ?>
        <div style="margin-bottom:8px;"><img src="<?= APP_URL . '/uploads/identitas/' . htmlspecialchars($identitas['hero_image']) ?>" alt="Hero" style="width:220px; border-radius:8px; border:1px solid var(--admin-border);"></div>
      <?php endif; ?>
      <input type="file" id="hero_image" name="hero_image" class="form-control" accept="image/jpeg,image/png,image/webp">
      <p class="hint">Foto latar belakang penuh di bagian atas landing page. Disarankan foto gedung/kampus, ukuran lanskap besar (min. 1600px lebar).</p>
    </div>

    <div class="form-group">
      <label for="foto_profil">Foto Section "Tentang Kami"</label>
      <?php if (!empty($identitas['foto_profil'])): ?>
        <div style="margin-bottom:8px;"><img src="<?= APP_URL . '/uploads/identitas/' . htmlspecialchars($identitas['foto_profil']) ?>" alt="Foto Tentang Kami" style="width:160px; border-radius:8px; border:1px solid var(--admin-border);"></div>
      <?php endif; ?>
      <input type="file" id="foto_profil" name="foto_profil" class="form-control" accept="image/jpeg,image/png,image/webp">
      <p class="hint">Foto yang tampil di section sambutan/tentang kami (potret gedung, kegiatan, atau foto profil). Disarankan rasio potret (4:5).</p>
    </div>
  </div>

  <button type="submit" class="btn">Simpan Identitas Kampus</button>
</form>

<?php require BASE_PATH . '/app/Views/admin/layouts/footer.php'; ?>
