"use client";

import { FormEvent, useEffect, useState } from "react";
import Link from "next/link";
import { useRouter } from "next/navigation";

export default function CreateHeroPage() {
  const router = useRouter();

  const [loading, setLoading] = useState(false);
  const [error, setError] = useState("");

  const [form, setForm] = useState({
    badge: "",
    title: "",
    highlight: "",
    description: "",
    primaryButtonText: "",
    primaryButtonUrl: "",
    secondaryButtonText: "",
    secondaryButtonUrl: "",
    githubUrl: "",
    linkedinUrl: "",
    email: "",
    cv: "",
    active: true,
  });

  const [photoFiles, setPhotoFiles] = useState<File[]>([]);
  const [photoPreviews, setPhotoPreviews] = useState<string[]>([]);
  const [cvFile, setCvFile] = useState<File | null>(null);
  const [sidebarOpen, setSidebarOpen] = useState(false);

  /* =========================================================
     CLEANUP PHOTO PREVIEWS
  ========================================================= */

  useEffect(() => {
    return () => {
      photoPreviews.forEach((preview) => {
        URL.revokeObjectURL(preview);
      });
    };
  }, []);

  /* =========================================================
     HANDLE FORM
  ========================================================= */

  const handleChange = (
    e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>
  ) => {
    const { name, value } = e.target;

    setForm((prev) => ({
      ...prev,
      [name]: value,
    }));
  };

  /* =========================================================
     HANDLE PHOTO
  ========================================================= */

  const handlePhotoChange = (
    e: React.ChangeEvent<HTMLInputElement>
  ) => {
    const files = Array.from(e.target.files || []);

    if (files.length === 0) {
      return;
    }

    const imageFiles = files.filter((file) =>
      file.type.startsWith("image/")
    );

    if (imageFiles.length !== files.length) {
      setError("Semua file foto harus berupa gambar.");
      e.target.value = "";
      return;
    }

    setError("");

    setPhotoFiles((prev) => [...prev, ...imageFiles]);

    const newPreviews = imageFiles.map((file) =>
      URL.createObjectURL(file)
    );

    setPhotoPreviews((prev) => [...prev, ...newPreviews]);

    e.target.value = "";
  };

  /* =========================================================
     REMOVE PHOTO
  ========================================================= */

  const removePhoto = (index: number) => {
    const preview = photoPreviews[index];

    if (preview) {
      URL.revokeObjectURL(preview);
    }

    setPhotoFiles((prev) =>
      prev.filter((_, i) => i !== index)
    );

    setPhotoPreviews((prev) =>
      prev.filter((_, i) => i !== index)
    );
  };

  /* =========================================================
     HANDLE CV
  ========================================================= */

  const handleCvChange = (
    e: React.ChangeEvent<HTMLInputElement>
  ) => {
    const file = e.target.files?.[0] || null;

    if (!file) {
      setCvFile(null);
      return;
    }

    if (file.type !== "application/pdf") {
      setError("File CV harus berupa PDF.");
      e.target.value = "";
      setCvFile(null);
      return;
    }

    setError("");
    setCvFile(file);
  };

  /* =========================================================
     CLOSE SIDEBAR
  ========================================================= */

  const closeSidebar = () => {
    setSidebarOpen(false);
  };

  /* =========================================================
     SUBMIT
  ========================================================= */

  const handleSubmit = async (e: FormEvent) => {
    e.preventDefault();

    setLoading(true);
    setError("");

    try {
      /* =====================================================
         VALIDASI
      ===================================================== */

      if (!form.title.trim()) {
        throw new Error("Title Hero wajib diisi.");
      }

      /* =====================================================
         1. UPLOAD FOTO HERO
      ===================================================== */

      const uploadedPhotos: string[] = [];

      for (const file of photoFiles) {
        const formData = new FormData();

        formData.append("file", file);

        const response = await fetch("/api/hero/upload", {
          method: "POST",
          body: formData,
        });

        const result = await response.json();

        if (!response.ok || !result.success) {
          throw new Error(
            result.message || "Gagal upload foto Hero."
          );
        }

        uploadedPhotos.push(result.data);
      }

      /* =====================================================
         2. UPLOAD CV
      ===================================================== */

      let cvUrl = "";

      if (cvFile) {
        const cvFormData = new FormData();

        cvFormData.append("file", cvFile);

        const cvResponse = await fetch("/api/hero/cv", {
          method: "POST",
          body: cvFormData,
        });

        const cvResult = await cvResponse.json();

        if (!cvResponse.ok || !cvResult.success) {
          throw new Error(
            cvResult.message || "Gagal upload CV."
          );
        }

        cvUrl = cvResult.data;
      }

      /* =====================================================
         3. BUAT HERO
      ===================================================== */

      const response = await fetch("/api/hero", {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
        },
        body: JSON.stringify({
          ...form,
          cv: cvUrl,
        }),
      });

      const result = await response.json();

      if (!response.ok || !result.success) {
        throw new Error(
          result.message || "Gagal menambahkan Hero."
        );
      }

      /* =====================================================
         4. SIMPAN FOTO KE HERO IMAGE
      ===================================================== */

      if (uploadedPhotos.length > 0) {
        for (const image of uploadedPhotos) {
          const imageResponse = await fetch(
            "/api/hero/images",
            {
              method: "POST",
              headers: {
                "Content-Type": "application/json",
              },
              body: JSON.stringify({
                heroId: result.data.id,
                image,
              }),
            }
          );

          const imageResult =
            await imageResponse.json();

          if (
            !imageResponse.ok ||
            !imageResult.success
          ) {
            throw new Error(
              imageResult.message ||
                "Gagal menyimpan foto Hero."
            );
          }
        }
      }

      /* =====================================================
         5. SELESAI
      ===================================================== */

      router.push("/secure-panel/hero");
      router.refresh();
    } catch (error) {
      console.error("CREATE HERO ERROR:", error);

      setError(
        error instanceof Error
          ? error.message
          : "Terjadi kesalahan saat menambahkan Hero."
      );
    } finally {
      setLoading(false);
    }
  };

  return (
    <>
      <style>{`
        * {
          box-sizing: border-box;
        }

        html,
        body {
          margin: 0;
          padding: 0;
          max-width: 100%;
          overflow-x: hidden;
        }

        body {
          background: #f5f7fb;
        }

        button,
        a,
        input,
        textarea {
          -webkit-tap-highlight-color: transparent;
        }

        .hero-create-page {
          min-height: 100vh;
          width: 100%;
          background: #f5f7fb;
          color: #1f2937;
        }

        .admin-layout {
          min-height: 100vh;
          width: 100%;
          display: flex;
          position: relative;
        }

        /* =========================================================
           SIDEBAR
        ========================================================= */

        .admin-sidebar {
          width: 270px;
          min-width: 270px;
          height: 100vh;
          position: fixed;
          top: 0;
          left: 0;
          z-index: 1050;
          background: #ffffff;
          border-right: 1px solid #e8ecf1;
          transition: transform 0.3s ease;
        }

        .sidebar-inner {
          height: 100%;
          display: flex;
          flex-direction: column;
          padding: 24px 16px;
          overflow-y: auto;
          overflow-x: hidden;
        }

        .sidebar-brand {
          display: flex;
          align-items: center;
          gap: 12px;
          padding: 4px 10px 28px;
          border-bottom: 1px solid #edf0f4;
          margin-bottom: 22px;
        }

        .brand-icon {
          width: 42px;
          height: 42px;
          min-width: 42px;
          border-radius: 12px;
          display: flex;
          align-items: center;
          justify-content: center;
          background: linear-gradient(
            135deg,
            #198754,
            #20c997
          );
          color: #ffffff;
          font-size: 18px;
          box-shadow: 0 8px 20px rgba(25, 135, 84, 0.2);
        }

        .brand-text {
          min-width: 0;
        }

        .brand-text strong {
          display: block;
          font-size: 16px;
          line-height: 1.2;
          color: #17202a;
        }

        .brand-text span {
          display: block;
          margin-top: 3px;
          font-size: 11px;
          color: #8b95a5;
          font-weight: 600;
          letter-spacing: 0.08em;
          text-transform: uppercase;
        }

        .sidebar-close {
          margin-left: auto;
          border: 0;
          background: transparent;
          color: #7b8492;
          font-size: 17px;
          cursor: pointer;
          padding: 5px;
        }

        .sidebar-section-label {
          padding: 0 12px;
          margin-bottom: 8px;
          color: #9aa3af;
          font-size: 10px;
          font-weight: 700;
          letter-spacing: 0.1em;
        }

        .sidebar-nav {
          display: flex;
          flex-direction: column;
          gap: 4px;
        }

        .sidebar-link {
          display: flex;
          align-items: center;
          gap: 12px;
          min-height: 44px;
          padding: 10px 12px;
          border-radius: 11px;
          color: #697386;
          text-decoration: none;
          font-size: 14px;
          font-weight: 500;
          transition:
            background 0.2s ease,
            color 0.2s ease,
            transform 0.2s ease;
        }

        .sidebar-link:hover {
          background: #f0f8f4;
          color: #198754;
          transform: translateX(2px);
        }

        .sidebar-link.active {
          background: linear-gradient(
            90deg,
            rgba(25, 135, 84, 0.12),
            rgba(25, 135, 84, 0.06)
          );
          color: #198754;
          font-weight: 700;
        }

        .sidebar-link-icon {
          width: 23px;
          min-width: 23px;
          text-align: center;
          font-size: 16px;
          flex-shrink: 0;
        }

        .sidebar-bottom {
          margin-top: auto;
          padding-top: 18px;
          border-top: 1px solid #edf0f4;
        }

        .sidebar-bottom a {
          display: flex;
          align-items: center;
          gap: 10px;
          padding: 11px 12px;
          border-radius: 10px;
          color: #6b7280;
          text-decoration: none;
          font-size: 13px;
          transition: 0.2s ease;
        }

        .sidebar-bottom a:hover {
          background: #f5f7fa;
          color: #198754;
        }

        /* =========================================================
           MAIN
        ========================================================= */

        .admin-main {
          width: calc(100% - 270px);
          margin-left: 270px;
          min-width: 0;
        }

        /* =========================================================
           TOPBAR
        ========================================================= */

        .admin-topbar {
          width: 100%;
          height: 76px;
          background: rgba(255, 255, 255, 0.96);
          border-bottom: 1px solid #e9edf2;
          display: flex;
          align-items: center;
          justify-content: space-between;
          gap: 15px;
          padding: 0 34px;
          position: sticky;
          top: 0;
          z-index: 900;
          backdrop-filter: blur(12px);
        }

        .topbar-left {
          display: flex;
          align-items: center;
          gap: 14px;
          min-width: 0;
        }

        .mobile-menu-button {
          width: 40px;
          height: 40px;
          border: 1px solid #e2e7ed;
          background: #ffffff;
          border-radius: 10px;
          color: #344054;
          font-size: 18px;
          cursor: pointer;
          transition: 0.2s ease;
          flex-shrink: 0;
        }

        .mobile-menu-button:hover {
          background: #f5f8f6;
          color: #198754;
          border-color: #cde5d7;
        }

        .topbar-left > div:last-child {
          min-width: 0;
        }

        .topbar-label {
          color: #9aa3af;
          font-size: 10px;
          font-weight: 700;
          letter-spacing: 0.1em;
          margin-bottom: 3px;
        }

        .topbar-title {
          color: #17202a;
          font-size: 15px;
          font-weight: 700;
          white-space: nowrap;
        }

        .topbar-right {
          display: flex;
          align-items: center;
          gap: 10px;
          flex-shrink: 0;
        }

        .topbar-website,
        .topbar-logout {
          min-height: 40px;
          display: inline-flex;
          align-items: center;
          justify-content: center;
          gap: 8px;
          border-radius: 10px;
          padding: 8px 13px;
          text-decoration: none;
          font-size: 13px;
          font-weight: 600;
          transition: 0.2s ease;
          white-space: nowrap;
        }

        .topbar-website {
          color: #667085;
          border: 1px solid #e4e8ed;
          background: #ffffff;
        }

        .topbar-website:hover {
          color: #198754;
          border-color: #b7ddca;
          background: #f4fbf7;
        }

        .topbar-logout {
          color: #dc3545;
          border: 1px solid #f1c4c9;
          background: #ffffff;
        }

        .topbar-logout:hover {
          background: #fff5f6;
          border-color: #e8aeb5;
        }

        /* =========================================================
           CONTENT
        ========================================================= */

        .admin-content {
          width: 100%;
          max-width: 1550px;
          margin: 0 auto;
          padding: 34px;
          animation: contentEnter 0.45s ease both;
        }

        @keyframes contentEnter {
          from {
            opacity: 0;
            transform: translateY(10px);
          }

          to {
            opacity: 1;
            transform: translateY(0);
          }
        }

        /* =========================================================
           PAGE HEADER
        ========================================================= */

        .page-header {
          display: flex;
          align-items: flex-end;
          justify-content: space-between;
          gap: 25px;
          margin-bottom: 25px;
        }

        .page-header-left {
          min-width: 0;
          flex: 1;
        }

        .back-link {
          display: inline-flex;
          align-items: center;
          gap: 7px;
          margin-bottom: 15px;
          color: #198754;
          text-decoration: none;
          font-size: 12px;
          font-weight: 700;
          transition: 0.2s ease;
        }

        .back-link:hover {
          color: #157347;
          transform: translateX(-2px);
        }

        .page-eyebrow {
          display: flex;
          align-items: center;
          gap: 7px;
          color: #198754;
          font-size: 10px;
          font-weight: 800;
          letter-spacing: 0.11em;
          margin-bottom: 8px;
        }

        .page-eyebrow-dot {
          width: 6px;
          height: 6px;
          border-radius: 50%;
          background: #20c997;
          flex-shrink: 0;
        }

        .page-title-row {
          display: flex;
          align-items: flex-start;
          gap: 15px;
        }

        .page-title-icon {
          width: 56px;
          height: 56px;
          min-width: 56px;
          border-radius: 15px;
          background: linear-gradient(
            135deg,
            rgba(25, 135, 84, 0.13),
            rgba(32, 201, 151, 0.08)
          );
          color: #198754;
          display: flex;
          align-items: center;
          justify-content: center;
          font-size: 23px;
          flex-shrink: 0;
        }

        .page-title {
          margin: 0;
          font-size: clamp(26px, 3vw, 35px);
          font-weight: 800;
          letter-spacing: -0.025em;
          color: #182230;
          line-height: 1.15;
        }

        .page-description {
          margin: 8px 0 0;
          color: #7a8493;
          font-size: 13px;
          line-height: 1.7;
          max-width: 760px;
          text-align: justify;
          text-justify: inter-word;
          overflow-wrap: anywhere;
        }

        /* =========================================================
           ERROR
        ========================================================= */

        .error-alert {
          display: flex;
          align-items: flex-start;
          gap: 11px;
          margin-bottom: 20px;
          padding: 14px 16px;
          border: 1px solid #f1c4c9;
          border-radius: 12px;
          background: #fff5f6;
          color: #b02a37;
          font-size: 12px;
          line-height: 1.6;
          text-align: justify;
          text-justify: inter-word;
          animation: contentEnter 0.25s ease both;
        }

        .error-alert i {
          margin-top: 2px;
          font-size: 15px;
          flex-shrink: 0;
        }

        /* =========================================================
           FORM LAYOUT
        ========================================================= */

        .hero-form {
          display: flex;
          flex-direction: column;
          gap: 18px;
        }

        .form-card {
          width: 100%;
          background: #ffffff;
          border: 1px solid #e5e9ee;
          border-radius: 18px;
          overflow: hidden;
          box-shadow:
            0 8px 30px rgba(20, 30, 45, 0.045),
            0 2px 8px rgba(20, 30, 45, 0.025);
        }

        .form-card-header {
          display: flex;
          align-items: center;
          gap: 12px;
          padding: 19px 22px;
          border-bottom: 1px solid #edf0f3;
          background: linear-gradient(
            180deg,
            #ffffff 0%,
            #fcfdfd 100%
          );
        }

        .form-section-icon {
          width: 42px;
          height: 42px;
          min-width: 42px;
          border-radius: 11px;
          display: flex;
          align-items: center;
          justify-content: center;
          background: #eaf7f0;
          color: #198754;
          font-size: 18px;
        }

        .form-card-header-content {
          min-width: 0;
        }

        .form-card-title {
          margin: 0;
          color: #202b38;
          font-size: 15px;
          font-weight: 800;
          line-height: 1.3;
        }

        .form-card-description {
          margin: 3px 0 0;
          color: #9aa3af;
          font-size: 11px;
          line-height: 1.6;
          text-align: justify;
          text-justify: inter-word;
          overflow-wrap: anywhere;
        }

        .form-card-body {
          padding: 23px 22px;
        }

        /* =========================================================
           FORM ELEMENTS
        ========================================================= */

        .field-group {
          margin-bottom: 19px;
        }

        .field-group:last-child {
          margin-bottom: 0;
        }

        .field-label {
          display: flex;
          align-items: center;
          gap: 6px;
          margin-bottom: 7px;
          color: #344054;
          font-size: 12px;
          font-weight: 700;
        }

        .field-label i {
          color: #198754;
          font-size: 13px;
        }

        .required {
          color: #dc3545;
        }

        .form-control-custom {
          width: 100%;
          min-height: 44px;
          padding: 10px 13px;
          border: 1px solid #dfe4ea;
          border-radius: 10px;
          background: #ffffff;
          color: #344054;
          font-size: 12px;
          line-height: 1.5;
          outline: none;
          transition:
            border-color 0.2s ease,
            box-shadow 0.2s ease,
            background 0.2s ease;
        }

        .form-control-custom::placeholder {
          color: #adb5bd;
        }

        .form-control-custom:hover {
          border-color: #cbd3dc;
        }

        .form-control-custom:focus {
          border-color: #198754;
          background: #ffffff;
          box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.1);
        }

        textarea.form-control-custom {
          min-height: 125px;
          resize: vertical;
          line-height: 1.7;
          text-align: justify;
          text-justify: inter-word;
        }

        .field-help {
          margin-top: 6px;
          color: #9aa3af;
          font-size: 10px;
          line-height: 1.6;
          text-align: justify;
          text-justify: inter-word;
        }

        .form-row {
          display: grid;
          grid-template-columns: repeat(2, minmax(0, 1fr));
          gap: 18px;
        }

        /* =========================================================
           FILE UPLOAD
        ========================================================= */

        .file-input-wrapper {
          position: relative;
        }

        .file-input {
          width: 100%;
          min-height: 46px;
          padding: 9px 11px;
          border: 1px dashed #cfd8d3;
          border-radius: 10px;
          background: #fbfdfc;
          color: #667085;
          font-size: 11px;
          cursor: pointer;
          transition: 0.2s ease;
        }

        .file-input:hover {
          border-color: #198754;
          background: #f5fbf7;
        }

        .file-input::file-selector-button {
          margin-right: 10px;
          padding: 7px 11px;
          border: 1px solid #cfe4d7;
          border-radius: 8px;
          background: #eaf7f0;
          color: #198754;
          font-size: 10px;
          font-weight: 700;
          cursor: pointer;
        }

        /* =========================================================
           PHOTO PREVIEW
        ========================================================= */

        .photo-preview-header {
          display: flex;
          align-items: center;
          justify-content: space-between;
          gap: 12px;
          margin-top: 20px;
          margin-bottom: 13px;
        }

        .photo-preview-title {
          margin: 0;
          color: #344054;
          font-size: 12px;
          font-weight: 800;
        }

        .photo-count {
          display: inline-flex;
          align-items: center;
          gap: 5px;
          padding: 6px 9px;
          border-radius: 8px;
          background: #eaf7f0;
          color: #198754;
          font-size: 9px;
          font-weight: 800;
          white-space: nowrap;
        }

        .photo-grid {
          display: grid;
          grid-template-columns: repeat(4, minmax(0, 1fr));
          gap: 13px;
        }

        .photo-preview {
          position: relative;
          width: 100%;
          aspect-ratio: 1 / 0.78;
          overflow: hidden;
          border: 1px solid #e2e7eb;
          border-radius: 12px;
          background: #f7f9fa;
        }

        .photo-preview img {
          width: 100%;
          height: 100%;
          display: block;
          object-fit: cover;
        }

        .photo-number {
          position: absolute;
          top: 8px;
          left: 8px;
          min-width: 25px;
          height: 25px;
          padding: 0 7px;
          border-radius: 7px;
          display: inline-flex;
          align-items: center;
          justify-content: center;
          background: rgba(25, 135, 84, 0.94);
          color: #ffffff;
          font-size: 9px;
          font-weight: 800;
        }

        .photo-remove {
          position: absolute;
          top: 7px;
          right: 7px;
          width: 29px;
          height: 29px;
          padding: 0;
          border: 1px solid rgba(255, 255, 255, 0.8);
          border-radius: 8px;
          display: inline-flex;
          align-items: center;
          justify-content: center;
          background: rgba(220, 53, 69, 0.94);
          color: #ffffff;
          font-size: 14px;
          cursor: pointer;
          transition: 0.2s ease;
        }

        .photo-remove:hover {
          background: #bb2d3b;
          transform: scale(1.04);
        }

        /* =========================================================
           CV SUCCESS
        ========================================================= */

        .cv-selected {
          display: flex;
          align-items: flex-start;
          gap: 11px;
          margin-top: 13px;
          padding: 13px 14px;
          border: 1px solid #bfe3cc;
          border-radius: 11px;
          background: #f0faf4;
          color: #198754;
        }

        .cv-selected-icon {
          width: 35px;
          height: 35px;
          min-width: 35px;
          border-radius: 9px;
          display: flex;
          align-items: center;
          justify-content: center;
          background: #dff3e7;
          color: #198754;
          font-size: 15px;
        }

        .cv-selected-content {
          min-width: 0;
        }

        .cv-selected-name {
          color: #1f5137;
          font-size: 11px;
          font-weight: 800;
          overflow-wrap: anywhere;
        }

        .cv-selected-description {
          margin-top: 3px;
          color: #6f8e7a;
          font-size: 10px;
          line-height: 1.5;
          text-align: justify;
          text-justify: inter-word;
        }

        /* =========================================================
           ACTIVE SWITCH
        ========================================================= */

        .active-box {
          display: flex;
          align-items: center;
          justify-content: space-between;
          gap: 15px;
          padding: 15px 16px;
          border: 1px solid #e2e7eb;
          border-radius: 12px;
          background: #fbfcfc;
        }

        .active-info {
          min-width: 0;
        }

        .active-title {
          color: #344054;
          font-size: 12px;
          font-weight: 800;
        }

        .active-description {
          margin-top: 4px;
          color: #929baa;
          font-size: 10px;
          line-height: 1.55;
          text-align: justify;
          text-justify: inter-word;
        }

        .switch {
          position: relative;
          width: 48px;
          height: 26px;
          flex-shrink: 0;
        }

        .switch input {
          width: 0;
          height: 0;
          opacity: 0;
        }

        .switch-slider {
          position: absolute;
          inset: 0;
          border-radius: 50px;
          background: #d6dbe1;
          cursor: pointer;
          transition: 0.25s ease;
        }

        .switch-slider::before {
          content: "";
          position: absolute;
          width: 20px;
          height: 20px;
          left: 3px;
          top: 3px;
          border-radius: 50%;
          background: #ffffff;
          box-shadow: 0 2px 5px rgba(20, 30, 45, 0.15);
          transition: 0.25s ease;
        }

        .switch input:checked + .switch-slider {
          background: #198754;
        }

        .switch input:checked + .switch-slider::before {
          transform: translateX(22px);
        }

        /* =========================================================
           FORM ACTION
        ========================================================= */

        .form-actions {
          display: flex;
          align-items: center;
          justify-content: space-between;
          gap: 15px;
          padding: 19px 22px;
          border-top: 1px solid #edf0f3;
          background: #fcfdfd;
        }

        .form-actions-info {
          display: flex;
          align-items: center;
          gap: 7px;
          color: #9aa3af;
          font-size: 10px;
          line-height: 1.5;
        }

        .form-actions-info i {
          color: #198754;
          font-size: 13px;
        }

        .action-group {
          display: flex;
          align-items: center;
          gap: 8px;
        }

        .submit-button,
        .cancel-button {
          min-height: 42px;
          display: inline-flex;
          align-items: center;
          justify-content: center;
          gap: 7px;
          padding: 9px 15px;
          border-radius: 10px;
          font-size: 11px;
          font-weight: 800;
          text-decoration: none;
          cursor: pointer;
          transition: 0.2s ease;
          white-space: nowrap;
        }

        .submit-button {
          border: 1px solid #198754;
          background: linear-gradient(
            135deg,
            #198754,
            #20a46c
          );
          color: #ffffff;
          box-shadow: 0 7px 16px rgba(25, 135, 84, 0.16);
        }

        .submit-button:hover:not(:disabled) {
          color: #ffffff;
          transform: translateY(-1px);
          box-shadow: 0 10px 21px rgba(25, 135, 84, 0.23);
        }

        .submit-button:disabled {
          cursor: not-allowed;
          opacity: 0.7;
        }

        .cancel-button {
          border: 1px solid #dfe4ea;
          background: #ffffff;
          color: #667085;
        }

        .cancel-button:hover {
          color: #344054;
          background: #f7f8fa;
          border-color: #cfd5dc;
        }

        /* =========================================================
           PAGE FOOTER
        ========================================================= */

        .admin-page-footer {
          padding: 20px 2px 5px;
          display: flex;
          align-items: center;
          justify-content: space-between;
          gap: 15px;
          color: #9aa3af;
          font-size: 10px;
        }

        .admin-page-footer div {
          display: flex;
          align-items: center;
          gap: 7px;
        }

        .admin-page-footer i {
          color: #198754;
        }

        .admin-page-footer a {
          display: inline-flex;
          align-items: center;
          color: #7b8492;
          text-decoration: none;
          font-weight: 600;
        }

        .admin-page-footer a:hover {
          color: #198754;
        }

        /* =========================================================
           SIDEBAR OVERLAY
        ========================================================= */

        .sidebar-overlay {
          display: none;
        }

        /* =========================================================
           LARGE DESKTOP
        ========================================================= */

        @media (max-width: 1399.98px) {
          .admin-content {
            padding: 30px;
          }

          .photo-grid {
            grid-template-columns: repeat(4, minmax(0, 1fr));
          }
        }

        /* =========================================================
           TABLET / LAPTOP
        ========================================================= */

        @media (max-width: 1199.98px) {
          .admin-content {
            padding: 28px;
          }

          .page-header {
            align-items: flex-start;
          }

          .photo-grid {
            grid-template-columns: repeat(3, minmax(0, 1fr));
          }
        }

        /* =========================================================
           MOBILE SIDEBAR
        ========================================================= */

        @media (max-width: 991.98px) {
          .admin-sidebar {
            transform: translateX(-100%);
            box-shadow: 15px 0 40px rgba(20, 30, 45, 0.1);
          }

          .admin-sidebar.open {
            transform: translateX(0);
          }

          .admin-main {
            width: 100%;
            margin-left: 0;
          }

          .sidebar-overlay {
            position: fixed;
            inset: 0;
            z-index: 1040;
            display: block;
            background: rgba(15, 23, 42, 0.35);
            backdrop-filter: blur(2px);
          }

          .admin-topbar {
            padding: 0 24px;
          }

          .page-header {
            flex-direction: column;
            align-items: stretch;
          }

          .form-card-body {
            padding: 21px;
          }

          .form-actions {
            align-items: flex-start;
            flex-direction: column;
          }

          .action-group {
            width: 100%;
          }

          .submit-button,
          .cancel-button {
            flex: 1;
          }
        }

        /* =========================================================
           TABLET
        ========================================================= */

        @media (max-width: 767.98px) {
          .admin-topbar {
            height: 68px;
            padding: 0 16px;
          }

          .topbar-title {
            font-size: 13px;
          }

          .admin-content {
            width: 100%;
            max-width: 100%;
            padding: 22px 16px;
          }

          .page-title-row {
            gap: 12px;
          }

          .page-title-icon {
            width: 48px;
            height: 48px;
            min-width: 48px;
            border-radius: 13px;
            font-size: 20px;
          }

          .page-title {
            font-size: 26px;
          }

          .page-description {
            font-size: 11px;
            line-height: 1.7;
            text-align: justify;
            text-justify: inter-word;
          }

          .form-card {
            border-radius: 15px;
          }

          .form-card-header {
            padding: 16px;
          }

          .form-card-body {
            padding: 18px 16px;
          }

          .form-card-title {
            font-size: 14px;
          }

          .form-card-description {
            font-size: 10px;
          }

          .form-row {
            grid-template-columns: 1fr;
            gap: 0;
          }

          .photo-grid {
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 10px;
          }

          .photo-preview {
            aspect-ratio: 1 / 0.78;
          }

          .form-actions {
            padding: 15px 16px;
          }

          .form-actions-info {
            align-items: flex-start;
            text-align: justify;
            text-justify: inter-word;
          }

          .admin-page-footer {
            flex-direction: column;
            align-items: flex-start;
            padding-top: 17px;
          }
        }

        /* =========================================================
           MOBILE
        ========================================================= */

        @media (max-width: 575.98px) {
          .admin-content {
            padding: 19px 12px;
          }

          .admin-topbar {
            padding-left: 12px;
            padding-right: 12px;
          }

          .topbar-left {
            gap: 9px;
          }

          .topbar-right {
            gap: 6px;
          }

          .topbar-website,
          .topbar-logout {
            width: 38px;
            height: 38px;
            min-height: 38px;
            padding: 0;
            border-radius: 9px;
          }

          .mobile-menu-button {
            width: 38px;
            height: 38px;
          }

          .page-title-row {
            align-items: flex-start;
            gap: 10px;
          }

          .page-title-icon {
            width: 43px;
            height: 43px;
            min-width: 43px;
            border-radius: 11px;
            font-size: 17px;
          }

          .page-title {
            font-size: 23px;
          }

          .page-description {
            font-size: 10px;
            line-height: 1.7;
            text-align: justify;
            text-justify: inter-word;
          }

          .back-link {
            font-size: 11px;
            margin-bottom: 13px;
          }

          .form-card {
            border-radius: 13px;
          }

          .form-card-header {
            padding: 14px;
            gap: 10px;
          }

          .form-section-icon {
            width: 37px;
            height: 37px;
            min-width: 37px;
            border-radius: 10px;
            font-size: 16px;
          }

          .form-card-title {
            font-size: 13px;
          }

          .form-card-description {
            display: none;
          }

          .form-card-body {
            padding: 15px 14px;
          }

          .field-group {
            margin-bottom: 16px;
          }

          .field-label {
            font-size: 11px;
          }

          .form-control-custom {
            min-height: 42px;
            font-size: 11px;
            padding: 9px 11px;
          }

          textarea.form-control-custom {
            min-height: 115px;
          }

          .field-help {
            font-size: 9px;
          }

          .photo-preview-header {
            margin-top: 17px;
          }

          .photo-preview-title {
            font-size: 11px;
          }

          .photo-count {
            font-size: 8px;
          }

          .photo-grid {
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 8px;
          }

          .photo-number {
            top: 6px;
            left: 6px;
            min-width: 22px;
            height: 22px;
            font-size: 8px;
          }

          .photo-remove {
            top: 6px;
            right: 6px;
            width: 26px;
            height: 26px;
            font-size: 12px;
          }

          .cv-selected {
            padding: 11px;
          }

          .active-box {
            padding: 13px;
          }

          .active-title {
            font-size: 11px;
          }

          .active-description {
            font-size: 9px;
          }

          .form-actions {
            padding: 13px 14px;
          }

          .form-actions-info {
            font-size: 9px;
          }

          .action-group {
            width: 100%;
            display: grid;
            grid-template-columns: 1fr 1fr;
          }

          .submit-button,
          .cancel-button {
            min-height: 40px;
            font-size: 10px;
            padding: 8px 9px;
          }
        }

        /* =========================================================
           EXTRA SMALL
        ========================================================= */

        @media (max-width: 399.98px) {
          .topbar-title {
            max-width: 130px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
          }

          .page-title {
            font-size: 21px;
          }

          .page-title-icon {
            width: 40px;
            height: 40px;
            min-width: 40px;
          }

          .admin-content {
            padding-left: 10px;
            padding-right: 10px;
          }

          .photo-grid {
            grid-template-columns: 1fr 1fr;
            gap: 7px;
          }

          .form-card-body {
            padding: 13px 12px;
          }

          .form-actions {
            padding-left: 12px;
            padding-right: 12px;
          }
        }

        /* =========================================================
           VERY SMALL SCREEN
        ========================================================= */

        @media (max-width: 340px) {
          .admin-content {
            padding-left: 8px;
            padding-right: 8px;
          }

          .topbar-title {
            max-width: 105px;
          }

          .page-title {
            font-size: 19px;
          }

          .page-description {
            font-size: 9px;
            text-align: justify;
            text-justify: inter-word;
          }

          .page-title-icon {
            width: 38px;
            height: 38px;
            min-width: 38px;
          }

          .form-card-body {
            padding: 12px 10px;
          }

          .photo-grid {
            grid-template-columns: 1fr;
          }

          .photo-preview {
            aspect-ratio: 16 / 9;
          }

          .action-group {
            grid-template-columns: 1fr;
          }
        }

        /* =========================================================
           REDUCED MOTION
        ========================================================= */

        @media (prefers-reduced-motion: reduce) {
          .hero-create-page *,
          .hero-create-page *::before,
          .hero-create-page *::after {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
          }
        }
      `}</style>

      <div className="hero-create-page">
        <div className="admin-layout">

          {/* =====================================================
              MOBILE OVERLAY
          ===================================================== */}

          {sidebarOpen && (
            <div
              className="sidebar-overlay"
              onClick={closeSidebar}
              aria-hidden="true"
            />
          )}

          {/* =====================================================
              SIDEBAR
          ===================================================== */}

          <aside
            className={`admin-sidebar ${
              sidebarOpen ? "open" : ""
            }`}
          >
            <div className="sidebar-inner">

              {/* BRAND */}

              <div className="sidebar-brand">

                <div className="brand-icon">
                  <i className="bi bi-grid-1x2-fill"></i>
                </div>

                <div className="brand-text">
                  <strong>GloVaTech</strong>
                  <span>Admin Panel</span>
                </div>

                <button
                  type="button"
                  className="sidebar-close d-lg-none"
                  onClick={closeSidebar}
                  aria-label="Close sidebar"
                >
                  <i className="bi bi-x-lg"></i>
                </button>

              </div>

              {/* MAIN MENU */}

<div className="sidebar-section-label">
  MAIN MENU
</div>

<nav className="sidebar-nav">

  {/* DASHBOARD */}

  <Link
    href="/secure-panel"
    className="sidebar-link"
    onClick={closeSidebar}
  >
    <span className="sidebar-link-icon">
      <i className="bi bi-speedometer2"></i>
    </span>

    <span>Dashboard</span>
  </Link>

</nav>

{/* CONTENT */}

<div className="sidebar-section-label mt-4">
  CONTENT
</div>

<nav className="sidebar-nav">

  {/* HERO */}

  <Link
    href="/secure-panel/hero"
    className="sidebar-link active"
    onClick={closeSidebar}
  >
    <span className="sidebar-link-icon">
      <i className="bi bi-stars"></i>
    </span>

    <span>Hero</span>
  </Link>

  {/* ABOUT */}

  <Link
    href="/secure-panel/about"
    className="sidebar-link"
    onClick={closeSidebar}
  >
    <span className="sidebar-link-icon">
      <i className="bi bi-person-vcard"></i>
    </span>

    <span>About</span>
  </Link>

  {/* ABOUT STATS */}

  <Link
    href="/secure-panel/about/stats"
    className="sidebar-link"
    onClick={closeSidebar}
  >
    <span className="sidebar-link-icon">
      <i className="bi bi-bar-chart-line"></i>
    </span>

    <span>About Stats</span>
  </Link>

  {/* EDUCATION */}

  <Link
    href="/secure-panel/education"
    className="sidebar-link"
    onClick={closeSidebar}
  >
    <span className="sidebar-link-icon">
      <i className="bi bi-mortarboard"></i>
    </span>

    <span>Education</span>
  </Link>

  {/* SKILLS */}

  <Link
    href="/secure-panel/skills"
    className="sidebar-link"
    onClick={closeSidebar}
  >
    <span className="sidebar-link-icon">
      <i className="bi bi-tools"></i>
    </span>

    <span>Skills</span>
  </Link>

  {/* EXPERIENCE */}

  <Link
    href="/secure-panel/experience"
    className="sidebar-link"
    onClick={closeSidebar}
  >
    <span className="sidebar-link-icon">
      <i className="bi bi-briefcase"></i>
    </span>

    <span>Experience</span>
  </Link>

  {/* PROJECTS */}

  <Link
    href="/secure-panel/projects"
    className="sidebar-link"
    onClick={closeSidebar}
  >
    <span className="sidebar-link-icon">
      <i className="bi bi-code-square"></i>
    </span>

    <span>Projects</span>
  </Link>

  {/* CERTIFICATION */}

  <Link
    href="/secure-panel/certifications"
    className="sidebar-link"
    onClick={closeSidebar}
  >
    <span className="sidebar-link-icon">
      <i className="bi bi-patch-check"></i>
    </span>

    <span>Certification</span>
  </Link>

  {/* ACHIEVEMENT */}

  <Link
    href="/secure-panel/achievements"
    className="sidebar-link"
    onClick={closeSidebar}
  >
    <span className="sidebar-link-icon">
      <i className="bi bi-trophy"></i>
    </span>

    <span>Achievement</span>
  </Link>

  {/* SERVICES */}

  <Link
    href="/secure-panel/services"
    className="sidebar-link"
    onClick={closeSidebar}
  >
    <span className="sidebar-link-icon">
      <i className="bi bi-gear-wide-connected"></i>
    </span>

    <span>Services</span>
  </Link>

  {/* GALLERY */}

  <Link
    href="/secure-panel/gallery"
    className="sidebar-link"
    onClick={closeSidebar}
  >
    <span className="sidebar-link-icon">
      <i className="bi bi-images"></i>
    </span>

    <span>Gallery</span>
  </Link>

  {/* CONTACT INFO */}

  <Link
    href="/secure-panel/contact-info"
    className="sidebar-link"
    onClick={closeSidebar}
  >
    <span className="sidebar-link-icon">
      <i className="bi bi-person-lines-fill"></i>
    </span>

    <span>Contact Info</span>
  </Link>

  {/* CONTACT SOCIAL MEDIA */}

  <Link
    href="/secure-panel/contact-info/list"
    className="sidebar-link"
    onClick={closeSidebar}
  >
    <span className="sidebar-link-icon">
      <i className="bi bi-share-fill"></i>
    </span>

    <span>Contact Social Media</span>
  </Link>

  {/* ARTICLES */}

  <Link
    href="/secure-panel/articles"
    className="sidebar-link"
    onClick={closeSidebar}
  >
    <span className="sidebar-link-icon">
      <i className="bi bi-journal-text"></i>
    </span>

    <span>Articles</span>
  </Link>

  {/* CONTACT MESSAGES */}

  <Link
    href="/secure-panel/contact-messages"
    className="sidebar-link"
    onClick={closeSidebar}
  >
    <span className="sidebar-link-icon">
      <i className="bi bi-chat-left-text"></i>
    </span>

    <span>Contact Messages</span>
  </Link>

  {/* CONTACT USER */}

  <Link
    href="/secure-panel/contact-users"
    className="sidebar-link"
    onClick={closeSidebar}
  >
    <span className="sidebar-link-icon">
      <i className="bi bi-people-fill"></i>
    </span>

    <span>Contact User</span>
  </Link>

</nav>
              {/* SIDEBAR BOTTOM */}

              <div className="sidebar-bottom">

                <Link
                  href="/"
                  onClick={closeSidebar}
                >
                  <i className="bi bi-globe2"></i>

                  <span>View Website</span>

                  <i className="bi bi-arrow-up-right ms-auto"></i>
                </Link>

              </div>

            </div>
          </aside>

          {/* =====================================================
              MAIN AREA
          ===================================================== */}

          <div className="admin-main">

            {/* ===================================================
                TOPBAR
            =================================================== */}

            <header className="admin-topbar">

              <div className="topbar-left">

                <button
                  type="button"
                  className="mobile-menu-button d-lg-none"
                  onClick={() => setSidebarOpen(true)}
                  aria-label="Open menu"
                >
                  <i className="bi bi-list"></i>
                </button>

                <div>

                  <div className="topbar-label">
                    ADMIN PANEL
                  </div>

                  <div className="topbar-title">
                    Create Hero
                  </div>

                </div>

              </div>

              <div className="topbar-right">

                <Link
                  href="/"
                  className="topbar-website"
                  title="View Website"
                  aria-label="View Website"
                >
                  <i className="bi bi-globe2"></i>

                  <span className="d-none d-sm-inline">
                    Website
                  </span>
                </Link>

                <Link
                  href="/secure-panel/login"
                  className="topbar-logout"
                  title="Logout"
                  aria-label="Logout"
                >
                  <i className="bi bi-box-arrow-right"></i>

                  <span className="d-none d-sm-inline">
                    Logout
                  </span>
                </Link>

              </div>

            </header>

            {/* ===================================================
                CONTENT
            =================================================== */}

            <main className="admin-content">

              {/* PAGE HEADER */}

              <section className="page-header">

                <div className="page-header-left">

                  <Link
                    href="/secure-panel/hero"
                    className="back-link"
                  >
                    <i className="bi bi-arrow-left"></i>
                    Kembali ke Hero
                  </Link>

                  <div className="page-eyebrow">
                    <span className="page-eyebrow-dot"></span>
                    CONTENT MANAGEMENT
                  </div>

                  <div className="page-title-row">

                    <div className="page-title-icon">
                      <i className="bi bi-stars"></i>
                    </div>

                    <div>

                      <h1 className="page-title">
                        Tambah Hero
                      </h1>

                      <p className="page-description">
                        Tambahkan konten Hero baru yang akan
                        ditampilkan pada halaman utama website
                        GloVaTech. Lengkapi informasi, gambar,
                        tombol, sosial media, CV, dan status
                        publikasi Hero secara terstruktur.
                      </p>

                    </div>

                  </div>

                </div>

              </section>

              {/* ERROR */}

              {error && (
                <div className="error-alert" role="alert">

                  <i className="bi bi-exclamation-triangle-fill"></i>

                  <span>
                    {error}
                  </span>

                </div>
              )}

              {/* FORM */}

              <form
                onSubmit={handleSubmit}
                className="hero-form"
              >

                {/* =================================================
                    HERO INFORMATION
                ================================================= */}

                <section className="form-card">

                  <div className="form-card-header">

                    <div className="form-section-icon">
                      <i className="bi bi-stars"></i>
                    </div>

                    <div className="form-card-header-content">

                      <h2 className="form-card-title">
                        Informasi Hero
                      </h2>

                      <p className="form-card-description">
                        Tentukan informasi utama yang akan
                        digunakan sebagai konten pembuka pada
                        halaman utama website.
                      </p>

                    </div>

                  </div>

                  <div className="form-card-body">

                    {/* BADGE */}

                    <div className="field-group">

                      <label
                        htmlFor="badge"
                        className="field-label"
                      >
                        <i className="bi bi-tag"></i>
                        Badge
                      </label>

                      <input
                        id="badge"
                        type="text"
                        name="badge"
                        value={form.badge}
                        onChange={handleChange}
                        className="form-control-custom"
                        placeholder="IT Professional & Developer"
                      />

                    </div>

                    {/* TITLE */}

                    <div className="field-group">

                      <label
                        htmlFor="title"
                        className="field-label"
                      >
                        <i className="bi bi-type-h1"></i>
                        Title
                        <span className="required">*</span>
                      </label>

                      <input
                        id="title"
                        type="text"
                        name="title"
                        value={form.title}
                        onChange={handleChange}
                        className="form-control-custom"
                        placeholder="Building Digital Solutions"
                        required
                      />

                    </div>

                    {/* HIGHLIGHT */}

                    <div className="field-group">

                      <label
                        htmlFor="highlight"
                        className="field-label"
                      >
                        <i className="bi bi-highlighter"></i>
                        Highlight
                      </label>

                      <input
                        id="highlight"
                        type="text"
                        name="highlight"
                        value={form.highlight}
                        onChange={handleChange}
                        className="form-control-custom"
                        placeholder="That Make an Impact."
                      />

                    </div>

                    {/* DESCRIPTION */}

                    <div className="field-group">

                      <label
                        htmlFor="description"
                        className="field-label"
                      >
                        <i className="bi bi-text-paragraph"></i>
                        Description
                      </label>

                      <textarea
                        id="description"
                        name="description"
                        value={form.description}
                        onChange={handleChange}
                        className="form-control-custom"
                        rows={5}
                        placeholder="Deskripsi singkat mengenai diri, keahlian, atau value yang ingin ditampilkan pada Hero..."
                      />

                      <div className="field-help">
                        Gunakan deskripsi singkat, profesional,
                        dan mudah dipahami pengunjung website.
                      </div>

                    </div>

                  </div>

                </section>

                {/* =================================================
                    HERO PHOTO
                ================================================= */}

                <section className="form-card">

                  <div className="form-card-header">

                    <div className="form-section-icon">
                      <i className="bi bi-images"></i>
                    </div>

                    <div className="form-card-header-content">

                      <h2 className="form-card-title">
                        Foto Hero
                      </h2>

                      <p className="form-card-description">
                        Upload satu atau beberapa gambar yang
                        akan digunakan pada bagian Hero website.
                      </p>

                    </div>

                  </div>

                  <div className="form-card-body">

                    <div className="field-group">

                      <label
                        htmlFor="hero-photo"
                        className="field-label"
                      >
                        <i className="bi bi-cloud-arrow-up"></i>
                        Upload Foto
                      </label>

                      <input
                        id="hero-photo"
                        type="file"
                        className="file-input"
                        accept="image/*"
                        multiple
                        onChange={handlePhotoChange}
                      />

                      <div className="field-help">
                        Pilih satu atau lebih gambar. Anda dapat
                        memilih foto kembali untuk menambahkan
                        gambar berikutnya.
                      </div>

                    </div>

                    {/* PHOTO PREVIEW */}

                    {photoPreviews.length > 0 && (
                      <div>

                        <div className="photo-preview-header">

                          <h3 className="photo-preview-title">
                            Foto yang dipilih
                          </h3>

                          <span className="photo-count">
                            <i className="bi bi-images"></i>
                            {photoFiles.length} foto
                          </span>

                        </div>

                        <div className="photo-grid">

                          {photoPreviews.map(
                            (preview, index) => (
                              <div
                                key={`${preview}-${index}`}
                                className="photo-preview"
                              >

                                <img
                                  src={preview}
                                  alt={`Preview foto Hero ${
                                    index + 1
                                  }`}
                                />

                                <span className="photo-number">
                                  {index + 1}
                                </span>

                                <button
                                  type="button"
                                  onClick={() =>
                                    removePhoto(index)
                                  }
                                  className="photo-remove"
                                  aria-label={`Hapus foto ${
                                    index + 1
                                  }`}
                                  title={`Hapus foto ${
                                    index + 1
                                  }`}
                                >
                                  <i className="bi bi-x-lg"></i>
                                </button>

                              </div>
                            )
                          )}

                        </div>

                      </div>
                    )}

                  </div>

                </section>

                {/* =================================================
                    BUTTONS
                ================================================= */}

                <section className="form-card">

                  <div className="form-card-header">

                    <div className="form-section-icon">
                      <i className="bi bi-mouse2"></i>
                    </div>

                    <div className="form-card-header-content">

                      <h2 className="form-card-title">
                        Call to Action
                      </h2>

                      <p className="form-card-description">
                        Atur tombol yang akan membantu pengunjung
                        melakukan navigasi atau terhubung dengan
                        bagian lain pada website.
                      </p>

                    </div>

                  </div>

                  <div className="form-card-body">

                    {/* PRIMARY */}

                    <div className="field-group">

                      <label className="field-label">
                        <i className="bi bi-1-circle"></i>
                        Primary Button
                      </label>

                      <div className="form-row">

                        <div className="field-group">

                          <label
                            htmlFor="primaryButtonText"
                            className="field-label"
                          >
                            Button Text
                          </label>

                          <input
                            id="primaryButtonText"
                            type="text"
                            name="primaryButtonText"
                            value={
                              form.primaryButtonText
                            }
                            onChange={handleChange}
                            className="form-control-custom"
                            placeholder="Explore My Profile"
                          />

                        </div>

                        <div className="field-group">

                          <label
                            htmlFor="primaryButtonUrl"
                            className="field-label"
                          >
                            Button URL
                          </label>

                          <input
                            id="primaryButtonUrl"
                            type="text"
                            name="primaryButtonUrl"
                            value={
                              form.primaryButtonUrl
                            }
                            onChange={handleChange}
                            className="form-control-custom"
                            placeholder="#about"
                          />

                        </div>

                      </div>

                    </div>

                    {/* SECONDARY */}

                    <div className="field-group">

                      <label className="field-label">
                        <i className="bi bi-2-circle"></i>
                        Secondary Button
                      </label>

                      <div className="form-row">

                        <div className="field-group">

                          <label
                            htmlFor="secondaryButtonText"
                            className="field-label"
                          >
                            Button Text
                          </label>

                          <input
                            id="secondaryButtonText"
                            type="text"
                            name="secondaryButtonText"
                            value={
                              form.secondaryButtonText
                            }
                            onChange={handleChange}
                            className="form-control-custom"
                            placeholder="Let's Connect"
                          />

                        </div>

                        <div className="field-group">

                          <label
                            htmlFor="secondaryButtonUrl"
                            className="field-label"
                          >
                            Button URL
                          </label>

                          <input
                            id="secondaryButtonUrl"
                            type="text"
                            name="secondaryButtonUrl"
                            value={
                              form.secondaryButtonUrl
                            }
                            onChange={handleChange}
                            className="form-control-custom"
                            placeholder="#contact"
                          />

                        </div>

                      </div>

                    </div>

                  </div>

                </section>

                {/* =================================================
                    SOCIAL MEDIA
                ================================================= */}

                <section className="form-card">

                  <div className="form-card-header">

                    <div className="form-section-icon">
                      <i className="bi bi-share"></i>
                    </div>

                    <div className="form-card-header-content">

                      <h2 className="form-card-title">
                        Social Media
                      </h2>

                      <p className="form-card-description">
                        Tambahkan tautan sosial media dan alamat
                        email yang dapat digunakan pengunjung
                        untuk terhubung dengan Anda.
                      </p>

                    </div>

                  </div>

                  <div className="form-card-body">

                    {/* GITHUB */}

                    <div className="field-group">

                      <label
                        htmlFor="githubUrl"
                        className="field-label"
                      >
                        <i className="bi bi-github"></i>
                        GitHub URL
                      </label>

                      <input
                        id="githubUrl"
                        type="url"
                        name="githubUrl"
                        value={form.githubUrl}
                        onChange={handleChange}
                        className="form-control-custom"
                        placeholder="https://github.com/..."
                      />

                    </div>

                    {/* LINKEDIN */}

                    <div className="field-group">

                      <label
                        htmlFor="linkedinUrl"
                        className="field-label"
                      >
                        <i className="bi bi-linkedin"></i>
                        LinkedIn URL
                      </label>

                      <input
                        id="linkedinUrl"
                        type="url"
                        name="linkedinUrl"
                        value={form.linkedinUrl}
                        onChange={handleChange}
                        className="form-control-custom"
                        placeholder="https://linkedin.com/in/..."
                      />

                    </div>

                    {/* EMAIL */}

                    <div className="field-group">

                      <label
                        htmlFor="email"
                        className="field-label"
                      >
                        <i className="bi bi-envelope"></i>
                        Email
                      </label>

                      <input
                        id="email"
                        type="email"
                        name="email"
                        value={form.email}
                        onChange={handleChange}
                        className="form-control-custom"
                        placeholder="email@example.com"
                      />

                    </div>

                  </div>

                </section>

                {/* =================================================
                    CV
                ================================================= */}

                <section className="form-card">

                  <div className="form-card-header">

                    <div className="form-section-icon">
                      <i className="bi bi-file-earmark-pdf"></i>
                    </div>

                    <div className="form-card-header-content">

                      <h2 className="form-card-title">
                        CV / Resume
                      </h2>

                      <p className="form-card-description">
                        Upload CV atau resume dalam format PDF
                        untuk digunakan pada tombol download CV
                        di bagian Hero.
                      </p>

                    </div>

                  </div>

                  <div className="form-card-body">

                    <div className="field-group">

                      <label
                        htmlFor="cv-upload"
                        className="field-label"
                      >
                        <i className="bi bi-file-earmark-pdf text-danger"></i>
                        Upload CV
                      </label>

                      <input
                        id="cv-upload"
                        type="file"
                        className="file-input"
                        accept="application/pdf"
                        onChange={handleCvChange}
                      />

                      <div className="field-help">
                        File CV harus menggunakan format PDF.
                      </div>

                      {cvFile && (
                        <div className="cv-selected">

                          <div className="cv-selected-icon">
                            <i className="bi bi-check-lg"></i>
                          </div>

                          <div className="cv-selected-content">

                            <div className="cv-selected-name">
                              {cvFile.name}
                            </div>

                            <div className="cv-selected-description">
                              CV siap diupload bersama data Hero.
                            </div>

                          </div>

                        </div>
                      )}

                    </div>

                  </div>

                </section>

                {/* =================================================
                    STATUS & ACTION
                ================================================= */}

                <section className="form-card">

                  <div className="form-card-header">

                    <div className="form-section-icon">
                      <i className="bi bi-check2-circle"></i>
                    </div>

                    <div className="form-card-header-content">

                      <h2 className="form-card-title">
                        Status Publikasi
                      </h2>

                      <p className="form-card-description">
                        Tentukan apakah Hero baru ini langsung
                        aktif dan dapat ditampilkan pada website.
                      </p>

                    </div>

                  </div>

                  <div className="form-card-body">

                    <div className="active-box">

                      <div className="active-info">

                        <div className="active-title">
                          Hero Active
                        </div>

                        <div className="active-description">
                          Hero akan tersedia sebagai konten
                          aktif ketika status ini dinyalakan.
                        </div>

                      </div>

                      <label className="switch">
                        <input
                          type="checkbox"
                          checked={form.active}
                          onChange={(e) =>
                            setForm((prev) => ({
                              ...prev,
                              active:
                                e.target.checked,
                            }))
                          }
                          id="active"
                        />

                        <span className="switch-slider"></span>
                      </label>

                    </div>

                  </div>

                  {/* ACTION */}

                  <div className="form-actions">

                    <div className="form-actions-info">

                      <i className="bi bi-shield-check"></i>

                      <span>
                        Data Hero akan disimpan ke sistem
                        manajemen konten.
                      </span>

                    </div>

                    <div className="action-group">

                      <Link
                        href="/secure-panel/hero"
                        className="cancel-button"
                      >
                        <i className="bi bi-x-lg"></i>
                        Batal
                      </Link>

                      <button
                        type="submit"
                        className="submit-button"
                        disabled={loading}
                      >

                        {loading ? (
                          <>
                            <span
                              className="spinner-border spinner-border-sm"
                              role="status"
                              aria-hidden="true"
                            ></span>

                            Menyimpan...
                          </>
                        ) : (
                          <>
                            <i className="bi bi-save"></i>
                            Simpan Hero
                          </>
                        )}

                      </button>

                    </div>

                  </div>

                </section>

              </form>

              {/* =================================================
                  PAGE FOOTER
              ================================================= */}

              <footer className="admin-page-footer">

                <div>

                  <i className="bi bi-shield-check"></i>

                  <span>
                    Admin Content Management System
                  </span>

                </div>

                <Link href="/secure-panel/hero">

                  <i className="bi bi-arrow-left me-1"></i>

                  Hero Management

                </Link>

              </footer>

            </main>

          </div>

        </div>
      </div>
    </>
  );
}

